프로젝트

일반

사용자정보

개정판 d938b798

IDd938b798730e1d01ff0b63048e609eee14083d43
상위 12544234
하위 5ffad8b4, 023c10f1

함의성이(가) 2년 이상 전에 추가함

bm on going

Change-Id: I9432e1b5b81d1dd81135eb629dfce77601cc7644

차이점 보기:

DTI_PID/DTI_PID/BMSettingDialog.py
12 12

  
13 13
import BMSetting_UI
14 14

  
15
class AttributeListModel(QStandardItemModel):
16
    def __init__(self, columListAll, parent=None, *args):
17
        QStandardItemModel.__init__(self, parent, *args)
18

  
19
        self.columListAll = columListAll
20

  
21
        for symbol in self.columListAll:
22
            items = [QStandardItem(symbol)]
23
            items[0].setEditable(False)
24
            self.appendRow(items)
25

  
26
        headers = [QStandardItem("Name"), QStandardItem("State")]
27
        for idx, header in enumerate(headers):
28
            header.setTextAlignment(Qt.AlignCenter)
29
            self.setHorizontalHeaderItem(idx, header)
30

  
15 31
class SymbolListModel(QStandardItemModel):
16 32
    def __init__(self, parent=None, *args):
17 33
        QStandardItemModel.__init__(self, parent, *args)
18 34

  
19 35
        self.SymbolList = [ "DRAIN CUP", "EOL", "FLANGE", "FLANGE BLIND", "ORIFICE", "SCREW CAP", \
20
            "3WAY", "4WAY", "BALL", "BUTTERFLY", "CHECK", "GATE", "GLOBE", \
36
            "3WAY", "4WAY", "BALL", "BUTTERFLY", "CHECK", "GATE", "GLOBE", "NEEDLE", \
21 37
            "CONTROL(BALL)", "CONTROL(BUTTERFLY)", "CONTROL(CHECK)", "CONTROL(GATE)", "CONTROL(GLOBE)", \
22 38
            "MOV(BALL)", "MOV(BUTTERFLY)", "MOV(CHECK)", "MOV(GATE)", "MOV(GLOBE)", "MAGNETIC FLOW METER", "MASS FLOW METER", "ULTRASONIC FLOW METER", "VORTEX FLOW METER", "OPC", \
23 39
            "GOOSE NECK VENT", "IP", "PG", "PP", "PSV", "RE", "SAMPLE CONNECTION", "SB", "SPACER", "STRAINER", "TG", "HOSE CONNECTION", "OD" ]
......
100 116

  
101 117

  
102 118
class BMSettingDialog(QDialog):
103
    def __init__(self, parent):
119
    def __init__(self, parent, columListAll, columnOrder):
104 120
        QDialog.__init__(self, parent)
105 121

  
106 122
        self.ui = BMSetting_UI.Ui_BMSettingDialog()
......
108 124

  
109 125
        self.isAccepted = False
110 126
        self.symbol_mapping = {}
127
        self.columListAll = columListAll
128
        self.columnOrder = columnOrder
111 129

  
112 130
        self.symbolListModel = SymbolListModel()
113 131
        self.ui.tableViewSymbolList.setModel(self.symbolListModel)
......
115 133
        self.symbolMappingModel = SymbolMappingModel()
116 134
        self.symbolMappingModel.invisibleRootItem()
117 135
        self.ui.treeViewSymbolMapping.setModel(self.symbolMappingModel)
136
        self.ui.treeViewSymbolMapping.expandAll()
118 137
        self.add_check_box()
119 138
        self.load_symbol_mapping()
120
        self.ui.tableViewSymbolList.setCurrentIndex(self.symbolListModel.index(0, 0))
139

  
140
        self.attributeListModel = AttributeListModel(self.columListAll)
141
        self.ui.tableViewAttributeList.setModel(self.attributeListModel)
121 142

  
122 143
        self.ui.tableViewSymbolList.horizontalHeader().setStretchLastSection(True)
123 144
        self.ui.treeViewSymbolMapping.header().setStretchLastSection(True)
......
128 149
        self.ui.treeViewSymbolMapping.resizeColumnToContents(0)
129 150
        self.ui.treeViewSymbolMapping.setColumnWidth(1, 50)
130 151
        self.ui.tableViewSymbolList.resizeColumnsToContents()
131
        #self.ui.tableViewAttributeList.resizeColumnsToContents()
152
        self.ui.tableViewAttributeList.resizeColumnsToContents()
153
        self.ui.tableViewAttributeList.setColumnWidth(1, 50)
132 154
        
133 155
        self.ui.tableViewSymbolList.clicked.connect(self.on_symbol_changed)
134 156
        self.ui.buttonBox.accepted.connect(self.accept)
135 157
        self.ui.buttonBox.rejected.connect(self.reject)
136 158

  
159
        self.on_symbol_changed(self.symbolListModel.index(0, 0))
160

  
137 161
    def load_symbol_mapping(self):
138 162
        app_doc_data = AppDocData.instance()
139 163

  
......
175 199
            for child_row in range(child_count):
176 200
                child_index = self.symbolMappingModel.index(child_row, 0, category_index)
177 201
                id2_symbol_item = self.symbolMappingModel.itemFromIndex(child_index)
178
                id2_symbol_uid = id2_symbol_item.data(Qt.UserRole)
202
                id2_symbol_uid = str(id2_symbol_item.data(Qt.UserRole))
179 203
                checkBox_index = self.symbolMappingModel.index(child_row, 1, category_index)
180 204
                checkBox = self.ui.treeViewSymbolMapping.indexWidget(checkBox_index)
181
                if str(id2_symbol_uid) in self.symbol_mapping[selected_symbol.text()]:
205
                checkBox.setEnabled(True)
206
                if id2_symbol_uid in self.symbol_mapping[selected_symbol.text()]:
182 207
                    checkBox.setCheckState(Qt.Checked)
183 208
                else:
184 209
                    checkBox.setCheckState(Qt.Unchecked)
185
        
210

  
211
                    matches = [key for key, value in self.symbol_mapping.items() if key != id2_symbol_item.text() and id2_symbol_uid in value]
212
                    if matches:
213
                        checkBox.setEnabled(False) 
186 214

  
187 215
    def reject(self):
188 216
        QDialog.reject(self)
DTI_PID/DTI_PID/BMSetting_UI.py
14 14
        BMSettingDialog.resize(865, 396)
15 15
        self.gridLayout_2 = QtWidgets.QGridLayout(BMSettingDialog)
16 16
        self.gridLayout_2.setObjectName("gridLayout_2")
17
        self.gridLayout = QtWidgets.QGridLayout()
18
        self.gridLayout.setObjectName("gridLayout")
19
        self.groupBoxSymbol = QtWidgets.QGroupBox(BMSettingDialog)
17
        self.splitter = QtWidgets.QSplitter(BMSettingDialog)
18
        self.splitter.setOrientation(QtCore.Qt.Horizontal)
19
        self.splitter.setObjectName("splitter")
20
        self.verticalLayoutWidget = QtWidgets.QWidget(self.splitter)
21
        self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
22
        self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
23
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
24
        self.verticalLayout.setObjectName("verticalLayout")
25
        self.groupBoxSymbol = QtWidgets.QGroupBox(self.verticalLayoutWidget)
20 26
        self.groupBoxSymbol.setObjectName("groupBoxSymbol")
21 27
        self.gridLayout_5 = QtWidgets.QGridLayout(self.groupBoxSymbol)
22 28
        self.gridLayout_5.setObjectName("gridLayout_5")
......
29 35
        self.treeViewSymbolMapping.setObjectName("treeViewSymbolMapping")
30 36
        self.gridLayout_3.addWidget(self.treeViewSymbolMapping, 0, 1, 1, 1)
31 37
        self.gridLayout_5.addLayout(self.gridLayout_3, 0, 0, 1, 1)
32
        self.gridLayout.addWidget(self.groupBoxSymbol, 0, 0, 1, 1)
33
        self.groupBoxAttribute = QtWidgets.QGroupBox(BMSettingDialog)
38
        self.verticalLayout.addWidget(self.groupBoxSymbol)
39
        self.verticalLayoutWidget_6 = QtWidgets.QWidget(self.splitter)
40
        self.verticalLayoutWidget_6.setObjectName("verticalLayoutWidget_6")
41
        self.verticalLayout_11 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget_6)
42
        self.verticalLayout_11.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint)
43
        self.verticalLayout_11.setContentsMargins(0, 0, 0, 0)
44
        self.verticalLayout_11.setObjectName("verticalLayout_11")
45
        self.groupBoxAttribute = QtWidgets.QGroupBox(self.verticalLayoutWidget_6)
34 46
        self.groupBoxAttribute.setObjectName("groupBoxAttribute")
35 47
        self.gridLayout_6 = QtWidgets.QGridLayout(self.groupBoxAttribute)
36 48
        self.gridLayout_6.setObjectName("gridLayout_6")
......
40 52
        self.tableViewAttributeList.setObjectName("tableViewAttributeList")
41 53
        self.gridLayout_4.addWidget(self.tableViewAttributeList, 0, 0, 1, 1)
42 54
        self.gridLayout_6.addLayout(self.gridLayout_4, 0, 0, 1, 1)
43
        self.gridLayout.addWidget(self.groupBoxAttribute, 0, 1, 1, 1)
44
        self.gridLayout_2.addLayout(self.gridLayout, 0, 0, 1, 1)
55
        self.verticalLayout_11.addWidget(self.groupBoxAttribute)
56
        self.gridLayout_2.addWidget(self.splitter, 0, 0, 1, 1)
45 57
        self.buttonBox = QtWidgets.QDialogButtonBox(BMSettingDialog)
46 58
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
47 59
        self.buttonBox.setObjectName("buttonBox")
DTI_PID/DTI_PID/ItemDataExportDialog.py
54 54
                    QItemDataExportDialog.DATA_LIST[3]: self.instColumnListAll,
55 55
                    QItemDataExportDialog.DATA_LIST[4]: self.noteColumnListAll,
56 56
                    QItemDataExportDialog.DATA_LIST[5]: [],
57
                    QItemDataExportDialog.DATA_LIST[6]: [self.bmColumnListAll]
57
                    QItemDataExportDialog.DATA_LIST[6]: self.bmColumnListAll
58 58
                }
59 59

  
60 60
            self.lineOrder = []
......
71 71
                    QItemDataExportDialog.DATA_LIST[3]: self.instOrder,
72 72
                    QItemDataExportDialog.DATA_LIST[4]: self.noteOrder,
73 73
                    QItemDataExportDialog.DATA_LIST[5]: [],
74
                    QItemDataExportDialog.DATA_LIST[5]: [self.bmOrder]
74
                    QItemDataExportDialog.DATA_LIST[6]: self.bmOrder
75 75
                }
76 76

  
77 77
            self.parent = parent
......
849 849

  
850 850
        from BMSettingDialog import BMSettingDialog
851 851

  
852
        dlg = BMSettingDialog(self)
852
        dlg = BMSettingDialog(self, self.columnListAll[QItemDataExportDialog.DATA_LIST[6]], self.columnOrder[QItemDataExportDialog.DATA_LIST[6]])
853 853
        dlg.showDialog()
854 854

  
855 855
    def query_engineering_list(self, text):
DTI_PID/DTI_PID/UI/BMSetting.ui
15 15
  </property>
16 16
  <layout class="QGridLayout" name="gridLayout_2">
17 17
   <item row="0" column="0">
18
    <layout class="QGridLayout" name="gridLayout">
19
     <item row="0" column="0">
20
      <widget class="QGroupBox" name="groupBoxSymbol">
21
       <property name="title">
22
        <string>Symbol Mapping</string>
23
       </property>
24
       <layout class="QGridLayout" name="gridLayout_5">
25
        <item row="0" column="0">
26
         <layout class="QGridLayout" name="gridLayout_3">
18
    <widget class="QSplitter" name="splitter">
19
     <property name="orientation">
20
      <enum>Qt::Horizontal</enum>
21
     </property>
22
     <widget class="QWidget" name="verticalLayoutWidget">
23
      <layout class="QVBoxLayout" name="verticalLayout">
24
       <item>
25
        <widget class="QGroupBox" name="groupBoxSymbol">
26
         <property name="title">
27
          <string>Symbol Mapping</string>
28
         </property>
29
         <layout class="QGridLayout" name="gridLayout_5">
27 30
          <item row="0" column="0">
28
           <widget class="QTableView" name="tableViewSymbolList"/>
29
          </item>
30
          <item row="0" column="1">
31
           <widget class="QTreeView" name="treeViewSymbolMapping"/>
31
           <layout class="QGridLayout" name="gridLayout_3">
32
            <item row="0" column="0">
33
             <widget class="QTableView" name="tableViewSymbolList"/>
34
            </item>
35
            <item row="0" column="1">
36
             <widget class="QTreeView" name="treeViewSymbolMapping"/>
37
            </item>
38
           </layout>
32 39
          </item>
33 40
         </layout>
34
        </item>
35
       </layout>
36
      </widget>
37
     </item>
38
     <item row="0" column="1">
39
      <widget class="QGroupBox" name="groupBoxAttribute">
40
       <property name="title">
41
        <string>Attributes</string>
41
        </widget>
42
       </item>
43
      </layout>
44
     </widget>
45
     <widget class="QWidget" name="verticalLayoutWidget_6">
46
      <layout class="QVBoxLayout" name="verticalLayout_11">
47
       <property name="sizeConstraint">
48
        <enum>QLayout::SetDefaultConstraint</enum>
42 49
       </property>
43
       <layout class="QGridLayout" name="gridLayout_6">
44
        <item row="0" column="0">
45
         <layout class="QGridLayout" name="gridLayout_4">
50
       <item>
51
        <widget class="QGroupBox" name="groupBoxAttribute">
52
         <property name="title">
53
          <string>Attributes</string>
54
         </property>
55
         <layout class="QGridLayout" name="gridLayout_6">
46 56
          <item row="0" column="0">
47
           <widget class="QTableView" name="tableViewAttributeList"/>
57
           <layout class="QGridLayout" name="gridLayout_4">
58
            <item row="0" column="0">
59
             <widget class="QTableView" name="tableViewAttributeList"/>
60
            </item>
61
           </layout>
48 62
          </item>
49 63
         </layout>
50
        </item>
51
       </layout>
52
      </widget>
53
     </item>
54
    </layout>
64
        </widget>
65
       </item>
66
      </layout>
67
     </widget>
68
    </widget>
55 69
   </item>
56 70
   <item row="1" column="0">
57 71
    <widget class="QDialogButtonBox" name="buttonBox">

내보내기 Unified diff

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