修复退出时窗口状态不能保存的bug

This commit is contained in:
chenxy123 2016-04-30 10:11:52 +08:00
parent ff501eca46
commit 549f19be00
2 changed files with 8 additions and 5 deletions

View File

@ -22,6 +22,7 @@ class MainWindow(QtGui.QMainWindow):
self.widgetDict = {} # 用来保存子窗口的字典
self.initUi()
self.loadWindowSettings()
#----------------------------------------------------------------------
def initUi(self):
@ -273,6 +274,8 @@ class MainWindow(QtGui.QMainWindow):
if reply == QtGui.QMessageBox.Yes:
for widget in self.widgetDict.values():
widget.close()
self.saveWindowSettings()
self.mainEngine.exit()
event.accept()
else:

View File

@ -10,14 +10,14 @@ from uiMainWindow import *
#----------------------------------------------------------------------
def main():
"""主程序入口"""
# 设置底部任务栏图标win7以下请注释掉
if platform.uname() == 'Windows':
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID('vn.py demo')
# Reload sys, Set default encode to UTF8
# 重载sys模块设置默认字符串编码方式为utf8
reload(sys)
sys.setdefaultencoding('utf8')
# 设置Windows底部任务栏图标
if platform.uname() == 'Windows':
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID('vn.trader')
# 初始化Qt应用对象
app = QtGui.QApplication(sys.argv)
app.setWindowIcon(QtGui.QIcon('vnpy.ico'))