개정판 2439c9aa
issue #1171: add spec break necessity on validation, fix sym attribute editor
Change-Id: Ia9ef71392edeb5e8830b405e1469db2771a974fe
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
2046 | 2046 |
|
2047 | 2047 |
for attr in attrs: |
2048 | 2048 |
sql = self.project.database.to_sql( |
2049 |
'insert into SymbolAttribute(UID, SymbolType_UID, Attribute, DisplayAttribute, AttributeType, AttrAt, Expression, Target, [index]) values(?, ?, ?, ?, ?, ?, ?, ?, ?)')
|
|
2049 |
'insert into SymbolAttribute(UID, SymbolType_UID, Attribute, DisplayAttribute, AttributeType, AttrAt, Expression, Target, [index], [Property]) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)')
|
|
2050 | 2050 |
attr.insert(1, type) |
2051 | 2051 |
cursor.execute(sql, tuple(attr)) |
2052 | 2052 |
|
DTI_PID/DTI_PID/Commands/ValidateCommand.py | ||
---|---|---|
4 | 4 |
import os.path |
5 | 5 |
import AbstractCommand |
6 | 6 |
try: |
7 |
from PyQt5.QtCore import Qt, QPointF, QRectF, pyqtSignal, QT_VERSION_STR
|
|
8 |
from PyQt5.QtGui import QApplication, QImage, QPixmap, QPainterPath, QCursor
|
|
9 |
from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog
|
|
7 |
from PyQt5.QtCore import *
|
|
8 |
from PyQt5.QtGui import *
|
|
9 |
from PyQt5.QtWidgets import *
|
|
10 | 10 |
except ImportError: |
11 | 11 |
try: |
12 | 12 |
from PyQt4.QtCore import Qt, QPointF, QRectF, pyqtSignal, QT_VERSION_STR |
... | ... | |
24 | 24 |
from EngineeringLineItem import QEngineeringLineItem |
25 | 25 |
from EngineeringLineNoTextItem import QEngineeringLineNoTextItem |
26 | 26 |
from SymbolSvgItem import SymbolSvgItem |
27 |
#from AppDocData import AppDocData
|
|
27 |
from AppDocData import AppDocData |
|
28 | 28 |
|
29 | 29 |
QApplication.setOverrideCursor(Qt.WaitCursor) |
30 |
_translate = QCoreApplication.translate |
|
30 | 31 |
|
31 | 32 |
errors = [] |
32 | 33 |
try: |
... | ... | |
36 | 37 |
errors.extend(item.validate()) |
37 | 38 |
|
38 | 39 |
# check line no spec change |
39 |
#appDocData = AppDocData.instance() |
|
40 |
appDocData = AppDocData.instance() |
|
41 |
specBreakAttrs = [attr.Attribute for attr in appDocData.getSymbolAttribute('Segment Breaks') if attr.Target == 'ALL' and attr.AttributeType == 'Spec'] |
|
42 |
dataPath = appDocData.getErrorItemSvgPath() |
|
40 | 43 |
#lineProps = appDocData.getLineProperties() |
41 | 44 |
|
42 | 45 |
line_ends = [] |
43 | 46 |
for lineNo in [lineNo for lineNo in param if type(lineNo) is QEngineeringLineNoTextItem]: |
44 |
line_ends.append(lineNo.prop('From')) if lineNo.prop('From') is not None else None |
|
45 |
line_ends.append(lineNo.prop('To')) if lineNo.prop('To') is not None else None |
|
47 |
#line_ends.append(lineNo.prop('From')) if lineNo.prop('From') is not None else None |
|
48 |
#line_ends.append(lineNo.prop('To')) if lineNo.prop('To') is not None else None |
|
49 |
for run in lineNo.runs: |
|
50 |
line_ends.append(run.items[0]) if issubclass(type(run.items[0]), SymbolSvgItem) or (type(run.items[0]) is QEngineeringLineItem and (run.items[0].lineType == 'Secondary' or run.items[0].lineType == 'Primary')) else None |
|
51 |
if run.items[0] is not run.items[-1]: |
|
52 |
line_ends.append(run.items[-1]) if issubclass(type(run.items[-1]), SymbolSvgItem) or (type(run.items[-1]) is QEngineeringLineItem and (run.items[-1].lineType == 'Secondary' or run.items[-1].lineType == 'Primary')) else None |
|
46 | 53 |
|
47 | 54 |
spec_break = [] |
48 | 55 |
for line_end in line_ends: |
49 | 56 |
for connector in line_end.connectors: |
50 | 57 |
if connector.connectedItem is not None and type(connector.connectedItem.owner) is QEngineeringLineNoTextItem and connector.connectedItem.owner is not line_end.owner: |
51 |
for prop, value in line_end.owner.getAttributes().items():
|
|
58 |
for prop, value in [[prop, value] for prop, value in line_end.owner.getAttributes().items() if prop.Attribute in specBreakAttrs]:
|
|
52 | 59 |
done = False |
53 |
for prop2, value2 in connector.connectedItem.owner.getAttributes().items():
|
|
60 |
for prop2, value2 in [[prop2, value2] for prop2, value2 in connector.connectedItem.owner.getAttributes().items() if prop2.Attribute in specBreakAttrs]:
|
|
54 | 61 |
if str(prop.UID) == str(prop2.UID) and value != value2: |
55 | 62 |
spec_break.append([line_end, connector.connectedItem]) |
56 | 63 |
done = True |
... | ... | |
75 | 82 |
dupl = list(set([(indexSet[1]) for indexSet in list(dupl)])) |
76 | 83 |
dupl.sort(reverse=True) |
77 | 84 |
for index in dupl: |
78 |
end_breaks.pop(index) |
|
79 |
print(spec_break) |
|
85 |
spec_break.pop(index) |
|
86 |
|
|
87 |
for spec in spec_break: |
|
88 |
for connector in spec[0].connectors: |
|
89 |
if connector.connectedItem is spec[1]: |
|
90 |
error = SymbolSvgItem.createItem('Error', dataPath) |
|
91 |
error.setPosition(connector.center()) |
|
92 |
error.parent = self |
|
93 |
error.msg = _translate('may need spec break', 'may need spec break') |
|
94 |
error.setToolTip(error.msg) |
|
95 |
error.area = 'Drawing' |
|
96 |
error.name = 'Error' |
|
97 |
errors.append(error) |
|
80 | 98 |
|
81 | 99 |
finally: |
82 | 100 |
QApplication.restoreOverrideCursor() |
DTI_PID/DTI_PID/Scripts/MSSQL/ID2.sql | ||
---|---|---|
3558 | 3558 |
UID VARCHAR (37) PRIMARY KEY, |
3559 | 3559 |
Components_UID VARCHAR (37) NOT NULL |
3560 | 3560 |
REFERENCES Components (UID), |
3561 |
SymbolAttribute_UID VARCHAR (37) NOT NULL |
|
3562 |
REFERENCES SymbolAttribute (UID), |
|
3561 |
SymbolAttribute_UID VARCHAR (37) NOT NULL, |
|
3563 | 3562 |
Value TEXT, |
3564 | 3563 |
Association_UID VARCHAR (37) NULL, |
3565 | 3564 |
Freeze VARCHAR (37) NULL, |
DTI_PID/DTI_PID/SymbolAttrEditorDialog.py | ||
---|---|---|
202 | 202 |
attr.append(table.item(index, 0).text() if table.item(index, 0) is not None else '') |
203 | 203 |
attr.append(table.item(index, 1).text() if table.item(index, 1) is not None else '') |
204 | 204 |
attr.append(table.item(index, 2).text() if table.item(index, 2) is not None else '') |
205 |
attr.append(table.cellWidget(index, 3).currentText()) if table.cellWidget(index, 3) else attr.append(table.item(index, 1).text())
|
|
205 |
attr.append(table.cellWidget(index, 3).currentText() if table.cellWidget(index, 3) else table.item(index, 3).text())#attr.append(table.item(index, 1).text())
|
|
206 | 206 |
attr.append(table.item(index, 4).text() if table.item(index, 4) is not None else '') # Attribute At |
207 | 207 |
attr.append(table.item(index, 5).text() if table.item(index, 5) is not None else '') # Expression |
208 | 208 |
attr.append(table.item(index, 6).tag if table.item(index, 6).tag is not None else 'ALL') # Target |
209 | 209 |
attr.append(index) |
210 |
attr.append(table.item(index, 0).tag.IsProp) |
|
210 | 211 |
attrs.append(attr) |
211 | 212 |
|
212 | 213 |
appDocData.saveSymbolAttributes(self.currentTypeId, attrs) |
... | ... | |
287 | 288 |
item = QTableWidgetItem(attr.UID if attr.UID is not None else '') |
288 | 289 |
self.ui.tableWidgetAttr.setItem(row, 0, item) |
289 | 290 |
item = QTableWidgetItem(attr.Attribute if attr.Attribute is not None else '') |
291 |
#item.setFlags(Qt.ItemIsEnabled) |
|
290 | 292 |
self.ui.tableWidgetAttr.setItem(row, 1, item) |
291 | 293 |
item = QTableWidgetItem(attr.DisplayAttribute if attr.DisplayAttribute is not None else '') |
292 | 294 |
self.ui.tableWidgetAttr.setItem(row, 2, item) |
DTI_PID/DTI_PID/SymbolAttrTargetDialog.py | ||
---|---|---|
81 | 81 |
self.isAccepted = True |
82 | 82 |
QDialog.accept(self) |
83 | 83 |
else: |
84 |
self.target = '' |
|
85 |
checked = False |
|
84 |
self.target = [] |
|
86 | 85 |
for row in range(self.ui.tableWidget.rowCount()): |
87 | 86 |
if int(self.ui.tableWidget.item(row, 1).checkState()) is int(Qt.Checked): |
88 |
self.target += str(self.ui.tableWidget.item(row, 1).tag) + ',' |
|
89 |
checked = True |
|
90 |
if checked: |
|
91 |
self.target = self.target[:-1] |
|
92 |
self.isAccepted = True |
|
93 |
QDialog.accept(self) |
|
94 |
else: |
|
95 |
return |
|
87 |
self.target.append(str(self.ui.tableWidget.item(row, 1).tag)) |
|
88 |
|
|
89 |
self.target = ','.join(self.target) |
|
90 |
self.isAccepted = True |
|
91 |
QDialog.accept(self) |
|
96 | 92 |
|
97 | 93 |
except Exception as ex: |
98 | 94 |
from App import App |
내보내기 Unified diff