프로젝트

일반

사용자정보

개정판 d66325ef

IDd66325ef77558ffb72e733b112ffc379c20b56ea
상위 37a9aa71
하위 2f13b3fb

백흠경이(가) 약 5년 전에 추가함

issue #641: 사용자가 설정한 전처리 과정을 실행한다

Change-Id: I0e575215ddaed5090cf241ffc79e0b892e59bbab

차이점 보기:

DTI_PID/DTI_PID/AppDocData.py
556 556
                sql = self.project.database.to_sql("""
557 557
                    UPDATE Symbol
558 558
                    SET
559
                        name = ?, SymbolType_UID=(select UID from SymbolType where Type=?), threshold = ?, minMatchPoint = ?, isDetectOrigin = ?,
560
                        rotationCount = ?, ocrOption = ?, isContainChild = ?, originalPoint = ?, connectionPoint = ?,
561
                        baseSymbol = ?, additionalSymbol = ?, isExceptDetect = ?, hasInstrumentLabel = ?, width = ?, height = ?, flip = ?, text_area = ?,
562
                    WHERE uid = ?
559
                        name = ?, SymbolType_UID=(select UID from SymbolType where Type=?), threshold=?, 
560
                        minMatchPoint=?, isDetectOrigin=?, rotationCount=?, ocrOption=?, isContainChild=?, 
561
                        originalPoint=?, connectionPoint=?, baseSymbol=?, additionalSymbol=?, isExceptDetect=?, 
562
                        hasInstrumentLabel=?, width=?, height=?, flip=?, TextArea=? WHERE uid = ?
563 563
                """)
564 564

  
565 565
                cursor = conn.cursor()
......
568 568
                         , symbol.getOcrOption(), symbol.getIsContainChild()
569 569
                         , symbol.getOriginalPoint(), symbol.getConnectionPoint()
570 570
                         , symbol.getBaseSymbol(), symbol.getAdditionalSymbol(), symbol.getIsExceptDetect(),
571
                         symbol.getHasInstrumentLabel(), symbol.width, symbol.height, symbol.detectFlip, symbol.getText_area_str(),
571
                         symbol.getHasInstrumentLabel(), symbol.width, symbol.height, symbol.detectFlip, symbol.text_area_str,
572 572
                         symbol.getUid())
573 573
                cursor.execute(sql, query)
574 574
                conn.commit()
......
599 599
        with self.project.database.connect() as conn:
600 600
            cursor = conn.cursor()
601 601
            sql = """SELECT a.UID,a.Name,b.Type,a.Threshold,a.MinMatchPoint,a.IsDetectOrigin,a.RotationCount,a.OCROption,a.IsContainChild,a.OriginalPoint,a.ConnectionPoint,
602
                    a.BaseSymbol,a.AdditionalSymbol,a.IsExceptDetect,a.HasInstrumentLabel,a.flip, a.text_area\
603
                        b.UID FROM Symbol a inner join SymbolType b on a.SymbolType_UID=b.UID WHERE a.IsExceptDetect = 0 order by width * height desc"""
602
                    a.BaseSymbol,a.AdditionalSymbol,a.IsExceptDetect,a.HasInstrumentLabel,a.flip, a.TextArea\
603
                        b.UID FROM Symbol a inner join SymbolType b on a.SymbolType_UID=b.UID WHERE 
604
                        a.IsExceptDetect = 0 order by width * height desc"""
604 605
            try:
605 606
                cursor.execute(sql)
606 607
                rows = cursor.fetchall()
......
1628 1629

  
1629 1630
        with self.project.database.connect() as conn:
1630 1631
            cursor = conn.cursor()
1631
            sql = self.project.database.to_sql("""SELECT a.UID,a.Name,b.Type,a.Threshold,a.MinMatchPoint,a.IsDetectOrigin,a.RotationCount,a.OCROption,a.IsContainChild,a.OriginalPoint,a.ConnectionPoint,
1632
                        a.BaseSymbol,a.AdditionalSymbol,a.IsExceptDetect,a.HasInstrumentLabel,a.flip,a.text_area, \
1633
                            b.UID FROM Symbol a inner join SymbolType b on a.SymbolType_UID=b.UID WHERE """ + "a." + fieldName + '=?')
1632
            sql = self.project.database.to_sql(f"SELECT a.UID,a.Name,b.Type,a.Threshold,a.MinMatchPoint,"
1633
                                               f"a.IsDetectOrigin,a.RotationCount,a.OCROption,a.IsContainChild,"
1634
                                               f"a.OriginalPoint,a.ConnectionPoint,a.BaseSymbol,a.AdditionalSymbol,"
1635
                                               f"a.IsExceptDetect,a.HasInstrumentLabel,a.flip,a.TextArea,b.UID FROM "
1636
                                               f"Symbol a inner join SymbolType b on a.SymbolType_UID=b.UID WHERE "
1637
                                               f"a.{fieldName}=?")
1634 1638
            try:
1635 1639
                cursor.execute(sql, (param,))
1636 1640
                rows = cursor.fetchall()
......
1660 1664
        with self.project.database.connect() as conn:
1661 1665
            cursor = conn.cursor()
1662 1666
            if field_name is not None and param is not None:
1663
                sql = """SELECT a.UID,a.Name,b.Type,a.Threshold,a.MinMatchPoint,a.IsDetectOrigin,a.RotationCount,a.OCROption,a.IsContainChild,a.OriginalPoint,a.ConnectionPoint,
1664
                        a.BaseSymbol,a.AdditionalSymbol,a.IsExceptDetect,a.HasInstrumentLabel,a.flip,a.text_area \
1665
                            b.UID FROM Symbol a inner join SymbolType b on a.SymbolType_UID=b.UID WHERE SymbolType_UID = (select UID from SymbolType where {}={})""".format(
1667
                sql = """SELECT a.UID,a.Name,b.Type,a.Threshold,a.MinMatchPoint,a.IsDetectOrigin,a.RotationCount,
1668
                a.OCROption,a.IsContainChild,a.OriginalPoint,a.ConnectionPoint,a.BaseSymbol,a.AdditionalSymbol,
1669
                a.IsExceptDetect,a.HasInstrumentLabel,a.flip,a.TextArea,b.UID FROM Symbol a 
1670
                inner join SymbolType b on a.SymbolType_UID=b.UID WHERE 
1671
                SymbolType_UID = (select UID from SymbolType where {}={})""".format(
1666 1672
                    field_name, self.project.database.place_holder)
1667 1673
            else:
1668
                sql = """SELECT a.UID,a.Name,b.Type,a.Threshold,a.MinMatchPoint,a.IsDetectOrigin,a.RotationCount,a.OCROption,a.IsContainChild,a.OriginalPoint,a.ConnectionPoint,
1669
                        a.BaseSymbol,a.AdditionalSymbol,a.IsExceptDetect,a.HasInstrumentLabel,a.flip FROM Symbol a inner join SymbolType b on a.SymbolType_UID=b.UID"""
1674
                sql = """SELECT a.UID,a.Name,b.Type,a.Threshold,a.MinMatchPoint,a.IsDetectOrigin,a.RotationCount, 
1675
                a.OCROption,a.IsContainChild,a.OriginalPoint,a.ConnectionPoint,a.BaseSymbol,a.AdditionalSymbol,
1676
                a.IsExceptDetect,a.HasInstrumentLabel,a.flip FROM Symbol a 
1677
                inner join SymbolType b on a.SymbolType_UID=b.UID"""
1670 1678
            try:
1671 1679
                cursor.execute(sql, (param,)) if param is not None else cursor.execute(sql)
1672 1680
                rows = cursor.fetchall()
DTI_PID/DTI_PID/ConfigurationDialog.py
112 112
        configs = docData.getConfigs('Filter', 'FlatSize')
113 113
        self.ui.spinBoxFlatSize.setValue(int(configs[0].value)) if 1 == len(
114 114
            configs) else self.ui.spinBoxFlatSize.setValue(0)
115

  
116
        configs = docData.getConfigs('Filter', 'Threshold')
117
        if configs:
118
            tokens = configs[0].value.split(',')
119
            if tokens[0] == 'No':
120
                self.ui.radioButtonNoThreshold.setChecked(True)
121
            elif tokens[0] == 'OTSU':
122
                self.ui.radioButtonOTSU.setChecked(True)
123
                self.ui.lineEditOTSUValue.setText(tokens[1] if tokens[1] else '0')
124
            elif tokens[0] == 'Binary':
125
                self.ui.radioButtonBinary.setChecked(True)
126
                self.ui.lineEditBinaryValue.setText(tokens[1] if tokens[1] else '0')
127
        else:
128
            self.ui.radioButtonNoThreshold.setChecked(True)
129

  
115 130
        configs = docData.getConfigs('Filter', 'Mode')
116 131
        if configs:
117 132
            mode = int(configs[0].value)
......
883 898
            configs.append(Config('Filter', 'ErodeSize', self.ui.spinBoxUnrecognitionIgnoreStep.value()))
884 899
            configs.append(Config('Filter', 'DilateSize', self.ui.spinBoxDilateSize.value()))
885 900
            configs.append(Config('Filter', 'FlatSize', self.ui.spinBoxFlatSize.value()))
901

  
902
            if self.ui.radioButtonNoThreshold.isChecked():
903
                configs.append(Config('Filter', 'Threshold', 'No'))
904
            elif self.ui.radioButtonOTSU.isChecked():
905
                configs.append(Config('Filter', 'Threshold', f"OTSU,{self.ui.lineEditOTSUValue.text()}"))
906
            elif self.ui.radioButtonBinary.isChecked():
907
                configs.append(Config('Filter', 'Threshold', f"Binary,{self.ui.lineEditBinaryValue.text()}"))
908

  
886 909
            configs.append(Config('Filter', 'Mode', '1' if self.ui.checkBoxApplyGaussianBlur.isChecked() else '0'))
887 910
            configs.append(Config('Small Object Size', 'Min Area', self.ui.spinBoxMinArea.value()))
888 911
            configs.append(Config('Small Object Size', 'Max Area', self.ui.spinBoxMaxArea.value()))
DTI_PID/DTI_PID/Configuration_UI.py
2 2

  
3 3
# Form implementation generated from reading ui file '.\UI\Configuration.ui'
4 4
#
5
# Created by: PyQt5 UI code generator 5.13.0
5
# Created by: PyQt5 UI code generator 5.14.1
6 6
#
7 7
# WARNING! All changes made in this file will be lost!
8 8

  
......
37 37
        self.gridLayout_27.setObjectName("gridLayout_27")
38 38
        self.gridLayout_35 = QtWidgets.QGridLayout()
39 39
        self.gridLayout_35.setObjectName("gridLayout_35")
40
        self.lineEdit = QtWidgets.QLineEdit(self.groupBoxFilter)
41
        self.lineEdit.setObjectName("lineEdit")
42
        self.gridLayout_35.addWidget(self.lineEdit, 2, 2, 1, 1)
40
        self.lineEditBinaryValue = QtWidgets.QLineEdit(self.groupBoxFilter)
41
        self.lineEditBinaryValue.setObjectName("lineEditBinaryValue")
42
        self.gridLayout_35.addWidget(self.lineEditBinaryValue, 2, 2, 1, 1)
43 43
        self.radioButtonNoThreshold = QtWidgets.QRadioButton(self.groupBoxFilter)
44 44
        self.radioButtonNoThreshold.setObjectName("radioButtonNoThreshold")
45 45
        self.gridLayout_35.addWidget(self.radioButtonNoThreshold, 0, 0, 1, 1)
46 46
        self.radioButtonOTSU = QtWidgets.QRadioButton(self.groupBoxFilter)
47 47
        self.radioButtonOTSU.setObjectName("radioButtonOTSU")
48 48
        self.gridLayout_35.addWidget(self.radioButtonOTSU, 1, 0, 1, 1)
49
        self.radioButton = QtWidgets.QRadioButton(self.groupBoxFilter)
50
        self.radioButton.setObjectName("radioButton")
51
        self.gridLayout_35.addWidget(self.radioButton, 2, 0, 1, 1)
49
        self.radioButtonBinary = QtWidgets.QRadioButton(self.groupBoxFilter)
50
        self.radioButtonBinary.setObjectName("radioButtonBinary")
51
        self.gridLayout_35.addWidget(self.radioButtonBinary, 2, 0, 1, 1)
52 52
        self.label_41 = QtWidgets.QLabel(self.groupBoxFilter)
53 53
        self.label_41.setObjectName("label_41")
54 54
        self.gridLayout_35.addWidget(self.label_41, 2, 1, 1, 1)
55 55
        self.label_42 = QtWidgets.QLabel(self.groupBoxFilter)
56 56
        self.label_42.setObjectName("label_42")
57 57
        self.gridLayout_35.addWidget(self.label_42, 1, 1, 1, 1)
58
        self.lineEdit_3 = QtWidgets.QLineEdit(self.groupBoxFilter)
59
        self.lineEdit_3.setObjectName("lineEdit_3")
60
        self.gridLayout_35.addWidget(self.lineEdit_3, 1, 2, 1, 1)
58
        self.lineEditOTSUValue = QtWidgets.QLineEdit(self.groupBoxFilter)
59
        self.lineEditOTSUValue.setObjectName("lineEditOTSUValue")
60
        self.gridLayout_35.addWidget(self.lineEditOTSUValue, 1, 2, 1, 1)
61 61
        self.gridLayout_27.addLayout(self.gridLayout_35, 2, 1, 1, 1)
62 62
        self.label_32 = QtWidgets.QLabel(self.groupBoxFilter)
63 63
        self.label_32.setMaximumSize(QtCore.QSize(230, 16777215))
......
700 700
        ConfigurationDialog.setTabOrder(self.spinBoxMinimumSize, self.spinBoxUnrecognitionIgnoreStep)
701 701
        ConfigurationDialog.setTabOrder(self.spinBoxUnrecognitionIgnoreStep, self.radioButtonNoThreshold)
702 702
        ConfigurationDialog.setTabOrder(self.radioButtonNoThreshold, self.radioButtonOTSU)
703
        ConfigurationDialog.setTabOrder(self.radioButtonOTSU, self.lineEdit_3)
704
        ConfigurationDialog.setTabOrder(self.lineEdit_3, self.radioButton)
705
        ConfigurationDialog.setTabOrder(self.radioButton, self.lineEdit)
706
        ConfigurationDialog.setTabOrder(self.lineEdit, self.checkBoxApplyGaussianBlur)
703
        ConfigurationDialog.setTabOrder(self.radioButtonOTSU, self.lineEditOTSUValue)
704
        ConfigurationDialog.setTabOrder(self.lineEditOTSUValue, self.radioButtonBinary)
705
        ConfigurationDialog.setTabOrder(self.radioButtonBinary, self.lineEditBinaryValue)
706
        ConfigurationDialog.setTabOrder(self.lineEditBinaryValue, self.checkBoxApplyGaussianBlur)
707 707
        ConfigurationDialog.setTabOrder(self.checkBoxApplyGaussianBlur, self.spinBoxDilateSize)
708 708
        ConfigurationDialog.setTabOrder(self.spinBoxDilateSize, self.spinBoxFlatSize)
709 709
        ConfigurationDialog.setTabOrder(self.spinBoxFlatSize, self.spinBoxMinArea)
......
758 758
        self.groupBoxFilter.setTitle(_translate("ConfigurationDialog", "Filter"))
759 759
        self.radioButtonNoThreshold.setText(_translate("ConfigurationDialog", "No"))
760 760
        self.radioButtonOTSU.setText(_translate("ConfigurationDialog", "OTSU"))
761
        self.radioButton.setText(_translate("ConfigurationDialog", "Binary"))
761
        self.radioButtonBinary.setText(_translate("ConfigurationDialog", "Binary"))
762 762
        self.label_41.setText(_translate("ConfigurationDialog", "thres = "))
763 763
        self.label_42.setText(_translate("ConfigurationDialog", "thres = "))
764 764
        self.label_32.setText(_translate("ConfigurationDialog", "Drawing Flattening Step : "))
DTI_PID/DTI_PID/Drawing.py
127 127
            numpyArray = np.asarray(bytearray(self.contents), dtype=np.uint8)
128 128
            image = cv2.imdecode(numpyArray, cv2.IMREAD_UNCHANGED)
129 129
            self._image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
130
            
131
            # drawing opening mode
130

  
131
            configs = app_doc_data.getConfigs('Filter', 'Threshold')
132
            if configs:
133
                tokens = configs[0].value.split(',')
134
                if tokens[0] == 'OTSU':
135
                    self._image = cv2.threshold(self._image, int(tokens[1]), 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)[1]
136
                elif tokens[0] == 'Binary':
137
                    self._image = cv2.threshold(self._image, int(tokens[1]), 255, cv2.THRESH_BINARY)[1]
138

  
132 139
            configs = app_doc_data.getConfigs('Filter', 'Mode')
133 140
            if 1 == len(configs) and int(configs[0].value) is not 0:
134
                kernel_sharpen_2 = np.array([[-1, -1, -1, -1, -1],
135
                                             [-1, 2, 2, 2, -1],
136
                                             [-1, 2, 8, 2, -1],
137
                                             [-1, 2, 2, 2, -1],
138
                                             [-2, -1, -1, -1, -1]]) / 8.0  # 정규화위해 8로나눔
139
                kernel = np.array([[-1, -1, -1],
140
                                   [-1, 9, -1],
141
                                   [-1, -1, -1]])
142
                #self._image = cv2.filter2D(self._image, -1, kernel_sharpen_2)  # 이미지 외곽선 강화
143
                #self._image = cv2.GaussianBlur(self._image, (1, 1), 0, 0)       # gaussian blur
144

  
145
            self._image = cv2.threshold(self._image, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)[1]
146
            #self._image = cv2.threshold(self._image, 100, 255, cv2.THRESH_BINARY)[1]
147
            #self._image = cv2.GaussianBlur(self._image, (1, 1), 0, 0)       # gaussian blur
148
            if 1 == len(configs) and int(configs[0].value) is not 0:
149
                kernel_sharpen_2 = np.array([[-1, -1, -1, -1, -1],
150
                                             [-1, 2, 2, 2, -1],
151
                                             [-1, 2, 8, 2, -1],
152
                                             [-1, 2, 2, 2, -1],
153
                                             [-2, -1, -1, -1, -1]]) / 8.0  # 정규화위해 8로나눔
154
                kernel = np.array([[-1, -1, -1],
155
                                   [-1, 9, -1],
156
                                   [-1, -1, -1]])
157
                #self._image = cv2.filter2D(self._image, -1, kernel_sharpen_2)  # 이미지 외곽선 강화
158 141
                self._image = cv2.GaussianBlur(self._image, (1, 1), 0, 0)       # gaussian blur
159 142

  
160 143
            """
DTI_PID/DTI_PID/ProjectDialog.py
96 96
        options = QFileDialog.Options()
97 97
        options |= QFileDialog.DontUseNativeDialog
98 98
        options |= QFileDialog.ShowDirsOnly
99
        selectedDir = QFileDialog.getExistingDirectory(None, _translate('Project Dialog', "Select Project Path"),
99
        selected_dir = QFileDialog.getExistingDirectory(None, _translate('Project Dialog', "Select Project Path"),
100 100
                                                       os.getcwd(), options=options)
101
        if selectedDir and not any(c.isspace() for c in selectedDir):
102
            prj_unit = self.ui.comboBoxProjectUnit.currentText()
103
            self.insertProjectInfo(dir=selectedDir, desc=self.ui.lineEditProjectDesc.text(), prj_unit=prj_unit)
104
        else:
105
            QMessageBox.warning(self, self.tr('Message'), self.tr('Folder name should not contains space'))
101
        if selected_dir:
102
            if selected_dir and not any(c.isspace() for c in selected_dir):
103
                prj_unit = self.ui.comboBoxProjectUnit.currentText()
104
                self.insertProjectInfo(dir=selected_dir, desc=self.ui.lineEditProjectDesc.text(), prj_unit=prj_unit)
105
            else:
106
                QMessageBox.warning(self, self.tr('Message'), self.tr('Folder name should not contains space'))
106 107

  
107 108
    def deleteProjectClick(self):
108 109
        """remove selected project"""
DTI_PID/DTI_PID/Scripts/ID2.sql
50 50
    Flip               INTEGER,
51 51
    Image              BLOB,
52 52
    Svg                BLOB,
53
	TextArea		   TEXT,
53 54
    FOREIGN KEY (
54 55
        SymbolType_UID
55 56
    )
DTI_PID/DTI_PID/Scripts/MSSQL/ID2.sql
1260 1260
    Image              VARCHAR(MAX),
1261 1261
    Svg                VARCHAR(MAX),
1262 1262
    Image_display      VARCHAR(MAX),
1263
    Text_Area	TEXT,
1263
    TextArea           TEXT,
1264 1264
    FOREIGN KEY (
1265 1265
        SymbolType_UID
1266 1266
    )
DTI_PID/DTI_PID/Shapes/EngineeringConnectorItem.py
157 157
        """ setter of spec_break """
158 158
        self._spec_break = value
159 159

  
160
    '''
161
        @brief      return direction vector
162
        @author     humkyung
163
        @date       2018.09.01
164
    '''
165

  
166 160
    def dir(self):
161
        """return direction vector"""
162

  
167 163
        if self._direction == 'LEFT':
168
            return (-1, 0)
164
            return -1, 0
169 165
        elif self._direction == 'RIGHT':
170
            return (1, 0)
166
            return 1, 0
171 167
        elif self._direction == 'UP':
172
            return (0, -1)
168
            return 0, -1
173 169
        elif self._direction == 'DOWN':
174
            return (0, 1)
170
            return 0, 1
171
        elif self._direction == 'AUTO':
172
            import math
173
            from SymbolSvgItem import SymbolSvgItem
174

  
175
            if issubclass(type(self.parentItem()), SymbolSvgItem):
176
                dx = self.center()[0] - self.parentItem().origin[0]
177
                dy = self.center()[1] - self.parentItem().origin[1]
178
                length = math.sqrt(dx*dx + dy*dy)
179
                return dx/length, dy/length
175 180

  
176 181
        return None
177 182

  
......
485 490
        QGraphicsEllipseItem.paint(self, painter, options, widget)
486 491

  
487 492
        if self.parentItem() is not None:
488
            self._label.setDefaultTextColor(Qt.red) if self.parentItem().hover else self._label.setDefaultTextColor(
489
                Qt.black)
493
            self._label.setDefaultTextColor(Qt.red) if self.parentItem().hover else \
494
                self._label.setDefaultTextColor(Qt.black)
495

  
496
            direction = self.dir()
497
            if direction:
498
                # draw direction
499
                painter.setPen(Qt.magenta)
500
                rect = self.rect()
501
                size = rect.width()
502
                painter.drawLine(rect.center().x(), rect.center().y(),
503
                                 rect.center().x() + direction[0]*size, rect.center().y() + direction[1]*size)
490 504

  
491 505
    '''
492 506
        @brief      check Overlap
DTI_PID/DTI_PID/SymbolBase.py
155 155
    def getText_area(self):
156 156
        return self.text_area
157 157

  
158
    def getText_area_str(self):
158
    @property
159
    def text_area_str(self):
159 160
        return '/'.join([area.toString() for area in self.text_area]) if self.text_area else ''
160 161

  
161 162
    '''
DTI_PID/DTI_PID/SymbolEditorDialog.py
19 19

  
20 20
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '\\Commands')
21 21
import CropCommand, HandCommand, ZoomCommand, PenCommand, EraserCommand, AreaEraserCommand, OriginalPointCommand, \
22
    ConnectionPointCommand, AreaZoomCommand, FitImageCommand, RemoveTextCommand, RotateImageCommand, FlipImageCommand, FenceCommand
22
    ConnectionPointCommand, AreaZoomCommand, FitImageCommand, RemoveTextCommand, RotateImageCommand, FlipImageCommand, \
23
    FenceCommand
23 24
from GraphicsBoundingBoxItem import QGraphicsBoundingBoxItem
24 25
from Area import Area
25 26

  
27

  
26 28
class QSymbolEditorDialog(QDialog):
27 29
    """ This is symbol editor dialog """
28 30

  
......
313 315
        self.ui.addOriginalPointButton.clicked.connect(self.addOriginalPoint)
314 316
        self.ui.addConnectionPointButton.clicked.connect(self.addConnectionPoint)
315 317
        self.initSymbolTypeComboBoxItems()
316
        #self.initBaseSymbolComboBoxItems(None)
318
        # self.initBaseSymbolComboBoxItems(None)
317 319
        self.initAdditionalSymbolComboBoxItems()
318 320
        self.ui.guidelineCheckbox.setChecked(True)
319 321

  
......
386 388
        self.ui.typeComboBox.currentTextChanged.connect(self.symbolTypeTextChagedEvent)
387 389
        """
388 390

  
389
    """
390
    def symbolTypeTextChagedEvent(self, value):
391
        self.initBaseSymbolComboBoxItems(value)
392
    """
393

  
394 391
    '''
395 392
        @brief  Set data on forms, For modifying symbol
396 393
        @history    2018.05.02  Jeongwoo    When modifying symbol, Make immediateInsertCheckBox disable
......
408 405
                self.ui.rotationCountSpinBox.setValue(self.selectedSymbol.getRotationCount() * 90)
409 406
                self.ui.isContainChildCheckBox.setChecked(True if self.selectedSymbol.getIsContainChild() else False)
410 407

  
411
                category = self.ui.treeViewSymbolCategory.model().findItems(self.selectedSymbol.getType(), Qt.MatchExactly)
408
                category = self.ui.treeViewSymbolCategory.model().findItems(self.selectedSymbol.getType(),
409
                                                                            Qt.MatchExactly)
412 410
                if category:
413 411
                    index = self.ui.treeViewSymbolCategory.model().indexFromItem(category[0])
414 412
                    self.ui.treeViewSymbolCategory.expand(index)
415
                    types = self.ui.treeViewSymbolCategory.model().findItems(self.selectedSymbol.getBaseSymbol(),
416
                                                                                Qt.MatchExactly | Qt.MatchRecursive)
417
                    if types:
418
                        """
419
                        self.ui.treeViewSymbolCategory.selectionModel().select(index,
420
                                                                               QItemSelectionModel.Rows | QItemSelectionModel.Select)
421
                        """
422
                        index = self.ui.treeViewSymbolCategory.model().indexFromItem(types[0] if len(types) is 1 else types[1])
423
                        self.ui.treeViewSymbolCategory.setCurrentIndex(index)
413
                    for row in range(category[0].rowCount()):
414
                        child = category[0].child(row)
415
                        if child.text() == self.selectedSymbol.getBaseSymbol():
416
                            index = self.ui.treeViewSymbolCategory.model().indexFromItem(child)
417
                            self.ui.treeViewSymbolCategory.setCurrentIndex(index)
424 418

  
425 419
                """
426 420
                self.ui.typeComboBox.setCurrentIndex(self.ui.typeComboBox.findText(self.selectedSymbol.getType()))
427 421
                self.ui.baseSymbolComboBox.setCurrentIndex(
428 422
                    self.ui.baseSymbolComboBox.findText(self.selectedSymbol.getBaseSymbol()))
429 423
                """
424

  
430 425
                self.ui.isExceptDetectCheckBox.setChecked(True if self.selectedSymbol.getIsExceptDetect() else False)
431 426
                self.ui.makeFlipCheckBox.setChecked(True if self.selectedSymbol.getDetectFlip() else False)
432 427

  
......
640 635
        isContainChild = 1 if self.ui.isContainChildCheckBox.isChecked() else 0
641 636
        originalPoint = self.ui.originalPointLineEdit.text()
642 637
        connectionPoint = self.makeConnectionPointListString()
643
        baseSymbol = item.text() #self.ui.baseSymbolComboBox.currentText()
638
        baseSymbol = item.text()  # self.ui.baseSymbolComboBox.currentText()
644 639
        additionalSymbol = self.makeAdditionalSymbolListString()
645 640
        isExceptDetect = 1 if self.ui.isExceptDetectCheckBox.isChecked() else 0
646 641

  
......
653 648
        imageWidth = width
654 649
        iamgeHeight = height
655 650

  
656
        text_area = []
651
        text_areas = []
657 652
        for row in range(self.ui.textAreaTableWidget.rowCount()):
658 653
            area = Area('Text Area')
659 654
            area.parse(self.ui.textAreaTableWidget.item(row, 0).text())
660
            text_area.append(area)
655
            text_areas.append(area)
661 656

  
662 657
        self.newSym = symbol.SymbolBase(fileName, category, convertedThreshold, int(minMatchPoint), True,
663 658
                                        rotationCount, ocrOption, isContainChild, originalPoint, connectionPoint,
664 659
                                        baseSymbol, additionalSymbol, isExceptDetect, hasInstrumentLabel, uid,
665
                                        imageWidth, iamgeHeight, detectFlip=detectFlip, text_area=text_area)
660
                                        imageWidth, iamgeHeight, detectFlip=detectFlip, text_area=text_areas)
666 661

  
667 662
        return self.newSym
668 663

  
DTI_PID/DTI_PID/SymbolEditor_UI.py
1 1
# -*- coding: utf-8 -*-
2 2

  
3
# Form implementation generated from reading ui file './UI/SymbolEditor.ui'
3
# Form implementation generated from reading ui file '.\UI\SymbolEditor.ui'
4 4
#
5
# Created by: PyQt5 UI code generator 5.11.3
5
# Created by: PyQt5 UI code generator 5.14.1
6 6
#
7 7
# WARNING! All changes made in this file will be lost!
8 8

  
9

  
9 10
from PyQt5 import QtCore, QtGui, QtWidgets
10 11

  
12

  
11 13
class Ui_Dialog(object):
12 14
    def setupUi(self, Dialog):
13 15
        Dialog.setObjectName("Dialog")
......
648 650
        self.isExceptDetectLabel.setText(_translate("Dialog", "Exclude"))
649 651
        self.addAdditionalSymbolButton.setText(_translate("Dialog", "Add"))
650 652
        self.label_5.setText(_translate("Dialog", "Text Area"))
651

  
652 653
import MainWindow_rc
653

  
654
if __name__ == "__main__":
655
    import sys
656
    app = QtWidgets.QApplication(sys.argv)
657
    Dialog = QtWidgets.QDialog()
658
    ui = Ui_Dialog()
659
    ui.setupUi(Dialog)
660
    Dialog.show()
661
    sys.exit(app.exec_())
662

  
DTI_PID/DTI_PID/UI/Configuration.ui
47 47
            <item row="2" column="1">
48 48
             <layout class="QGridLayout" name="gridLayout_35">
49 49
              <item row="2" column="2">
50
               <widget class="QLineEdit" name="lineEdit"/>
50
               <widget class="QLineEdit" name="lineEditBinaryValue"/>
51 51
              </item>
52 52
              <item row="0" column="0">
53 53
               <widget class="QRadioButton" name="radioButtonNoThreshold">
......
64 64
               </widget>
65 65
              </item>
66 66
              <item row="2" column="0">
67
               <widget class="QRadioButton" name="radioButton">
67
               <widget class="QRadioButton" name="radioButtonBinary">
68 68
                <property name="text">
69 69
                 <string>Binary</string>
70 70
                </property>
......
85 85
               </widget>
86 86
              </item>
87 87
              <item row="1" column="2">
88
               <widget class="QLineEdit" name="lineEdit_3"/>
88
               <widget class="QLineEdit" name="lineEditOTSUValue"/>
89 89
              </item>
90 90
             </layout>
91 91
            </item>
......
1460 1460
  <tabstop>spinBoxUnrecognitionIgnoreStep</tabstop>
1461 1461
  <tabstop>radioButtonNoThreshold</tabstop>
1462 1462
  <tabstop>radioButtonOTSU</tabstop>
1463
  <tabstop>lineEdit_3</tabstop>
1464
  <tabstop>radioButton</tabstop>
1465
  <tabstop>lineEdit</tabstop>
1463
  <tabstop>lineEditOTSUValue</tabstop>
1464
  <tabstop>radioButtonBinary</tabstop>
1465
  <tabstop>lineEditBinaryValue</tabstop>
1466 1466
  <tabstop>checkBoxApplyGaussianBlur</tabstop>
1467 1467
  <tabstop>spinBoxDilateSize</tabstop>
1468 1468
  <tabstop>spinBoxFlatSize</tabstop>
......
1550 1550
  </connection>
1551 1551
 </connections>
1552 1552
 <buttongroups>
1553
  <buttongroup name="buttonGroup_4"/>
1553 1554
  <buttongroup name="buttonGroup"/>
1554 1555
  <buttongroup name="buttonGroup_2"/>
1555
  <buttongroup name="buttonGroup_4"/>
1556 1556
  <buttongroup name="buttonGroup_3"/>
1557 1557
 </buttongroups>
1558 1558
</ui>
DTI_PID/DTI_PID/symbol.py
11 11
'''
12 12
class Symbol(SymbolBase):
13 13
    def __init__(self, sName, sType, sp, width, height, threshold, minMatchCount, hitRate, rotatedAngle
14
                 , isDetectOnOrigin, rotationCount, ocrOption, isContainChild = 0
15
                 , originalPoint = None, connectionPoint = None, baseSymbol = None, additionalSymbol = None
16
                 , isExceptDetect = 0, hasInstrumentLabel = 0, uid = None, detectFlip = None, text_area=None):
14
                 , isDetectOnOrigin, rotationCount, ocrOption, isContainChild=0
15
                 , originalPoint=None, connectionPoint=None, baseSymbol=None, additionalSymbol = None
16
                 , isExceptDetect=0, hasInstrumentLabel=0, uid=None, detectFlip=None, text_area=None):
17 17
        SymbolBase.__init__(self, sName, sType, threshold, minMatchCount
18 18
                            , isDetectOnOrigin, rotationCount, ocrOption, isContainChild
19 19
                            , originalPoint, connectionPoint, baseSymbol, additionalSymbol, isExceptDetect

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)