개정판 477b7622
issue #1171: add missing data and fix attr, prop, fix spec break
Change-Id: I1aced96f832cd41dd1d3dbdff841b5c7faf18f39
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
2073 | 2073 |
cursor = conn.cursor() if self.project.database.db_type == 'SQLite' else conn.cursor(as_dict=True) |
2074 | 2074 |
|
2075 | 2075 |
sql = "select * from [Attributes] a \ |
2076 |
join SymbolAttribute b on a.SymbolAttribute_UID=b.UID where a.Components_UID='{}' order by a.Components_UID,b.Property".format(component)
|
|
2076 |
join SymbolAttribute b on a.SymbolAttribute_UID=b.UID where a.Components_UID='{}' order by a.Components_UID,b.[index]".format(component)
|
|
2077 | 2077 |
cursor.execute(sql) |
2078 | 2078 |
return cursor.fetchall() |
2079 | 2079 |
# Catch the exception |
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
1172 | 1172 |
self.progress.show() |
1173 | 1173 |
## Load data on xml |
1174 | 1174 |
path = os.path.join(appDocData.getCurrentProject().getTempPath(), appDocData.imgName + '.xml') |
1175 |
if False:#os.path.isfile(path):
|
|
1175 |
if os.path.isfile(path): |
|
1176 | 1176 |
self.loadRecognitionResultFromXml(path) |
1177 | 1177 |
else: |
1178 | 1178 |
self.load_drawing(appDocData.activeDrawing) |
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py | ||
---|---|---|
466 | 466 |
res.append((sql, tuple(param))) |
467 | 467 |
|
468 | 468 |
cols = ['UID', 'Drawings_UID', 'Symbol_UID', 'X', 'Y', 'Width', 'Height', 'Rotation', 'Area', 'Owner', 'Connected', '[Supplied By]', \ |
469 |
'SpecialItemTypes_UID', 'OriginIndex'] |
|
470 |
values = ['?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?'] |
|
469 |
'SpecialItemTypes_UID', 'OriginIndex', '[From]', '[To]', '[Freeze]', '[Connected Item]']
|
|
470 |
values = ['?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?']
|
|
471 | 471 |
param = [(str(self.uid), str(appDocData.activeDrawing.UID), self.dbUid, self.loc[0], self.loc[1], self.size[0], self.size[1], self.angle, |
472 | 472 |
self.area, str(self.owner) if self.owner else None, \ |
473 | 473 |
str(self.conns[0]) if self.conns else None, \ |
474 | 474 |
self.prop('Supplied By'), \ |
475 |
str(self.special_item_type) if self.special_item_type else None,\ |
|
476 |
self.currentPointModeIndex)] |
|
475 |
str(self.special_item_type) if self.special_item_type else None, \ |
|
476 |
self.currentPointModeIndex, \ |
|
477 |
self.prop('From'),\ |
|
478 |
self.prop('To'),\ |
|
479 |
self.prop('Freeze'),\ |
|
480 |
str(self.prop('Connected Item')) if self.prop('Connected Item') else None)] |
|
477 | 481 |
sql = 'insert into Components({}) values({})'.format(','.join(cols), ','.join(values)) |
478 | 482 |
res.append((sql, tuple(param))) |
479 | 483 |
|
480 | 484 |
_attrs = self.getAttributes() |
481 | 485 |
if _attrs: |
482 |
cols = ['UID', 'Components_UID', 'SymbolAttribute_UID', 'Value'] |
|
483 |
values = ['?', '?', '?', '?'] |
|
486 |
cols = ['UID', 'Components_UID', 'SymbolAttribute_UID', 'Value', 'Association_UID', 'Freeze']
|
|
487 |
values = ['?', '?', '?', '?', '?', '?']
|
|
484 | 488 |
params = [] |
485 | 489 |
for key in _attrs.keys(): |
486 |
params.append((str(uuid.uuid4()), str(self.uid), str(key.UID), str(_attrs[key]))) |
|
490 |
params.append((str(uuid.uuid4()), str(self.uid), str(key.UID), str(_attrs[key]), str(key.AssocItem), str(key.Freeze)))
|
|
487 | 491 |
sql = 'insert into Attributes({}) values({})'.format(','.join(cols), ','.join(values)) |
488 | 492 |
res.append((sql, tuple(params))) |
489 | 493 |
|
... | ... | |
1292 | 1296 |
return None |
1293 | 1297 |
|
1294 | 1298 |
for key in item._properties.keys(): |
1295 |
if key.Attribute in component: |
|
1296 |
item._properties[key] = key.parse_value(component[key.Attribute]) if component[key.Attribute] else '' |
|
1299 |
for compo in component.keys(): |
|
1300 |
if key.Attribute == compo: |
|
1301 |
item._properties[key] = key.parse_value(component[key.Attribute]) if component[key.Attribute] else '' |
|
1297 | 1302 |
|
1298 | 1303 |
## assign area |
1299 | 1304 |
areaNode = component['Area'] |
DTI_PID/DTI_PID/SymbolAttr.py | ||
---|---|---|
138 | 138 |
|
139 | 139 |
attr = SymbolAttr() |
140 | 140 |
attr.UID = uuid.UUID(record['UID'], version=4) |
141 |
#attr.Freeze = record['Freeze'] == 'True' if record['Freeze'] else False
|
|
141 |
attr.Freeze = record['Freeze'] == 'True' if record['Freeze'] else False |
|
142 | 142 |
attr.Attribute = record['Attribute'] |
143 | 143 |
attr.DisplayAttribute = record['DisplayAttribute'] |
144 | 144 |
attr.AttributeType = record['AttributeType'] |
... | ... | |
146 | 146 |
attr.Expression = record['Expression'] |
147 | 147 |
attr.Length = record['Length'] if 'Length' in record else 0 |
148 | 148 |
attr.IsProp = int(record['Property']) if record['Property'] else 0 |
149 |
attr.AssocItem = uuid.UUID(record['Association_UID'], version=4) if record['Association_UID'] and record['Association_UID'] != 'None' else None |
|
149 | 150 |
|
150 | 151 |
return attr |
151 | 152 |
|
내보내기 Unified diff