개정판 c9478bf6
Revert "issue #000: improve open xml file, fix explode, not exist item reference"
This reverts commit 9777bbd18e4de6c8e9f43cc311021237a0a92d48.
Reason for revert: <INSERT REASONING HERE>
Change-Id: I70c11ad9ebc528a5611440d2b8c5bb5396c93995
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
111 | 111 |
self._titleBlockProperties = None |
112 | 112 |
self.needReOpening = None |
113 | 113 |
|
114 |
self.configTable = None |
|
115 |
|
|
116 | 114 |
def clearItemList(self, trim): |
117 | 115 |
''' |
118 | 116 |
@brief clear item list |
... | ... | |
1213 | 1211 |
@date 2018.04.16 |
1214 | 1212 |
@history kyouho 2018.07.09 change query method |
1215 | 1213 |
''' |
1216 |
''' |
|
1217 | 1214 |
def getConfigs(self, section, key=None): |
1218 | 1215 |
res = [] |
1219 | 1216 |
|
... | ... | |
1245 | 1242 |
conn.close() |
1246 | 1243 |
|
1247 | 1244 |
return res |
1248 |
''' |
|
1249 |
def getConfigs(self, section, key=None): |
|
1250 |
res = [] |
|
1251 |
|
|
1252 |
if self.configTable is None: |
|
1253 |
self.configTable = [] |
|
1254 |
try: |
|
1255 |
# Creates or opens a file called mydb with a SQLite3 DB |
|
1256 |
dbPath = os.path.join(self.getCurrentProject().getDbFilePath(), AppDocData.DATABASE) |
|
1257 |
conn = sqlite3.connect(dbPath) |
|
1258 |
# Get a cursor object |
|
1259 |
cursor = conn.cursor() |
|
1260 |
|
|
1261 |
sql = "select * from configuration" |
|
1262 |
|
|
1263 |
cursor.execute(sql) |
|
1264 |
rows = cursor.fetchall() |
|
1265 |
for row in rows: |
|
1266 |
self.configTable.append(Config(row[0], row[1], row[2])) |
|
1267 |
# Catch the exception |
|
1268 |
except Exception as ex: |
|
1269 |
# Roll back any change if something goes wrong |
|
1270 |
conn.rollback() |
|
1271 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
|
1272 |
finally: |
|
1273 |
# Close the db connection |
|
1274 |
conn.close() |
|
1275 |
|
|
1276 |
if key is not None: |
|
1277 |
for con in self.configTable: |
|
1278 |
if con.section == section and con.key == key: |
|
1279 |
res.append(con) |
|
1280 |
else: |
|
1281 |
for con in self.configTable: |
|
1282 |
if con.section == section: |
|
1283 |
res.append(con) |
|
1284 |
|
|
1285 |
return res |
|
1286 | 1245 |
|
1287 | 1246 |
def getAppConfigs(self, section, key=None): |
1288 | 1247 |
""" |
DTI_PID/DTI_PID/ConfigurationAreaDialog.py | ||
---|---|---|
686 | 686 |
# up to here |
687 | 687 |
|
688 | 688 |
docData.saveConfigs(configs) |
689 |
docData.configTable = None |
|
690 | 689 |
|
691 | 690 |
self.isAccepted = True |
692 | 691 |
except Exception as ex: |
DTI_PID/DTI_PID/ConfigurationDialog.py | ||
---|---|---|
690 | 690 |
docData.saveConfigs(configs) |
691 | 691 |
docData.lineTypeConfigs = None # clear line type configurations |
692 | 692 |
NominalPipeSizeTable.instance().pipe_sizes = None # clear nominal pipe size table |
693 |
|
|
694 |
docData.configTable = None |
|
695 | 693 |
except Exception as ex: |
696 | 694 |
from App import App |
697 | 695 |
from AppDocData import MessageType |
DTI_PID/DTI_PID/ItemTreeWidget.py | ||
---|---|---|
164 | 164 |
menu.addAction(lineTypeAction) |
165 | 165 |
line_no = item.parent().data(0, self.TREE_DATA_ROLE) |
166 | 166 |
freeze = line_no.prop('Freeze') |
167 |
explode_action = QAction(self.tr("Explode")) |
|
168 | 167 |
explode_action.setEnabled(not freeze) |
168 |
explode_action = QAction(self.tr("Explode")) |
|
169 | 169 |
explode_action.triggered.connect(lambda : self.explode_line_run(item)) |
170 | 170 |
menu.addAction(explode_action) |
171 | 171 |
menu.exec_(self.viewport().mapToGlobal(position)) |
DTI_PID/DTI_PID/LineNoTracer.py | ||
---|---|---|
350 | 350 |
|
351 | 351 |
while len(pool) > 0: |
352 | 352 |
sign, obj = pool.pop() |
353 |
|
|
353 |
#print(type(obj)) |
|
354 |
|
|
354 | 355 |
""" check obj is upstream or downstream of spec break """ |
355 | 356 |
matches = [spec_break for spec_break in self._spec_breaks if spec_break.is_connected(obj)] |
356 | 357 |
if matches or issubclass(type(obj), QEngineeringEquipmentItem): continue |
357 |
#print('obj={} pool={}'.format(obj, pool)) |
|
358 | 358 |
""" end loop if obj is to """ |
359 | 359 |
if to is not None and str(obj.uid) == str(to.uid): break |
360 | 360 |
|
... | ... | |
376 | 376 |
#for s in self._symbols: |
377 | 377 |
# print(s) |
378 | 378 |
# print(s.owner) |
379 |
|
|
379 |
#print(symbolMatches) |
|
380 |
|
|
380 | 381 |
# order connected objects |
381 | 382 |
matches = [] |
382 | 383 |
matches.extend(symbolMatches) |
... | ... | |
394 | 395 |
rhs = matches |
395 | 396 |
|
396 | 397 |
for match in lhs: |
397 |
#print(match) |
|
398 | 398 |
pool.append((-1, match)) |
399 | 399 |
visited.insert(0, match) |
400 | 400 |
|
401 | 401 |
for match in rhs: |
402 |
#print(match) |
|
403 | 402 |
pool.append((1, match)) |
404 | 403 |
visited.append(match) |
405 | 404 |
# up to here |
... | ... | |
410 | 409 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
411 | 410 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
412 | 411 |
|
413 |
#print(visited) |
|
414 | 412 |
return visited |
415 | 413 |
|
416 | 414 |
''' |
DTI_PID/DTI_PID/Shapes/EngineeringConnectorItem.py | ||
---|---|---|
74 | 74 |
|
75 | 75 |
if type(self._connectedItem) is uuid.UUID: |
76 | 76 |
matches = [x for x in self.scene().items() if hasattr(x, 'uid') and str(x.uid) == str(self._connectedItem)] |
77 |
if matches: |
|
78 |
self._connectedItem = matches[0] |
|
79 |
else: |
|
80 |
self._connectedItem = None |
|
77 |
if matches: self._connectedItem = matches[0] |
|
81 | 78 |
|
82 | 79 |
return self._connectedItem |
83 | 80 |
|
내보내기 Unified diff