개정판 d0db0878
issue #622: 저장 - save item to database -
Change-Id: I21e4a97aece0ea9e0b1432b8dae88bde1edfd1c1
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
1627 | 1627 |
@brief get symbol name list |
1628 | 1628 |
@history 18.04.24 Jeongwoo Add isExceptDetect Field |
1629 | 1629 |
''' |
1630 |
def getSymbolListByType(self, fieldName=None, param=None):
|
|
1630 |
def getSymbolListByType(self, field_name=None, param=None):
|
|
1631 | 1631 |
ret = [] |
1632 | 1632 |
|
1633 | 1633 |
try: |
1634 | 1634 |
dbPath = os.path.join(self.getCurrentProject().getDbFilePath(), AppDocData.DATABASE) |
1635 | 1635 |
conn = sqlite3.connect(dbPath) |
1636 | 1636 |
cursor = conn.cursor() |
1637 |
if fieldName is not None and param is not None:
|
|
1637 |
if field_name is not None and param is not None:
|
|
1638 | 1638 |
sql = """SELECT a.UID,a.Name,b.Type,a.Threshold,a.MinMatchPoint,a.IsDetectOrigin,a.RotationCount,a.OCROption,a.IsContainChild,a.OriginalPoint,a.ConnectionPoint, |
1639 | 1639 |
a.BaseSymbol,a.AdditionalSymbol,a.IsExceptDetect,a.HasInstrumentLabel,a.flip |
1640 |
FROM Symbol a inner join SymbolType b on a.SymbolType_UID=b.UID WHERE SymbolType_UID = (select UID from SymbolType where Type=?)"""
|
|
1640 |
FROM Symbol a inner join SymbolType b on a.SymbolType_UID=b.UID WHERE SymbolType_UID = (select UID from SymbolType where {}=?)""".format(field_name)
|
|
1641 | 1641 |
else: |
1642 | 1642 |
sql = """SELECT a.UID,a.Name,b.Type,a.Threshold,a.MinMatchPoint,a.IsDetectOrigin,a.RotationCount,a.OCROption,a.IsContainChild,a.OriginalPoint,a.ConnectionPoint, |
1643 | 1643 |
a.BaseSymbol,a.AdditionalSymbol,a.IsExceptDetect,a.HasInstrumentLabel,a.flip FROM Symbol a inner join SymbolType b on a.SymbolType_UID=b.UID""" |
... | ... | |
2478 | 2478 |
# Get a cursor object |
2479 | 2479 |
cursor = conn.cursor() |
2480 | 2480 |
|
2481 |
#sql = "delete from Ports where Components_UID in (select UID from Components where Drawings_UID = (select UID from Drawings where Name= '{}'))".format(pidNo) |
|
2482 |
|
|
2483 | 2481 |
sql = 'select A.UID,B.Name from Components A left join Drawings B on A.Drawings_UID=B.UID' |
2484 | 2482 |
if docName is not None: |
2485 | 2483 |
sql += " where Drawings_UID=(select UID from Drawings where Name='{}')".format(docName) |
... | ... | |
2872 | 2870 |
sql = "delete from TitleBlockValues where Drawings_UID = '{}'".format(pidNo) |
2873 | 2871 |
cursor.execute(sql) |
2874 | 2872 |
|
2875 |
# delete ports |
|
2876 |
sql = "delete from Ports where Components_UID in (select UID from Components where Drawings_UID = (select UID from Drawings where Name= '{}'))".format(pidNo) |
|
2877 |
cursor.execute(sql) |
|
2878 |
|
|
2879 | 2873 |
# delete Attributes |
2880 | 2874 |
sql = "delete from Attributes where Components_UID in (select UID from Components where Drawings_UID = (select UID from Drawings where Name= '{}'))".format(pidNo) |
2881 | 2875 |
cursor.execute(sql) |
2882 | 2876 |
|
2877 |
# delete Points |
|
2878 |
sql = "delete from Points where Components_UID = (select UID from Components where Drawings_UID=(select UID from Drawings where Name= '{}'))".format(pidNo) |
|
2879 |
cursor.execute(sql) |
|
2880 |
|
|
2883 | 2881 |
# delete Components |
2884 | 2882 |
sql = "delete from Components where Drawings_UID = (select UID from Drawings where Name= '{}')".format(pidNo) |
2885 | 2883 |
cursor.execute(sql) |
DTI_PID/DTI_PID/Commands/SaveWorkCommand.py | ||
---|---|---|
32 | 32 |
from EngineeringVendorItem import QEngineeringVendorItem |
33 | 33 |
from SymbolSvgItem import SymbolSvgItem |
34 | 34 |
from EngineeringReducerItem import QEngineeringReducerItem |
35 |
from EngineeringLineItem import QEngineeringLineItem |
|
35 | 36 |
|
36 | 37 |
try: |
37 | 38 |
appDocData = AppDocData.instance() |
... | ... | |
46 | 47 |
titleBlockItems.append(item) |
47 | 48 |
|
48 | 49 |
dbItems = [item for item in items if type(item) is QEngineeringInstrumentItem or type(item) is QEngineeringEquipmentItem or type(item) is QEngineeringReducerItem or\ |
49 |
type(item) is QEngineeringNoteItem or type(item) is SymbolSvgItem or type(item) is QEngineeringLineNoTextItem or type(item) is QEngineeringVendorItem] + titleBlockItems |
|
50 |
type(item) is QEngineeringNoteItem or type(item) is SymbolSvgItem or type(item) is QEngineeringLineNoTextItem or type(item) is QEngineeringVendorItem or\ |
|
51 |
type(item) is QEngineeringTextItem or type(item) is QEngineeringLineItem] + titleBlockItems |
|
50 | 52 |
appDocData.saveToDatabase(dbItems) |
51 | 53 |
|
52 | 54 |
self.resultStr = SaveWorkCommand.save_to_xml() |
DTI_PID/DTI_PID/Scripts/LineNoAttributes.sql | ||
---|---|---|
1 |
CREATE TABLE IF NOT EXISTS LineNoAttributes ( |
|
2 |
UID TEXT PRIMARY KEY, |
|
3 |
Components_UID TEXT NOT NULL |
|
4 |
REFERENCES Components (UID), |
|
5 |
LineProperties_UID TEXT NOT NULL |
|
6 |
REFERENCES LineProperties (UID), |
|
7 |
Value TEXT, |
|
8 |
FOREIGN KEY ( |
|
9 |
LineProperties_UID |
|
10 |
) |
|
11 |
REFERENCES SymbolAttribute (UID), |
|
12 |
UNIQUE ( |
|
13 |
Components_UID, |
|
14 |
LineProperties_UID |
|
15 |
) |
|
16 |
); |
DTI_PID/DTI_PID/Scripts/Points.sql | ||
---|---|---|
1 |
CREATE TABLE IF NOT EXISTS Points ( |
|
2 |
UID TEXT NOT NULL, |
|
3 |
Components_UID TEXT NOT NULL, |
|
4 |
[Index] INTEGER NOT NULL, |
|
5 |
X REAL NOT NULL, |
|
6 |
Y REAL NOT NULL, |
|
7 |
CONSTRAINT PK_Points PRIMARY KEY ( |
|
8 |
UID |
|
9 |
), |
|
10 |
CONSTRAINT FK_Components_UID FOREIGN KEY ( |
|
11 |
Components_UID |
|
12 |
) |
|
13 |
REFERENCES Components (UID) |
|
14 |
); |
DTI_PID/DTI_PID/Scripts/Ports.sql | ||
---|---|---|
1 |
CREATE TABLE IF NOT EXISTS Ports ( |
|
2 |
UID TEXT PRIMARY KEY |
|
3 |
NOT NULL, |
|
4 |
Components_UID TEXT REFERENCES Components (UID) NOT NULL, |
|
5 |
X INTEGER, |
|
6 |
Y INTEGER, |
|
7 |
Connected_UID TEXT REFERENCES Components (UID) |
|
8 |
); |
DTI_PID/DTI_PID/Shapes/EngineeringAbstractItem.py | ||
---|---|---|
1 | 1 |
# coding: utf-8 |
2 |
""" This is engineering abstract item module """ |
|
3 |
|
|
2 | 4 |
import sys |
3 | 5 |
|
4 | 6 |
''' |
... | ... | |
20 | 22 |
def __init__(self, parent=None): |
21 | 23 |
self._color = self.DEFAULT_COLOR # default color |
22 | 24 |
self._owner = None |
25 |
self.special_item_type = None # UID for special item type |
|
23 | 26 |
self._hover = False |
24 | 27 |
self._area = None |
25 | 28 |
self.connectors = [] |
DTI_PID/DTI_PID/Shapes/EngineeringConnectorItem.py | ||
---|---|---|
21 | 21 |
A {ConnectorItem} is the graphical representation of a {Symbol.Connectors}. |
22 | 22 |
""" |
23 | 23 |
class QEngineeringConnectorItem(QGraphicsEllipseItem): |
24 |
""" |
|
25 |
This is engineering connector item class |
|
26 |
""" |
|
24 |
""" This is engineering connector item class """ |
|
27 | 25 |
SMALL_SIZE = 10 |
28 | 26 |
BIG_SIZE = 16 |
29 | 27 |
HIGHLIGHT = '#BC4438' |
... | ... | |
106 | 104 |
|
107 | 105 |
@property |
108 | 106 |
def symbol_idx(self): |
109 |
""" |
|
110 |
""" |
|
107 |
""" """ |
|
111 | 108 |
return self._symbol_idx |
112 | 109 |
|
113 | 110 |
@symbol_idx.setter |
114 | 111 |
def symbol_idx(self, value): |
115 |
""" |
|
116 |
setter of symbol_idx |
|
117 |
""" |
|
112 |
""" setter of symbol_idx """ |
|
118 | 113 |
self._symbol_idx = value |
119 | 114 |
|
120 | 115 |
@property |
121 | 116 |
def spec_break(self): |
122 |
""" |
|
123 |
getter of spec break |
|
124 |
""" |
|
117 |
""" getter of spec break """ |
|
125 | 118 |
return self._spec_break |
126 | 119 |
|
127 | 120 |
@spec_break.setter |
128 | 121 |
def spec_idx(self, value): |
129 |
""" |
|
130 |
setter of spec_break |
|
131 |
""" |
|
122 |
""" setter of spec_break """ |
|
132 | 123 |
self._spec_break = value |
133 | 124 |
|
134 | 125 |
''' |
... | ... | |
515 | 506 |
def toSql(self): |
516 | 507 |
""" generate sql string to save connectors to database """ |
517 | 508 |
|
518 |
cols = ['UID', 'Components_UID', 'X', 'Y'] |
|
519 |
values = ['?', '?', '?', '?'] |
|
520 |
param = [str(self.uid), str(self.parent.uid), self.connectPoint[0], self.connectPoint[1]] |
|
521 |
if self.connectedItem is not None: |
|
522 |
cols.append('Connected_UID') |
|
523 |
values.append('?') |
|
524 |
param.append(str(self.connectedItem.uid)) |
|
525 |
|
|
526 |
sql = 'insert or replace into Ports({}) values({})'.format(','.join(cols), ','.join(values)) |
|
509 |
cols = ['UID', 'Components_UID', '[Index]', 'X', 'Y', 'Connected'] |
|
510 |
values = ['?', '?', '?', '?', '?', '?'] |
|
511 |
param = [str(self.uid), str(self.parent.uid), self.symbol_idx, self.connectPoint[0], self.connectPoint[1], str(self.connectedItem.uid) if self.connectedItem else None] |
|
512 |
sql = 'insert or replace into Points({}) values({})'.format(','.join(cols), ','.join(values)) |
|
527 | 513 |
|
528 | 514 |
return (sql, tuple(param)) |
529 | 515 |
|
DTI_PID/DTI_PID/Shapes/EngineeringLineItem.py | ||
---|---|---|
1292 | 1292 |
|
1293 | 1293 |
return node |
1294 | 1294 |
|
1295 |
def toSql(self): |
|
1296 |
""" generate sql phrase to save line to database """ |
|
1297 |
import uuid |
|
1298 |
from AppDocData import AppDocData |
|
1299 |
|
|
1300 |
res = [] |
|
1301 |
|
|
1302 |
app_doc_data = AppDocData.instance() |
|
1303 |
cols = ['UID', 'Drawings_UID', 'Symbol_UID', 'X', 'Y', 'Width', 'Height', 'Rotation', 'Area', 'Owner', 'SpecialItemTypes_UID'] |
|
1304 |
values = ['?', '?', "(select UID from Symbol where Name='Line' and SymbolType_UID='-1')", '?', '?', '?', '?', '?', '?', '?', '?'] |
|
1305 |
|
|
1306 |
rect = self.sceneBoundingRect() |
|
1307 |
param = [str(self.uid), str(app_doc_data.activeDrawing.UID), rect.x(), rect.y(), rect.width(), rect.height(), 0, |
|
1308 |
self.area, str(self.owner) if self.owner else None, str(self.special_item_type) if self.special_item_type else None] |
|
1309 |
sql = 'insert or replace into Components({}) values({})'.format(','.join(cols), ','.join(values)) |
|
1310 |
res.append((sql, tuple(param))) |
|
1311 |
|
|
1312 |
# save connectors to database |
|
1313 |
for connector in self.connectors: |
|
1314 |
res.append(connector.toSql()) |
|
1315 |
# up to here |
|
1316 |
|
|
1317 |
return res |
|
1318 |
|
|
1295 | 1319 |
''' |
1296 | 1320 |
@brief Delete Line Item from scene |
1297 | 1321 |
@author Jeongwoo |
DTI_PID/DTI_PID/Shapes/EngineeringLineNoTextItem.py | ||
---|---|---|
571 | 571 |
|
572 | 572 |
app_doc_data = AppDocData.instance() |
573 | 573 |
|
574 |
sql = "insert or replace into Components(UID, Drawings_UID, Symbol_UID, X, Y, Width, Height, Rotation) values(?, ?, ?, ?, ?, ?, ?, ?)"
|
|
574 |
cols = ['UID', 'Drawings_UID', 'Symbol_UID', 'X', 'Y', 'Width', 'Height', 'Rotation', 'Connected']
|
|
575 | 575 |
rect = self.sceneBoundingRect() |
576 |
data = [str(self.uid), str(app_doc_data.activeDrawing.UID), str(1), str(rect.x()), str(rect.y()), str(rect.width()), str(rect.height()), str(self.angle)] |
|
577 |
res.append((sql, tuple(data))) |
|
576 |
values = ['?', '?', "(select UID from Symbol where Name='Line NO' and SymbolType_UID='-1')", '?', '?', '?', '?', '?', '?'] |
|
577 |
params = [str(self.uid), str(app_doc_data.activeDrawing.UID), str(rect.x()), str(rect.y()), str(rect.width()), str(rect.height()), str(self.angle),\ |
|
578 |
str(self.conns[0]) if self.conns else None] |
|
579 |
sql = 'insert or replace into Components({}) values({})'.format(','.join(cols), ','.join(values)) |
|
580 |
res.append((sql, tuple(params))) |
|
578 | 581 |
|
579 | 582 |
attrs = self.getAttributes() |
580 | 583 |
for key,value in attrs.items(): |
DTI_PID/DTI_PID/Shapes/EngineeringTextItem.py | ||
---|---|---|
636 | 636 |
self.update() |
637 | 637 |
|
638 | 638 |
def toSql(self): |
639 |
""" |
|
640 |
convert instrument data to sql query for title block now on |
|
641 |
""" |
|
639 |
""" convert text data to sql query for components and title block """ |
|
642 | 640 |
from AppDocData import AppDocData |
643 | 641 |
|
642 |
res = [] |
|
643 |
|
|
644 | 644 |
appDocData = AppDocData.instance() |
645 |
cols = ['UID', 'Drawings_UID', 'Symbol_UID', 'X', 'Y', 'Width', 'Height', 'Rotation', 'Area', 'Value', 'Owner', 'SpecialItemTypes_UID'] |
|
646 |
values = ['?', '?', "(select UID from Symbol where Name='Text' and SymbolType_UID='-1')", '?', '?', '?', '?', '?', '?', '?', '?', '?'] |
|
647 |
|
|
648 |
rect = self.sceneBoundingRect() |
|
649 |
param = [str(self.uid), str(appDocData.activeDrawing.UID), rect.x(), rect.y(), rect.width(), rect.height(), str(self.angle), |
|
650 |
self.area, self.text(), str(self.owner) if self.owner else None, str(self.special_item_type) if self.special_item_type else None] |
|
651 |
sql = 'insert or replace into Components({}) values({})'.format(','.join(cols), ','.join(values)) |
|
652 |
res.append((sql, tuple(param))) |
|
653 |
|
|
645 | 654 |
titleBlockProps = appDocData.getTitleBlockProperties() |
646 | 655 |
for titleBlockProp in titleBlockProps: |
647 | 656 |
if self.area == titleBlockProp[0]: |
... | ... | |
649 | 658 |
values = ['?','?','?','?'] |
650 | 659 |
param = [str(self.uid), appDocData.activeDrawing.name, self.area, self.text()] |
651 | 660 |
|
652 |
sql = 'insert or replace into TitleBlockValues values({})'.format(','.join(values)) |
|
653 |
return (sql, tuple(param)) |
|
654 |
|
|
655 |
return None |
|
661 |
sql = 'insert or replace into TitleBlockValues({}) values({})'.format(','.join(cols), ','.join(values)) |
|
662 |
res.append((sql, tuple(param))) |
|
656 | 663 |
|
664 |
return res |
|
657 | 665 |
|
658 | 666 |
''' |
659 | 667 |
@brief The class transfer pyqtSignal Event. Cause Subclass of QGraphicsRectItem can't use pyqtSignal |
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py | ||
---|---|---|
39 | 39 |
|
40 | 40 |
self.setFlags(QGraphicsItem.ItemIsSelectable|QGraphicsItem.ItemIsFocusable|QGraphicsItem.ItemSendsGeometryChanges) |
41 | 41 |
|
42 |
self.dbUid = None |
|
42 |
self.dbUid = None # symbol UID
|
|
43 | 43 |
self.uid = uuid.uuid4() if uid is None else uuid.UUID(uid, version=4) |
44 | 44 |
self.name = '' |
45 | 45 |
self.type = '' |
... | ... | |
406 | 406 |
sql = 'insert or replace into VALVE_DATA_LIST({}) values({})'.format(','.join(cols), ','.join(values)) |
407 | 407 |
res.append((sql, tuple(param))) |
408 | 408 |
|
409 |
cols = ['UID', 'Drawings_UID', 'Symbol_UID', 'X', 'Y', 'Width', 'Height', 'Rotation'] |
|
410 |
values = ['?','?','?', '?', '?', '?', '?', '?'] |
|
411 |
param = [str(self.uid), str(appDocData.activeDrawing.UID), str(self.dbUid), self.loc[0], self.loc[1], self.size[0], self.size[1], str(self.angle)] |
|
409 |
cols = ['UID', 'Drawings_UID', 'Symbol_UID', 'X', 'Y', 'Width', 'Height', 'Rotation', 'Area', 'Owner', 'SpecialItemTypes_UID'] |
|
410 |
values = ['?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?'] |
|
411 |
param = [str(self.uid), str(appDocData.activeDrawing.UID), str(self.dbUid), self.loc[0], self.loc[1], self.size[0], self.size[1], str(self.angle), |
|
412 |
self.area, str(self.owner) if self.owner else None, str(self.special_item_type) if self.special_item_type else None] |
|
412 | 413 |
sql = 'insert or replace into Components({}) values({})'.format(','.join(cols), ','.join(values)) |
413 | 414 |
res.append((sql, tuple(param))) |
414 | 415 |
|
DTI_PID/DTI_PID/SpecialItemTypesDialog.py | ||
---|---|---|
11 | 11 |
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '\\UI') |
12 | 12 |
import SpecialItemTypes_UI |
13 | 13 |
|
14 |
class SpecialItemTypes: |
|
15 |
""" This is special item type class """ |
|
16 |
|
|
17 |
SPECIAL_ITEM_TYPES = {} |
|
18 |
|
|
19 |
def __init__(self, name, values): |
|
20 |
self.name = name |
|
21 |
self.values = [{'UID':x[0], 'Code':x[1], 'Type':x[2], 'Allowables':x[3].split(',')} for x in values] |
|
22 |
|
|
23 |
def find_match_exactly(self, item): |
|
24 |
""" check given item does match with special item type """ |
|
25 |
from SymbolSvgItem import SymbolSvgItem |
|
26 |
from EngineeringTextItem import QEngineeringTextItem |
|
27 |
|
|
28 |
for value in self.values: |
|
29 |
if type(item) is SymbolSvgItem and value['Type'] == 'Symbol': |
|
30 |
if item.name in value['Allowables']: return value['UID'] |
|
31 |
elif type(item) is QEngineeringTextItem and value['Type'] == 'String': |
|
32 |
if item.text() in value['Allowables']: return value['UID'] |
|
33 |
|
|
34 |
return None |
|
35 |
|
|
36 |
@staticmethod |
|
37 |
def instance(): |
|
38 |
""" return instance of special item type """ |
|
39 |
|
|
40 |
if 'SpecialItemTypes' not in SpecialItemTypes.SPECIAL_ITEM_TYPES: |
|
41 |
app_doc_data = AppDocData.instance() |
|
42 |
values = app_doc_data.get_special_item_types() |
|
43 |
SpecialItemTypes.SPECIAL_ITEM_TYPES['SpecialItemTypes'] = SpecialItemTypes('SpecialItemTypes', values) |
|
44 |
|
|
45 |
return SpecialItemTypes.SPECIAL_ITEM_TYPES['SpecialItemTypes'] |
|
46 |
|
|
47 |
@staticmethod |
|
48 |
def clearTables(): |
|
49 |
SpecialItemType.SPECIAL_ITEM_TYPES = {} |
|
50 |
|
|
14 | 51 |
class QSpecialItemTypesDialog(QDialog): |
15 | 52 |
""" This Special Item Types dialog class """ |
16 | 53 |
|
DTI_PID/DTI_PID/SymbolAttrEditorDialog.py | ||
---|---|---|
17 | 17 |
import SymbolAttrEditor_UI |
18 | 18 |
|
19 | 19 |
class QSymbolAttrEditorDialog(QDialog): |
20 |
""" |
|
21 |
This is symbol attribute editor dialog class |
|
22 |
""" |
|
20 |
""" This is symbol attribute editor dialog class """ |
|
23 | 21 |
|
24 | 22 |
SYMBOL_ATTR_DATA_TYPES = {'Symbol Item':-1, 'Size Text Item':-1, 'Text Item':-1, 'Tag No':-1, 'Valve Oper Code':-1, 'Comp Item':-1, 'Int':1, 'String':1} |
23 |
LINE_NO_ATTR_TYPES = ['Code Table', 'Int', 'String', 'Symbol'] |
|
25 | 24 |
|
26 | 25 |
def __init__(self, parent, symbolType = None): |
27 | 26 |
QDialog.__init__(self, parent) |
... | ... | |
63 | 62 |
self.ui.tableWidgetAttr.verticalHeader().setVisible(False) |
64 | 63 |
self.ui.horizontalLayout_2.addWidget(self.ui.tableWidgetAttr) |
65 | 64 |
## up to here |
66 |
self.ui.tableWidgetAttr.setHorizontalHeaderLabels(['UID', 'Name', 'Display Name', 'Type', 'Length']) |
|
65 |
self.ui.tableWidgetAttr.setHorizontalHeaderLabels(['UID', 'Name', 'Display Name', 'Type', 'Length', 'Expression'])
|
|
67 | 66 |
self.ui.tableWidgetAttr.horizontalHeaderItem(1).setSizeHint(QSize(25, 25)) |
68 | 67 |
self.ui.tableWidgetAttr.hideColumn(0) |
69 | 68 |
|
... | ... | |
293 | 292 |
self.ui.tableWidgetAttr.setItem(row, 2, item) |
294 | 293 |
|
295 | 294 |
attrTypeComboBox = QComboBox() |
296 |
attrTypeComboBox.addItem('Code Table') |
|
297 |
attrTypeComboBox.addItem('Int') |
|
298 |
attrTypeComboBox.addItem('String') |
|
295 |
for _type in QSymbolAttrEditorDialog.LINE_NO_ATTR_TYPES: |
|
296 |
attrTypeComboBox.addItem(_type) |
|
299 | 297 |
self.ui.tableWidgetAttr.setCellWidget(row, 3, attrTypeComboBox) |
300 | 298 |
result = attrTypeComboBox.findText(attr.AttributeType if attr.DisplayAttribute is not None else '') |
301 | 299 |
attrTypeComboBox.setCurrentIndex(result) |
... | ... | |
303 | 301 |
item = QTableWidgetItem(str(attr.Length) if attr.Length is not None else '') |
304 | 302 |
self.ui.tableWidgetAttr.setItem(row, 4, item) |
305 | 303 |
|
304 |
item = QTableWidgetItem(str(attr.Expression) if attr.Expression is not None else '') |
|
305 |
self.ui.tableWidgetAttr.setItem(row, 5, item) |
|
306 |
|
|
306 | 307 |
row = row + 1 |
307 | 308 |
|
308 | 309 |
''' |
... | ... | |
315 | 316 |
self.ui.tableWidgetAttr.setRowCount(rows + 1) |
316 | 317 |
|
317 | 318 |
attrTypeComboBox = QComboBox() |
318 |
attrTypeComboBox.addItem('Code Table') |
|
319 |
attrTypeComboBox.addItem('Int') |
|
320 |
attrTypeComboBox.addItem('String') |
|
319 |
for _type in QSymbolAttrEditorDialog.LINE_NO_ATTR_TYPES: |
|
320 |
attrTypeComboBox.addItem(_type) |
|
321 | 321 |
self.ui.tableWidgetAttr.setCellWidget(rows, 3, attrTypeComboBox) |
322 | 322 |
|
323 | 323 |
import uuid |
DTI_PID/DTI_PID/SymbolTreeWidget.py | ||
---|---|---|
1 |
# coding: utf-8 |
|
2 |
""" This is Symbol Tree Widget module """ |
|
3 |
|
|
1 | 4 |
try: |
2 | 5 |
from PyQt5.QtCore import * |
3 | 6 |
from PyQt5.QtGui import * |
... | ... | |
151 | 154 |
try: |
152 | 155 |
symbolTypeList = AppDocData.instance().getSymbolTypeList() |
153 | 156 |
for symbolType in symbolTypeList: |
157 |
if not symbolType[1]: continue # skip if category is empty |
|
154 | 158 |
parent = QTreeWidgetItem(self, [symbolType[2]]) |
155 | 159 |
parent.setData(0, self.TREE_DATA_ROLE, symbolType) |
156 |
symbolList = AppDocData.instance().getSymbolListByType('type', symbolType[2])
|
|
160 |
symbolList = AppDocData.instance().getSymbolListByType('UID', symbolType[0])
|
|
157 | 161 |
for symbol in symbolList: |
158 | 162 |
symbolItem = QTreeWidgetItem(parent, [symbol.getName()]) |
159 | 163 |
symbolItem.setData(0, self.TREE_DATA_ROLE, symbol) |
DTI_PID/DTI_PID/TextItemFactory.py | ||
---|---|---|
1 |
""" |
|
2 |
This is TextItemFactor module |
|
3 |
""" |
|
1 |
# coding: utf-8 |
|
2 |
""" This is TextItemFactor module """ |
|
4 | 3 |
|
5 | 4 |
from SingletonInstance import SingletonInstane |
6 | 5 |
import re |
... | ... | |
24 | 23 |
from QEngineeringTagNoTextItem import QEngineeringTagNoTextItem |
25 | 24 |
from EngineeringValveOperCodeTextItem import QEngineeringValveOperCodeTextItem |
26 | 25 |
from EngineeringReservedWordTextItem import QEngineeringReservedWordTextItem |
26 |
from SpecialItemTypesDialog import SpecialItemTypes |
|
27 | 27 |
|
28 | 28 |
class TextItemFactory(SingletonInstane): |
29 | 29 |
""" This is TextItemFactor class """ |
... | ... | |
135 | 135 |
item = QEngineeringTextItem() |
136 | 136 |
item.setToolTip(text) |
137 | 137 |
item.setPlainText(text) |
138 |
item.special_item_type = SpecialItemTypes.instance().find_match_exactly(item) |
|
138 | 139 |
docData.texts.append(item) |
139 | 140 |
except Exception as ex: |
140 | 141 |
from App import App |
내보내기 Unified diff