개정판 937874e8
issue #628: fix spec break attr
Change-Id: Ib46621c5e340161b8a17309098ac1849cca77e6f
DTI_PID/DTI_PID/ItemPropertyTableWidget.py | ||
---|---|---|
574 | 574 |
if key.Attribute == 'UpStream' or key.Attribute == 'DownStream': |
575 | 575 |
UpDownItem = QTableWidgetItem('{}'.format('None' if value is None else value)) |
576 | 576 |
self.setItem(row, 3, UpDownItem) |
577 |
else: # elif key.AttributeType == 'Spec': |
|
578 |
self.setItem(row, 3, QTableWidgetItem(str(value)[1:-1])) |
|
577 | 579 |
else: |
578 | 580 |
self.setItem(row, 3, value_item) |
579 | 581 |
if key.Attribute.upper() == 'STREAM NO': |
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
1996 | 1996 |
old_symbol = None |
1997 | 1997 |
if symbolItems and len(symbolItems) is 1: |
1998 | 1998 |
old_symbol = symbolItems[0] |
1999 |
scenePos = QPoint(old_symbol.origin[0], old_symbol.origin[1]) |
|
1999 |
#scenePos = QPoint(old_symbol.origin[0], old_symbol.origin[1]) |
|
2000 |
scenePos = old_symbol.mapToScene(old_symbol.transformOriginPoint()) |
|
2000 | 2001 |
old_symbol.transfer.onRemoved.emit(old_symbol) |
2001 | 2002 |
else: |
2002 | 2003 |
scenePos = self.current_pos |
DTI_PID/DTI_PID/QtImageViewer.py | ||
---|---|---|
609 | 609 |
@history humkyung 2018.08.23 change scenePos to connector's center when symbol is placed on connector |
610 | 610 |
''' |
611 | 611 |
|
612 |
def matchSymbolToLine(self, svg, scenePos): |
|
612 |
def matchSymbolToLine(self, svg, scenePos, angle=None, flip=None):
|
|
613 | 613 |
from EngineeringConnectorItem import QEngineeringConnectorItem |
614 | 614 |
from EngineeringLineItem import QEngineeringLineItem |
615 | 615 |
from SymbolSvgItem import SymbolSvgItem |
... | ... | |
715 | 715 |
connectors[0].connect(svg) |
716 | 716 |
#connectors[0].highlight(False) |
717 | 717 |
else: |
718 |
svg.angle = 0.0 |
|
718 |
svg.angle = angle if angle else 0.0 |
|
719 |
svg.flip = flip if flip else 0 |
|
719 | 720 |
svg.loc = [round(scenePos.x() - svg.symbolOrigin[0], 1), round(scenePos.y() - svg.symbolOrigin[1], 1)] |
720 | 721 |
svg.origin = [round(scenePos.x(), 1), round(scenePos.y(), 1)] |
721 | 722 |
if len(svg.connectors) == 1: |
DTI_PID/DTI_PID/ReplaceSymbolDialog.py | ||
---|---|---|
20 | 20 |
QDialog.__init__(self, parent) |
21 | 21 |
|
22 | 22 |
self.mainWindow = parent |
23 |
self.view = self.mainWindow.graphicsView |
|
23 | 24 |
self.ui = ReplaceSymbol_UI.Ui_ReplaceSymbolDialog() |
24 | 25 |
self.ui.setupUi(self) |
25 | 26 |
|
27 |
self.ui.pushButtonRun.clicked.connect(self.run) |
|
28 |
|
|
29 |
self.init_symbol_list() |
|
30 |
|
|
31 |
def init_symbol_list(self): |
|
32 |
app_doc_data = AppDocData.instance() |
|
33 |
symbol_list = app_doc_data.getTargetSymbolList() |
|
34 |
|
|
35 |
for symbol in symbol_list: |
|
36 |
self.ui.comboBoxFind.addItem(symbol.getName()) |
|
37 |
self.ui.comboBoxReplace.addItem(symbol.getName()) |
|
38 |
|
|
39 |
def run(self): |
|
40 |
find_symbol = self.ui.comboBoxFind.currentText() |
|
41 |
replace_symbol = self.ui.comboBoxReplace.currentText() |
|
42 |
|
|
43 |
if self.ui.radioButtonReplace.isChecked(): |
|
44 |
# replace |
|
45 |
symbol_items = [item for item in self.view.scene().items() |
|
46 |
if issubclass(type(item), SymbolSvgItem) and find_symbol == item.name] |
|
47 |
|
|
48 |
#items = self.mainWindow.symbolTreeWidget.findItems(replace_symbol, Qt.MatchExactly | Qt.MatchRecursive, 0) |
|
49 |
if not symbol_items: |
|
50 |
return |
|
51 |
|
|
52 |
for old_symbol in symbol_items: |
|
53 |
scenePos = old_symbol.mapToScene(old_symbol.transformOriginPoint()) |
|
54 |
old_symbol.transfer.onRemoved.emit(old_symbol) |
|
55 |
|
|
56 |
svg = self.view.createSymbolObject(replace_symbol) |
|
57 |
self.view.matchSymbolToLine(svg, scenePos, angle=old_symbol.angle, flip=old_symbol.flip) |
|
58 |
|
|
59 |
else: |
|
60 |
# insert |
|
61 |
pass |
|
62 |
|
|
26 | 63 |
|
27 | 64 |
def reject(self): |
28 | 65 |
"""close a dialog""" |
DTI_PID/DTI_PID/ReplaceSymbol_UI.py | ||
---|---|---|
34 | 34 |
self.gridLayout_2.setObjectName("gridLayout_2") |
35 | 35 |
self.gridLayout = QtWidgets.QGridLayout() |
36 | 36 |
self.gridLayout.setObjectName("gridLayout") |
37 |
self.lineEdit_2 = QtWidgets.QLineEdit(self.widget) |
|
38 |
self.lineEdit_2.setObjectName("lineEdit_2") |
|
39 |
self.gridLayout.addWidget(self.lineEdit_2, 1, 1, 1, 1) |
|
40 |
self.lineEdit = QtWidgets.QLineEdit(self.widget) |
|
41 |
self.lineEdit.setObjectName("lineEdit") |
|
42 |
self.gridLayout.addWidget(self.lineEdit, 0, 1, 1, 1) |
|
43 |
self.labelReplace = QtWidgets.QLabel(self.widget) |
|
44 |
font = QtGui.QFont() |
|
45 |
font.setBold(False) |
|
46 |
font.setWeight(50) |
|
47 |
self.labelReplace.setFont(font) |
|
48 |
self.labelReplace.setObjectName("labelReplace") |
|
49 |
self.gridLayout.addWidget(self.labelReplace, 1, 0, 1, 1) |
|
50 | 37 |
self.plainTextEdit = QtWidgets.QPlainTextEdit(self.widget) |
51 | 38 |
self.plainTextEdit.setObjectName("plainTextEdit") |
52 | 39 |
self.gridLayout.addWidget(self.plainTextEdit, 2, 1, 1, 2) |
53 |
self.pushButtonRun = QtWidgets.QPushButton(self.widget) |
|
54 |
font = QtGui.QFont() |
|
55 |
font.setBold(False) |
|
56 |
font.setWeight(50) |
|
57 |
self.pushButtonRun.setFont(font) |
|
58 |
self.pushButtonRun.setObjectName("pushButtonRun") |
|
59 |
self.gridLayout.addWidget(self.pushButtonRun, 1, 2, 1, 1) |
|
60 | 40 |
self.label = QtWidgets.QLabel(self.widget) |
61 | 41 |
font = QtGui.QFont() |
62 | 42 |
font.setBold(False) |
... | ... | |
71 | 51 |
self.label_3.setFont(font) |
72 | 52 |
self.label_3.setObjectName("label_3") |
73 | 53 |
self.gridLayout.addWidget(self.label_3, 2, 0, 1, 1) |
54 |
self.labelReplace = QtWidgets.QLabel(self.widget) |
|
55 |
font = QtGui.QFont() |
|
56 |
font.setBold(False) |
|
57 |
font.setWeight(50) |
|
58 |
self.labelReplace.setFont(font) |
|
59 |
self.labelReplace.setObjectName("labelReplace") |
|
60 |
self.gridLayout.addWidget(self.labelReplace, 1, 0, 1, 1) |
|
61 |
self.pushButtonRun = QtWidgets.QPushButton(self.widget) |
|
62 |
font = QtGui.QFont() |
|
63 |
font.setBold(False) |
|
64 |
font.setWeight(50) |
|
65 |
self.pushButtonRun.setFont(font) |
|
66 |
self.pushButtonRun.setObjectName("pushButtonRun") |
|
67 |
self.gridLayout.addWidget(self.pushButtonRun, 1, 2, 1, 1) |
|
74 | 68 |
self.horizontalLayout_2 = QtWidgets.QHBoxLayout() |
75 | 69 |
self.horizontalLayout_2.setObjectName("horizontalLayout_2") |
76 | 70 |
self.radioButtonReplace = QtWidgets.QRadioButton(self.widget) |
... | ... | |
93 | 87 |
self.buttonGroup.addButton(self.radioButtonInsert) |
94 | 88 |
self.horizontalLayout_2.addWidget(self.radioButtonInsert) |
95 | 89 |
self.gridLayout.addLayout(self.horizontalLayout_2, 0, 2, 1, 1) |
90 |
self.comboBoxFind = QtWidgets.QComboBox(self.widget) |
|
91 |
self.comboBoxFind.setMinimumSize(QtCore.QSize(295, 0)) |
|
92 |
self.comboBoxFind.setObjectName("comboBoxFind") |
|
93 |
self.gridLayout.addWidget(self.comboBoxFind, 0, 1, 1, 1) |
|
94 |
self.comboBoxReplace = QtWidgets.QComboBox(self.widget) |
|
95 |
self.comboBoxReplace.setObjectName("comboBoxReplace") |
|
96 |
self.gridLayout.addWidget(self.comboBoxReplace, 1, 1, 1, 1) |
|
96 | 97 |
self.gridLayout_2.addLayout(self.gridLayout, 0, 0, 1, 1) |
97 | 98 |
self.gridLayout_3.addWidget(self.widget, 0, 0, 1, 1) |
98 | 99 |
|
... | ... | |
102 | 103 |
def retranslateUi(self, ReplaceSymbolDialog): |
103 | 104 |
_translate = QtCore.QCoreApplication.translate |
104 | 105 |
ReplaceSymbolDialog.setWindowTitle(_translate("ReplaceSymbolDialog", "Symbol Replace")) |
105 |
self.labelReplace.setText(_translate("ReplaceSymbolDialog", "Replace :")) |
|
106 |
self.pushButtonRun.setText(_translate("ReplaceSymbolDialog", "Run")) |
|
107 | 106 |
self.label.setText(_translate("ReplaceSymbolDialog", "Find : ")) |
108 | 107 |
self.label_3.setText(_translate("ReplaceSymbolDialog", "Condition: ")) |
108 |
self.labelReplace.setText(_translate("ReplaceSymbolDialog", "Replace :")) |
|
109 |
self.pushButtonRun.setText(_translate("ReplaceSymbolDialog", "Run")) |
|
109 | 110 |
self.radioButtonReplace.setText(_translate("ReplaceSymbolDialog", "Replace")) |
110 | 111 |
self.radioButtonInsert.setText(_translate("ReplaceSymbolDialog", "Insert")) |
111 | 112 |
|
DTI_PID/DTI_PID/UI/ReplaceSymbol.ui | ||
---|---|---|
49 | 49 |
<layout class="QGridLayout" name="gridLayout_2"> |
50 | 50 |
<item row="0" column="0"> |
51 | 51 |
<layout class="QGridLayout" name="gridLayout"> |
52 |
<item row="1" column="1"> |
|
53 |
<widget class="QLineEdit" name="lineEdit_2"/> |
|
54 |
</item> |
|
55 |
<item row="0" column="1"> |
|
56 |
<widget class="QLineEdit" name="lineEdit"/> |
|
52 |
<item row="2" column="1" colspan="2"> |
|
53 |
<widget class="QPlainTextEdit" name="plainTextEdit"/> |
|
57 | 54 |
</item> |
58 |
<item row="1" column="0">
|
|
59 |
<widget class="QLabel" name="labelReplace">
|
|
55 |
<item row="0" column="0">
|
|
56 |
<widget class="QLabel" name="label"> |
|
60 | 57 |
<property name="font"> |
61 | 58 |
<font> |
62 | 59 |
<weight>50</weight> |
... | ... | |
64 | 61 |
</font> |
65 | 62 |
</property> |
66 | 63 |
<property name="text"> |
67 |
<string>Replace :</string>
|
|
64 |
<string>Find : </string>
|
|
68 | 65 |
</property> |
69 | 66 |
</widget> |
70 | 67 |
</item> |
71 |
<item row="2" column="1" colspan="2"> |
|
72 |
<widget class="QPlainTextEdit" name="plainTextEdit"/> |
|
73 |
</item> |
|
74 |
<item row="1" column="2"> |
|
75 |
<widget class="QPushButton" name="pushButtonRun"> |
|
68 |
<item row="2" column="0"> |
|
69 |
<widget class="QLabel" name="label_3"> |
|
76 | 70 |
<property name="font"> |
77 | 71 |
<font> |
78 | 72 |
<weight>50</weight> |
... | ... | |
80 | 74 |
</font> |
81 | 75 |
</property> |
82 | 76 |
<property name="text"> |
83 |
<string>Run</string>
|
|
77 |
<string>Condition: </string>
|
|
84 | 78 |
</property> |
85 | 79 |
</widget> |
86 | 80 |
</item> |
87 |
<item row="0" column="0">
|
|
88 |
<widget class="QLabel" name="label"> |
|
81 |
<item row="1" column="0">
|
|
82 |
<widget class="QLabel" name="labelReplace">
|
|
89 | 83 |
<property name="font"> |
90 | 84 |
<font> |
91 | 85 |
<weight>50</weight> |
... | ... | |
93 | 87 |
</font> |
94 | 88 |
</property> |
95 | 89 |
<property name="text"> |
96 |
<string>Find : </string>
|
|
90 |
<string>Replace :</string>
|
|
97 | 91 |
</property> |
98 | 92 |
</widget> |
99 | 93 |
</item> |
100 |
<item row="2" column="0">
|
|
101 |
<widget class="QLabel" name="label_3">
|
|
94 |
<item row="1" column="2">
|
|
95 |
<widget class="QPushButton" name="pushButtonRun">
|
|
102 | 96 |
<property name="font"> |
103 | 97 |
<font> |
104 | 98 |
<weight>50</weight> |
... | ... | |
106 | 100 |
</font> |
107 | 101 |
</property> |
108 | 102 |
<property name="text"> |
109 |
<string>Condition: </string>
|
|
103 |
<string>Run</string>
|
|
110 | 104 |
</property> |
111 | 105 |
</widget> |
112 | 106 |
</item> |
... | ... | |
149 | 143 |
</item> |
150 | 144 |
</layout> |
151 | 145 |
</item> |
146 |
<item row="0" column="1"> |
|
147 |
<widget class="QComboBox" name="comboBoxFind"> |
|
148 |
<property name="minimumSize"> |
|
149 |
<size> |
|
150 |
<width>295</width> |
|
151 |
<height>0</height> |
|
152 |
</size> |
|
153 |
</property> |
|
154 |
</widget> |
|
155 |
</item> |
|
156 |
<item row="1" column="1"> |
|
157 |
<widget class="QComboBox" name="comboBoxReplace"/> |
|
158 |
</item> |
|
152 | 159 |
</layout> |
153 | 160 |
</item> |
154 | 161 |
</layout> |
내보내기 Unified diff