From ac9048b0ad60c9b640719ac09ffd3948bd0aa259 Mon Sep 17 00:00:00 2001 From: nanoric Date: Fri, 28 Dec 2018 03:01:09 -0400 Subject: [PATCH] =?UTF-8?q?[Fix]=20=E4=BF=AE=E6=AD=A3=E4=B8=80=E4=B8=AAUI?= =?UTF-8?q?=E9=94=99=E8=AF=AF=EF=BC=9A=E4=BF=AE=E5=A4=8D=E4=BA=86=E6=9C=80?= =?UTF-8?q?=E5=A4=A7=E5=8C=96app=E4=B9=8B=E5=90=8E=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E5=86=8D=E6=89=93=E5=BC=80=E4=BC=9A=E6=98=BE=E7=A4=BA=E4=B8=80?= =?UTF-8?q?=E5=A4=A7=E7=89=87=E7=A9=BA=E7=99=BD=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20[Add]=20UI=E5=8A=9F=E8=83=BD=E6=80=A7=E5=A2=9E=E5=BC=BA?= =?UTF-8?q?=EF=BC=9A=E7=82=B9=E5=87=BB=E6=9F=90=E4=B8=AAapp=E4=B9=8B?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E8=AF=A5app=E4=B8=80=E5=AE=9A=E4=BC=9A?= =?UTF-8?q?=E8=A2=AB=E7=A7=BB=E5=88=B0=E5=89=8D=E5=8F=B0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 顺便去掉了try_catch KeyError,改用if --- vnpy/trader/uiMainWindow.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/vnpy/trader/uiMainWindow.py b/vnpy/trader/uiMainWindow.py index 8e0f555a..329566a5 100644 --- a/vnpy/trader/uiMainWindow.py +++ b/vnpy/trader/uiMainWindow.py @@ -206,13 +206,15 @@ class MainWindow(QtWidgets.QMainWindow): :return 返回app的窗口 """ appName = appDetail['appName'] - try: - self.widgetDict[appName].show() - except KeyError: - appEngine = self.mainEngine.getApp(appName) - self.widgetDict[appName] = appDetail['appWidget'](appEngine, self.eventEngine) - self.widgetDict[appName].show() - return self.widgetDict[appName] + if appName not in self.widgetDict: + self.widgetDict[appName] = appDetail['appWidget'](self.mainEngine.getApp(appName), + self.eventEngine) + app = self.widgetDict[appName] # type: QtWidgets.QWidget + app.show() + app.resize(app.size()) # 修正最大化后的空白 + app.raise_() # 移到前台 + app.activateWindow() # 移到前台并获取焦点 + return app #---------------------------------------------------------------------- def createOpenAppFunction(self, appDetail):