개정판 9661a533
issue #1062: 입력 데이타 유효성 검사 로직 업데이트
Change-Id: I1679ef2b804495a03b27906592a1c5c2ab18caf0
HYTOS/HYTOS/Commands/PlaceStreamlineCommand.py | ||
---|---|---|
3 | 3 |
|
4 | 4 |
import os.path |
5 | 5 |
import AbstractCommand |
6 |
|
|
6 | 7 |
try: |
7 | 8 |
from PyQt5.QtCore import * |
8 | 9 |
from PyQt5.QtGui import * |
... | ... | |
14 | 15 |
except ImportError: |
15 | 16 |
raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.") |
16 | 17 |
|
18 |
|
|
17 | 19 |
class PlaceStreamlineCommand(AbstractCommand.AbstractCommand): |
18 | 20 |
""" This is place line class """ |
19 | 21 |
|
... | ... | |
22 | 24 |
|
23 | 25 |
def __init__(self, imageViewer): |
24 | 26 |
super(PlaceStreamlineCommand, self).__init__(imageViewer) |
25 |
self.name = 'PlaceStreamline'
|
|
27 |
self.name = 'PlaceStreamline' |
|
26 | 28 |
self.imageViewer.setCursor(QCursor(Qt.CrossCursor)) |
27 | 29 |
|
28 | 30 |
self._streamline = None |
... | ... | |
31 | 33 |
@property |
32 | 34 |
def streamline(self): |
33 | 35 |
""" getter of _streamline """ |
34 |
|
|
36 |
|
|
35 | 37 |
return self._streamline |
36 | 38 |
|
37 | 39 |
''' |
... | ... | |
39 | 41 |
@author humkyung |
40 | 42 |
@date 2018.07.23 |
41 | 43 |
''' |
44 |
|
|
42 | 45 |
def reset(self): |
43 | 46 |
self._streamline = None |
44 | 47 |
|
45 |
|
|
46 | 48 |
''' |
47 | 49 |
@brief place a line |
48 | 50 |
@author humkyung |
49 | 51 |
@date 2018.07.23 |
50 | 52 |
''' |
53 |
|
|
51 | 54 |
def execute(self, param): |
52 | 55 |
from EngineeringConnectorItem import QEngineeringConnectorItem |
53 | 56 |
from EngineeringStreamlineItem import QEngineeringStreamlineItem |
... | ... | |
57 | 60 |
event = param[1] |
58 | 61 |
if 'mousePressEvent' == param[0] and event.button() == Qt.LeftButton: |
59 | 62 |
selected = self.imageViewer.scene.itemAt(param[2], QTransform()) |
60 |
|
|
61 |
if self._streamline is None: |
|
62 |
if selected is not None and (type(selected) is QEngineeringConnectorItem or type(selected.parentItem()) is QEngineeringConnectorItem): |
|
63 |
|
|
64 |
if self._streamline is None: |
|
65 |
if selected is not None and (type(selected) is QEngineeringConnectorItem or type( |
|
66 |
selected.parentItem()) is QEngineeringConnectorItem): |
|
63 | 67 |
if selected.hasConnectedItem() == False: |
64 | 68 |
self._streamline = QEngineeringStreamlineItem() |
65 |
self._streamline._vertices.append(selected.center() if type(selected) is QEngineeringConnectorItem else selected.parentItem().center()) |
|
69 |
self._streamline._vertices.append(selected.center() if type( |
|
70 |
selected) is QEngineeringConnectorItem else selected.parentItem().center()) |
|
66 | 71 |
self.imageViewer.scene.addItem(self._streamline) |
67 | 72 |
self.imageViewer.scene.setFocusItem(self._streamline) |
68 | 73 |
|
69 |
self.connectorItems.append(selected if type(selected) is QEngineeringConnectorItem else selected.parentItem()) |
|
74 |
self.connectorItems.append( |
|
75 |
selected if type(selected) is QEngineeringConnectorItem else selected.parentItem()) |
|
70 | 76 |
else: |
71 |
try: |
|
72 |
if selected is not None and (type(selected) is QEngineeringConnectorItem or type(selected.parentItem()) is QEngineeringConnectorItem): |
|
77 |
try: |
|
78 |
if selected is not None and (type(selected) is QEngineeringConnectorItem or type( |
|
79 |
selected.parentItem()) is QEngineeringConnectorItem): |
|
73 | 80 |
if selected.hasConnectedItem() == False: |
74 |
self.connectorItems.append(selected if type(selected) is QEngineeringConnectorItem else selected.parentItem()) |
|
75 |
self._streamline._vertices[-1] = selected.center() if type(selected) is QEngineeringConnectorItem else selected.parentItem().center() |
|
81 |
self.connectorItems.append( |
|
82 |
selected if type(selected) is QEngineeringConnectorItem else selected.parentItem()) |
|
83 |
self._streamline._vertices[-1] = selected.center() if type( |
|
84 |
selected) is QEngineeringConnectorItem else selected.parentItem().center() |
|
76 | 85 |
else: |
77 | 86 |
return |
78 | 87 |
|
... | ... | |
99 | 108 |
pass |
100 | 109 |
|
101 | 110 |
def redo(self): |
102 |
pass |
|
111 |
pass |
HYTOS/HYTOS/Shapes/EngineeringConnectorItem.py | ||
---|---|---|
205 | 205 |
if self.connectedItem and (self.data.pressure_drop is None or self.data.elevation is None): |
206 | 206 |
res.extend([self, 'pressure drop or elevation is invalid']) |
207 | 207 |
elif parent.category == 'Equipment - [ Rotating ]': |
208 |
if self.connectedItem and (self.data.over_design_cv is None is None or self.data.elevation is None): |
|
209 |
res.extend([self, 'over_design_cv or elevation is invalid']) |
|
208 |
if self.connectedItem and parent.name in ['L_KOMP', 'R_KOMP', 'R_Pump', 'L_Pump', 'V_Pump']: |
|
209 |
if self.data.elevation is None: |
|
210 |
res.extend([self, 'need to check elevation']) |
|
211 |
elif self.connectedItem and (self.data.pressure_drop is None or self.data.elevation is None): |
|
212 |
res.extend([self, 'need to check pressure drop and elevation']) |
|
213 |
elif self.connectedItem and parent.name in ['CV_H', 'CV_V']: |
|
214 |
if self.data.elevation is None: |
|
215 |
res.extend([self, 'need to check elevation']) |
|
210 | 216 |
elif parent.name == 'Line Splitter': # set default value for line splitter |
211 | 217 |
if self.connectedItem: |
212 | 218 |
if self.data.pressure_drop is None: |
HYTOS/HYTOS/Shapes/EngineeringStreamlineItem.py | ||
---|---|---|
147 | 147 |
def validate(self): |
148 | 148 |
"""validate stream line data""" |
149 | 149 |
|
150 |
# TODO: need to implement this function |
|
151 |
return [[self, 'check the data of mixed type']] if self.data and self.data.phase_type == 'Mixed' else None |
|
150 |
res = None |
|
151 |
|
|
152 |
if self.data and self.data.phase_type == 'Mixed': |
|
153 |
res = None if self.pressure_variation else [[self, 'need to check pressure variation']] |
|
154 |
|
|
155 |
return res |
|
152 | 156 |
|
153 | 157 |
def build_connectors(self, connected, pointsUids=None): |
154 | 158 |
""" build connectors for stream line |
... | ... | |
845 | 849 |
|
846 | 850 |
def mouseDoubleClickEvent(self, event): |
847 | 851 |
from StreamDataDialog import QStreamDataDialog |
848 |
try: |
|
849 | 852 |
|
853 |
try: |
|
850 | 854 |
dialog = QStreamDataDialog() |
851 |
res = dialog.showDialog(self) |
|
852 |
if res: |
|
855 |
if dialog.showDialog(self): |
|
853 | 856 |
self.load_HMB() |
854 |
|
|
855 | 857 |
except Exception as ex: |
856 | 858 |
from App import App |
857 | 859 |
from AppDocData import MessageType |
HYTOS/HYTOS/ValidationDialog.py | ||
---|---|---|
34 | 34 |
|
35 | 35 |
row += 1 |
36 | 36 |
|
37 |
self.ui.tableWidgetValidation.horizontalHeader().setSectionResizeMode(0, QHeaderView.ResizeToContents) |
|
38 |
self.ui.tableWidgetValidation.horizontalHeader().setSectionResizeMode(1, QHeaderView.ResizeToContents) |
|
39 |
|
|
37 | 40 |
def accept(self): |
38 | 41 |
QDialog.accept(self) |
39 | 42 |
|
내보내기 Unified diff