프로젝트

일반

사용자정보

개정판 e89f871b

IDe89f871b36c71fccdca2d710e07d161682925ce5
상위 f07a3e4a
하위 b7931b24

함의성이(가) 약 5년 전에 추가함

issue #640: add symbol attribute code table ui

Change-Id: I5fe40ee0dc2f98320085ab29c40f5c1686350ec9

차이점 보기:

DTI_PID/DTI_PID/AppDocData.py
2273 2273
        @date       2018.07.10
2274 2274
    '''
2275 2275

  
2276
    def getCodeTable(self, property, forCheckLineNumber=False):
2276
    def getCodeTable(self, property, forCheckLineNumber=False, symbol_attribute_uid=None):
2277 2277
        result = []
2278 2278
        conn = self.project.database.connect()
2279 2279
        with conn:
......
2296 2296
                    rows = cursor.fetchall()
2297 2297
                    if property.upper() in [name[0].upper() for name in rows]:
2298 2298
                    """
2299
                    sql = 'select uid, code, description, Allowables from [{}] order by code DESC'.format(property)
2299
                    if not symbol_attribute_uid:
2300
                        sql = 'select uid, code, description, Allowables from [{}] order by code DESC'.format(property)
2301
                    else:
2302
                        sql = "select uid, code, description, Allowables from [{}] where SymbolAttribute_UID='{}' order by code DESC".format(property, symbol_attribute_uid)
2300 2303
                    cursor.execute(sql)
2301 2304
                    rows = cursor.fetchall()
2302 2305
                    for row in rows:
DTI_PID/DTI_PID/CodeTableDialog.py
8 8
from PyQt5.QtGui import *
9 9
from PyQt5.QtWidgets import *
10 10
from AppDocData import AppDocData, MessageType
11
from App import App
11 12
from openpyxl import *
12 13
from openpyxl.styles import *
13 14

  
......
26 27
    'Nominal Diameter', 'Fluid Code', 'Insulation Purpose', 'PnID Number', 'Piping Materials Class', 'Unit Number',
27 28
    'ValveOperCodes', 'EqpTagNames', 'ReservedWords', 'Dictionary')
28 29

  
29
    def __init__(self, parent):
30
    def __init__(self, parent, child_dialog=''):
30 31
        QDialog.__init__(self, parent)
31 32

  
32 33
        self.currentCode = {}
33 34

  
34
        self.ui = CodeTable_UI.Ui_CodeTableDialog()
35
        self.ui.setupUi(self)
36

  
37 35
        self.code_area = None
38 36
        self.desc_area = None
39
        self.ui.spinBoxHeight.setValue(50)
40

  
41
        self.ui.tableWidgetNominalDiameter.setSortingEnabled(True)
42
        self.ui.tableWidgetFluidCode.setSortingEnabled(True)
43
        self.ui.tableWidgetInsulationPurpose.setSortingEnabled(True)
44
        self.ui.tableWidgetPnIDNumber.setSortingEnabled(True)
45
        self.ui.tableWidgetPipingMaterialsClass.setSortingEnabled(True)
46
        self.ui.tableWidgetUnitNumber.setSortingEnabled(True)
47
        self.ui.tableWidgetValveOperCodes.setSortingEnabled(True)
48
        self.ui.tableWidgetEqpTagNames.setSortingEnabled(True)
49
        self.ui.tableWidgetReservedWords.setSortingEnabled(True)
50

  
51
        # DB Table명 기준으로 작성
52
        for table in QCodeTableDialog.CODE_TABLES:
53
            self.settingTable(table)
54

  
55
        # connect signals
56
        self.ui.pushButtonImport.clicked.connect(self.import_code_table)
57
        self.ui.pushButtonExport.clicked.connect(self.export_code_table)
58
        self.ui.pushButtonRead.clicked.connect(self.read_from_legend)
59 37

  
60
        self.fence_cmd = FenceCommand.FenceCommand(self.parent().graphicsView)
38
        self.child_dialog = child_dialog
39
        if not child_dialog:
40
            self.ui = CodeTable_UI.Ui_CodeTableDialog()
41
            self.ui.setupUi(self)
42

  
43
            self.ui.spinBoxHeight.setValue(50)
44

  
45
            self.ui.tableWidgetNominalDiameter.setSortingEnabled(True)
46
            self.ui.tableWidgetFluidCode.setSortingEnabled(True)
47
            self.ui.tableWidgetInsulationPurpose.setSortingEnabled(True)
48
            self.ui.tableWidgetPnIDNumber.setSortingEnabled(True)
49
            self.ui.tableWidgetPipingMaterialsClass.setSortingEnabled(True)
50
            self.ui.tableWidgetUnitNumber.setSortingEnabled(True)
51
            self.ui.tableWidgetValveOperCodes.setSortingEnabled(True)
52
            self.ui.tableWidgetEqpTagNames.setSortingEnabled(True)
53
            self.ui.tableWidgetReservedWords.setSortingEnabled(True)
54

  
55
            # DB Table명 기준으로 작성
56
            for table in QCodeTableDialog.CODE_TABLES:
57
                self.settingTable(table)
58

  
59
            # connect signals
60
            self.ui.pushButtonImport.clicked.connect(self.import_code_table)
61
            self.ui.pushButtonExport.clicked.connect(self.export_code_table)
62
            self.ui.pushButtonRead.clicked.connect(self.read_from_legend)
63

  
64
        self.graphicsView = App.mainWnd().graphicsView
65
        self.fence_cmd = FenceCommand.FenceCommand(self.graphicsView)
61 66
        self.fence_cmd.onSuccess.connect(self.onAreaCreated)
62 67

  
68
    def getTabText(self):
69
        """ get current tab name text """
70
        if not self.child_dialog:
71
            _tabWidget = self.ui.tabWidget
72
            currentTabIndex = _tabWidget.currentIndex()
73
            tabText = self.replaceText(_tabWidget.tabText(currentTabIndex))
74
        else:
75
            tabText = self.child_dialog
76
        return tabText
77

  
63 78
    def read_from_legend(self):
64 79
        """ read code data from legend drawing """
65 80
        if self.ui.pushButtonRead.text() == 'Read from Legend':
66
            self.parent().graphicsView.command = self.fence_cmd
81
            self.graphicsView.command = self.fence_cmd
67 82
            self.ui.pushButtonRead.setText('Draw Code Area')
68 83
        elif self.ui.pushButtonRead.text() == 'Read' and self.code_area and self.code_area.scene() and self.desc_area and self.desc_area.scene():
69 84
            # read ocr
70 85
            code_rect = self.code_area.sceneBoundingRect()
71 86
            desc_rect = self.desc_area.sceneBoundingRect()
72
            code_img = self.parent().graphicsView.image().copy(code_rect.x(), code_rect.y(), code_rect.width(), code_rect.height())
73
            desc_img = self.parent().graphicsView.image().copy(desc_rect.x(), desc_rect.y(), desc_rect.width(), desc_rect.height())
87
            code_img = self.graphicsView.image().copy(code_rect.x(), code_rect.y(), code_rect.width(), code_rect.height())
88
            desc_img = self.graphicsView.image().copy(desc_rect.x(), desc_rect.y(), desc_rect.width(), desc_rect.height())
74 89
            code_texts = self.detectText(code_img, code_rect)
75 90
            desc_texts = self.detectText(desc_img, desc_rect)
76 91

  
......
107 122
                desc_texts.append(desc)
108 123

  
109 124
            # fill table
110
            _tabWidget = self.ui.tabWidget
111
            currentTabIndex = _tabWidget.currentIndex()
112
            tabText = self.replaceText(_tabWidget.tabText(currentTabIndex))
125
            tabText = self.getTabText()
126

  
113 127
            if tabText == 'NominalDiameter':
114 128
                return
115 129
            table = self.findTableWidget(tabText)
......
135 149

  
136 150
            if self.code_area:
137 151
                if self.code_area.scene():
138
                    self.parent().graphicsView.scene.removeItem(self.code_area)
152
                    self.graphicsView.scene.removeItem(self.code_area)
139 153
                self.code_area = None
140 154
            if self.desc_area:
141 155
                if self.desc_area.scene():
142
                    self.parent().graphicsView.scene.removeItem(self.desc_area)
156
                    self.graphicsView.scene.removeItem(self.desc_area)
143 157
                self.desc_area = None
144 158
            self.ui.pushButtonRead.setText('Read from Legend')
145 159
        else:
146 160
            if self.code_area:
147 161
                if self.code_area.scene():
148
                    self.parent().graphicsView.scene.removeItem(self.code_area)
162
                    self.graphicsView.scene.removeItem(self.code_area)
149 163
                self.code_area = None
150 164
            if self.desc_area:
151 165
                if self.desc_area.scene():
152
                    self.parent().graphicsView.scene.removeItem(self.desc_area)
166
                    self.graphicsView.scene.removeItem(self.desc_area)
153 167
                self.desc_area = None
154 168
            self.ui.pushButtonRead.setText('Read from Legend')
155 169

  
......
160 174
        if self.ui.pushButtonRead.text() == 'Draw Code Area':
161 175
            item = QGraphicsBoundingBoxItem(x, y, width, height)
162 176
            item.setPen(QPen(Qt.red, THICKNESS, Qt.SolidLine))
163
            self.parent().graphicsView.scene.addItem(item)
177
            self.graphicsView.scene.addItem(item)
164 178
            self.code_area = item
165 179
            self.ui.pushButtonRead.setText('Draw Description Area')
166 180
        elif self.ui.pushButtonRead.text() == 'Draw Description Area' and self.code_area and self.code_area.scene():
167 181
            item = QGraphicsBoundingBoxItem(x, y, width, height)
168 182
            item.setPen(QPen(Qt.blue, THICKNESS, Qt.SolidLine))
169
            self.parent().graphicsView.scene.addItem(item)
183
            self.graphicsView.scene.addItem(item)
170 184
            self.desc_area = item
171 185
            self.ui.pushButtonRead.setText('Read')
172
            self.parent().graphicsView.command = None
186
            self.graphicsView.command = None
173 187

  
174 188
    def detectText(self, image, rect):
175 189
        """ detect text from image, come from OcrResultDialog and modified """
......
203 217
        @date       2018.07.10
204 218
    '''
205 219

  
206
    def settingTable(self, tableName):
220
    def settingTable(self, tableName, symbol_attribute_uid=None):
207 221
        try:
208 222
            tableName = self.replaceText(tableName)
209 223
            docData = AppDocData.instance()
......
211 225
            if table: table.horizontalHeader().setStretchLastSection(True)
212 226
            if tableName == "NominalDiameter":
213 227
                tableDatas = docData.getNomialPipeSizeData()
228
            elif tableName == "SymbolAttributeCodeTable":
229
                tableDatas = docData.getCodeTable(tableName, forCheckLineNumber=False, symbol_attribute_uid=symbol_attribute_uid)
214 230
            else:
215 231
                tableDatas = docData.getCodeTable(tableName)
216 232

  
......
317 333
    def keyPressEvent(self, e):
318 334
        try:
319 335
            if e.key() == Qt.Key_Delete:
320
                _tabWidget = self.ui.tabWidget
321
                currentTabIndex = _tabWidget.currentIndex()
322
                tabText = self.replaceText(_tabWidget.tabText(currentTabIndex))
336
                tabText = self.getTabText()
337
                
323 338
                table = self.findTableWidget(tabText)
324 339
                if table:
325 340
                    selectedIndexes = table.selectedIndexes()
......
345 360

  
346 361
                        self.checkRowAndAddRow(tabText, table)
347 362
            elif (e.key() == Qt.Key_C) and (e.modifiers() & Qt.ControlModifier):
348
                tab = self.ui.tabWidget.widget(self.ui.tabWidget.currentIndex())
349
                table = tab.findChild(QTableWidget)
363
                tabText = self.getTabText()
364
                
365
                table = self.findTableWidget(tabText)
350 366
                if table:
351 367
                    self.copy_selection(table)
352 368
            elif (e.key() == Qt.Key_V) and (e.modifiers() & Qt.ControlModifier):
369
                tabText = self.getTabText()
370
                '''
371
                table = self.findTableWidget(tabText)
353 372
                tab = self.ui.tabWidget.widget(self.ui.tabWidget.currentIndex())
354 373
                table = tab.findChild(QTableWidget)
374
                '''
375
                table = self.findTableWidget(tabText)
355 376
                if table:
356 377
                    self.paste_selection(table)
357 378
        except Exception as ex:
......
460 481

  
461 482
    def cellValueChanged(self, row, column):
462 483
        try:
463
            _tabWidget = self.ui.tabWidget
464
            currentTabIndex = _tabWidget.currentIndex()
465
            tabText = self.replaceText(_tabWidget.tabText(currentTabIndex))
484
            tabText = self.getTabText()
485

  
466 486
            table = self.findTableWidget(tabText)
467 487

  
468 488
            if tabText != "NominalDiameter":
DTI_PID/DTI_PID/DetectSymbolDialog.py
172 172
                        target_conn.execute('PRAGMA foreign_keys = ON')
173 173
                        target_cursor.execute('begin')
174 174

  
175
                    tables = ['SymbolType', 'SymbolName', 'SymbolAttribute', 'Symbol']
175
                    tables = ['SymbolType', 'SymbolName', 'SymbolAttribute', 'Symbol', 'SymbolAttributeCodeTable']
176 176

  
177 177
                    for table in reversed(tables):
178 178
                        target_cursor.execute(f"delete from {table}")
......
267 267
                    target_cursor = target_conn.cursor()
268 268
                    target_cursor.execute('begin')
269 269

  
270
                    tables = ['SymbolType', 'SymbolName', 'SymbolAttribute', 'Symbol']
270
                    tables = ['SymbolType', 'SymbolName', 'SymbolAttribute', 'Symbol', 'SymbolAttributeCodeTable']
271 271
                    for table in tables:
272 272
                        sql = f"select * from {table}"
273 273
                        cursor.execute(sql)
DTI_PID/DTI_PID/MainWindow.py
1919 1919
                        run.items.pop(index)
1920 1920
                        if not run.items:
1921 1921
                            run.explode()
1922
                            if type(match) is QEngineeringTrimLineNoTextItem and not match.runs:
1923
                                app_doc_data.tracerLineNos.pop(app_doc_data.tracerLineNos.index(match))
1922 1924
                        break
1923 1925

  
1924 1926
            matches = [_item for _item in self.graphicsView.scene.items() if hasattr(_item, 'owner')]
DTI_PID/DTI_PID/Scripts/MSSQL/ID2.sql
1266 1266
CREATE TABLE SymbolAttribute (
1267 1267
    UID              VARCHAR (37) NOT NULL
1268 1268
                                  PRIMARY KEY,
1269
    SymbolType_UID   INTEGER,
1269
    SymbolType_UID   VARCHAR (37),
1270 1270
    Attribute        VARCHAR(32)  NOT NULL,
1271 1271
    DisplayAttribute TEXT         NOT NULL,
1272 1272
    AttributeType    TEXT         NOT NULL,
......
2088 2088
    Description TEXT,
2089 2089
    Allowables  TEXT
2090 2090
);
2091

  
2092
  CREATE TABLE SymbolAttributeCodeTable (
2093
	UID	VARCHAR(37) NOT NULL,
2094
	Code	VARCHAR(32) NOT NULL,
2095
	Description	TEXT,
2096
	Allowables	TEXT,
2097
	SymbolAttribute_UID	VARCHAR(37) NOT NULL,
2098
	PRIMARY KEY(UID),
2099
	FOREIGN KEY(SymbolAttribute_UID) REFERENCES SymbolAttribute (UID)
2100
);
DTI_PID/DTI_PID/Scripts/SQLite_Project.tables.sql
3 3
	`Code` varchar (32) NOT NULL UNIQUE,
4 4
	`Description` TEXT,
5 5
	`Allowables` TEXT, PRIMARY KEY(`UID`)
6
);
7

  
8
CREATE TABLE `SymbolAttributeCodeTable` (
9
	`UID`	VARCHAR ( 37 ) NOT NULL,
10
	`Code`	VARCHAR ( 32 ) NOT NULL,
11
	`Description`	TEXT,
12
	`Allowables`	TEXT,
13
	`SymbolAttribute_UID`	VARCHAR ( 37 ) NOT NULL,
14
	PRIMARY KEY(`UID`),
15
	FOREIGN KEY(`SymbolAttribute_UID`) REFERENCES `SymbolAttribute`(`UID`)
6 16
);
DTI_PID/DTI_PID/Shapes/QEngineeringTrimLineNoTextItem.py
89 89
        treeWidget = App.mainWnd().itemTreeWidget
90 90
        treeWidget.findItemByData(self).parent().removeChild(treeWidget.findItemByData(self))
91 91
        tracerLineNos = AppDocData.instance().tracerLineNos
92
        tracerLineNos.pop(tracerLineNos.index(self))
92
        if self in tracerLineNos:
93
            tracerLineNos.pop(tracerLineNos.index(self))
DTI_PID/DTI_PID/SymbolAttrCodeTableDialog.py
1
# coding: utf-8
2
"""
3
    This is area configuration module
4
"""
5
import os
6
import sys
7
from PyQt5.QtCore import *
8
from PyQt5.QtGui import *
9
from PyQt5.QtWidgets import *
10
from AppDocData import AppDocData
11

  
12
from CodeTableDialog import QCodeTableDialog
13

  
14
import SymbolAttrCodeTable_UI
15

  
16
class SymbolAttrCodeTableDialog(QCodeTableDialog):
17
    def __init__(self, parent, symbol_attribute_uid):
18
        QCodeTableDialog.__init__(self, parent, 'SymbolAttributeCodeTable')
19

  
20
        self.ui = SymbolAttrCodeTable_UI.Ui_AttributeCodeTable()
21
        self.ui.setupUi(self)
22

  
23
        self.ui.spinBoxHeight.setValue(50)
24
        self.ui.tableWidgetSymbolAttributeCodeTable.setSortingEnabled(True)
25

  
26
        self.isAccepted = False
27
        self.code_data = None
28

  
29
        self.ui.pushButtonRead.clicked.connect(self.read_from_legend)
30
        self.ui.buttonBox.accepted.connect(self.accept)
31
        self.ui.buttonBox.rejected.connect(self.reject)
32

  
33
        self.settingTable('SymbolAttributeCodeTable', symbol_attribute_uid=symbol_attribute_uid)
34
    '''
35
        @brief  accept dialog
36
    '''
37
    def accept(self):
38
        try:
39
            self.isAccepted = False
40

  
41
            pass
42
            QDialog.accept(self)
43

  
44
        except Exception as ex:
45
            from App import App
46
            from AppDocData import MessageType
47

  
48
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
49
            App.mainWnd().addMessage.emit(MessageType.Error, message)
50
        
51
    def reject(self):
52
        try:
53
            self.isAccepted = False
54

  
55
            pass
56
            QDialog.reject(self)
57

  
58
        except Exception as ex:
59
            from App import App
60
            from AppDocData import MessageType
61

  
62
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
63
            App.mainWnd().addMessage.emit(MessageType.Error, message)
64

  
65
    def showDialog(self):
66
        self.show()
67
        self.exec_()
68
        return self.isAccepted, self.code_data
DTI_PID/DTI_PID/SymbolAttrCodeTable_UI.py
1
# -*- coding: utf-8 -*-
2

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

  
9
from PyQt5 import QtCore, QtGui, QtWidgets
10

  
11
class Ui_AttributeCodeTable(object):
12
    def setupUi(self, AttributeCodeTable):
13
        AttributeCodeTable.setObjectName("AttributeCodeTable")
14
        AttributeCodeTable.resize(496, 341)
15
        font = QtGui.QFont()
16
        font.setFamily("맑은 고딕")
17
        AttributeCodeTable.setFont(font)
18
        icon = QtGui.QIcon()
19
        icon.addPixmap(QtGui.QPixmap(":/newPrefix/codetable.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
20
        AttributeCodeTable.setWindowIcon(icon)
21
        self.gridLayout = QtWidgets.QGridLayout(AttributeCodeTable)
22
        self.gridLayout.setObjectName("gridLayout")
23
        self.horizontalLayout = QtWidgets.QHBoxLayout()
24
        self.horizontalLayout.setObjectName("horizontalLayout")
25
        self.label = QtWidgets.QLabel(AttributeCodeTable)
26
        self.label.setObjectName("label")
27
        self.horizontalLayout.addWidget(self.label)
28
        self.spinBoxHeight = QtWidgets.QSpinBox(AttributeCodeTable)
29
        self.spinBoxHeight.setMaximum(100)
30
        self.spinBoxHeight.setObjectName("spinBoxHeight")
31
        self.horizontalLayout.addWidget(self.spinBoxHeight)
32
        self.pushButtonRead = QtWidgets.QPushButton(AttributeCodeTable)
33
        self.pushButtonRead.setObjectName("pushButtonRead")
34
        self.horizontalLayout.addWidget(self.pushButtonRead)
35
        self.buttonBox = QtWidgets.QDialogButtonBox(AttributeCodeTable)
36
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
37
        self.buttonBox.setObjectName("buttonBox")
38
        self.horizontalLayout.addWidget(self.buttonBox)
39
        self.gridLayout.addLayout(self.horizontalLayout, 2, 0, 1, 1)
40
        self.groupBoxTitleBlock = QtWidgets.QGroupBox(AttributeCodeTable)
41
        self.groupBoxTitleBlock.setObjectName("groupBoxTitleBlock")
42
        self.gridLayout_4 = QtWidgets.QGridLayout(self.groupBoxTitleBlock)
43
        self.gridLayout_4.setObjectName("gridLayout_4")
44
        self.verticalLayout_3 = QtWidgets.QVBoxLayout()
45
        self.verticalLayout_3.setObjectName("verticalLayout_3")
46
        self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
47
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
48
        self.tableWidgetSymbolAttributeCodeTable = QtWidgets.QTableWidget(self.groupBoxTitleBlock)
49
        self.tableWidgetSymbolAttributeCodeTable.setColumnCount(2)
50
        self.tableWidgetSymbolAttributeCodeTable.setObjectName("tableWidgetSymbolAttributeCodeTable")
51
        self.tableWidgetSymbolAttributeCodeTable.setRowCount(0)
52
        self.horizontalLayout_4.addWidget(self.tableWidgetSymbolAttributeCodeTable)
53
        self.verticalLayout_3.addLayout(self.horizontalLayout_4)
54
        self.gridLayout_4.addLayout(self.verticalLayout_3, 0, 0, 1, 1)
55
        self.gridLayout.addWidget(self.groupBoxTitleBlock, 1, 0, 1, 1)
56

  
57
        self.retranslateUi(AttributeCodeTable)
58
        QtCore.QMetaObject.connectSlotsByName(AttributeCodeTable)
59

  
60
    def retranslateUi(self, AttributeCodeTable):
61
        _translate = QtCore.QCoreApplication.translate
62
        AttributeCodeTable.setWindowTitle(_translate("AttributeCodeTable", "Attribute Code Table"))
63
        self.label.setText(_translate("AttributeCodeTable", "Line Height : "))
64
        self.pushButtonRead.setText(_translate("AttributeCodeTable", "Read from Legend"))
65
        self.groupBoxTitleBlock.setTitle(_translate("AttributeCodeTable", "Attribute Table"))
66

  
67
import MainWindow_rc
68

  
69
if __name__ == "__main__":
70
    import sys
71
    app = QtWidgets.QApplication(sys.argv)
72
    AttributeCodeTable = QtWidgets.QDialog()
73
    ui = Ui_AttributeCodeTable()
74
    ui.setupUi(AttributeCodeTable)
75
    AttributeCodeTable.show()
76
    sys.exit(app.exec_())
77

  
DTI_PID/DTI_PID/SymbolAttrEditorDialog.py
34 34
            self.currentTypeId = 0
35 35
            # insert QTableWidgetEx
36 36
            self.ui.tableWidgetAttr = QTableWidgetEx(self.ui.groupBox)
37
            self.ui.tableWidgetAttr.setColumnCount(7)
37
            self.ui.tableWidgetAttr.setColumnCount(8)
38 38
            self.ui.tableWidgetAttr.setObjectName("tableWidgetAttr")
39 39
            self.ui.tableWidgetAttr.setRowCount(0)
40 40
            self.ui.tableWidgetAttr.verticalHeader().setVisible(False)
......
47 47
            self.ui.pushButtonAddAttr.clicked.connect(self.onAddAttr)
48 48
            self.ui.pushButtonDelAttr.clicked.connect(self.onDelAttr)
49 49
            self.ui.tableWidgetAttr.setHorizontalHeaderLabels(['UID', 'Name', 'Display Name', 'Type', 'Attr At',
50
                                                               'Expression', 'Target'])
50
                                                               'Expression', 'Target', 'Code Table'])
51 51
            self.ui.tableWidgetAttr.horizontalHeaderItem(1).setSizeHint(QSize(25, 25))
52 52
            self.ui.tableWidgetAttr.setColumnWidth(3, 130)
53 53
            self.ui.tableWidgetAttr.hideColumn(0)
......
74 74
            self.ui.pushButtonDelAttr.clicked.connect(self.onDelLineNoAttr)
75 75

  
76 76
    def cell_double_clicked(self, row, column):
77
        if self._symbolType is None or column is not 6 :return
77
        if self._symbolType is None or not (column is 6 or column is 7): return
78 78
        if hasattr(self.ui.tableWidgetAttr.item(row, 0), 'tag') and self.ui.tableWidgetAttr.item(row, 0).tag.IsProp == 2: return
79 79
    
80 80
        from SymbolAttrTargetDialog import SymbolAttrTargetDialog
81
        from SymbolAttrCodeTableDialog import SymbolAttrCodeTableDialog
82
        from App import App
81 83

  
82 84
        try:
83
            symbolType = self.ui.comboBoxSymbolType.currentText()
85
            # code table settting
86
            if column == 7:
87
                symbolType = self.ui.comboBoxSymbolType.currentText()
84 88

  
85
            dialog = SymbolAttrTargetDialog(self, symbolType, self.ui.tableWidgetAttr.item(row, 6).tag)
86
            (isAccept, target) = dialog.showDialog()
89
                dialog = SymbolAttrCodeTableDialog(self, str(self.ui.tableWidgetAttr.item(row, 0).tag.UID))
90
                (isAccept, code_data) = dialog.showDialog()
87 91
  
88
            if isAccept:
89
                self.ui.tableWidgetAttr.item(row, 6).tag = target
90
                if target == 'ALL':
91
                    self.ui.tableWidgetAttr.item(row, 6).setText('ALL')
92
                else:
93
                    self.ui.tableWidgetAttr.item(row, 6).setText('...')
92
                if isAccept:
93
                    self.ui.tableWidgetAttr.item(row, 6).tag = code_data
94

  
95
                graphicsView = App.mainWnd().graphicsView
96
                if dialog.code_area:
97
                    if dialog.code_area.scene():
98
                        graphicsView.scene.removeItem(dialog.code_area)
99
                if dialog.desc_area:
100
                    if dialog.desc_area.scene():
101
                        graphicsView.scene.removeItem(dialog.desc_area)
102
                graphicsView.useDefaultCommand()
103
            # target settting
104
            elif column == 6:
105
                symbolType = self.ui.comboBoxSymbolType.currentText()
106

  
107
                dialog = SymbolAttrTargetDialog(self, symbolType, self.ui.tableWidgetAttr.item(row, 6).tag)
108
                (isAccept, target) = dialog.showDialog()
109
  
110
                if isAccept:
111
                    self.ui.tableWidgetAttr.item(row, 6).tag = target
112
                    if target == 'ALL':
113
                        self.ui.tableWidgetAttr.item(row, 6).setText('ALL')
114
                    else:
115
                        self.ui.tableWidgetAttr.item(row, 6).setText('...')
94 116

  
95 117
        except Exception as ex:
96 118
            from App import App
......
188 210
            item.setFlags(Qt.ItemIsEnabled)
189 211
            self.ui.tableWidgetAttr.setItem(row, 6, item)
190 212

  
213
            item = QTableWidgetItem('...')
214
            item.tag = None
215
            item.setTextAlignment(Qt.AlignHCenter)
216
            item.setFlags(Qt.ItemIsEnabled)
217
            self.ui.tableWidgetAttr.setItem(row, 7, item)
218

  
191 219
            row = row + 1
192 220

  
193 221
    def saveData(self):
DTI_PID/DTI_PID/SymbolAttrTargetDialog.py
4 4
"""
5 5
import os
6 6
import sys
7
#sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '\\Commands')
8 7
from PyQt5.QtCore import *
9 8
from PyQt5.QtGui import *
10 9
from PyQt5.QtWidgets import *
11 10
from AppDocData import AppDocData
12 11

  
13
#sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '\\Shapes')
14 12
import SymbolAttrTarget_UI
15 13

  
16 14
class SymbolAttrTargetDialog(QDialog):
DTI_PID/DTI_PID/SymbolTreeWidget.py
100 100
            data = item.data(0, self.TREE_DATA_ROLE)
101 101

  
102 102
            dlg = QSymbolAttrEditorDialog(self, data)
103
            dlg.show()
103 104
            dlg.exec_()
104 105
        except Exception as ex:
105 106
            from App import App
DTI_PID/DTI_PID/UI/SymbolAttrCodeTable.ui
1
<?xml version="1.0" encoding="UTF-8"?>
2
<ui version="4.0">
3
 <class>AttributeCodeTable</class>
4
 <widget class="QDialog" name="AttributeCodeTable">
5
  <property name="geometry">
6
   <rect>
7
    <x>0</x>
8
    <y>0</y>
9
    <width>496</width>
10
    <height>341</height>
11
   </rect>
12
  </property>
13
  <property name="font">
14
   <font>
15
    <family>맑은 고딕</family>
16
   </font>
17
  </property>
18
  <property name="windowTitle">
19
   <string>Attribute Code Table</string>
20
  </property>
21
  <property name="windowIcon">
22
   <iconset resource="../res/MainWindow.qrc">
23
    <normaloff>:/newPrefix/codetable.png</normaloff>:/newPrefix/codetable.png</iconset>
24
  </property>
25
  <layout class="QGridLayout" name="gridLayout">
26
   <item row="2" column="0">
27
    <layout class="QHBoxLayout" name="horizontalLayout">
28
     <item>
29
      <widget class="QLabel" name="label">
30
       <property name="text">
31
        <string>Line Height : </string>
32
       </property>
33
      </widget>
34
     </item>
35
     <item>
36
      <widget class="QSpinBox" name="spinBoxHeight">
37
       <property name="maximum">
38
        <number>100</number>
39
       </property>
40
      </widget>
41
     </item>
42
     <item>
43
      <widget class="QPushButton" name="pushButtonRead">
44
       <property name="text">
45
        <string>Read from Legend</string>
46
       </property>
47
      </widget>
48
     </item>
49
     <item>
50
      <widget class="QDialogButtonBox" name="buttonBox">
51
       <property name="standardButtons">
52
        <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
53
       </property>
54
      </widget>
55
     </item>
56
    </layout>
57
   </item>
58
   <item row="1" column="0">
59
    <widget class="QGroupBox" name="groupBoxTitleBlock">
60
     <property name="title">
61
      <string>Attribute Table</string>
62
     </property>
63
     <layout class="QGridLayout" name="gridLayout_4">
64
      <item row="0" column="0">
65
       <layout class="QVBoxLayout" name="verticalLayout_3">
66
        <item>
67
         <layout class="QHBoxLayout" name="horizontalLayout_4">
68
          <item>
69
           <widget class="QTableWidget" name="tableWidgetSymbolAttributeCodeTable">
70
            <property name="columnCount">
71
             <number>2</number>
72
            </property>
73
            <column/>
74
            <column/>
75
           </widget>
76
          </item>
77
         </layout>
78
        </item>
79
       </layout>
80
      </item>
81
     </layout>
82
    </widget>
83
   </item>
84
  </layout>
85
 </widget>
86
 <resources>
87
  <include location="../res/MainWindow.qrc"/>
88
 </resources>
89
 <connections/>
90
</ui>

내보내기 Unified diff

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