개정판 a3da2d97
issue #1048 화면/메뉴/툴바 개발
Change-Id: Ia30bc2f9f359eb5778cfdb1c2356f20761673322
HYTOS/HYTOS/AppDocData.py | ||
---|---|---|
441 | 441 |
|
442 | 442 |
return res |
443 | 443 |
|
444 |
def get_selected_nd(self, row_id, unit): |
|
445 |
res = None |
|
446 |
|
|
447 |
try: |
|
448 |
conn = sqlite3.connect(self.activeDrawing.path) |
|
449 |
conn.execute('PRAGMA foreign_keys = ON') |
|
450 |
# Get a cursor object |
|
451 |
cursor = conn.cursor() |
|
452 |
|
|
453 |
if unit == 'in': |
|
454 |
sql = 'select Inch from NominalDiameter where rowid <= ?' |
|
455 |
elif unit == 'mm': |
|
456 |
sql = 'select Milimeter from NominalDiameter where rowid <= ?' |
|
457 |
|
|
458 |
param = (row_id,) |
|
459 |
cursor.execute(sql, param) |
|
460 |
rows = cursor.fetchall() |
|
461 |
for row in rows: |
|
462 |
res = row[0] |
|
463 |
except Exception as ex: |
|
464 |
from App import App |
|
465 |
# Roll back any change if something goes wrong |
|
466 |
conn.rollback() |
|
467 |
|
|
468 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
469 |
sys.exc_info()[-1].tb_lineno) |
|
470 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
471 |
finally: |
|
472 |
# Close the db connection |
|
473 |
conn.close() |
|
474 |
|
|
475 |
return res |
|
476 |
|
|
477 |
def get_row_id(self, size, unit): |
|
478 |
res = None |
|
479 |
|
|
480 |
try: |
|
481 |
conn = sqlite3.connect(self.activeDrawing.path) |
|
482 |
conn.execute('PRAGMA foreign_keys = ON') |
|
483 |
# Get a cursor object |
|
484 |
cursor = conn.cursor() |
|
485 |
|
|
486 |
if unit == 'in': |
|
487 |
sql = 'select count(*) from NominalDiameter where Inch <= ?' |
|
488 |
elif unit == 'mm': |
|
489 |
sql = 'select count(*) from NominalDiameter where Milimeter <= ?' |
|
490 |
|
|
491 |
param = (size,) |
|
492 |
cursor.execute(sql, param) |
|
493 |
rows = cursor.fetchall() |
|
494 |
for row in rows: |
|
495 |
res = row[0] |
|
496 |
except Exception as ex: |
|
497 |
from App import App |
|
498 |
# Roll back any change if something goes wrong |
|
499 |
conn.rollback() |
|
500 |
|
|
501 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
502 |
sys.exc_info()[-1].tb_lineno) |
|
503 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
504 |
finally: |
|
505 |
# Close the db connection |
|
506 |
conn.close() |
|
507 |
|
|
508 |
return res |
|
509 |
|
|
510 |
|
|
444 | 511 |
def getInsideDiameter(self, nominaldiameter_uid, schedule_uid): |
445 | 512 |
res = [] |
446 | 513 |
try: |
내보내기 Unified diff