프로젝트

일반

사용자정보

개정판 d2c68320

IDd2c68320ce81ccbbced275b965f5ce37a7feb18d
상위 19bc0ecc
하위 14ddf5d8

백흠경이(가) 6년 이상 전에 추가함

Add replace text options

차이점 보기:

DTI_PID/DTI_PID/AppDocData.py
867 867
        return res
868 868

  
869 869
    '''
870
        @brief  save configurations
871
        @author humkyung
872
        @date   2018.04.16
870
        @brief      save configurations
871
        @author     humkyung
872
        @date       2018.04.16
873
        @history    humkyung 2018.07.03 replace ' with " if value has '
873 874
    '''
874 875
    def saveConfigs(self, configs):
875 876
        try:
......
880 881
            cursor = conn.cursor()
881 882

  
882 883
            for config in configs:
883
                sql = "insert or replace into configuration values('{}','{}','{}')".format(config.section, config.key, config.value)
884
                value = config.value
885
                if type(value) is str and "'" in value:
886
                    value = value.replace("'", "''")
887

  
888
                sql = "insert or replace into configuration values('{}','{}','{}')".format(config.section, config.key, value)
884 889
                cursor.execute(sql)
885 890
            conn.commit()
886 891
        # Catch the exception
DTI_PID/DTI_PID/ConfigurationDialog.py
74 74
        self.ui.spinBoxShrinkSize.setValue(int(configs[0].value)) if 1 == len(configs) else self.ui.spinBoxShrinkSize.setValue(0)
75 75
        configs = docData.getConfigs('Text Recognition', 'Merge Size')
76 76
        self.ui.spinBoxMergeSize.setValue(int(configs[0].value)) if 1 == len(configs) else self.ui.spinBoxMergeSize.setValue(10)
77
        # text replace options - 2018.07.03 added by humkyung
78
        configs = docData.getConfigs('Text Recognition', 'Remove White Space')
79
        self.ui.checkBoxRemoveWhiteSpace.setChecked(('True' == configs[0].value) if 1 == len(configs) else False)
80
        configs = docData.getConfigs('Text Recognition', 'OldStr')
81
        self.ui.lineEditOldStr.setText(configs[0].value if 1 == len(configs) else '')
82
        configs = docData.getConfigs('Text Recognition', 'NewStr')
83
        self.ui.lineEditNewStr.setText(configs[0].value if 1 == len(configs) else '')
84
        # up to here
77 85

  
78 86
        configs = docData.getConfigs('Text Size', 'Min Text Size')
79 87
        self.ui.minTextSizeSpinBox.setValue(int(configs[0].value)) if 1 == len(configs) else self.ui.minTextSizeSpinBox.setValue(30)
......
226 234
            configs.append(Config('Text Recognition', 'Expand Size', self.ui.spinBoxExpandSize.value()))
227 235
            configs.append(Config('Text Recognition', 'Shrink Size', self.ui.spinBoxShrinkSize.value()))
228 236
            configs.append(Config('Text Recognition', 'Merge Size', self.ui.spinBoxMergeSize.value()))
237
            # save text replace options - 2018.07.03 added by humkyung
238
            configs.append(Config('Text Recognition', 'Remove White Space', 'True' if self.ui.checkBoxRemoveWhiteSpace.isChecked() else 'False'))
239
            configs.append(Config('Text Recognition', 'OldStr', self.ui.lineEditOldStr.text()))
240
            configs.append(Config('Text Recognition', 'NewStr', self.ui.lineEditNewStr.text()))
241
            # up to here
229 242
            configs.append(Config('Text Size', 'Min Text Size', self.ui.minTextSizeSpinBox.value()))
230 243
            configs.append(Config('Text Size', 'Max Text Size', self.ui.maxTextSizeSpinBox.value()))
231 244
            configs.append(Config('Size', 'Delimiter', self.ui.lineEditSizeDelimiter.text()))
DTI_PID/DTI_PID/Configuration_UI.py
11 11
class Ui_ConfigurationDialog(object):
12 12
    def setupUi(self, ConfigurationDialog):
13 13
        ConfigurationDialog.setObjectName("ConfigurationDialog")
14
        ConfigurationDialog.resize(550, 589)
14
        ConfigurationDialog.resize(550, 643)
15 15
        font = QtGui.QFont()
16 16
        font.setFamily("맑은 고딕")
17 17
        ConfigurationDialog.setFont(font)
......
235 235
        self.spinBoxMergeSize.setObjectName("spinBoxMergeSize")
236 236
        self.horizontalLayout_17.addWidget(self.spinBoxMergeSize)
237 237
        self.verticalLayout_5.addLayout(self.horizontalLayout_17)
238
        self.checkBoxRemoveWhiteSpace = QtWidgets.QCheckBox(self.groupBoxText)
239
        self.checkBoxRemoveWhiteSpace.setObjectName("checkBoxRemoveWhiteSpace")
240
        self.verticalLayout_5.addWidget(self.checkBoxRemoveWhiteSpace)
241
        self.horizontalLayout_20 = QtWidgets.QHBoxLayout()
242
        self.horizontalLayout_20.setObjectName("horizontalLayout_20")
243
        self.label_23 = QtWidgets.QLabel(self.groupBoxText)
244
        self.label_23.setObjectName("label_23")
245
        self.horizontalLayout_20.addWidget(self.label_23)
246
        self.lineEditOldStr = QtWidgets.QLineEdit(self.groupBoxText)
247
        self.lineEditOldStr.setObjectName("lineEditOldStr")
248
        self.horizontalLayout_20.addWidget(self.lineEditOldStr)
249
        self.label_24 = QtWidgets.QLabel(self.groupBoxText)
250
        self.label_24.setObjectName("label_24")
251
        self.horizontalLayout_20.addWidget(self.label_24)
252
        self.lineEditNewStr = QtWidgets.QLineEdit(self.groupBoxText)
253
        self.lineEditNewStr.setObjectName("lineEditNewStr")
254
        self.horizontalLayout_20.addWidget(self.lineEditNewStr)
255
        self.verticalLayout_5.addLayout(self.horizontalLayout_20)
238 256
        self.gridLayout_14.addLayout(self.verticalLayout_5, 0, 0, 1, 1)
239 257
        self.gridLayout_2.addWidget(self.groupBoxText, 0, 1, 1, 1)
240 258
        self.tabWidget.addTab(self.Recognition, "")
......
439 457
        self.label_17.setText(_translate("ConfigurationDialog", "Minimum Text Size : "))
440 458
        self.label_18.setText(_translate("ConfigurationDialog", "Maximum Text Size : "))
441 459
        self.label_22.setText(_translate("ConfigurationDialog", "병합 크기 : "))
460
        self.checkBoxRemoveWhiteSpace.setText(_translate("ConfigurationDialog", "공백 제거"))
461
        self.label_23.setText(_translate("ConfigurationDialog", "Replace"))
462
        self.label_24.setText(_translate("ConfigurationDialog", "with"))
442 463
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.Recognition), _translate("ConfigurationDialog", "인식"))
443 464
        self.groupBox_2.setTitle(_translate("ConfigurationDialog", "Instrument Tag No Rule"))
444 465
        self.label_8.setText(_translate("ConfigurationDialog", "Measured Variable Code"))
DTI_PID/DTI_PID/DTI_PID.py
667 667
                Jeongwoo 2018.06.05 Get text area data list by config.type
668 668
                Jeongwoo 2018.06.08 Add angle Parameter on TOCR.getTextInfo
669 669
                humkyung 2018.06.16 update proessbar while recognizing text
670
                humkyung 2018.07.03 remove white space and replace given oldStr with newStr
670 671
'''
671 672
def initMainSrc(mainRes, tInfoList, updateProgressSignal, listWidget):
672 673
    global srcGray
......
681 682

  
682 683
        path = os.path.join(project.getTempPath(), 'OCR_' + os.path.basename(mainRes))
683 684
        if os.path.isfile(path):
685
            configs = docData.getConfigs('Text Recognition', 'Remove White Space')
686
            removeWhiteSpace = 'True' == configs[0].value if len(configs) == 1 else False
687
            configs = docData.getConfigs('Text Recognition', 'OldStr')
688
            oldStr = configs[0].value if len(configs) == 1 else ''
689
            configs = docData.getConfigs('Text Recognition', 'NewStr')
690
            newStr = configs[0].value if len(configs) == 1 else ''
691

  
684 692
            ocrCompletedSrc = srcGray.copy()
685 693
            ocrCompletedSrc = cv2.threshold(ocrCompletedSrc, 127, 255, cv2.THRESH_BINARY)[1]
686 694
            
......
699 707
                        for result in resultTextInfo:
700 708
                            result.setX(result.getX() + round(area.x))
701 709
                            result.setY(result.getY() + round(area.y))
710
                            if removeWhiteSpace: result.setText(result.getText().replace(' ', ''))      # remove white space - 2018.07.03 added by humkyung
711
                            if oldStr != '': result.setText(result.getText().replace(oldStr, newStr))   # replace oldStr with newStr - 2018.07.03 added by humkyung
702 712
                        textInfoList.extend(resultTextInfo)
703 713
                        ocrCompletedSrc = removeText(ocrCompletedSrc, (tInfo.getX(), tInfo.getY()), img) 
704 714
                        
......
737 747
        _,contours,_ = cv2.findContours(image, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE);
738 748
        selectedContours=[]
739 749
        for contour in contours:
740
            #if cv2.isContourConvex(contour):
741
                #approx = cv2.approxPolyDP(contour, 0.2*cv2.arcLength(contour, True), True)
742 750
            area = cv2.contourArea(contour)
743 751
            if area > minArea and area < maxArea: selectedContours.append(contour)
744 752
        contourImage = cv2.drawContours(image, selectedContours, -1, (255,255,255), -1); # draw contour with white color
745
        #path = os.path.join(AppDocData.instance().getCurrentProject().getTempPath(), 'contours.png')
746
        #cv2.imwrite(path, contourImage)
747 753
    except Exception as ex:
748 754
        print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
749 755

  
......
787 793
                if res is not None:
788 794
                    connectedLines.extend(res)
789 795

  
790
        lineNos = [item for item in graphicsView.scene.items() if type(item) is QEngineeringLineNoTextItem]
791

  
792 796
        if len(connectedLines) > 1:
793 797
            detector.mergeLines(connectedLines, toler=5)
794 798
            # connect line to symbol
......
833 837

  
834 838
            if processLine.length() > 100: # TODO: check critical length
835 839
                processLine.addFlowArrow()
840
        
841
        # re-order process line's start,end
842
        '''
843
        pool = [line for line in lines if line.flowMark is not None]
844
        visited = pool
845
        while len(pool) > 0:
846
            item = pool.pop()
847
            rhs = [line for line in lines if line not in visited and item.isJointed(line)]
848
            
849
            for line in rhs:
850
                pt = item.startPoint()
851
                st = line.startPoint()
852
                et = line.endPoint()    
853
                sdx = st[0] - pt[0]
854
                sdy = st[1] - pt[1]
855
                edx = et[0] - pt[0]
856
                edy = et[1] - pt[1]
857
                if math.sqrt(sdx*sdx + sdy*sdy) < math.sqrt(edx*edx + edy*edy):
858
                    line.reverse()
859
        # up to here
860
        '''
836 861
    except Exception as ex:
837 862
        print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
838 863
    finally:
DTI_PID/DTI_PID/MainWindow.py
180 180
    '''
181 181
    def onSelectionChanged(self):
182 182
        for item in self.graphicsView.scene.selectedItems():
183
            print('{} - {}'.format(type(item), item.uid))
183
            self.resultPropertyTableWidget.showItemProperty(item)
184 184
        
185 185
    '''
186 186
        @brief      Initialize scene and QResultTreeWidget
DTI_PID/DTI_PID/QResultPropertyTableWidget.py
14 14
import math
15 15
from SymbolSvgItem import SymbolSvgItem
16 16
from QEngineeringLineNoTextItem import QEngineeringLineNoTextItem
17
from QEngineeringLineItem import QEngineeringLineItem
18
from QEngineeringNoteItem import QEngineeringNoteItem
17 19
from enum import Enum
18 20

  
19 21
'''
......
34 36
        self.initResultPropertyTableWidget()
35 37

  
36 38
    '''
39
        @brief  show item's property
40
        @author humkyung
41
        @date   2018.07.03
42
    '''
43
    def showItemProperty(self, item):
44
        '''
45
        if issubclass(type(item), SymbolSvgItem):
46
            self.getClickedSymbol(item)
47
        elif type(item) is QEngineeringLineNoTextItem:
48
            self.getClickedLineNo(item)
49
        '''
50
        if type(item) is QEngineeringLineItem:
51
            self.initTitleCell(item)
52
            self.setItem(0, 1, QTableWidgetItem(item.lineType))
53

  
54
            pt = item.startPoint()
55
            self.setItem(1, 1, QTableWidgetItem('({},{})'.format(pt[0], pt[1])))
56
            pt = item.endPoint()
57
            self.setItem(2, 1, QTableWidgetItem('({},{})'.format(pt[0], pt[1])))
58

  
59
    '''
37 60
        @brief      Initialize TableWidget
38 61
        @author     Jeongwoo
39 62
        @date       18.04.13
......
58 81
    def getClickedSymbol(self, symbol):
59 82
        if issubclass(type(symbol), SymbolSvgItem):
60 83
            self.symData = symbol
61
            self.symbolChanged()
84
            self.symbolChanged(symbol)
62 85

  
63 86
    '''
64 87
        @brief      Slot to accept Note item click event
......
84 107
        @date       18.04.13
85 108
        @history    .
86 109
    '''
87
    def symbolChanged(self):
88
        self.initTitleCell(ItemType.SYMBOL)
110
    def symbolChanged(self, item):
111
        self.initTitleCell(item)
89 112
        self.initContentsCell()
90 113

  
91 114
    '''
......
94 117
        @date       18.04.27
95 118
    '''
96 119
    def noteChanged(self, noteNoStr, noteContentsList):
97
        self.initTitleCell(ItemType.NOTE)
120
        self.initTitleCell(QEngineeringNoteItem())
98 121
        self.initNoteCell(noteNoStr, noteContentsList)
99 122

  
100 123
    '''
......
106 129
        from QEngineeringRunItem import QEngineeringRunItem
107 130

  
108 131
        if type(item) is QEngineeringLineNoTextItem:
109
            self.initTitleCell(ItemType.LINE_NO)
132
            self.initTitleCell(item)
110 133
            self.initLineNoCell(item)
111 134
        elif type(item) is QEngineeringRunItem:
112 135
            self.initLineRunCell(item)
......
118 141
        @history    2018.04.27 Jeongwoo Add if-statement by ItemType
119 142
                    2018.05.10 Jeongwoo Add if-statement LINE_NO ItemType
120 143
    '''
121
    def initTitleCell(self, type):
144
    def initTitleCell(self, item):
122 145
        self.clear()
123 146

  
124
        if type == ItemType.SYMBOL:
125
            self.setItem(0,     0,      QTableWidgetItem("심볼명"))
126
            self.setItem(1,     0,      QTableWidgetItem("타입"))
127
            self.setItem(2,     0,      QTableWidgetItem("각도"))
128
        elif type == ItemType.NOTE:
129
            self.setItem(0,     0,      QTableWidgetItem("노트번호"))
130
            self.setItem(1,     0,      QTableWidgetItem("노트내용"))
131
        elif type == ItemType.LINE_NO:
132
            '''
133
            DO NOTHING / initLineNoCell
134
            '''
135

  
136
        for index in range(self.rowCount()):
137
            item = self.item(index, 0)
138
            if item is not None:
139
                item.setBackground(QColor(220, 220, 220))
147
        try:
148
            if issubclass(type(item), SymbolSvgItem) or type(item) is SymbolSvgItem:
149
                widgetItem = QTableWidgetItem("심볼명")
150
                widgetItem.setFlags(Qt.ItemIsEnabled)
151
                self.setItem(0, 0, widgetItem)
152
                widgetItem = QTableWidgetItem("타입")
153
                widgetItem.setFlags(Qt.ItemIsEnabled)
154
                self.setItem(1, 0, widgetItem)
155
                widgetItem = QTableWidgetItem("각도")
156
                widgetItem.setFlags(Qt.ItemIsEnabled)
157
                self.setItem(2, 0, widgetItem)
158
            elif type(item) is QEngineeringNoteItem:
159
                widgetItem = QTableWidgetItem("노트번호")
160
                widgetItem.setFlags(Qt.ItemIsEnabled)
161
                self.setItem(0, 0, widgetItem)
162
                widgetItem = QTableWidgetItem("노트내용")
163
                widgetItem.setFlags(Qt.ItemIsEnabled)
164
                self.setItem(1, 0, widgetItem)
165
            elif type(item) is QEngineeringLineNoTextItem:
166
                '''
167
                DO NOTHING / initLineNoCell
168
                '''
169
            elif type(item) is QEngineeringLineItem:
170
                widgetItem = QTableWidgetItem("타입")
171
                widgetItem.setFlags(Qt.ItemIsEnabled)
172
                self.setItem(0, 0, widgetItem)
173
                widgetItem = QTableWidgetItem("시작점")
174
                widgetItem.setFlags(Qt.ItemIsEnabled)
175
                self.setItem(1, 0, widgetItem)
176
                widgetItem = QTableWidgetItem("끝점")
177
                widgetItem.setFlags(Qt.ItemIsEnabled)
178
                self.setItem(2, 0, widgetItem)
179

  
180
            for index in range(self.rowCount()):
181
                item = self.item(index, 0)
182
                if item is not None:
183
                    item.setBackground(QColor(220, 220, 220))
184
        except Exception as ex:
185
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
140 186
                
141 187
    '''
142 188
        @brief      Initialize Contents Cell
......
148 194
        from QEngineeringInstrumentItem import QEngineeringInstrumentItem
149 195

  
150 196
        if self.symData is not None:
151
            self.setItem(0,     1,      QTableWidgetItem(self.symData.name))
152
            self.setItem(1,     1,      QTableWidgetItem(self.symData.type))
153
            self.setItem(2,     1,      QTableWidgetItem(str(round(math.degrees(self.symData.angle)))))
197
            self.setItem(0, 1, QTableWidgetItem(self.symData.name))
198
            self.setItem(1, 1, QTableWidgetItem(self.symData.type))
199
            self.setItem(2, 1, QTableWidgetItem(str(round(math.degrees(self.symData.angle)))))
154 200

  
155 201
            # display attributes of symbol
156 202
            attrs = self.symData.getAttributes()
......
176 222
        @date       18.04.27
177 223
    '''
178 224
    def initNoteCell(self, noteNoStr, noteContentsList):
179
        self.setItem(0,     1,      QTableWidgetItem(noteNoStr))
225
        self.setItem(0, 1, QTableWidgetItem(noteNoStr))
180 226
        for index in range(len(noteContentsList)):
181
            self.setItem(1+index,     1,      QTableWidgetItem(noteContentsList[index]))
227
            self.setItem(1+index, 1, QTableWidgetItem(noteContentsList[index]))
182 228

  
183 229
    '''
184 230
        @brief      Initialize Line No Contents Cell
DTI_PID/DTI_PID/Shapes/QEngineeringLineItem.py
309 309
        return (pt is not None) and (type(pt) == shapely.geometry.point.Point)
310 310

  
311 311
    '''
312
        @brief  check if two lines are jointable
313
        @author humkyung
314
        @date   2018.06.26
312
        @brief      check if line and given item is jointable
313
        @author     humkyung
314
        @date       2018.06.26
315
        @history    humkyung 2018.07.03 allow item to be line or symbol
315 316
    '''
316
    def isJointable(self, line, toler=5):
317
    def isJointed(self, item, toler=5):
317 318
        import math
319
        from SymbolSvgItem import SymbolSvgItem
318 320

  
319 321
        lhs = [self.startPoint(), self.endPoint()]
320
        rhs = [line.startPoint(), line.endPoint()]
322
        if type(item) is QEngineeringLineItem:
323
            rhs = [item.startPoint(), item.endPoint()]
324
        elif issubclass(type(item), SymbolSvgItem):
325
            rhs = item.connPts
326
        else:
327
            rhs = []
321 328

  
322 329
        for pt in lhs:
323 330
            for _pt in rhs:
......
325 332
                dy = _pt[1] - pt[1]
326 333
                if math.sqrt(dx*dx + dy*dy) < toler:
327 334
                    return True
328
        
335

  
329 336
        return False
330 337

  
331 338
    '''
......
401 408
        return res
402 409

  
403 410
    '''
411
        @brief      reverse line
412
        @author     humkyung
413
        @date       2018.07.03
414
    '''
415
    def reverse(self):
416
        clone = self._pol.toPolygon()
417
        self._pol.clear()
418
        for idx in reversed(range(clone.count())):
419
            self._pol.append(clone.at(idx))
420

  
421
    '''
404 422
        @brief      add flow arrow
405 423
        @author     humkyung
406 424
        @date       2018.05.08
......
439 457
            docData = AppDocData.instance()
440 458
            area = docData.getArea('Drawing')
441 459
            img = np.array(AppDocData.instance().getCurrentPidSource().getPyImageOnRect(rect))
442
            #img = area.img[int(rect.top() - area.y):int(rect.bottom() - area.y), int(rect.left() - area.y):int(rect.right() - area.y)]
443 460
            
444 461
            imgLine = cv2.threshold(cv2.cvtColor(img, cv2.COLOR_BGR2GRAY), 127, 255, cv2.THRESH_BINARY)[1]
445 462
            # remove noise
......
513 530
                            if dist1 > dist2:
514 531
                                startPt,endPt = endPt,startPt
515 532
                                direction[0],direction[1] = -direction[0],-direction[1]
516
                                
517
                                # reverse polygon
518
                                '''
519
                                clone = self._pol.toPolygon()
520
                                self._pol.clear()
521
                                for idx in reversed(range(self._pol.count())):
522
                                    self._pol.append(clone.at(idx))
523
                                '''
524
                                # up to here
533
                                self.reverse()
525 534
                                    
526 535
                        center = [(startPt[0]+endPt[0])*0.5, (startPt[1]+endPt[1])*0.5]
527 536
                        arrow = QEngineeringFlowArrowItem(center, direction)
......
533 542
                        self.flowMark = ([x, y, w + 10, h + 10], None)
534 543
                else:
535 544
                    pass
536
                    #cv2.imshow('flow arrow', imgLine)
537
                    #cv2.waitKey(0)
538 545
        except Exception as ex:
539 546
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
540 547

  
DTI_PID/DTI_PID/Shapes/QEngineeringRunItem.py
143 143
                count = 0
144 144
                for other in mergedLines:
145 145
                    if line is other: continue
146
                    if line.isJointable(other):
146
                    if line.isJointed(other):
147 147
                        count += 1
148 148

  
149 149
                if 1 == count:
......
157 157
                pool = [head]
158 158
                while len(pool) > 0:
159 159
                    line = pool.pop()
160
                    connected = [param for param in mergedLines if param not in visited and param.isJointable(line)]
160
                    connected = [param for param in mergedLines if param not in visited and param.isJointed(line)]
161 161
                    pool.extend(connected)
162 162
                    visited.extend(connected)
163 163
                    
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py
138 138
            if (math.sqrt(dx*dx + dy*dy) < toler): return True
139 139

  
140 140
        return False
141
        
141
 
142
    '''
143
        @brief      check if symbol and given item is jointed
144
        @author     humkyung
145
        @date       2018.07.03
146
    '''
147
    def isJointed(self, item, toler=5):
148
        import math
149
        from QEngineeringLineItem import QEngineeringLineItem
150

  
151
        lhs = item.connPts
152
        if type(item) is QEngineeringLineItem:
153
            rhs = [item.startPoint(), item.endPoint()]
154
        elif issubclass(type(item), SymbolSvgItem):
155
            rhs = item.connPts
156
        else:
157
            rhs = []
158

  
159
        for pt in lhs:
160
            for _pt in rhs:
161
                dx = _pt[0] - pt[0]
162
                dy = _pt[1] - pt[1]
163
                if math.sqrt(dx*dx + dy*dy) < toler:
164
                    return True
165

  
166
        return False
167
       
142 168
    '''
143 169
        @brief      connect line and symbol is able to be connected and return line
144 170
        @author     humkyung
DTI_PID/DTI_PID/TextInfo.py
1 1
class TextInfo():
2 2
    def __init__(self, text, x, y, w, h, angle):
3
        self.text = text
3
        self._text = text
4 4
        self.x = x
5 5
        self.y = y
6 6
        self.w = w
......
8 8
        self.angle = angle
9 9

  
10 10
    def setText(self, text):
11
        self.text = text
11
        self._text = text
12 12

  
13 13
    def getText(self):
14
        return self.text
14
        return self._text
15 15

  
16 16
    def setX(self, x):
17 17
        self.x = x
DTI_PID/DTI_PID/UI/Configuration.ui
7 7
    <x>0</x>
8 8
    <y>0</y>
9 9
    <width>550</width>
10
    <height>589</height>
10
    <height>643</height>
11 11
   </rect>
12 12
  </property>
13 13
  <property name="font">
......
402 402
              </item>
403 403
             </layout>
404 404
            </item>
405
            <item>
406
             <widget class="QCheckBox" name="checkBoxRemoveWhiteSpace">
407
              <property name="text">
408
               <string>공백 제거</string>
409
              </property>
410
             </widget>
411
            </item>
412
            <item>
413
             <layout class="QHBoxLayout" name="horizontalLayout_20">
414
              <item>
415
               <widget class="QLabel" name="label_23">
416
                <property name="text">
417
                 <string>Replace</string>
418
                </property>
419
               </widget>
420
              </item>
421
              <item>
422
               <widget class="QLineEdit" name="lineEditOldStr"/>
423
              </item>
424
              <item>
425
               <widget class="QLabel" name="label_24">
426
                <property name="text">
427
                 <string>with</string>
428
                </property>
429
               </widget>
430
              </item>
431
              <item>
432
               <widget class="QLineEdit" name="lineEditNewStr"/>
433
              </item>
434
             </layout>
435
            </item>
405 436
           </layout>
406 437
          </item>
407 438
         </layout>
DTI_PID/DTI_PID/tesseract_ocr_module.py
183 183
    try:
184 184
        docData = AppDocData.instance()
185 185
        configs = docData.getConfigs('Text Size', 'Min Text Size')
186
        minSize = int(configs[0].value) if 1 == len(configs) else self.ui.minTextSizeSpinBox.setValue(30)
186
        minSize = int(configs[0].value) if 1 == len(configs) else 30
187 187
        configs = docData.getConfigs('Text Size', 'Max Text Size')
188
        maxSize = int(configs[0].value) if 1 == len(configs) else self.ui.maxTextSizeSpinBox.setValue(60)
188
        maxSize = int(configs[0].value) if 1 == len(configs) else 60
189 189

  
190 190
        im = Image.fromarray(img)
191 191
        im = im.rotate(-angle, expand=True)

내보내기 Unified diff