개정판 5358c5c4
issue #563: multi codes support
Change-Id: Ie6d87ebee7a229fa402012c781f210d12db05cac
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
123 | 123 |
@date 2018.11.28 |
124 | 124 |
''' |
125 | 125 |
from QEngineeringInstLineNoTextItem import QEngineeringInstLineNoTextItem |
126 |
|
|
126 |
|
|
127 | 127 |
self.equipments.clear() |
128 | 128 |
self.symbols.clear() |
129 | 129 |
self.lineNos.clear() |
... | ... | |
2568 | 2568 |
for code in table[3]: |
2569 | 2569 |
sql = self.project.database.to_sql( \ |
2570 | 2570 |
"insert into InstCodes(UID, Code, Symbols, NewCode, Table_UID) VALUES(?,?,?,?,?)") |
2571 |
param = (code[0], code[1], ','.join(code[2]), code[3], table[0])
|
|
2571 |
param = (code[0], ','.join(code[1]), ','.join(code[2]), code[3], table[0])
|
|
2572 | 2572 |
cursor.execute(sql, param) |
2573 | 2573 |
# up to here |
2574 | 2574 |
|
DTI_PID/DTI_PID/CodeTableDialog.py | ||
---|---|---|
355 | 355 |
table.setItem(row, 3, QTableWidgetItem(self.makeAllowable(tableData[1]) if tableData[1] else '')) |
356 | 356 |
else: |
357 | 357 |
table.setItem(row, 0, QTableWidgetItem(tableData[0])) # UID |
358 |
table.setItem(row, 1, QTableWidgetItem(tableData[1])) # Code
|
|
358 |
table.setItem(row, 1, QTableWidgetItem(','.join(tableData[1]))) # Code
|
|
359 | 359 |
table.setItem(row, 2, QTableWidgetItem(','.join(tableData[2]))) # Symbols |
360 | 360 |
table.setItem(row, 3, QTableWidgetItem(tableData[3])) # New Code |
361 | 361 |
|
... | ... | |
884 | 884 |
|
885 | 885 |
def accept(self): |
886 | 886 |
from CodeTables import CodeTable |
887 |
|
|
887 | 888 |
for table in QCodeTableDialog.CODE_TABLES: |
888 | 889 |
if table != 'Nominal Diameter': |
889 | 890 |
self.saveCommonCodeData(table) |
DTI_PID/DTI_PID/CodeTables.py | ||
---|---|---|
29 | 29 |
elif inst: |
30 | 30 |
self.values = [] |
31 | 31 |
for x in values: |
32 |
olds = [old.strip() for old in x[1].split(',')] |
|
32 | 33 |
symbols = [symbol.strip() for symbol in x[2].split(',')] |
33 |
self.values.append((x[0], x[1], symbols, x[3]))
|
|
34 |
self.values.append((x[0], olds, symbols, x[3]))
|
|
34 | 35 |
else: |
35 | 36 |
self.values = values |
36 | 37 |
|
DTI_PID/DTI_PID/CustomCodeTablesDialog.py | ||
---|---|---|
129 | 129 |
''' |
130 | 130 |
def accept(self): |
131 | 131 |
import uuid |
132 |
from CodeTables import CodeTable |
|
132 | 133 |
|
133 | 134 |
try: |
134 | 135 |
self.isAccepted = False |
... | ... | |
152 | 153 |
appDocData.saveReplaceCodes(tables) |
153 | 154 |
|
154 | 155 |
self.isAccepted = True |
156 |
CodeTable.clearTables() |
|
155 | 157 |
QDialog.accept(self) |
156 | 158 |
|
157 | 159 |
except Exception as ex: |
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py | ||
---|---|---|
2000 | 2000 |
table = CodeTable.instance(code_name, inst=True) |
2001 | 2001 |
|
2002 | 2002 |
for value in table.values: |
2003 |
if old_code == value[1] and [item for item in value[2] if item in items]:
|
|
2003 |
if old_code in value[1] and [item for item in value[2] if item in items]:
|
|
2004 | 2004 |
return value[3] |
2005 | 2005 |
|
2006 | 2006 |
return '' |
DTI_PID/DTI_PID/SymbolAttrCodeTableDialog.py | ||
---|---|---|
75 | 75 |
self.code_data.append((uid, code, description, allowables)) |
76 | 76 |
else: |
77 | 77 |
uid = table.item(row, 0).text() if table.item(row, 0).text() else str(uuid.uuid4()) |
78 |
code = table.item(row, 1).text() if table.item(row, 1) else ''
|
|
78 |
code = table.item(row, 1).text().split(',') if table.item(row, 1) is not None else []
|
|
79 | 79 |
symbols = table.item(row, 2).text().split(',') if table.item(row, 3) is not None else [] |
80 | 80 |
newCode = table.item(row, 3).text() if table.item(row, 1) else '' |
81 | 81 |
|
내보내기 Unified diff