개정판 22c53a52
issue #477: add parent index for child symbol
Change-Id: I64fa397a3ef16fdbdea855c7f2f2d8c3692f7bfa
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
522 | 522 |
targetSymbolList = [] |
523 | 523 |
|
524 | 524 |
try: |
525 |
dbPath = os.path.join(self.getCurrentProject().getDbFilePath(), "ITI_PID.db")
|
|
525 |
dbPath = os.path.join(self.getCurrentProject().getDbFilePath(), AppDocData.DATABASE)
|
|
526 | 526 |
|
527 | 527 |
conn = sqlite3.connect(dbPath) |
528 | 528 |
cursor = conn.cursor() |
DTI_PID/DTI_PID/Commands/SelectAttributeCommand.py | ||
---|---|---|
100 | 100 |
elif self._attr is not None and type(self._attr) is SymbolProp: |
101 | 101 |
item = self.imageViewer.scene.itemAt(scenePos, QTransform()) |
102 | 102 |
if item is not None and self._attr.match_type(item): |
103 |
self._item._properties[self._attr] = item
|
|
103 |
self._item._properties[self._attr] = eval(self._attr.Expression)
|
|
104 | 104 |
self.onSuccess.emit() |
105 | 105 |
except Exception as ex: |
106 | 106 |
from App import App |
DTI_PID/DTI_PID/ItemPropertyTableWidget.py | ||
---|---|---|
402 | 402 |
|
403 | 403 |
""" show property value """ |
404 | 404 |
if prop.is_selectable: |
405 |
if prop.Expression: |
|
406 |
item = value # assume item is instance |
|
407 |
value_item = QTableWidgetItem(eval(prop.Expression)) |
|
408 |
else: |
|
409 |
value_item = QTableWidgetItem(str(value.uid) if value else '') |
|
405 |
value_item = QTableWidgetItem(value) |
|
410 | 406 |
value_item.setFlags(Qt.ItemIsEnabled|Qt.ItemIsSelectable) |
411 | 407 |
self.setItem(row, 3, value_item) |
412 | 408 |
else: |
DTI_PID/DTI_PID/Shapes/EngineeringEquipmentItem.py | ||
---|---|---|
28 | 28 |
''' |
29 | 29 |
''' |
30 | 30 |
def __init__(self, path, uid=None, flip=0): |
31 |
from SymbolAttr import SymbolProp |
|
32 |
|
|
31 | 33 |
SymbolSvgItem.__init__(self, path, uid, flip=flip) |
32 | 34 |
self.setZValue(QEngineeringEquipmentItem.ZVALUE) |
33 | 35 |
|
36 |
self._properties = {SymbolProp(None, 'Desc', 'Text Item', Expression="item.text() if item else ''"):None} |
|
37 |
|
|
34 | 38 |
if QEngineeringEquipmentItem.EQUIP_COLUMN_LIST is None: |
35 | 39 |
from AppDocData import AppDocData |
36 | 40 |
|
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py | ||
---|---|---|
933 | 933 |
matches = [prop for prop in item._properties.keys() if prop.Attribute == prop_node.attrib['Attribute']] |
934 | 934 |
if matches: |
935 | 935 |
matches[0].parse_xml(prop_node) |
936 |
item._properties[matches[0]] = uuid.UUID(prop_node.text) if prop_node.text and matches[0].is_selectable else prop_node.text if prop_node.text else ''
|
|
936 |
item._properties[matches[0]] = prop_node.text if prop_node.text else '' |
|
937 | 937 |
|
938 | 938 |
## assign area |
939 | 939 |
areaNode = node.find('AREA') |
DTI_PID/DTI_PID/SymbolEditorDialog.py | ||
---|---|---|
21 | 21 |
|
22 | 22 |
|
23 | 23 |
class QSymbolEditorDialog(QDialog): |
24 |
""" |
|
25 |
This is symbol editor dialog |
|
26 |
""" |
|
24 |
""" This is symbol editor dialog """ |
|
27 | 25 |
|
28 | 26 |
FILE_NUMBER = 0 |
29 | 27 |
|
... | ... | |
44 | 42 |
self.ui = SymbolEditor_UI.Ui_Dialog() |
45 | 43 |
self.ui.setupUi(self) |
46 | 44 |
self.ui.tableWidgetConnList.setColumnCount(3) |
47 |
self.ui.tableWidgetConnList.setHorizontalHeaderLabels(['위치', '방향', '심볼'])
|
|
45 |
self.ui.tableWidgetConnList.setHorizontalHeaderLabels([self.tr('위치'), self.tr('방향'), self.tr('심볼')])
|
|
48 | 46 |
self.ui.tableWidgetConnList.horizontalHeaderItem(0).setSizeHint(QSize(25, 25)) |
49 | 47 |
self.ui.tableWidgetConnList.itemPressed.connect(self.onConnPtPressed) |
50 | 48 |
|
... | ... | |
57 | 55 |
self.offsetY = 0 |
58 | 56 |
self.newSym = None |
59 | 57 |
|
60 |
self.setWindowTitle('심볼 편집기')
|
|
58 |
self.setWindowTitle(self.tr('심볼 편집기'))
|
|
61 | 59 |
if self.selectedSymbol is None: |
62 | 60 |
self.ui.checkBoxChange.setEnabled(False) |
63 | 61 |
self.ui.pushButtonChange.setEnabled(False) |
... | ... | |
434 | 432 |
if index != 0: |
435 | 433 |
ret = ret + "/" |
436 | 434 |
ret = ret + text |
435 |
|
|
437 | 436 |
return ret |
438 | 437 |
|
439 | 438 |
''' |
... | ... | |
665 | 664 |
def addAdditionalSymbolEvent(self, event): |
666 | 665 |
additionalSymbolIndex = self.ui.additionalSymbolComboBox.currentIndex() |
667 | 666 |
if additionalSymbolIndex != 0: |
667 |
parent_index = self.ui.spinBoxParent.value() |
|
668 | 668 |
direction = self.ui.defaultSymbolDirectionComboBox.currentText() |
669 | 669 |
symbolName = self.ui.additionalSymbolComboBox.currentText() |
670 |
self.addAdditionalSymbol(direction, symbolName) |
|
670 |
self.addAdditionalSymbol(parent_index, direction, symbolName)
|
|
671 | 671 |
|
672 | 672 |
''' |
673 | 673 |
@brief Add AdditionalSymbol String on ListWidget |
674 | 674 |
''' |
675 |
def addAdditionalSymbol(self, direction, symbolName): |
|
676 |
text = "{},{}".format(direction, symbolName)
|
|
675 |
def addAdditionalSymbol(self, parent_index, direction, symbolName):
|
|
676 |
text = "{},{},{}".format(parent_index, direction, symbolName)
|
|
677 | 677 |
|
678 | 678 |
if self.isAlreadyAdded(text): |
679 |
QMessageBox.about(self.ui.buttonBox, "알림", "이미 추가된 아이템입니다.")
|
|
679 |
QMessageBox.about(self.ui.buttonBox, self.tr("알림"), self.tr("이미 추가된 아이템입니다."))
|
|
680 | 680 |
else: |
681 | 681 |
self.ui.additionalSymbolListWidget.addItem(text) |
682 | 682 |
|
DTI_PID/DTI_PID/SymbolEditor_UI.py | ||
---|---|---|
2 | 2 |
|
3 | 3 |
# Form implementation generated from reading ui file './UI/SymbolEditor.ui' |
4 | 4 |
# |
5 |
# Created by: PyQt5 UI code generator 5.11.3
|
|
5 |
# Created by: PyQt5 UI code generator 5.12
|
|
6 | 6 |
# |
7 | 7 |
# WARNING! All changes made in this file will be lost! |
8 | 8 |
|
9 | 9 |
from PyQt5 import QtCore, QtGui, QtWidgets |
10 | 10 |
|
11 |
|
|
11 | 12 |
class Ui_Dialog(object): |
12 | 13 |
def setupUi(self, Dialog): |
13 | 14 |
Dialog.setObjectName("Dialog") |
... | ... | |
410 | 411 |
self.formLayout.setWidget(7, QtWidgets.QFormLayout.LabelRole, self.additionalSymbolLabel) |
411 | 412 |
self.horizontalLayout_2 = QtWidgets.QHBoxLayout() |
412 | 413 |
self.horizontalLayout_2.setObjectName("horizontalLayout_2") |
414 |
self.spinBoxParent = QtWidgets.QSpinBox(self.scrollAreaWidgetContents) |
|
415 |
self.spinBoxParent.setMaximumSize(QtCore.QSize(50, 16777215)) |
|
416 |
self.spinBoxParent.setMaximum(10) |
|
417 |
self.spinBoxParent.setObjectName("spinBoxParent") |
|
418 |
self.horizontalLayout_2.addWidget(self.spinBoxParent) |
|
413 | 419 |
self.defaultSymbolDirectionComboBox = QtWidgets.QComboBox(self.scrollAreaWidgetContents) |
414 | 420 |
self.defaultSymbolDirectionComboBox.setMaximumSize(QtCore.QSize(50, 16777215)) |
415 | 421 |
self.defaultSymbolDirectionComboBox.setObjectName("defaultSymbolDirectionComboBox") |
... | ... | |
592 | 598 |
self.label_4.setText(_translate("Dialog", "Symbol Info on Drawing")) |
593 | 599 |
self.pushButtonChange.setText(_translate("Dialog", "Change Item on Drawing without DB Update")) |
594 | 600 |
|
595 |
import MainWindow_rc |
|
596 |
|
|
597 |
if __name__ == "__main__": |
|
598 |
import sys |
|
599 |
app = QtWidgets.QApplication(sys.argv) |
|
600 |
Dialog = QtWidgets.QDialog() |
|
601 |
ui = Ui_Dialog() |
|
602 |
ui.setupUi(Dialog) |
|
603 |
Dialog.show() |
|
604 |
sys.exit(app.exec_()) |
|
605 | 601 |
|
602 |
import MainWindow_rc |
DTI_PID/DTI_PID/UI/SymbolEditor.ui | ||
---|---|---|
894 | 894 |
<item row="7" column="1"> |
895 | 895 |
<layout class="QHBoxLayout" name="horizontalLayout_2"> |
896 | 896 |
<item> |
897 |
<widget class="QSpinBox" name="spinBoxParent"> |
|
898 |
<property name="maximumSize"> |
|
899 |
<size> |
|
900 |
<width>50</width> |
|
901 |
<height>16777215</height> |
|
902 |
</size> |
|
903 |
</property> |
|
904 |
<property name="maximum"> |
|
905 |
<number>10</number> |
|
906 |
</property> |
|
907 |
</widget> |
|
908 |
</item> |
|
909 |
<item> |
|
897 | 910 |
<widget class="QComboBox" name="defaultSymbolDirectionComboBox"> |
898 | 911 |
<property name="maximumSize"> |
899 | 912 |
<size> |
내보내기 Unified diff