개정판 6d715a6e
issue #000: 952, 538
Change-Id: Ie2941cf9f4153b2f2ae8580322a7e29230957060
DTI_PID/DTI_PID/Commands/SelectAttributeCommand.py | ||
---|---|---|
78 | 78 |
self._item.conns.append(item) |
79 | 79 | |
80 | 80 |
self.onSuccess.emit() |
81 |
elif item is not None and self._attr.AttributeType == 'Line Conn' and issubclass(type(item), QEngineeringLineItem):
|
|
81 |
elif item is not None and self._attr.AttributeType == 'Conn' and (issubclass(type(item), QEngineeringLineItem) or issubclass(type(item), SymbolSvgItem)):
|
|
82 | 82 |
self._item.connectors[self._attr.ConnNum - 1].connectedItem = item |
83 | 83 | |
84 | 84 |
self.onSuccess.emit() |
DTI_PID/DTI_PID/ItemPropertyTableWidget.py | ||
---|---|---|
379 | 379 |
self.setItem(row, 0, item) |
380 | 380 | |
381 | 381 |
item = QTableWidgetItem('{}'.format('None' if connector.connectedItem is None else str(connector.connectedItem.uid))) |
382 |
item.setFlags(Qt.ItemIsEnabled) |
|
382 |
item.setFlags(Qt.ItemIsEnabled|Qt.ItemIsSelectable) |
|
383 |
icon = QtGui.QIcon() |
|
384 |
icon.addPixmap(QtGui.QPixmap(":/newPrefix/doubleclick.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
|
385 |
item.setIcon(icon) |
|
383 | 386 |
self.setItem(row, 1, item) |
384 | 387 |
row = row + 1 |
385 | 388 |
count = count + 1 |
... | ... | |
564 | 567 |
if event.key() == Qt.Key_Delete: |
565 | 568 |
items = self.mainWindow.graphicsView.scene.selectedItems() |
566 | 569 |
selectedIndexes = self.selectedIndexes() |
567 |
if len(items) == 1 and len(selectedIndexes) == 1 and type(items[0]) is not QEngineeringLineItem and type(items[0]) is not QEngineeringSpecBreakItem: |
|
570 |
if len(items) == 1 and len(selectedIndexes) == 1 and type(items[0]) is not QEngineeringLineItem and type(items[0]) is not QEngineeringSpecBreakItem and self.item(selectedIndexes[0].row(), 0).text().find('CONN') is not 0:
|
|
568 | 571 |
if selectedIndexes[0].column() == 1: |
569 | 572 |
attributeStr = self.item(selectedIndexes[0].row(), 0).text() |
570 | 573 |
items[0].removeSelfAttr(attributeStr) |
571 | 574 |
self.mainWindow.refreshResultPropertyTableWidget() |
572 |
elif len(items) == 1 and len(selectedIndexes) == 1 and type(items[0]) is QEngineeringLineItem:
|
|
575 |
elif len(items) == 1 and len(selectedIndexes) == 1 and (type(items[0]) is QEngineeringLineItem or issubclass(type(items[0]), SymbolSvgItem)):
|
|
573 | 576 |
keyCell = self.item(selectedIndexes[0].row(), 0) |
574 | 577 |
if selectedIndexes[0].column() == 1 and keyCell.text().find('CONN') is 0: |
578 |
selectedUID = self.item(selectedIndexes[0].row(), 1).text() |
|
575 | 579 |
connNum = int(keyCell.text().replace('CONN', '')) |
576 | 580 |
items[0].connectors[connNum - 1].connectedItem = None |
577 | 581 |
self.showItemProperty(items[0]) |
578 | 582 | |
579 | 583 |
for sceneItem in self.mainWindow.graphicsView.scene.items(): |
580 |
if hasattr(sceneItem, 'connectors'): |
|
584 |
if hasattr(sceneItem, 'uid') and str(sceneItem.uid) == selectedUID and hasattr(sceneItem, 'connectors'):
|
|
581 | 585 |
for sceneConnector in sceneItem.connectors: |
582 | 586 |
if sceneConnector.connectedItem is not None and items[0].uid == sceneConnector.connectedItem.uid: |
583 | 587 |
sceneConnector.connectedItem = None |
... | ... | |
649 | 653 |
cmd = SelectAttributeCommand.SelectAttributeCommand(items[0], attr, self.mainWindow.graphicsView) |
650 | 654 |
cmd.onSuccess.connect(self.onSuccessSelectAttribute) |
651 | 655 |
self.mainWindow.graphicsView.command = cmd |
652 |
elif keyCell.text().find('CONN') is 0 and type(items[0]) is QEngineeringLineItem:
|
|
656 |
elif keyCell.text().find('CONN') is 0 and (type(items[0]) is QEngineeringLineItem or (issubclass(type(items[0]), SymbolSvgItem) and type(items[0]) is not QEngineeringSpecBreakItem)):
|
|
653 | 657 |
from SymbolAttr import SymbolAttr |
654 | 658 |
attr = SymbolAttr() |
655 |
attr.AttributeType = "Line Conn"
|
|
659 |
attr.AttributeType = "Conn" |
|
656 | 660 |
attr.ConnNum = int(keyCell.text().replace('CONN', '')) |
657 | 661 |
cmd = SelectAttributeCommand.SelectAttributeCommand(items[0], attr, self.mainWindow.graphicsView) |
658 | 662 |
cmd.onSuccess.connect(self.onSuccessSelectAttribute) |
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
625 | 625 |
elif (issubclass(type(attr), SymbolSvgItem) or type(attr) is QEngineeringTextItem): |
626 | 626 |
attr.unsetHightlight() |
627 | 627 | |
628 | ||
629 | 628 |
''' |
630 | 629 |
@brief add message listwidget |
631 | 630 |
@author humkyung |
DTI_PID/DTI_PID/RotateSymbolDialog.py | ||
---|---|---|
1 |
# -*- coding: utf-8 -*- |
|
2 | ||
3 |
# Form implementation generated from reading ui file 'ProjectDialog.ui' |
|
4 |
# |
|
5 |
# Created by: PyQt5 UI code generator 5.6 |
|
6 |
# |
|
7 |
# WARNING! All changes made in this file will be lost! |
|
8 | ||
9 |
from PyQt5 import QtCore, QtGui, QtWidgets |
|
10 |
from PyQt5.QtWidgets import * |
|
11 |
import os |
|
12 |
from Project import Project |
|
13 |
from AppDocData import AppDocData |
|
14 |
import RotateSymbol_UI |
|
15 | ||
16 |
class QRotateSymbolDialog(QDialog): |
|
17 |
def __init__(self, parent): |
|
18 |
QDialog.__init__(self, parent) |
|
19 | ||
20 |
self.ui = RotateSymbol_UI.Ui_RotateSymbolDialog() |
|
21 |
self.ui.setupUi(self) |
|
22 |
self.degree = None |
|
23 |
self.angle = None |
|
24 |
self.isAccepted = False |
|
25 | ||
26 |
def showDialog(self): |
|
27 |
self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowCloseButtonHint & ~QtCore.Qt.WindowContextHelpButtonHint) |
|
28 |
self.exec_() |
|
29 |
return self.isAccepted, self.angle |
|
30 | ||
31 |
def accept(self): |
|
32 |
import math |
|
33 |
self.degree = self.ui.doubleSpinBox.value() |
|
34 |
allowed_error = 0.0001 |
|
35 | ||
36 |
#degree 0 |
|
37 |
if abs(self.degree - 0) <= allowed_error: |
|
38 |
self.angle = 0 |
|
39 |
#degree 90 |
|
40 |
elif abs(self.degree - 90) <= allowed_error: |
|
41 |
self.angle = 1.57 |
|
42 |
#degree 180 |
|
43 |
elif abs(self.degree - 180) <= allowed_error: |
|
44 |
self.angle = 3.14 |
|
45 |
#degree 270 |
|
46 |
elif abs(self.degree - 270) <= allowed_error: |
|
47 |
self.angle = 4.71 |
|
48 |
else: |
|
49 |
self.angle = math.pi / 180 * self.degree |
|
50 | ||
51 |
self.isAccepted = True |
|
52 | ||
53 |
QDialog.accept(self) |
|
54 | ||
55 |
def reject(self): |
|
56 |
QDialog.reject(self) |
DTI_PID/DTI_PID/RotateSymbol_UI.py | ||
---|---|---|
1 |
# -*- coding: utf-8 -*- |
|
2 | ||
3 |
# Form implementation generated from reading ui file './UI/RotateSymbol.ui' |
|
4 |
# |
|
5 |
# Created by: PyQt5 UI code generator 5.11.3 |
|
6 |
# |
|
7 |
# WARNING! All changes made in this file will be lost! |
|
8 | ||
9 |
from PyQt5 import QtCore, QtGui, QtWidgets |
|
10 | ||
11 |
class Ui_RotateSymbolDialog(object): |
|
12 |
def setupUi(self, RotateSymbolDialog): |
|
13 |
RotateSymbolDialog.setObjectName("RotateSymbolDialog") |
|
14 |
RotateSymbolDialog.resize(350, 79) |
|
15 |
RotateSymbolDialog.setMinimumSize(QtCore.QSize(350, 79)) |
|
16 |
RotateSymbolDialog.setMaximumSize(QtCore.QSize(350, 79)) |
|
17 |
font = QtGui.QFont() |
|
18 |
font.setFamily("맑은 고딕") |
|
19 |
font.setBold(True) |
|
20 |
font.setWeight(75) |
|
21 |
RotateSymbolDialog.setFont(font) |
|
22 |
self.verticalLayout = QtWidgets.QVBoxLayout(RotateSymbolDialog) |
|
23 |
self.verticalLayout.setObjectName("verticalLayout") |
|
24 |
self.formLayout = QtWidgets.QFormLayout() |
|
25 |
self.formLayout.setObjectName("formLayout") |
|
26 |
self.label = QtWidgets.QLabel(RotateSymbolDialog) |
|
27 |
font = QtGui.QFont() |
|
28 |
font.setFamily("맑은 고딕") |
|
29 |
font.setPointSize(10) |
|
30 |
font.setBold(False) |
|
31 |
font.setWeight(50) |
|
32 |
self.label.setFont(font) |
|
33 |
self.label.setObjectName("label") |
|
34 |
self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label) |
|
35 |
self.horizontalLayout = QtWidgets.QHBoxLayout() |
|
36 |
self.horizontalLayout.setObjectName("horizontalLayout") |
|
37 |
self.doubleSpinBox = QtWidgets.QDoubleSpinBox(RotateSymbolDialog) |
|
38 |
self.doubleSpinBox.setDecimals(3) |
|
39 |
self.doubleSpinBox.setMinimum(0.0) |
|
40 |
self.doubleSpinBox.setMaximum(359.0) |
|
41 |
self.doubleSpinBox.setObjectName("doubleSpinBox") |
|
42 |
self.horizontalLayout.addWidget(self.doubleSpinBox) |
|
43 |
self.formLayout.setLayout(0, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout) |
|
44 |
self.verticalLayout.addLayout(self.formLayout) |
|
45 |
self.errorLabel = QtWidgets.QLabel(RotateSymbolDialog) |
|
46 |
self.errorLabel.setMaximumSize(QtCore.QSize(16777215, 0)) |
|
47 |
self.errorLabel.setStyleSheet("") |
|
48 |
self.errorLabel.setText("") |
|
49 |
self.errorLabel.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) |
|
50 |
self.errorLabel.setObjectName("errorLabel") |
|
51 |
self.verticalLayout.addWidget(self.errorLabel) |
|
52 |
self.buttonBox = QtWidgets.QDialogButtonBox(RotateSymbolDialog) |
|
53 |
font = QtGui.QFont() |
|
54 |
font.setFamily("맑은 고딕") |
|
55 |
font.setBold(True) |
|
56 |
font.setWeight(75) |
|
57 |
self.buttonBox.setFont(font) |
|
58 |
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) |
|
59 |
self.buttonBox.setObjectName("buttonBox") |
|
60 |
self.verticalLayout.addWidget(self.buttonBox) |
|
61 | ||
62 |
self.retranslateUi(RotateSymbolDialog) |
|
63 |
self.buttonBox.rejected.connect(RotateSymbolDialog.reject) |
|
64 |
self.buttonBox.accepted.connect(RotateSymbolDialog.accept) |
|
65 |
QtCore.QMetaObject.connectSlotsByName(RotateSymbolDialog) |
|
66 | ||
67 |
def retranslateUi(self, RotateSymbolDialog): |
|
68 |
_translate = QtCore.QCoreApplication.translate |
|
69 |
RotateSymbolDialog.setWindowTitle(_translate("RotateSymbolDialog", "Symbol Rotation")) |
|
70 |
self.label.setText(_translate("RotateSymbolDialog", "Degree : ")) |
|
71 | ||
72 | ||
73 |
if __name__ == "__main__": |
|
74 |
import sys |
|
75 |
app = QtWidgets.QApplication(sys.argv) |
|
76 |
RotateSymbolDialog = QtWidgets.QDialog() |
|
77 |
ui = Ui_RotateSymbolDialog() |
|
78 |
ui.setupUi(RotateSymbolDialog) |
|
79 |
RotateSymbolDialog.show() |
|
80 |
sys.exit(app.exec_()) |
|
81 |
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py | ||
---|---|---|
630 | 630 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
631 | 631 | |
632 | 632 |
''' |
633 |
@brief Double click event, Show rotate symbol dialog |
|
634 |
@author euisung |
|
635 |
@date 2019.04.16 |
|
636 |
''' |
|
637 |
def mouseDoubleClickEvent(self, event): |
|
638 |
from RotateSymbolDialog import QRotateSymbolDialog |
|
639 |
dialog = QRotateSymbolDialog(None) |
|
640 |
(isAccept, angle) = dialog.showDialog() |
|
641 |
|
|
642 |
if isAccept: |
|
643 |
self.rotateSymbol(angle) |
|
644 | ||
645 |
''' |
|
633 | 646 |
@brief get attribute |
634 | 647 |
@author humkyung |
635 | 648 |
@date 2018.06.14 |
... | ... | |
1211 | 1224 |
@author kyouho |
1212 | 1225 |
@date 2018.07.24 |
1213 | 1226 |
''' |
1214 |
def rotateSymbol(self): |
|
1215 |
#degree 0 |
|
1216 |
if 0 == self.angle: |
|
1217 |
self.angle = 1.57 |
|
1218 |
#degree 90 |
|
1219 |
elif (1.57 == self.angle): |
|
1220 |
self.angle = 3.14 |
|
1221 |
#degree 180 |
|
1222 |
elif 3.14 == self.angle: |
|
1223 |
self.angle = 4.71 |
|
1224 |
#degree 270 |
|
1225 |
elif 4.71 == self.angle : |
|
1226 |
self.angle = 0 |
|
1227 |
def rotateSymbol(self, angle=None): |
|
1228 |
if angle is None: |
|
1229 |
#degree 0 |
|
1230 |
if 0 == self.angle: |
|
1231 |
self.angle = 1.57 |
|
1232 |
#degree 90 |
|
1233 |
elif (1.57 == self.angle): |
|
1234 |
self.angle = 3.14 |
|
1235 |
#degree 180 |
|
1236 |
elif 3.14 == self.angle: |
|
1237 |
self.angle = 4.71 |
|
1238 |
#degree 270 |
|
1239 |
elif 4.71 == self.angle : |
|
1240 |
self.angle = 0 |
|
1241 |
else: |
|
1242 |
self.angle = angle |
|
1227 | 1243 | |
1228 | 1244 |
self.size[0], self.size[1] = self.size[1], self.size[0] |
1229 | 1245 |
|
DTI_PID/DTI_PID/UI/RotateSymbol.ui | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<ui version="4.0"> |
|
3 |
<class>RotateSymbolDialog</class> |
|
4 |
<widget class="QDialog" name="RotateSymbolDialog"> |
|
5 |
<property name="geometry"> |
|
6 |
<rect> |
|
7 |
<x>0</x> |
|
8 |
<y>0</y> |
|
9 |
<width>350</width> |
|
10 |
<height>79</height> |
|
11 |
</rect> |
|
12 |
</property> |
|
13 |
<property name="minimumSize"> |
|
14 |
<size> |
|
15 |
<width>350</width> |
|
16 |
<height>79</height> |
|
17 |
</size> |
|
18 |
</property> |
|
19 |
<property name="maximumSize"> |
|
20 |
<size> |
|
21 |
<width>350</width> |
|
22 |
<height>79</height> |
|
23 |
</size> |
|
24 |
</property> |
|
25 |
<property name="font"> |
|
26 |
<font> |
|
27 |
<family>맑은 고딕</family> |
|
28 |
<weight>75</weight> |
|
29 |
<bold>true</bold> |
|
30 |
</font> |
|
31 |
</property> |
|
32 |
<property name="windowTitle"> |
|
33 |
<string>Symbol Rotation</string> |
|
34 |
</property> |
|
35 |
<layout class="QVBoxLayout" name="verticalLayout"> |
|
36 |
<item> |
|
37 |
<layout class="QFormLayout" name="formLayout"> |
|
38 |
<item row="0" column="0"> |
|
39 |
<widget class="QLabel" name="label"> |
|
40 |
<property name="font"> |
|
41 |
<font> |
|
42 |
<family>맑은 고딕</family> |
|
43 |
<pointsize>10</pointsize> |
|
44 |
<weight>50</weight> |
|
45 |
<bold>false</bold> |
|
46 |
</font> |
|
47 |
</property> |
|
48 |
<property name="text"> |
|
49 |
<string>Degree : </string> |
|
50 |
</property> |
|
51 |
</widget> |
|
52 |
</item> |
|
53 |
<item row="0" column="1"> |
|
54 |
<layout class="QHBoxLayout" name="horizontalLayout"> |
|
55 |
<item> |
|
56 |
<widget class="QDoubleSpinBox" name="doubleSpinBox"> |
|
57 |
<property name="decimals"> |
|
58 |
<number>3</number> |
|
59 |
</property> |
|
60 |
<property name="minimum"> |
|
61 |
<double>0.000000000000000</double> |
|
62 |
</property> |
|
63 |
<property name="maximum"> |
|
64 |
<double>359.000000000000000</double> |
|
65 |
</property> |
|
66 |
</widget> |
|
67 |
</item> |
|
68 |
</layout> |
|
69 |
</item> |
|
70 |
</layout> |
|
71 |
</item> |
|
72 |
<item> |
|
73 |
<widget class="QLabel" name="errorLabel"> |
|
74 |
<property name="maximumSize"> |
|
75 |
<size> |
|
76 |
<width>16777215</width> |
|
77 |
<height>0</height> |
|
78 |
</size> |
|
79 |
</property> |
|
80 |
<property name="styleSheet"> |
|
81 |
<string notr="true"/> |
|
82 |
</property> |
|
83 |
<property name="text"> |
|
84 |
<string/> |
|
85 |
</property> |
|
86 |
<property name="alignment"> |
|
87 |
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> |
|
88 |
</property> |
|
89 |
</widget> |
|
90 |
</item> |
|
91 |
<item> |
|
92 |
<widget class="QDialogButtonBox" name="buttonBox"> |
|
93 |
<property name="font"> |
|
94 |
<font> |
|
95 |
<family>맑은 고딕</family> |
|
96 |
<weight>75</weight> |
|
97 |
<bold>true</bold> |
|
98 |
</font> |
|
99 |
</property> |
|
100 |
<property name="standardButtons"> |
|
101 |
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> |
|
102 |
</property> |
|
103 |
</widget> |
|
104 |
</item> |
|
105 |
</layout> |
|
106 |
</widget> |
|
107 |
<resources/> |
|
108 |
<connections> |
|
109 |
<connection> |
|
110 |
<sender>buttonBox</sender> |
|
111 |
<signal>rejected()</signal> |
|
112 |
<receiver>RotateSymbolDialog</receiver> |
|
113 |
<slot>reject()</slot> |
|
114 |
<hints> |
|
115 |
<hint type="sourcelabel"> |
|
116 |
<x>299</x> |
|
117 |
<y>79</y> |
|
118 |
</hint> |
|
119 |
<hint type="destinationlabel"> |
|
120 |
<x>299</x> |
|
121 |
<y>49</y> |
|
122 |
</hint> |
|
123 |
</hints> |
|
124 |
</connection> |
|
125 |
<connection> |
|
126 |
<sender>buttonBox</sender> |
|
127 |
<signal>accepted()</signal> |
|
128 |
<receiver>RotateSymbolDialog</receiver> |
|
129 |
<slot>accept()</slot> |
|
130 |
<hints> |
|
131 |
<hint type="sourcelabel"> |
|
132 |
<x>299</x> |
|
133 |
<y>79</y> |
|
134 |
</hint> |
|
135 |
<hint type="destinationlabel"> |
|
136 |
<x>299</x> |
|
137 |
<y>49</y> |
|
138 |
</hint> |
|
139 |
</hints> |
|
140 |
</connection> |
|
141 |
</connections> |
|
142 |
</ui> |
내보내기 Unified diff