개정판 506cbe56
issue #1197: 프로그램 종료 시 수정된 도면 저장 여부를 확인하여 저장
Change-Id: I2cced3a86e9860a657fad3de3df5de136204ee0a
HYTOS/HYTOS/App.py | ||
---|---|---|
4 | 4 |
import os |
5 | 5 |
|
6 | 6 |
if hasattr(sys, 'frozen'): |
7 |
os.environ['PATH'] = sys._MEIPASS + ";" + os.environ['PATH'] |
|
7 |
os.environ['PATH'] = sys._MEIPASS + ";" + os.environ['PATH']
|
|
8 | 8 |
|
9 | 9 |
from PyQt5.QtCore import * |
10 | 10 |
from PyQt5.QtGui import * |
... | ... | |
15 | 15 |
|
16 | 16 |
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__))) |
17 | 17 |
|
18 |
|
|
18 | 19 |
class App(QApplication): |
19 | 20 |
""" This is App class inherits from QApplication """ |
20 | 21 |
|
21 |
NAME = 'HYTOS' ### program name
|
|
22 |
NAME = 'HYTOS' # program name |
|
22 | 23 |
|
23 | 24 |
def __init__(self, args): |
24 | 25 |
import locale |
25 | 26 |
from AppDocData import AppDocData |
26 | 27 |
|
27 |
|
|
28 | 28 |
super(App, self).__init__(args) |
29 |
|
|
29 | 30 |
app_doc_data = AppDocData.instance() |
30 | 31 |
app_style = app_doc_data.loadAppStyle() |
31 | 32 |
self.setStyle(app_style) |
... | ... | |
38 | 39 |
self.loadStyleSheet(os.path.dirname(os.path.realpath(__file__)) + '\\pagefold') |
39 | 40 |
self.stylesheet_name = 'pagefold' |
40 | 41 |
|
41 |
### load language file
|
|
42 |
# load language file |
|
42 | 43 |
self._translator = None |
43 | 44 |
configs = app_doc_data.getAppConfigs('app', 'language') |
44 | 45 |
if configs and len(configs) == 1: |
45 |
qm_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'translate' , '{0}.qm'.format(configs[0].value)) |
|
46 |
qm_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'translate', |
|
47 |
'{0}.qm'.format(configs[0].value)) |
|
46 | 48 |
else: |
47 | 49 |
locale = locale.getdefaultlocale() |
48 |
qm_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'translate' , '{0}.qm'.format(locale[0]))
|
|
50 |
qm_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'translate', '{0}.qm'.format(locale[0])) |
|
49 | 51 |
|
50 | 52 |
self.load_language(qm_file) |
51 |
### up to here
|
|
53 |
# up to here |
|
52 | 54 |
|
53 | 55 |
self._mainWnd = None |
54 | 56 |
|
... | ... | |
59 | 61 |
@author humkyung |
60 | 62 |
@date 2018.04.07 |
61 | 63 |
''' |
64 |
|
|
62 | 65 |
def loadStyleSheet(self, sheetName): |
63 | 66 |
try: |
64 | 67 |
file = QFile('%s.qss' % sheetName.lower()) |
... | ... | |
92 | 95 |
@author humkyung |
93 | 96 |
@date 2018.07.12 |
94 | 97 |
''' |
98 |
|
|
95 | 99 |
@staticmethod |
96 | 100 |
def mainWnd(): |
97 | 101 |
return QtWidgets.qApp._mainWnd |
98 | 102 |
|
103 |
|
|
99 | 104 |
if __name__ == '__main__': |
100 | 105 |
from AppDocData import AppDocData |
101 | 106 |
from MainWindow import MainWindow |
... | ... | |
122 | 127 |
if len(sys.argv) == 2: |
123 | 128 |
app._mainWnd.open_drawing(sys.argv[1]) |
124 | 129 |
app._mainWnd.show() |
125 |
sys.exit(app.exec_()) |
|
130 |
sys.exit(app.exec_()) |
HYTOS/HYTOS/MainWindow.py | ||
---|---|---|
179 | 179 |
else: |
180 | 180 |
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabLogs), 'Logs') |
181 | 181 |
|
182 |
def closeEvent(self, a0: QCloseEvent) -> None: |
|
183 |
"""ask user to save drawing which is modified""" |
|
184 |
self.save_drawing_if_necessary() |
|
185 |
a0.accept() |
|
186 |
|
|
182 | 187 |
def openContextMenu(self, position): |
183 | 188 |
indexes = self.treeWidgetDrawingList.selectedIndexes() |
184 | 189 |
if len(indexes) > 0: |
내보내기 Unified diff