개정판 af38e657
issue #1176: validation command will consider spec break and db save fix
Change-Id: I9fd78f14bc55b9ecbe00a3a37aef9dad5dab52c9
DTI_PID/DTI_PID/Commands/ValidateCommand.py | ||
---|---|---|
22 | 22 |
def execute(self, param): |
23 | 23 |
""" valite all items in scene """ |
24 | 24 |
from EngineeringLineItem import QEngineeringLineItem |
25 |
from EngineeringLineNoTextItem import QEngineeringLineNoTextItem |
|
25 | 26 |
from SymbolSvgItem import SymbolSvgItem |
27 |
#from AppDocData import AppDocData |
|
26 | 28 |
|
27 | 29 |
QApplication.setOverrideCursor(Qt.WaitCursor) |
28 | 30 |
|
29 | 31 |
errors = [] |
30 | 32 |
try: |
33 |
# item validation check |
|
31 | 34 |
for item in param: |
32 | 35 |
if type(item) is QEngineeringLineItem or issubclass(type(item), SymbolSvgItem): |
33 | 36 |
errors.extend(item.validate()) |
37 |
|
|
38 |
# check line no spec change |
|
39 |
#appDocData = AppDocData.instance() |
|
40 |
#lineProps = appDocData.getLineProperties() |
|
41 |
|
|
42 |
line_ends = [] |
|
43 |
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 |
|
46 |
|
|
47 |
spec_break = [] |
|
48 |
for line_end in line_ends: |
|
49 |
for connector in line_end.connectors: |
|
50 |
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(): |
|
52 |
done = False |
|
53 |
for prop2, value2 in connector.connectedItem.owner.getAttributes().items(): |
|
54 |
if str(prop.UID) == str(prop2.UID) and value != value2: |
|
55 |
spec_break.append([line_end, connector.connectedItem]) |
|
56 |
done = True |
|
57 |
break |
|
58 |
if done: |
|
59 |
break |
|
60 |
|
|
61 |
if spec_break: |
|
62 |
# check dulplication |
|
63 |
dupl = set() |
|
64 |
for i in range(len(spec_break)): |
|
65 |
for j in range(len(spec_break)): |
|
66 |
if i == j: continue |
|
67 |
else: |
|
68 |
setI = set(spec_break[i]) |
|
69 |
setJ = set(spec_break[j]) |
|
70 |
if not (setI - setJ): |
|
71 |
index = [i, j] |
|
72 |
index.sort() |
|
73 |
index = tuple(index) |
|
74 |
dupl.add(index) |
|
75 |
dupl = list(set([(indexSet[1]) for indexSet in list(dupl)])) |
|
76 |
dupl.sort(reverse=True) |
|
77 |
for index in dupl: |
|
78 |
end_breaks.pop(index) |
|
79 |
print(spec_break) |
|
80 |
|
|
34 | 81 |
finally: |
35 | 82 |
QApplication.restoreOverrideCursor() |
36 | 83 |
|
DTI_PID/DTI_PID/LineNoTracer.py | ||
---|---|---|
539 | 539 |
for line_end in lineNo_froms + lineNo_tos: |
540 | 540 |
#print(type(line_end)) |
541 | 541 |
for connector in line_end.connectors: |
542 |
if connector.connectedItem is not None and connector.connectedItem.owner is not line_end.owner: |
|
542 |
if connector.connectedItem is not None and type(connector.connectedItem.owner) is QEngineeringLineNoTextItem and connector.connectedItem.owner is not line_end.owner:
|
|
543 | 543 |
end_break = SymbolSvgItem.createItem(symbol.getType(), svgFilePath) |
544 | 544 |
pt = [connector.center()[0] - float(symbol.getOriginalPoint().split(',')[0]), connector.center()[1] - float(symbol.getOriginalPoint().split(',')[1])] |
545 | 545 |
origin = [0,0] |
DTI_PID/DTI_PID/Shapes/EngineeringLineNoTextItem.py | ||
---|---|---|
614 | 614 |
@author humkyung |
615 | 615 |
@date 2018.08.14 |
616 | 616 |
''' |
617 |
def toSql(self): |
|
617 |
def toSql_return_separately(self):
|
|
618 | 618 |
import uuid |
619 | 619 |
|
620 | 620 |
res = [] |
621 |
resLater = [] |
|
621 | 622 |
|
622 | 623 |
app_doc_data = AppDocData.instance() |
623 | 624 |
cols = ['UID', 'Drawings_UID', 'Symbol_UID', 'X', 'Y', 'Width', 'Height', 'Rotation', 'Value', 'Connected'] |
... | ... | |
640 | 641 |
continue |
641 | 642 |
params.append((str(uuid.uuid4()), str(self.uid), str(key.UID), str(value))) |
642 | 643 |
sql = 'insert into LineNoAttributes({}) values({})'.format(','.join(cols), ','.join(values)) |
643 |
res.append((sql, tuple(params))) |
|
644 |
resLater.append((sql, tuple(params)))
|
|
644 | 645 |
|
645 | 646 |
# insert line no's properties |
646 | 647 |
cols = ['UID', 'Components_UID', 'SymbolAttribute_UID', 'Value'] |
... | ... | |
653 | 654 |
|
654 | 655 |
_index = 0 |
655 | 656 |
for run in self.runs: |
656 |
res.extend(run.to_sql(_index, self)) |
|
657 |
resLater.extend(run.to_sql(_index, self))
|
|
657 | 658 |
_index += 1 |
658 | 659 |
|
659 |
return res |
|
660 |
return res, resLater
|
|
660 | 661 |
|
661 | 662 |
''' |
662 | 663 |
@brief return Line Data List |
DTI_PID/DTI_PID/Shapes/QEngineeringTrimLineNoTextItem.py | ||
---|---|---|
68 | 68 |
import uuid |
69 | 69 |
|
70 | 70 |
res = [] |
71 |
resLater = [] |
|
71 | 72 |
|
72 | 73 |
app_doc_data = AppDocData.instance() |
73 | 74 |
cols = ['UID', 'Drawings_UID', 'Symbol_UID'] |
... | ... | |
79 | 80 |
|
80 | 81 |
_index = 1 |
81 | 82 |
for run in self.runs: |
82 |
res.extend(run.to_sql(_index, self)) |
|
83 |
resLater.extend(run.to_sql(_index, self))
|
|
83 | 84 |
_index += 1 |
84 | 85 |
|
85 |
return res |
|
86 |
return res, resLater
|
|
86 | 87 |
|
87 | 88 |
def explode(self, dummy=None): |
88 | 89 |
from App import App |
내보내기 Unified diff