개정판 60f50aee
issue #000: save items to database
Change-Id: I2c5729c590148b6cb87290d2fa328b5f44099b7d
DTI_PID/DTI_PID/Shapes/EngineeringTextItem.py | ||
---|---|---|
646 | 646 |
values = ['?', '?', "(select UID from Symbol where Name='Text' and SymbolType_UID='-1')", '?', '?', '?', '?', '?', '?', '?', '?', '?', '?'] |
647 | 647 |
|
648 | 648 |
rect = self.sceneBoundingRect() |
649 |
param = [str(self.uid), str(appDocData.activeDrawing.UID), rect.x(), rect.y(), rect.width(), rect.height(), str(self.angle), |
|
649 |
param = [(str(self.uid), str(appDocData.activeDrawing.UID), rect.x(), rect.y(), rect.width(), rect.height(), str(self.angle),
|
|
650 | 650 |
self.area, self.text(), \ |
651 | 651 |
str(self.owner) if self.owner else None, \ |
652 | 652 |
str(self.conns[0]) if self.conns else None, \ |
653 |
str(self.special_item_type) if self.special_item_type else None] |
|
653 |
str(self.special_item_type) if self.special_item_type else None)]
|
|
654 | 654 |
sql = 'insert or replace into Components({}) values({})'.format(','.join(cols), ','.join(values)) |
655 | 655 |
res.append((sql, tuple(param))) |
656 | 656 |
|
657 | 657 |
titleBlockProps = appDocData.getTitleBlockProperties() |
658 |
for titleBlockProp in titleBlockProps: |
|
659 |
if self.area == titleBlockProp[0]: |
|
660 |
cols = ['UID', 'Drawing_UID', 'TitleBlockProperties_UID', 'VALUE'] |
|
661 |
values = ['?','?','?','?'] |
|
662 |
param = [str(self.uid), appDocData.activeDrawing.name, self.area, self.text()] |
|
663 |
|
|
664 |
sql = 'insert or replace into TitleBlockValues({}) values({})'.format(','.join(cols), ','.join(values)) |
|
665 |
res.append((sql, tuple(param))) |
|
658 |
if titleBlockProps: |
|
659 |
cols = ['UID', 'Drawing_UID', 'TitleBlockProperties_UID', 'VALUE'] |
|
660 |
values = ['?','?','?','?'] |
|
661 |
params = [] |
|
662 |
for titleBlockProp in titleBlockProps: |
|
663 |
if self.area == titleBlockProp[0]: |
|
664 |
params.append((str(self.uid), appDocData.activeDrawing.name, self.area, self.text())) |
|
665 |
|
|
666 |
sql = 'insert or replace into TitleBlockValues({}) values({})'.format(','.join(cols), ','.join(values)) |
|
667 |
if params: res.append((sql, tuple(params))) |
|
666 | 668 |
|
667 | 669 |
return res |
668 | 670 |
|
내보내기 Unified diff