[Fix] 修正一个UI错误:修复了最大化app之后关闭再打开会显示一大片空白的问题

[Add] UI功能性增强:点击某个app之后,该app一定会被移到前台。

顺便去掉了try_catch KeyError,改用if
This commit is contained in:
nanoric 2018-12-28 03:01:09 -04:00
parent dbd967bb6d
commit ac9048b0ad

View File

@ -206,13 +206,15 @@ class MainWindow(QtWidgets.QMainWindow):
:return 返回app的窗口 :return 返回app的窗口
""" """
appName = appDetail['appName'] appName = appDetail['appName']
try: if appName not in self.widgetDict:
self.widgetDict[appName].show() self.widgetDict[appName] = appDetail['appWidget'](self.mainEngine.getApp(appName),
except KeyError: self.eventEngine)
appEngine = self.mainEngine.getApp(appName) app = self.widgetDict[appName] # type: QtWidgets.QWidget
self.widgetDict[appName] = appDetail['appWidget'](appEngine, self.eventEngine) app.show()
self.widgetDict[appName].show() app.resize(app.size()) # 修正最大化后的空白
return self.widgetDict[appName] app.raise_() # 移到前台
app.activateWindow() # 移到前台并获取焦点
return app
#---------------------------------------------------------------------- #----------------------------------------------------------------------
def createOpenAppFunction(self, appDetail): def createOpenAppFunction(self, appDetail):