개정판 c5e51d41
issue #000: now can editting spec break attribute
Change-Id: I9948e5119d7621dd0fc0014b6ac35fa5d75791cc
DTI_PID/DTI_PID/SpecBreakDialog.py | ||
---|---|---|
44 | 44 |
self.ui.tableWidgetSpec.setCellWidget(row, 0, propertyComboBox) |
45 | 45 |
propertyComboBox.setCurrentText(attr.Attribute) |
46 | 46 |
|
47 |
upStreamComboBox = self.makeValueComboBox(attr.Attribute) |
|
48 |
downStreamComboBox = self.makeValueComboBox(attr.Attribute) |
|
49 |
self.ui.tableWidgetSpec.setCellWidget(row, 1, upStreamComboBox) |
|
50 |
upStreamComboBox.setCurrentText(value[0]) |
|
51 |
self.ui.tableWidgetSpec.setCellWidget(row, 2, downStreamComboBox) |
|
52 |
downStreamComboBox.setCurrentText(value[1]) |
|
53 |
|
|
47 |
upStreamComboBox = self.makeValueWidget(attr.Attribute) |
|
48 |
downStreamComboBox = self.makeValueWidget(attr.Attribute) |
|
49 |
if type(upStreamComboBox) is QComboBox: |
|
50 |
self.ui.tableWidgetSpec.setCellWidget(row, 1, upStreamComboBox) |
|
51 |
upStreamComboBox.setCurrentText(value[0]) |
|
52 |
else: |
|
53 |
self.ui.tableWidgetSpec.setItem(row, 1, upStreamComboBox) |
|
54 |
self.ui.tableWidgetSpec.item(row, 1).setText(value[0]) |
|
55 |
if type(downStreamComboBox) is QComboBox: |
|
56 |
self.ui.tableWidgetSpec.setCellWidget(row, 2, downStreamComboBox) |
|
57 |
downStreamComboBox.setCurrentText(value[1]) |
|
58 |
else: |
|
59 |
self.ui.tableWidgetSpec.setItem(row, 2, downStreamComboBox) |
|
60 |
self.ui.tableWidgetSpec.item(row, 2).setText(value[1]) |
|
54 | 61 |
row += 1 |
55 | 62 |
|
56 | 63 |
self.ui.tableWidgetSpec.resizeColumnsToContents() |
... | ... | |
75 | 82 |
valueComboBox.addItem('' if pipeSize.inchStr is None else pipeSize.inchStr) |
76 | 83 |
return valueComboBox |
77 | 84 |
|
78 |
def makeValueComboBox(self, tableName):
|
|
85 |
def makeValueWidget(self, tableName):
|
|
79 | 86 |
''' |
80 | 87 |
@brief return Value combobox |
81 | 88 |
@author euisung |
... | ... | |
84 | 91 |
if tableName == 'NominalDiameter': |
85 | 92 |
return self.makeNominalDiameterComboBox() |
86 | 93 |
|
87 |
valueComboBox = QComboBox(self) |
|
88 | 94 |
docData = AppDocData.instance() |
89 | 95 |
tableDatas = docData.getCodeTable(tableName) |
90 |
for value in tableDatas: |
|
91 |
valueComboBox.addItem(value[1]) |
|
92 |
|
|
93 |
return valueComboBox |
|
96 |
if tableDatas is not None: |
|
97 |
valueComboBox = QComboBox(self) |
|
98 |
for value in tableDatas: |
|
99 |
valueComboBox.addItem(value[1]) |
|
100 |
return valueComboBox |
|
101 |
else: |
|
102 |
return QTableWidgetItem('') |
|
103 |
|
|
94 | 104 |
|
95 | 105 |
def makePropertyComboBox(self): |
96 | 106 |
''' |
... | ... | |
99 | 109 |
@date 2019.01.17 |
100 | 110 |
''' |
101 | 111 |
propertyComboBox = QComboBox(self) |
102 |
propertyComboBox.addItem('NominalDiameter') |
|
103 |
propertyComboBox.addItem('FluidCode') |
|
104 |
propertyComboBox.addItem('InsulationPurpose') |
|
105 |
propertyComboBox.addItem('PnIDNumber') |
|
106 |
propertyComboBox.addItem('PipingMaterialsClass') |
|
107 |
propertyComboBox.addItem('UnitNumber') |
|
112 |
attrs = AppDocData.instance().getSymbolAttribute('Segment Breaks') |
|
113 |
for attr in attrs: |
|
114 |
propertyComboBox.addItem(attr.DisplayAttribute) |
|
115 |
#propertyComboBox.addItem('NominalDiameter') |
|
116 |
#propertyComboBox.addItem('FluidCode') |
|
117 |
#propertyComboBox.addItem('InsulationPurpose') |
|
118 |
#propertyComboBox.addItem('PnIDNumber') |
|
119 |
#propertyComboBox.addItem('PipingMaterialsClass') |
|
120 |
#propertyComboBox.addItem('UnitNumber') |
|
108 | 121 |
propertyComboBox.currentTextChanged.connect(self.currentPropertyChangeEvent) |
109 | 122 |
return propertyComboBox |
110 | 123 |
|
... | ... | |
116 | 129 |
''' |
117 | 130 |
row = self.ui.tableWidgetSpec.currentRow() |
118 | 131 |
if row is -1: return |
119 |
upStreamComboBox = self.makeValueComboBox(text) |
|
120 |
downStreamComboBox = self.makeValueComboBox(text) |
|
121 |
self.ui.tableWidgetSpec.setCellWidget(row, 1, upStreamComboBox) |
|
122 |
self.ui.tableWidgetSpec.setCellWidget(row, 2, downStreamComboBox) |
|
123 |
|
|
132 |
upStreamComboBox = self.makeValueWidget(text) |
|
133 |
downStreamComboBox = self.makeValueWidget(text) |
|
134 |
if type(upStreamComboBox) is QComboBox: |
|
135 |
self.ui.tableWidgetSpec.setCellWidget(row, 1, upStreamComboBox) |
|
136 |
else: |
|
137 |
self.ui.tableWidgetSpec.removeCellWidget(row, 1) |
|
138 |
self.ui.tableWidgetSpec.setItem(row, 1, upStreamComboBox) |
|
139 |
if type(downStreamComboBox) is QComboBox: |
|
140 |
self.ui.tableWidgetSpec.setCellWidget(row, 2, downStreamComboBox) |
|
141 |
else: |
|
142 |
self.ui.tableWidgetSpec.removeCellWidget(row, 2) |
|
143 |
self.ui.tableWidgetSpec.setItem(row, 2, downStreamComboBox) |
|
124 | 144 |
|
125 | 145 |
def onAddSpec(self): |
126 | 146 |
''' |
... | ... | |
133 | 153 |
propertyComboBox = self.makePropertyComboBox() |
134 | 154 |
self.ui.tableWidgetSpec.setCellWidget(row, 0, propertyComboBox) |
135 | 155 |
propertyComboBox.setCurrentIndex(0) |
136 |
upStreamComboBox = self.makeValueComboBox(propertyComboBox.currentText())
|
|
137 |
downStreamComboBox = self.makeValueComboBox(propertyComboBox.currentText())
|
|
156 |
upStreamComboBox = self.makeValueWidget(propertyComboBox.currentText())
|
|
157 |
downStreamComboBox = self.makeValueWidget(propertyComboBox.currentText())
|
|
138 | 158 |
self.ui.tableWidgetSpec.setCellWidget(row, 1, upStreamComboBox) |
139 | 159 |
self.ui.tableWidgetSpec.setCellWidget(row, 2, downStreamComboBox) |
140 | 160 |
|
... | ... | |
150 | 170 |
return |
151 | 171 |
self.ui.tableWidgetSpec.removeRow(row) |
152 | 172 |
except Exception as ex: |
153 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
|
173 |
from App import App |
|
174 |
from AppDocData import MessageType |
|
154 | 175 |
|
176 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
|
177 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
155 | 178 |
|
156 | 179 |
''' |
157 | 180 |
@brief accept dialog |
... | ... | |
164 | 187 |
del self.attrs[key] |
165 | 188 |
row = 0 |
166 | 189 |
for rowIndex in range(self.ui.tableWidgetSpec.rowCount()): |
167 |
attr = SymbolAttr() |
|
168 |
attr.Attribute = self.ui.tableWidgetSpec.cellWidget(row, 0).currentText() |
|
169 |
attr.AttributeType = 'Spec' |
|
170 |
attr.DisplayAttribute = 'Spec' |
|
171 |
self.attrs[attr] = [self.ui.tableWidgetSpec.cellWidget(row, 1).currentText(), self.ui.tableWidgetSpec.cellWidget(row, 2).currentText()] |
|
190 |
attrs = AppDocData.instance().getSymbolAttribute('Segment Breaks') |
|
191 |
for attr in attrs: |
|
192 |
if attr.DisplayAttribute == self.ui.tableWidgetSpec.cellWidget(row, 0).currentText(): |
|
193 |
attr.AttributeType = 'Spec' |
|
194 |
attr.DisplayAttribute = 'Spec' |
|
195 |
up = self.ui.tableWidgetSpec.cellWidget(row, 1).currentText() if self.ui.tableWidgetSpec.cellWidget(row, 1) else self.ui.tableWidgetSpec.item(row, 1).text() |
|
196 |
down = self.ui.tableWidgetSpec.cellWidget(row, 2).currentText() if self.ui.tableWidgetSpec.cellWidget(row, 2) else self.ui.tableWidgetSpec.item(row, 2).text() |
|
197 |
self.attrs[attr] = [up, down] |
|
172 | 198 |
row += 1 |
173 | 199 |
|
174 | 200 |
except Exception as ex: |
175 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
|
201 |
from App import App |
|
202 |
from AppDocData import MessageType |
|
203 |
|
|
204 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
|
205 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
176 | 206 |
finally: |
177 | 207 |
pass |
178 | 208 |
|
내보내기 Unified diff