개정판 171704df
SymbolSvgItem Build 시 connectors 초기화 구문 추가 / SymbolType 으로 SymbolCategory 값을 반환하는 메소드 추가
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
1040 | 1040 |
return symbolTypeList |
1041 | 1041 | |
1042 | 1042 |
''' |
1043 |
@brief Get Symbol Category by Symbol Type |
|
1044 |
@author Jeongwoo |
|
1045 |
@date 2018.05.09 |
|
1046 |
''' |
|
1047 |
def getSymbolCategoryByType(self, type): |
|
1048 |
category = None |
|
1049 |
try: |
|
1050 |
dbPath = self.getCurrentProject().getDbFilePath() + "/ITI_PID.db" |
|
1051 |
conn = sqlite3.connect(dbPath) |
|
1052 |
cursor = conn.cursor() |
|
1053 |
sql = 'SELECT category FROM SymbolType WHERE type = "' + type + '"' |
|
1054 |
cursor.execute(sql) |
|
1055 |
rows = cursor.fetchall() |
|
1056 |
if rows is not None and len(rows) > 0: |
|
1057 |
category = rows[0][0] |
|
1058 |
except Exception as ex: |
|
1059 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
|
1060 |
finally: |
|
1061 |
conn.close() |
|
1062 | ||
1063 |
return category |
|
1064 | ||
1065 |
''' |
|
1066 |
@brief Check Symbol Type is included in 'Equipment' Category |
|
1067 |
@author Jeongwoo |
|
1068 |
@date 2018.05.09 |
|
1069 |
''' |
|
1070 |
def isEquipmentByType(self, type): |
|
1071 |
category = self.getSymbolCategoryByType(type) |
|
1072 |
if category is None: |
|
1073 |
return False |
|
1074 |
elif category == 'Equipment': |
|
1075 |
return True |
|
1076 |
else: |
|
1077 |
return False |
|
1078 | ||
1079 |
''' |
|
1043 | 1080 |
@brief Return Symbol Type Items with "None" |
1044 | 1081 |
@author Jeongwoo |
1045 | 1082 |
@date 18.04.06 |
DTI_PID/DTI_PID/QResultTreeWidget.py | ||
---|---|---|
39 | 39 |
def setCurrentPID(self, baseName): |
40 | 40 |
self.clear() |
41 | 41 |
self.root = QTreeWidgetItem(self, [os.path.splitext(baseName)[0]]) |
42 |
self.addTreeItem(self.root, QTreeWidgetItem(self.root, ['EQUIPMENTS'])) |
|
42 | 43 |
self.addTreeItem(self.root, QTreeWidgetItem(self.root, ['SYMBOLS'])) |
43 | 44 |
self.addTreeItem(self.root, QTreeWidgetItem(self.root, ['NOTES'])) |
44 | 45 | |
... | ... | |
55 | 56 |
item = None |
56 | 57 |
if (not hasattr(child, 'treeItem')) or (child.treeItem is None): |
57 | 58 |
if issubclass(type(child), SymbolSvgItem): |
58 |
symbolsRootItem = self.findItems('SYMBOLS', Qt.MatchExactly|Qt.MatchRecursive, 0) |
|
59 |
symbolsRootItem = symbolsRootItem[0] |
|
60 |
item = QTreeWidgetItem(symbolsRootItem, [child.name]) |
|
59 |
if AppDocData.instance().isEquipmentByType(child.type): |
|
60 |
symbolsRootItem = self.findItems('EQUIPMENTS', Qt.MatchExactly|Qt.MatchRecursive, 0) |
|
61 |
symbolsRootItem = symbolsRootItem[0] |
|
62 |
item = QTreeWidgetItem(symbolsRootItem, [child.name]) |
|
63 |
else: |
|
64 |
symbolsRootItem = self.findItems('SYMBOLS', Qt.MatchExactly|Qt.MatchRecursive, 0) |
|
65 |
symbolsRootItem = symbolsRootItem[0] |
|
66 |
item = QTreeWidgetItem(symbolsRootItem, [child.name]) |
|
61 | 67 |
iconPath = os.path.join(AppDocData.instance().getCurrentProject().getSvgFilePath(), child.type , child.name + ".svg") |
62 | 68 |
item.setIcon(0, QIcon(iconPath)) |
63 | 69 |
item.setData(0, self.TREE_DATA_ROLE, child) |
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py | ||
---|---|---|
45 | 45 |
@brief build symbol item |
46 | 46 |
@author humkyung |
47 | 47 |
@date 2018.05.02 |
48 |
@history 2018.05.09 Jeongwoo Clear self.connectors |
|
48 | 49 |
''' |
49 | 50 |
def buildItem(self, name, type, angle, loc, size, origin, connPts): |
50 | 51 |
try: |
... | ... | |
56 | 57 |
self.origin = origin |
57 | 58 |
self.connPts = connPts |
58 | 59 | |
60 |
self.connectors.clear() |
|
59 | 61 |
for pt in self.connPts: |
60 | 62 |
connector = QConnectorItem() |
61 | 63 |
connector.setPos(pt) |
내보내기 Unified diff