개정판 e2b6f495
issue #481: add validation dialog
Change-Id: Ie8fcaaf26590404a71b354304b415bd73fef76b8
DTI_PID/DTI_PID/Commands/PlaceLineCommand.py | ||
---|---|---|
81 | 81 |
else: |
82 | 82 |
try: |
83 | 83 |
QGraphicsView.mouseReleaseEvent(self.imageViewer, event) |
84 |
self._polyline._vertices.append(self._polyline._pt) |
|
84 |
|
|
85 |
selected = \ |
|
86 |
[conn for conn in self.imageViewer.scene.items(param[2]) if |
|
87 |
type(conn) is not QGraphicsTextItem][0] |
|
88 |
if selected is not None and type(selected) is QEngineeringConnectorItem: |
|
89 |
self._polyline._vertices.append(selected.center()) |
|
90 |
else: |
|
91 |
self._polyline._vertices.append(self._polyline._pt) |
|
85 | 92 |
self._polyline.update() |
86 | 93 |
finally: |
87 | 94 |
pass |
DTI_PID/DTI_PID/Commands/ValidateCommand.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 * |
... | ... | |
10 | 11 |
except ImportError: |
11 | 12 |
try: |
12 | 13 |
from PyQt4.QtCore import Qt, QPointF, QRectF, pyqtSignal, QT_VERSION_STR |
13 |
from PyQt4.QtGui import QApplication, QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog, QCursor |
|
14 |
from PyQt4.QtGui import QApplication, QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog, \ |
|
15 |
QCursor |
|
14 | 16 |
except ImportError: |
15 | 17 |
raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.") |
16 | 18 |
|
19 |
|
|
17 | 20 |
class ValidateCommand(AbstractCommand.AbstractCommand): |
21 |
show_progress = pyqtSignal(int) |
|
22 |
|
|
18 | 23 |
def __init__(self, imageViewer): |
19 | 24 |
super(ValidateCommand, self).__init__(imageViewer) |
20 |
self.name = 'Validate'
|
|
21 |
|
|
25 |
self.name = 'Validate' |
|
26 |
|
|
22 | 27 |
def execute(self, param): |
23 | 28 |
""" valite all items in scene """ |
24 | 29 |
from EngineeringLineItem import QEngineeringLineItem |
... | ... | |
32 | 37 |
errors = [] |
33 | 38 |
try: |
34 | 39 |
# item validation check |
40 |
count = 0 |
|
35 | 41 |
for item in param: |
36 | 42 |
if type(item) is QEngineeringLineItem or issubclass(type(item), SymbolSvgItem): |
37 | 43 |
errors.extend(item.validate()) |
38 | 44 |
|
45 |
count += 1 |
|
46 |
self.show_progress.emit(count) |
|
47 |
|
|
39 | 48 |
finally: |
40 | 49 |
QApplication.restoreOverrideCursor() |
41 | 50 |
|
... | ... | |
45 | 54 |
pass |
46 | 55 |
|
47 | 56 |
def redo(self): |
48 |
pass |
|
57 |
pass |
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
380 | 380 |
|
381 | 381 |
def onValidation(self): |
382 | 382 |
"""validation check""" |
383 |
from ValidationDialog import QValidationDialog |
|
383 | 384 |
from ValidateCommand import ValidateCommand |
384 | 385 |
|
385 | 386 |
if not self.graphicsView.hasImage(): |
... | ... | |
387 | 388 |
return |
388 | 389 |
|
389 | 390 |
try: |
390 |
# remove error items |
|
391 |
for item in self.graphicsView.scene.items(): |
|
392 |
if type(item) is QEngineeringErrorItem: |
|
393 |
item.transfer.onRemoved.emit(item) |
|
394 |
# up to here |
|
391 |
dlg = QValidationDialog(self) |
|
392 |
if QDialog.Accepted == dlg.exec_(): |
|
393 |
# remove error items |
|
394 |
for item in self.graphicsView.scene.items(): |
|
395 |
if type(item) is QEngineeringErrorItem: |
|
396 |
item.transfer.onRemoved.emit(item) |
|
397 |
# up to here |
|
395 | 398 |
|
396 |
cmd = ValidateCommand(self.graphicsView) |
|
397 |
errors = cmd.execute(self.graphicsView.scene.items()) |
|
398 |
for error in errors: |
|
399 |
error.transfer.onRemoved.connect(self.itemRemoved) |
|
400 |
self.graphicsView.scene.addItem(error) |
|
399 |
self.progress_bar.setMaximum(len(self.graphicsView.scene.items())) |
|
400 |
self.progress_bar.setValue(0) |
|
401 | 401 |
|
402 |
self.tableWidgetInconsistency.clearContents() |
|
403 |
self.tableWidgetInconsistency.setRowCount(len(errors)) |
|
404 |
for index in range(len(errors)): |
|
405 |
self.makeInconsistencyTableRow(index, errors[index]) |
|
402 |
cmd = ValidateCommand(self.graphicsView) |
|
403 |
cmd.show_progress.connect(self.progress_bar.setValue) |
|
404 |
errors = cmd.execute(self.graphicsView.scene.items()) |
|
405 |
for error in errors: |
|
406 |
error.transfer.onRemoved.connect(self.itemRemoved) |
|
407 |
self.graphicsView.scene.addItem(error) |
|
406 | 408 |
|
407 |
self.tabWidget_2.setTabText(self.tabWidget_2.indexOf(self.tabInconsistency), |
|
408 |
self.tr('Inconsistency') + f"({len(errors)})") |
|
409 |
self.tableWidgetInconsistency.clearContents() |
|
410 |
self.tableWidgetInconsistency.setRowCount(len(errors)) |
|
411 |
for index in range(len(errors)): |
|
412 |
self.makeInconsistencyTableRow(index, errors[index]) |
|
413 |
|
|
414 |
self.tabWidget_2.setTabText(self.tabWidget_2.indexOf(self.tabInconsistency), |
|
415 |
self.tr('Inconsistency') + f"({len(errors)})") |
|
409 | 416 |
except Exception as ex: |
410 | 417 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
411 | 418 |
sys.exc_info()[-1].tb_lineno) |
412 | 419 |
self.addMessage.emit(MessageType.Error, message) |
420 |
finally: |
|
421 |
self.progress_bar.setValue(self.progress_bar.maximum()) |
|
413 | 422 |
|
414 | 423 |
def makeInconsistencyTableRow(self, row, errorItem): |
415 | 424 |
''' |
... | ... | |
1618 | 1627 |
|
1619 | 1628 |
pt = items[-1].endPoint() |
1620 | 1629 |
selected = [item for item in self.graphicsView.scene.items(QPointF(pt[0], pt[1])) if |
1621 |
(type(item) is QEngineeringConnectorItem and item.parent is not items[-1]) or type(
|
|
1622 |
item) is QEngineeringLineItem]
|
|
1630 |
(type(item) is QEngineeringConnectorItem and item.parent is not items[-1]) or |
|
1631 |
type(item) is QEngineeringLineItem]
|
|
1623 | 1632 |
if selected and selected[0] is not items[-1]: |
1624 | 1633 |
if type(selected[0]) is QEngineeringConnectorItem: |
1625 | 1634 |
items[-1].connect_if_possible(selected[0].parent, 5) |
... | ... | |
1924 | 1933 |
|
1925 | 1934 |
def itemRemoved(self, item): |
1926 | 1935 |
try: |
1927 |
self.itemTreeWidget.itemRemoved(item) |
|
1928 |
|
|
1929 |
matches = [_item for _item in self.graphicsView.scene.items() if |
|
1930 |
hasattr(_item, 'connectors') and [connector for connector in _item.connectors if |
|
1931 |
connector.connectedItem is item]] |
|
1932 |
for match in matches: |
|
1933 |
for connector in match.connectors: |
|
1934 |
if connector.connectedItem is item: |
|
1935 |
connector.connectedItem = None |
|
1936 |
connector.highlight(False) |
|
1937 |
|
|
1938 |
# matches = [_item for _item in self.graphicsView.scene.items() if hasattr(_item, 'remove_assoc_item')] |
|
1939 |
# for _item in matches: |
|
1940 |
# _item.remove_assoc_item(item) |
|
1941 |
|
|
1942 |
app_doc_data = AppDocData.instance() |
|
1943 |
if type(item) is QEngineeringLineNoTextItem and item in app_doc_data.tracerLineNos: |
|
1944 |
app_doc_data.tracerLineNos.pop(app_doc_data.tracerLineNos.index(item)) |
|
1945 |
|
|
1946 |
if type(item) is QEngineeringLineItem and item in app_doc_data.lines: |
|
1947 |
app_doc_data.lines.remove(item) |
|
1948 |
|
|
1949 |
matches = [_item for _item in self.graphicsView.scene.items() if type(_item) is QEngineeringLineNoTextItem] |
|
1950 |
matches.extend([lineNo for lineNo in app_doc_data.tracerLineNos if |
|
1951 |
type(lineNo) is QEngineeringTrimLineNoTextItem]) |
|
1952 |
for match in matches: |
|
1953 |
if item is match.prop('From'): |
|
1954 |
match.set_property('From', None) |
|
1955 |
if item is match.prop('To'): |
|
1956 |
match.set_property('To', None) |
|
1957 |
|
|
1958 |
for run_index in reversed(range(len(match.runs))): |
|
1959 |
run = match.runs[run_index] |
|
1960 |
if item in run.items: |
|
1961 |
index = run.items.index(item) |
|
1962 |
run.items.pop(index) |
|
1963 |
if not run.items: |
|
1964 |
run.explode() |
|
1965 |
if type(match) is QEngineeringTrimLineNoTextItem and not match.runs: |
|
1966 |
app_doc_data.tracerLineNos.pop(app_doc_data.tracerLineNos.index(match)) |
|
1967 |
# break |
|
1968 |
|
|
1969 |
matches = [_item for _item in self.graphicsView.scene.items() if hasattr(_item, 'owner')] |
|
1970 |
for match in matches: |
|
1971 |
if match.owner is item: |
|
1972 |
match.owner = None |
|
1973 |
|
|
1974 |
matches = [_item for _item in self.graphicsView.scene.items() if hasattr(_item, 'attrs')] |
|
1975 |
# done = False |
|
1976 |
for match in matches: |
|
1977 |
for assoc in match.associations(): |
|
1978 |
if item is assoc: |
|
1979 |
for attr in match.attrs.keys(): |
|
1980 |
if attr.AssocItem and str(item.uid) == str(attr.AssocItem.uid): |
|
1981 |
attr.AssocItem = None |
|
1982 |
match.attrs[attr] = '' |
|
1983 |
# done = True |
|
1984 |
match.remove_assoc_item(item) |
|
1985 |
break |
|
1986 |
# if done: break |
|
1987 |
|
|
1988 |
# remove error item from inconsistency list |
|
1989 | 1936 |
if type(item) is QEngineeringErrorItem: |
1937 |
# remove error item from inconsistency list |
|
1990 | 1938 |
for row in range(self.tableWidgetInconsistency.rowCount()): |
1991 | 1939 |
if item is self.tableWidgetInconsistency.item(row, 0).tag: |
1992 | 1940 |
self.tableWidgetInconsistency.removeRow(row) |
1993 | 1941 |
break |
1994 | 1942 |
|
1995 |
if item.scene() is not None: item.scene().removeItem(item) |
|
1943 |
if item.scene() is not None: item.scene().removeItem(item) |
|
1944 |
del item |
|
1945 |
else: |
|
1946 |
self.itemTreeWidget.itemRemoved(item) |
|
1947 |
|
|
1948 |
matches = [_item for _item in self.graphicsView.scene.items() if |
|
1949 |
hasattr(_item, 'connectors') and [connector for connector in _item.connectors if |
|
1950 |
connector.connectedItem is item]] |
|
1951 |
for match in matches: |
|
1952 |
for connector in match.connectors: |
|
1953 |
if connector.connectedItem is item: |
|
1954 |
connector.connectedItem = None |
|
1955 |
connector.highlight(False) |
|
1956 |
|
|
1957 |
# matches = [_item for _item in self.graphicsView.scene.items() if hasattr(_item, 'remove_assoc_item')] |
|
1958 |
# for _item in matches: |
|
1959 |
# _item.remove_assoc_item(item) |
|
1960 |
|
|
1961 |
app_doc_data = AppDocData.instance() |
|
1962 |
if type(item) is QEngineeringLineNoTextItem and item in app_doc_data.tracerLineNos: |
|
1963 |
app_doc_data.tracerLineNos.pop(app_doc_data.tracerLineNos.index(item)) |
|
1964 |
|
|
1965 |
if type(item) is QEngineeringLineItem and item in app_doc_data.lines: |
|
1966 |
app_doc_data.lines.remove(item) |
|
1967 |
|
|
1968 |
matches = [_item for _item in self.graphicsView.scene.items() if type(_item) is QEngineeringLineNoTextItem] |
|
1969 |
matches.extend([lineNo for lineNo in app_doc_data.tracerLineNos if |
|
1970 |
type(lineNo) is QEngineeringTrimLineNoTextItem]) |
|
1971 |
for match in matches: |
|
1972 |
if item is match.prop('From'): |
|
1973 |
match.set_property('From', None) |
|
1974 |
if item is match.prop('To'): |
|
1975 |
match.set_property('To', None) |
|
1976 |
|
|
1977 |
for run_index in reversed(range(len(match.runs))): |
|
1978 |
run = match.runs[run_index] |
|
1979 |
if item in run.items: |
|
1980 |
index = run.items.index(item) |
|
1981 |
run.items.pop(index) |
|
1982 |
if not run.items: |
|
1983 |
run.explode() |
|
1984 |
if type(match) is QEngineeringTrimLineNoTextItem and not match.runs: |
|
1985 |
app_doc_data.tracerLineNos.pop(app_doc_data.tracerLineNos.index(match)) |
|
1986 |
# break |
|
1987 |
|
|
1988 |
matches = [_item for _item in self.graphicsView.scene.items() if hasattr(_item, 'owner')] |
|
1989 |
for match in matches: |
|
1990 |
if match.owner is item: |
|
1991 |
match.owner = None |
|
1992 |
|
|
1993 |
matches = [_item for _item in self.graphicsView.scene.items() if hasattr(_item, 'attrs')] |
|
1994 |
# done = False |
|
1995 |
for match in matches: |
|
1996 |
for assoc in match.associations(): |
|
1997 |
if item is assoc: |
|
1998 |
for attr in match.attrs.keys(): |
|
1999 |
if attr.AssocItem and str(item.uid) == str(attr.AssocItem.uid): |
|
2000 |
attr.AssocItem = None |
|
2001 |
match.attrs[attr] = '' |
|
2002 |
# done = True |
|
2003 |
match.remove_assoc_item(item) |
|
2004 |
break |
|
2005 |
# if done: break |
|
2006 |
|
|
2007 |
if item.scene() is not None: item.scene().removeItem(item) |
|
1996 | 2008 |
except Exception as ex: |
1997 | 2009 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
1998 | 2010 |
sys.exc_info()[-1].tb_lineno) |
DTI_PID/DTI_PID/Shapes/EngineeringLineItem.py | ||
---|---|---|
709 | 709 |
res.append(obj) |
710 | 710 |
|
711 | 711 |
elif obj.connectors[1].connectedItem is None and self.distanceTo(_endPt) < toler: |
712 |
if self.connectors[0].connectedItem is None and ((Point(startPt[0], startPt[1]).distance(Point(_endPt[0], _endPt[1])) < toler)): |
|
712 |
if self.connectors[0].connectedItem is None and \ |
|
713 |
((Point(startPt[0], startPt[1]).distance(Point(_endPt[0], _endPt[1])) < toler)): |
|
713 | 714 |
self.connectors[0].connect(obj) |
714 | 715 |
obj.connectors[1].connect(self) |
715 | 716 |
res.append(obj) |
716 |
elif self.connectors[1].connectedItem is None and ((Point(endPt[0], endPt[1]).distance(Point(_endPt[0], _endPt[1])) < toler)): |
|
717 |
elif self.connectors[1].connectedItem is None and \ |
|
718 |
((Point(endPt[0], endPt[1]).distance(Point(_endPt[0], _endPt[1])) < toler)): |
|
717 | 719 |
self.connectors[1].connect(obj) |
718 | 720 |
obj.connectors[1].connect(self) |
719 | 721 |
res.append(obj) |
DTI_PID/DTI_PID/UI/Validation.ui | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<ui version="4.0"> |
|
3 |
<class>ValidationDialog</class> |
|
4 |
<widget class="QDialog" name="ValidationDialog"> |
|
5 |
<property name="geometry"> |
|
6 |
<rect> |
|
7 |
<x>0</x> |
|
8 |
<y>0</y> |
|
9 |
<width>647</width> |
|
10 |
<height>467</height> |
|
11 |
</rect> |
|
12 |
</property> |
|
13 |
<property name="windowTitle"> |
|
14 |
<string>Validation</string> |
|
15 |
</property> |
|
16 |
<layout class="QGridLayout" name="gridLayout_2"> |
|
17 |
<item row="1" column="0"> |
|
18 |
<widget class="QGroupBox" name="groupBox"> |
|
19 |
<property name="title"> |
|
20 |
<string>Custom Rules</string> |
|
21 |
</property> |
|
22 |
<layout class="QGridLayout" name="gridLayout_4"> |
|
23 |
<item row="0" column="0"> |
|
24 |
<layout class="QGridLayout" name="gridLayout_3"> |
|
25 |
<item row="0" column="1"> |
|
26 |
<widget class="QPushButton" name="pushButtonAddRule"> |
|
27 |
<property name="maximumSize"> |
|
28 |
<size> |
|
29 |
<width>32</width> |
|
30 |
<height>32</height> |
|
31 |
</size> |
|
32 |
</property> |
|
33 |
<property name="text"> |
|
34 |
<string>+</string> |
|
35 |
</property> |
|
36 |
</widget> |
|
37 |
</item> |
|
38 |
<item row="0" column="0"> |
|
39 |
<widget class="QLineEdit" name="lineEditRuleName"/> |
|
40 |
</item> |
|
41 |
<item row="0" column="2"> |
|
42 |
<widget class="QPushButton" name="pushButton_2"> |
|
43 |
<property name="maximumSize"> |
|
44 |
<size> |
|
45 |
<width>32</width> |
|
46 |
<height>32</height> |
|
47 |
</size> |
|
48 |
</property> |
|
49 |
<property name="text"> |
|
50 |
<string>-</string> |
|
51 |
</property> |
|
52 |
</widget> |
|
53 |
</item> |
|
54 |
<item row="1" column="0" colspan="3"> |
|
55 |
<widget class="QTableWidget" name="tableWidget"/> |
|
56 |
</item> |
|
57 |
</layout> |
|
58 |
</item> |
|
59 |
</layout> |
|
60 |
</widget> |
|
61 |
</item> |
|
62 |
<item row="2" column="0"> |
|
63 |
<widget class="QDialogButtonBox" name="buttonBox"> |
|
64 |
<property name="orientation"> |
|
65 |
<enum>Qt::Horizontal</enum> |
|
66 |
</property> |
|
67 |
<property name="standardButtons"> |
|
68 |
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> |
|
69 |
</property> |
|
70 |
</widget> |
|
71 |
</item> |
|
72 |
<item row="0" column="0"> |
|
73 |
<widget class="QGroupBox" name="groupBox_2"> |
|
74 |
<property name="title"> |
|
75 |
<string>Basic Rules</string> |
|
76 |
</property> |
|
77 |
<layout class="QGridLayout" name="gridLayout"> |
|
78 |
<item row="0" column="0"> |
|
79 |
<layout class="QGridLayout" name="gridLayout_5"> |
|
80 |
<property name="sizeConstraint"> |
|
81 |
<enum>QLayout::SetFixedSize</enum> |
|
82 |
</property> |
|
83 |
<item row="2" column="0"> |
|
84 |
<widget class="QCheckBox" name="checkBoxSizeError"> |
|
85 |
<property name="enabled"> |
|
86 |
<bool>false</bool> |
|
87 |
</property> |
|
88 |
<property name="text"> |
|
89 |
<string>check graphic size error</string> |
|
90 |
</property> |
|
91 |
<property name="checked"> |
|
92 |
<bool>true</bool> |
|
93 |
</property> |
|
94 |
</widget> |
|
95 |
</item> |
|
96 |
<item row="1" column="0"> |
|
97 |
<widget class="QCheckBox" name="checkBoxAssociationError"> |
|
98 |
<property name="enabled"> |
|
99 |
<bool>false</bool> |
|
100 |
</property> |
|
101 |
<property name="text"> |
|
102 |
<string>check association error</string> |
|
103 |
</property> |
|
104 |
<property name="checked"> |
|
105 |
<bool>true</bool> |
|
106 |
</property> |
|
107 |
</widget> |
|
108 |
</item> |
|
109 |
<item row="6" column="0"> |
|
110 |
<widget class="QCheckBox" name="checkBoxDisconnectionError"> |
|
111 |
<property name="enabled"> |
|
112 |
<bool>false</bool> |
|
113 |
</property> |
|
114 |
<property name="text"> |
|
115 |
<string>check disconnection error</string> |
|
116 |
</property> |
|
117 |
<property name="checked"> |
|
118 |
<bool>true</bool> |
|
119 |
</property> |
|
120 |
</widget> |
|
121 |
</item> |
|
122 |
<item row="3" column="0"> |
|
123 |
<widget class="QCheckBox" name="checkBoxDuplicatedConnectionError"> |
|
124 |
<property name="enabled"> |
|
125 |
<bool>false</bool> |
|
126 |
</property> |
|
127 |
<property name="text"> |
|
128 |
<string>check duplicated connection error</string> |
|
129 |
</property> |
|
130 |
<property name="checked"> |
|
131 |
<bool>true</bool> |
|
132 |
</property> |
|
133 |
</widget> |
|
134 |
</item> |
|
135 |
<item row="4" column="0"> |
|
136 |
<widget class="QCheckBox" name="checkBoxLineTypeError"> |
|
137 |
<property name="enabled"> |
|
138 |
<bool>false</bool> |
|
139 |
</property> |
|
140 |
<property name="text"> |
|
141 |
<string>check line type error</string> |
|
142 |
</property> |
|
143 |
<property name="checked"> |
|
144 |
<bool>true</bool> |
|
145 |
</property> |
|
146 |
</widget> |
|
147 |
</item> |
|
148 |
<item row="5" column="0"> |
|
149 |
<widget class="QCheckBox" name="checkBoxFlowDirectionError"> |
|
150 |
<property name="enabled"> |
|
151 |
<bool>false</bool> |
|
152 |
</property> |
|
153 |
<property name="text"> |
|
154 |
<string>check flow direction error</string> |
|
155 |
</property> |
|
156 |
<property name="checked"> |
|
157 |
<bool>true</bool> |
|
158 |
</property> |
|
159 |
</widget> |
|
160 |
</item> |
|
161 |
<item row="0" column="0"> |
|
162 |
<widget class="QCheckBox" name="checkBoxSpecBreakError"> |
|
163 |
<property name="enabled"> |
|
164 |
<bool>false</bool> |
|
165 |
</property> |
|
166 |
<property name="text"> |
|
167 |
<string>check specbreak error</string> |
|
168 |
</property> |
|
169 |
<property name="checked"> |
|
170 |
<bool>true</bool> |
|
171 |
</property> |
|
172 |
</widget> |
|
173 |
</item> |
|
174 |
</layout> |
|
175 |
</item> |
|
176 |
</layout> |
|
177 |
</widget> |
|
178 |
</item> |
|
179 |
</layout> |
|
180 |
</widget> |
|
181 |
<resources/> |
|
182 |
<connections> |
|
183 |
<connection> |
|
184 |
<sender>buttonBox</sender> |
|
185 |
<signal>accepted()</signal> |
|
186 |
<receiver>ValidationDialog</receiver> |
|
187 |
<slot>accept()</slot> |
|
188 |
<hints> |
|
189 |
<hint type="sourcelabel"> |
|
190 |
<x>248</x> |
|
191 |
<y>254</y> |
|
192 |
</hint> |
|
193 |
<hint type="destinationlabel"> |
|
194 |
<x>157</x> |
|
195 |
<y>274</y> |
|
196 |
</hint> |
|
197 |
</hints> |
|
198 |
</connection> |
|
199 |
<connection> |
|
200 |
<sender>buttonBox</sender> |
|
201 |
<signal>rejected()</signal> |
|
202 |
<receiver>ValidationDialog</receiver> |
|
203 |
<slot>reject()</slot> |
|
204 |
<hints> |
|
205 |
<hint type="sourcelabel"> |
|
206 |
<x>316</x> |
|
207 |
<y>260</y> |
|
208 |
</hint> |
|
209 |
<hint type="destinationlabel"> |
|
210 |
<x>286</x> |
|
211 |
<y>274</y> |
|
212 |
</hint> |
|
213 |
</hints> |
|
214 |
</connection> |
|
215 |
</connections> |
|
216 |
</ui> |
DTI_PID/DTI_PID/UI/Validation_UI.py | ||
---|---|---|
1 |
# -*- coding: utf-8 -*- |
|
2 |
|
|
3 |
# Form implementation generated from reading ui file '.\UI\Validation.ui' |
|
4 |
# |
|
5 |
# Created by: PyQt5 UI code generator 5.13.0 |
|
6 |
# |
|
7 |
# WARNING! All changes made in this file will be lost! |
|
8 |
|
|
9 |
|
|
10 |
from PyQt5 import QtCore, QtGui, QtWidgets |
|
11 |
|
|
12 |
|
|
13 |
class Ui_ValidationDialog(object): |
|
14 |
def setupUi(self, ValidationDialog): |
|
15 |
ValidationDialog.setObjectName("ValidationDialog") |
|
16 |
ValidationDialog.resize(647, 467) |
|
17 |
self.gridLayout_2 = QtWidgets.QGridLayout(ValidationDialog) |
|
18 |
self.gridLayout_2.setObjectName("gridLayout_2") |
|
19 |
self.groupBox = QtWidgets.QGroupBox(ValidationDialog) |
|
20 |
self.groupBox.setObjectName("groupBox") |
|
21 |
self.gridLayout_4 = QtWidgets.QGridLayout(self.groupBox) |
|
22 |
self.gridLayout_4.setObjectName("gridLayout_4") |
|
23 |
self.gridLayout_3 = QtWidgets.QGridLayout() |
|
24 |
self.gridLayout_3.setObjectName("gridLayout_3") |
|
25 |
self.pushButtonAddRule = QtWidgets.QPushButton(self.groupBox) |
|
26 |
self.pushButtonAddRule.setMaximumSize(QtCore.QSize(32, 32)) |
|
27 |
self.pushButtonAddRule.setObjectName("pushButtonAddRule") |
|
28 |
self.gridLayout_3.addWidget(self.pushButtonAddRule, 0, 1, 1, 1) |
|
29 |
self.lineEditRuleName = QtWidgets.QLineEdit(self.groupBox) |
|
30 |
self.lineEditRuleName.setObjectName("lineEditRuleName") |
|
31 |
self.gridLayout_3.addWidget(self.lineEditRuleName, 0, 0, 1, 1) |
|
32 |
self.pushButton_2 = QtWidgets.QPushButton(self.groupBox) |
|
33 |
self.pushButton_2.setMaximumSize(QtCore.QSize(32, 32)) |
|
34 |
self.pushButton_2.setObjectName("pushButton_2") |
|
35 |
self.gridLayout_3.addWidget(self.pushButton_2, 0, 2, 1, 1) |
|
36 |
self.tableWidget = QtWidgets.QTableWidget(self.groupBox) |
|
37 |
self.tableWidget.setObjectName("tableWidget") |
|
38 |
self.tableWidget.setColumnCount(0) |
|
39 |
self.tableWidget.setRowCount(0) |
|
40 |
self.gridLayout_3.addWidget(self.tableWidget, 1, 0, 1, 3) |
|
41 |
self.gridLayout_4.addLayout(self.gridLayout_3, 0, 0, 1, 1) |
|
42 |
self.gridLayout_2.addWidget(self.groupBox, 1, 0, 1, 1) |
|
43 |
self.buttonBox = QtWidgets.QDialogButtonBox(ValidationDialog) |
|
44 |
self.buttonBox.setOrientation(QtCore.Qt.Horizontal) |
|
45 |
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) |
|
46 |
self.buttonBox.setObjectName("buttonBox") |
|
47 |
self.gridLayout_2.addWidget(self.buttonBox, 2, 0, 1, 1) |
|
48 |
self.groupBox_2 = QtWidgets.QGroupBox(ValidationDialog) |
|
49 |
self.groupBox_2.setObjectName("groupBox_2") |
|
50 |
self.gridLayout = QtWidgets.QGridLayout(self.groupBox_2) |
|
51 |
self.gridLayout.setObjectName("gridLayout") |
|
52 |
self.gridLayout_5 = QtWidgets.QGridLayout() |
|
53 |
self.gridLayout_5.setSizeConstraint(QtWidgets.QLayout.SetFixedSize) |
|
54 |
self.gridLayout_5.setObjectName("gridLayout_5") |
|
55 |
self.checkBoxSizeError = QtWidgets.QCheckBox(self.groupBox_2) |
|
56 |
self.checkBoxSizeError.setEnabled(False) |
|
57 |
self.checkBoxSizeError.setChecked(True) |
|
58 |
self.checkBoxSizeError.setObjectName("checkBoxSizeError") |
|
59 |
self.gridLayout_5.addWidget(self.checkBoxSizeError, 2, 0, 1, 1) |
|
60 |
self.checkBoxAssociationError = QtWidgets.QCheckBox(self.groupBox_2) |
|
61 |
self.checkBoxAssociationError.setEnabled(False) |
|
62 |
self.checkBoxAssociationError.setChecked(True) |
|
63 |
self.checkBoxAssociationError.setObjectName("checkBoxAssociationError") |
|
64 |
self.gridLayout_5.addWidget(self.checkBoxAssociationError, 1, 0, 1, 1) |
|
65 |
self.checkBoxDisconnectionError = QtWidgets.QCheckBox(self.groupBox_2) |
|
66 |
self.checkBoxDisconnectionError.setEnabled(False) |
|
67 |
self.checkBoxDisconnectionError.setChecked(True) |
|
68 |
self.checkBoxDisconnectionError.setObjectName("checkBoxDisconnectionError") |
|
69 |
self.gridLayout_5.addWidget(self.checkBoxDisconnectionError, 6, 0, 1, 1) |
|
70 |
self.checkBoxDuplicatedConnectionError = QtWidgets.QCheckBox(self.groupBox_2) |
|
71 |
self.checkBoxDuplicatedConnectionError.setEnabled(False) |
|
72 |
self.checkBoxDuplicatedConnectionError.setChecked(True) |
|
73 |
self.checkBoxDuplicatedConnectionError.setObjectName("checkBoxDuplicatedConnectionError") |
|
74 |
self.gridLayout_5.addWidget(self.checkBoxDuplicatedConnectionError, 3, 0, 1, 1) |
|
75 |
self.checkBoxLineTypeError = QtWidgets.QCheckBox(self.groupBox_2) |
|
76 |
self.checkBoxLineTypeError.setEnabled(False) |
|
77 |
self.checkBoxLineTypeError.setChecked(True) |
|
78 |
self.checkBoxLineTypeError.setObjectName("checkBoxLineTypeError") |
|
79 |
self.gridLayout_5.addWidget(self.checkBoxLineTypeError, 4, 0, 1, 1) |
|
80 |
self.checkBoxFlowDirectionError = QtWidgets.QCheckBox(self.groupBox_2) |
|
81 |
self.checkBoxFlowDirectionError.setEnabled(False) |
|
82 |
self.checkBoxFlowDirectionError.setChecked(True) |
|
83 |
self.checkBoxFlowDirectionError.setObjectName("checkBoxFlowDirectionError") |
|
84 |
self.gridLayout_5.addWidget(self.checkBoxFlowDirectionError, 5, 0, 1, 1) |
|
85 |
self.checkBoxSpecBreakError = QtWidgets.QCheckBox(self.groupBox_2) |
|
86 |
self.checkBoxSpecBreakError.setEnabled(False) |
|
87 |
self.checkBoxSpecBreakError.setChecked(True) |
|
88 |
self.checkBoxSpecBreakError.setObjectName("checkBoxSpecBreakError") |
|
89 |
self.gridLayout_5.addWidget(self.checkBoxSpecBreakError, 0, 0, 1, 1) |
|
90 |
self.gridLayout.addLayout(self.gridLayout_5, 0, 0, 1, 1) |
|
91 |
self.gridLayout_2.addWidget(self.groupBox_2, 0, 0, 1, 1) |
|
92 |
|
|
93 |
self.retranslateUi(ValidationDialog) |
|
94 |
self.buttonBox.accepted.connect(ValidationDialog.accept) |
|
95 |
self.buttonBox.rejected.connect(ValidationDialog.reject) |
|
96 |
QtCore.QMetaObject.connectSlotsByName(ValidationDialog) |
|
97 |
|
|
98 |
def retranslateUi(self, ValidationDialog): |
|
99 |
_translate = QtCore.QCoreApplication.translate |
|
100 |
ValidationDialog.setWindowTitle(_translate("ValidationDialog", "Validation")) |
|
101 |
self.groupBox.setTitle(_translate("ValidationDialog", "Custom Rules")) |
|
102 |
self.pushButtonAddRule.setText(_translate("ValidationDialog", "+")) |
|
103 |
self.pushButton_2.setText(_translate("ValidationDialog", "-")) |
|
104 |
self.groupBox_2.setTitle(_translate("ValidationDialog", "Basic Rules")) |
|
105 |
self.checkBoxSizeError.setText(_translate("ValidationDialog", "check graphic size error")) |
|
106 |
self.checkBoxAssociationError.setText(_translate("ValidationDialog", "check association error")) |
|
107 |
self.checkBoxDisconnectionError.setText(_translate("ValidationDialog", "check disconnection error")) |
|
108 |
self.checkBoxDuplicatedConnectionError.setText(_translate("ValidationDialog", "check duplicated connection error")) |
|
109 |
self.checkBoxLineTypeError.setText(_translate("ValidationDialog", "check line type error")) |
|
110 |
self.checkBoxFlowDirectionError.setText(_translate("ValidationDialog", "check flow direction error")) |
|
111 |
self.checkBoxSpecBreakError.setText(_translate("ValidationDialog", "check specbreak error")) |
DTI_PID/DTI_PID/ValidationDialog.py | ||
---|---|---|
1 |
# coding: utf-8 |
|
2 |
""" This is OPC Relation dialog module """ |
|
3 |
|
|
4 |
import os |
|
5 |
import sys |
|
6 |
from PyQt5.QtCore import * |
|
7 |
from PyQt5.QtGui import * |
|
8 |
from PyQt5.QtWidgets import * |
|
9 |
from AppDocData import AppDocData, MessageType |
|
10 |
|
|
11 |
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), 'UI')) |
|
12 |
import Validation_UI |
|
13 |
|
|
14 |
|
|
15 |
class QValidationDialog(QDialog): |
|
16 |
""" This Validation dialog class """ |
|
17 |
|
|
18 |
def __init__(self, parent): |
|
19 |
QDialog.__init__(self, parent) |
|
20 |
|
|
21 |
self.ui = Validation_UI.Ui_ValidationDialog() |
|
22 |
self.ui.setupUi(self) |
|
23 |
|
|
24 |
def accept(self): |
|
25 |
QDialog.accept(self) |
내보내기 Unified diff