개정판 6a7ae25d
issue #000: hmb attr ongoing
Change-Id: I4e7c89f63eff7c5fa0f2d48d6351eb360e8720ed
DTI_PID/DTI_PID/SymbolAttrEditorDialog.py | ||
---|---|---|
28 | 28 |
editor = QLineEdit(parent) |
29 | 29 |
validator = QRegExpValidator(QRegExp('^(\\d+|)$'), parent) |
30 | 30 |
editor.setValidator(validator) |
31 |
elif index.column() == 5: |
|
32 |
combobox = self.parent().cellWidget(index.row(), 3) |
|
33 |
if combobox: |
|
34 |
if combobox.currentText() == 'HMB': |
|
35 |
app_doc_data = AppDocData.instance() |
|
36 |
attrs = app_doc_data.get_hmb_attributes() |
|
37 |
editor = QComboBox(parent) |
|
38 |
editor.addItems([attr.Attribute for attr in attrs]) |
|
31 |
#elif index.column() == 5:
|
|
32 |
# combobox = self.parent().cellWidget(index.row(), 3)
|
|
33 |
# if combobox:
|
|
34 |
# if combobox.currentText() == 'HMB':
|
|
35 |
# app_doc_data = AppDocData.instance()
|
|
36 |
# attrs = app_doc_data.get_hmb_attributes()
|
|
37 |
# editor = QComboBox(parent)
|
|
38 |
# editor.addItems([attr.Attribute for attr in attrs])
|
|
39 | 39 |
|
40 | 40 |
return editor |
41 | 41 |
|
... | ... | |
104 | 104 |
self.ui.pushButtonAddAttr.clicked.connect(self.onAddLineNoAttr) |
105 | 105 |
self.ui.pushButtonDelAttr.clicked.connect(self.onDelLineNoAttr) |
106 | 106 |
|
107 |
def changeType(self, text): |
|
108 |
""" make combobox for hmb type """ |
|
109 |
row = self.ui.tableWidgetAttr.indexAt(self.sender().pos()).row() |
|
110 |
col = self.ui.tableWidgetAttr.indexAt(self.sender().pos()).column() |
|
111 |
|
|
112 |
if text == 'HMB': |
|
113 |
hmb = QComboBox() |
|
114 |
hmb.addItems(['aaa', 'bbb']) |
|
115 |
self.ui.tableWidgetAttr.takeItem(row, 1) |
|
116 |
self.ui.tableWidgetAttr.setCellWidget(row, 1, hmb) |
|
117 |
else: |
|
118 |
if self.ui.tableWidgetAttr.cellWidget(row, 1): |
|
119 |
self.ui.tableWidgetAttr.removeCellWidget(row, 1) |
|
120 |
self.ui.tableWidgetAttr.setItem(row, 1, QTableWidgetItem()) |
|
121 |
|
|
122 |
|
|
107 | 123 |
def cell_double_clicked(self, row, column): |
108 | 124 |
if self._symbolType is None or not (column is 6 or column is 7): return |
109 | 125 |
if hasattr(self.ui.tableWidgetAttr.item(row, 0), 'tag') and \ |
... | ... | |
158 | 174 |
@author kyouho |
159 | 175 |
@date 2018.08.16 |
160 | 176 |
''' |
161 |
|
|
162 | 177 |
def settingComboBoxSymbolType(self, selectedType): |
163 | 178 |
docData = AppDocData.instance() |
164 | 179 |
comboBox = self.ui.comboBoxSymbolType |
... | ... | |
178 | 193 |
@author kyouho |
179 | 194 |
@date 2018.08.16 |
180 | 195 |
''' |
181 |
|
|
182 | 196 |
def changeSymbolType(self): |
183 | 197 |
self._symbolType = self.ui.comboBoxSymbolType.currentText() |
184 | 198 |
self.ui.tableWidgetAttr.setRowCount(0) |
... | ... | |
224 | 238 |
item = QTableWidgetItem(attr.AttributeType) |
225 | 239 |
item.setFlags(Qt.ItemIsEnabled) |
226 | 240 |
self.ui.tableWidgetAttr.setItem(row, 3, item) |
241 |
attrTypeComboBox.currentTextChanged.connect(self.changeType) |
|
227 | 242 |
|
228 | 243 |
item = QTableWidgetItem(str(attr.AttrAt)) # Attribute At |
229 | 244 |
if attr.IsProp and attr.IsProp >= 2: |
... | ... | |
308 | 323 |
@author humkyung |
309 | 324 |
@date 2018.08.13 |
310 | 325 |
''' |
311 |
|
|
312 | 326 |
def onAddAttr(self): |
313 | 327 |
import uuid |
314 | 328 |
from SymbolAttr import SymbolAttr |
... | ... | |
319 | 333 |
attrTypeComboBox = QComboBox() |
320 | 334 |
for key, value in QSymbolAttrEditorDialog.SYMBOL_ATTR_DATA_TYPES.items(): |
321 | 335 |
attrTypeComboBox.addItem(key) |
322 |
|
|
323 | 336 |
self.ui.tableWidgetAttr.setCellWidget(rows, 3, attrTypeComboBox) |
337 |
attrTypeComboBox.currentTextChanged.connect(self.changeType) |
|
324 | 338 |
|
325 | 339 |
item = QTableWidgetItem('ALL') |
326 | 340 |
item.setData(Qt.UserRole, 'ALL') |
... | ... | |
345 | 359 |
@author humkyung |
346 | 360 |
@date 2018.08.13 |
347 | 361 |
''' |
348 |
|
|
349 | 362 |
def onDelAttr(self): |
350 | 363 |
model = self.ui.tableWidgetAttr.model() |
351 | 364 |
row = self.ui.tableWidgetAttr.currentRow() |
... | ... | |
359 | 372 |
@author humkyung |
360 | 373 |
@date 2018.08.13 |
361 | 374 |
''' |
362 |
|
|
363 | 375 |
def accept(self): |
364 | 376 |
if self._symbolType is not None: |
365 | 377 |
if not self.save_data(): |
... | ... | |
374 | 386 |
@author kyoyho |
375 | 387 |
@date 2018.08.21 |
376 | 388 |
''' |
377 |
|
|
378 | 389 |
def settingLineNoAttributeTable(self): |
379 | 390 |
table = self.ui.tableWidgetAttr |
380 | 391 |
docData = AppDocData.instance() |
... | ... | |
412 | 423 |
@author kyoyho |
413 | 424 |
@date 2018.08.21 |
414 | 425 |
''' |
415 |
|
|
416 | 426 |
def onAddLineNoAttr(self): |
417 | 427 |
rows = self.ui.tableWidgetAttr.rowCount() |
418 | 428 |
self.ui.tableWidgetAttr.setRowCount(rows + 1) |
... | ... | |
430 | 440 |
@author kyoyho |
431 | 441 |
@date 2018.08.21 |
432 | 442 |
''' |
433 |
|
|
434 | 443 |
def onDelLineNoAttr(self): |
435 | 444 |
model = self.ui.tableWidgetAttr.model() |
436 | 445 |
row = self.ui.tableWidgetAttr.currentRow() |
... | ... | |
443 | 452 |
@author kyouho |
444 | 453 |
@date 2018.08.20 |
445 | 454 |
''' |
446 |
|
|
447 | 455 |
def isNumber(self, num): |
448 | 456 |
p = re.compile('(^[0-9]+$)') |
449 | 457 |
result = p.match(num) |
... | ... | |
458 | 466 |
@author kyouho |
459 | 467 |
@date 2018.08.21 |
460 | 468 |
''' |
461 |
|
|
462 | 469 |
def saveLineAttrData(self): |
463 | 470 |
appDocData = AppDocData.instance() |
464 | 471 |
|
... | ... | |
477 | 484 |
attr.append(index) |
478 | 485 |
attrs.append(attr) |
479 | 486 |
|
480 |
appDocData.saveLineAttributes(attrs) |
|
487 |
appDocData.saveLineAttributes(attrs) |
내보내기 Unified diff