개정판 680b280c
issue #567:
- 수정 필요(한규호)
DTI_PID/DTI_PID/Commands/SelectAttributeCommand.py | ||
---|---|---|
18 | 18 |
''' |
19 | 19 |
class SelectAttributeCommand(AbstractCommand.AbstractCommand): |
20 | 20 |
|
21 |
def __init__(self, imageViewer): |
|
21 |
def __init__(self, item, attr, imageViewer):
|
|
22 | 22 |
super(SelectAttributeCommand, self).__init__(imageViewer) |
23 | 23 |
self.name = 'SelectAttribute' |
24 | 24 |
self.imageViewer.setCursor(QCursor(Qt.ArrowCursor)) |
25 | 25 |
self._type = None |
26 | 26 |
self.resultItem = None |
27 |
|
|
27 | 28 |
''' |
28 | 29 |
@brief Select Attribuew |
29 | 30 |
@author kyouho |
... | ... | |
41 | 42 |
item = self.imageViewer.scene.itemAt(scenePos, QTransform()) |
42 | 43 |
if item is not None and self._type == 'Text Item' and type(item) is QEngineeringTextItem: |
43 | 44 |
self.resultItem = item |
45 |
#self._item._texts[self._attr.AttrAt] = item |
|
44 | 46 |
elif item is not None and self._type == 'Symbol Item' and issubclass(type(item), SymbolSvgItem): |
45 | 47 |
self.resultItem = item |
46 | 48 |
elif item is not None and self._type == 'Line Item' and issubclass(type(item), QEngineeringLineItem): |
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
381 | 381 |
''' |
382 | 382 |
def cellDoubleClickedEvent(self, row, column): |
383 | 383 |
if column == 1: |
384 |
keyCell = self.resultPropertyTableWidget.item(row, 0) |
|
385 |
attr = keyCell.tag |
|
384 | 386 |
cell = self.resultPropertyTableWidget.item(row, column) |
385 | 387 |
|
386 |
uid = None |
|
388 |
uid = attr.UID if attr else None |
|
389 |
""" |
|
387 | 390 |
for data in self.resultPropertyTableWidget.attrValueList: |
388 | 391 |
if data[0] == cell: |
389 | 392 |
uid = data[1] |
390 | 393 |
break |
394 |
""" |
|
391 | 395 |
|
392 | 396 |
items = self.graphicsView.scene.selectedItems() |
393 | 397 |
|
394 | 398 |
if uid is not None: |
395 | 399 |
if items is not None and len(items) == 1: |
396 | 400 |
if issubclass(type(items[0]), SymbolSvgItem): |
397 |
docData = AppDocData.instance() |
|
398 |
attrType = docData.getSymbolAttributeByUID(uid) |
|
399 |
if attrType[2] == 'Text Item' or attrType[2] == 'Symbol Item': |
|
400 |
self.graphicsView.command = SelectAttributeCommand.SelectAttributeCommand(self.graphicsView) |
|
401 |
self.graphicsView.command.setType(attrType[2]) |
|
401 |
#appDocData = AppDocData.instance() |
|
402 |
#attrType = docData.getSymbolAttributeByUID(uid) |
|
403 |
if attr.AttributeType == 'Text Item' or attr.AttributeType == 'Symbol Item': |
|
404 |
cmd = SelectAttributeCommand.SelectAttributeCommand(items[0], attr, self.graphicsView) |
|
405 |
cmd.onSuccess.connect(self.onSuccessSelectAttribute) |
|
406 |
self.graphicsView.command = cmd |
|
407 |
self.graphicsView.command.setType(attr.AttributeType) |
|
402 | 408 |
cursor = QCursor(Qt.PointingHandCursor) |
403 | 409 |
QApplication.instance().setOverrideCursor(cursor) |
404 | 410 |
self.graphicsView.currentAttribute = uid |
... | ... | |
412 | 418 |
icon.addPixmap(QtGui.QPixmap(":/newPrefix/doubleclick.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
413 | 419 |
cellItem.setIcon(icon) |
414 | 420 |
self.resultPropertyTableWidget.setItem(row, 1, cellItem) |
415 |
|
|
416 | 421 |
else: |
417 | 422 |
self.resultPropertyTableWidget.editItem(cell) |
418 | 423 |
else: |
... | ... | |
435 | 440 |
cellItem.setIcon(icon) |
436 | 441 |
self.resultPropertyTableWidget.setItem(row, 1, cellItem) |
437 | 442 |
|
438 |
#cell = self.resultPropertyTableWidget.item(row, 0) |
|
439 |
#if cell is not None and self.resultPropertyTableWidget.item(row, 0).text(): |
|
440 |
# cellText = self.resultPropertyTableWidget.item(row, 0).text() |
|
441 |
# docData = AppDocData.instance() |
|
442 |
|
|
443 |
def onSuccessSelectAttribute(self, attr): |
|
444 |
self.resultPropertyTableWidget.refreshAttr(attr) |
|
443 | 445 |
|
444 |
# if docData.checkAttribute(cellText): |
|
445 |
# items = self.graphicsView.scene.selectedItems() |
|
446 |
# if items is not None and len(items) == 1: |
|
447 |
# self.graphicsView.command = SelectAttributeCommand.SelectAttributeCommand(self.graphicsView) |
|
448 |
# cursor = QCursor(Qt.PointingHandCursor) |
|
449 |
# QApplication.instance().setOverrideCursor(cursor) |
|
450 |
# self.graphicsView.currentAttribute = cellText |
|
451 |
|
|
452 |
# # 기존 cellText를 가진 attrs 삭제 |
|
453 |
# items[0].removeSelfAttr(cellText) |
|
454 |
|
|
455 |
# from PyQt5 import QtGui |
|
456 |
# cellItem = QTableWidgetItem('') |
|
457 |
# icon = QtGui.QIcon() |
|
458 |
# icon.addPixmap(QtGui.QPixmap(":/newPrefix/doubleclick.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
|
459 |
# cellItem.setIcon(icon) |
|
460 |
# self.resultPropertyTableWidget.setItem(row, 1, cellItem) |
|
461 |
|
|
462 | 446 |
''' |
463 | 447 |
@brief add message listwidget |
464 | 448 |
@author humkyung |
DTI_PID/DTI_PID/SymbolAttrEditorDialog.py | ||
---|---|---|
107 | 107 |
|
108 | 108 |
row = 0 |
109 | 109 |
for attr in attrs: |
110 |
item = QTableWidgetItem(attr[0]) # UID
|
|
110 |
item = QTableWidgetItem(attr.UID) # UID
|
|
111 | 111 |
self.ui.tableWidgetAttr.setItem(row, 0, item) |
112 |
item = QTableWidgetItem(attr[1]) # Name
|
|
112 |
item = QTableWidgetItem(attr.Attribute) # Name
|
|
113 | 113 |
self.ui.tableWidgetAttr.setItem(row, 1, item) |
114 |
item = QTableWidgetItem(attr[2]) # Display Name
|
|
114 |
item = QTableWidgetItem(attr.DisplayAttribute) # Display Name
|
|
115 | 115 |
self.ui.tableWidgetAttr.setItem(row, 2, item) |
116 | 116 |
|
117 | 117 |
attrTypeComboBox = QComboBox() |
... | ... | |
120 | 120 |
attrTypeComboBox.addItem('Int') |
121 | 121 |
attrTypeComboBox.addItem('String') |
122 | 122 |
self.ui.tableWidgetAttr.setCellWidget(row, 3, attrTypeComboBox) |
123 |
result = attrTypeComboBox.findText(attr[3]) # Type
|
|
123 |
result = attrTypeComboBox.findText(attr.AttributeType) # Type
|
|
124 | 124 |
attrTypeComboBox.setCurrentIndex(result) |
125 | 125 |
|
126 |
item = QTableWidgetItem(str(attr[4])) # Attribute At
|
|
126 |
item = QTableWidgetItem(str(attr.AttrAt)) # Attribute At
|
|
127 | 127 |
self.ui.tableWidgetAttr.setItem(row, 4, item) |
128 | 128 |
|
129 |
item = QTableWidgetItem(attr[5]) # Expression
|
|
129 |
item = QTableWidgetItem(attr.Expression) # Expression
|
|
130 | 130 |
self.ui.tableWidgetAttr.setItem(row, 5, item) |
131 | 131 |
|
132 | 132 |
row = row + 1 |
내보내기 Unified diff