개정판 746c8f97
issue #663: fix saving db when execute recognition
Change-Id: Id531defcce65b156f5b43b2d12ee4f96f67cf391
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
32 | 32 |
from SingletonInstance import SingletonInstane |
33 | 33 |
|
34 | 34 |
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '\\Shapes') |
35 |
from EngineeringAbstractItem import QEngineeringAbstractItem |
|
35 | 36 |
from EngineeringPolylineItem import QEngineeringPolylineItem |
36 | 37 |
from EngineeringLineItem import QEngineeringLineItem |
37 | 38 |
from SymbolSvgItem import SymbolSvgItem |
... | ... | |
49 | 50 |
from EngineeringEndBreakItem import QEngineeringEndBreakItem |
50 | 51 |
from EngineeringReducerItem import QEngineeringReducerItem |
51 | 52 |
from EngineeringFlowMarkItem import QEngineeringFlowMarkItem |
53 |
from QEngineeringTrimLineNoTextItem import QEngineeringTrimLineNoTextItem |
|
52 | 54 |
from AppDocData import * |
53 | 55 |
import SymbolTreeWidget, SymbolPropertyTableWidget |
54 | 56 |
import SymbolEditorDialog |
... | ... | |
594 | 596 |
@date 2018.11.12 |
595 | 597 |
@history 2018.11.02 euisung remove scene dependency |
596 | 598 |
''' |
597 |
from AppDocData import AppDocData |
|
598 |
|
|
599 | 599 |
try: |
600 | 600 |
appDocData = AppDocData.instance() |
601 | 601 |
|
... | ... | |
611 | 611 |
if item.area == titleBlockProp[0]: |
612 | 612 |
titleBlockItems.append(item) |
613 | 613 |
|
614 |
db_items = [item for item in items if issubclass(type(item), QEngineeringAbstractItem) and type(item) is not QGraphicsBoundingBoxItem and type(item) is not QEngineeringErrorItem and type(item) is not QEngineeringLineNoTextItem] |
|
615 |
db_items.extend([item for item in items if type(item) is QEngineeringLineNoTextItem]) |
|
616 |
db_items.extend([line for line in appDocData.tracerLineNos if type(line) is QEngineeringTrimLineNoTextItem]) |
|
617 |
db_items.extend(titleBlockItems) |
|
618 |
''' |
|
614 | 619 |
dbItems = [item for item in items if |
615 | 620 |
type(item) is QEngineeringInstrumentItem or type(item) is QEngineeringEquipmentItem or type( |
616 | 621 |
item) is QEngineeringReducerItem or \ |
617 | 622 |
type(item) is QEngineeringNoteItem or type(item) is SymbolSvgItem or type( |
618 | 623 |
item) is QEngineeringLineNoTextItem or type( |
619 | 624 |
item) is QEngineeringVendorItem] + titleBlockItems |
620 |
appDocData.saveToDatabase(dbItems) |
|
625 |
''' |
|
626 |
appDocData.saveToDatabase(db_items) |
|
621 | 627 |
except Exception as ex: |
622 | 628 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
623 | 629 |
sys.exc_info()[-1].tb_lineno) |
... | ... | |
636 | 642 |
|
637 | 643 |
def actionSaveCliked(self): |
638 | 644 |
from datetime import datetime |
639 |
from AppDocData import AppDocData |
|
640 | 645 |
from EngineeringAbstractItem import QEngineeringAbstractItem |
641 | 646 |
from SaveWorkCommand import SaveWorkCommand |
642 | 647 |
|
... | ... | |
1949 | 1954 |
QApplication.processEvents() |
1950 | 1955 |
self.createDetectedTitleBlockTextItem(titleBlockTextInfoList) |
1951 | 1956 |
|
1952 |
self.dbUpdate() |
|
1953 |
|
|
1954 | 1957 |
# update scene |
1955 | 1958 |
# self.graphicsView.scene.update(self.graphicsView.sceneRect()) |
1956 | 1959 |
except Exception as ex: |
... | ... | |
1998 | 2001 |
@date 2018.11.15 |
1999 | 2002 |
@history 2018.11.15 euisung no more used, moved to TextItemFactoy isLineNo() |
2000 | 2003 |
''' |
2001 |
from AppDocData import AppDocData |
|
2002 | 2004 |
from TextItemFactory import TextItemFactory |
2003 | 2005 |
|
2004 | 2006 |
appDocData = AppDocData.instance() |
... | ... | |
2357 | 2359 |
message = 'can\'t found {}'.format(diffFilePath) |
2358 | 2360 |
self.addMessage.emit(MessageType.Normal, message) |
2359 | 2361 |
|
2362 |
self.dbUpdate() |
|
2360 | 2363 |
SaveWorkCommand.save_to_xml() |
2361 | 2364 |
except Exception as ex: |
2362 | 2365 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
내보내기 Unified diff