개정판 269a15c8
dev issue #640: edit lineProperty
DTI_PID/DTI_PID/ItemPropertyTableWidget.py | ||
---|---|---|
366 | 366 |
@history humkyung 2018.07.20 display combobox when key is 'Stream No' |
367 | 367 |
''' |
368 | 368 |
def initLineNoCell(self, lineNoItem): |
369 |
appDocData = AppDocData.instance() |
|
370 |
|
|
371 |
self.attrValueList = [] |
|
372 |
self.stringCell = [] |
|
373 |
|
|
369 | 374 |
self.setRowCount(1 + len(lineNoItem.getLineNoAttributes())) |
370 | 375 |
|
371 | 376 |
lineNoTitleItem = QTableWidgetItem("Line No.") |
... | ... | |
377 | 382 |
attrItems = lineNoItem.getLineNoAttributes() |
378 | 383 |
if attrItems is not None: |
379 | 384 |
for index in range(len(attrItems)): |
380 |
key = attrItems[index][0] |
|
381 |
value = attrItems[index][1] |
|
385 |
attr = attrItems[index] |
|
386 |
|
|
387 |
if type(attr) is UserInputAttribute: |
|
388 |
key = attr.attribute |
|
389 |
value = attr.text |
|
390 |
valueCell = QTableWidgetItem(value) |
|
391 |
self.attrValueList.append((valueCell, key)) |
|
392 |
self.stringCell.append(valueCell) |
|
393 |
key = appDocData.getLinePropertiesByUID(key)[0][2] |
|
394 |
else: |
|
395 |
key = attrItems[index][0] |
|
396 |
value = attrItems[index][1] |
|
397 |
valueCell = QTableWidgetItem(value) |
|
398 |
|
|
382 | 399 |
item = QTableWidgetItem(key) |
383 | 400 |
item.setFlags(Qt.ItemIsEnabled) |
384 | 401 |
item.setBackground(QColor(220, 220, 220)) |
... | ... | |
387 | 404 |
self.streamNoComboBox = QComboBox() |
388 | 405 |
self.streamNoComboBox.tag = lineNoItem |
389 | 406 |
self.streamNoComboBox.currentIndexChanged.connect(self.onStreamNoChanged) |
390 |
|
|
391 |
appDocData = AppDocData.instance() |
|
407 |
|
|
392 | 408 |
streamNos = sorted(list(appDocData.hmbTable.streamNos())) |
393 | 409 |
for streamNo in streamNos: |
394 | 410 |
self.streamNoComboBox.addItem(streamNo) |
395 | 411 |
self.setCellWidget(1 + index, 1, self.streamNoComboBox) |
396 | 412 |
self.streamNoComboBox.setCurrentText(value) |
397 | 413 |
else: |
398 |
self.setItem(1 + index, 1, QTableWidgetItem(value))
|
|
414 |
self.setItem(1 + index, 1, valueCell)
|
|
399 | 415 |
|
400 | 416 |
''' |
401 | 417 |
@brief change selected lines' stream no by selected stream no |
... | ... | |
444 | 460 |
cell = self.item(row, column) |
445 | 461 |
for valueCell in self.attrValueList: |
446 | 462 |
if valueCell[0] == cell and (self.intCell.count(cell) or self.stringCell.count(cell)): |
447 |
typeUID = valueCell[1] |
|
448 |
str = '' |
|
449 |
if self.intCell.count(cell): |
|
450 |
str = cell.text() |
|
451 |
if not self.isNumber(str): |
|
452 |
str = '' |
|
453 |
cell.setText(str) |
|
454 |
elif self.stringCell.count(cell): |
|
455 |
str = cell.text() |
|
456 |
|
|
457 | 463 |
items = self.mainWindow.graphicsView.scene.selectedItems() |
458 | 464 |
if items is not None and len(items) == 1: |
459 |
find = False |
|
460 |
for attr in items[0].attrs: |
|
461 |
if attr.attribute == typeUID: |
|
462 |
find = True |
|
463 |
attr.setText(str) |
|
464 |
break |
|
465 |
|
|
466 |
if not find: |
|
467 |
newAttr = UserInputAttribute(typeUID, str) |
|
468 |
items[0].attrs.append(newAttr) |
|
469 |
|
|
465 |
typeUID = valueCell[1] |
|
466 |
|
|
467 |
str = '' |
|
468 |
if self.intCell.count(cell): |
|
469 |
str = cell.text() |
|
470 |
if not self.isNumber(str): |
|
471 |
str = '' |
|
472 |
cell.setText(str) |
|
473 |
elif self.stringCell.count(cell): |
|
474 |
str = cell.text() |
|
475 |
|
|
476 |
if issubclass(type(items[0]), SymbolSvgItem): |
|
477 |
find = False |
|
478 |
for attr in items[0].attrs: |
|
479 |
if attr.attribute == typeUID: |
|
480 |
find = True |
|
481 |
attr.setText(str) |
|
482 |
break |
|
483 |
|
|
484 |
if not find: |
|
485 |
newAttr = UserInputAttribute(typeUID, str) |
|
486 |
items[0].attrs.append(newAttr) |
|
487 |
# line no 경우 |
|
488 |
else: |
|
489 |
for attr in items[0]._attrs: |
|
490 |
if type(attr) is UserInputAttribute and attr.attribute == typeUID: |
|
491 |
attr.text = str |
|
492 |
|
|
470 | 493 |
''' |
471 | 494 |
@brief Check Number |
472 | 495 |
@author kyouho |
내보내기 Unified diff