MCPcopy Create free account
hub / github.com/PyQt5/PyQtClient / main

Function main

Widgets/MainWindow.py:239–269  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

237
238
239def main():
240 if int(QtCore.PYQT_VERSION_STR.split('.')[1]) > 5:
241 # for > Qt 5.5
242 os.putenv('QT_AUTO_SCREEN_SCALE_FACTOR', '1')
243 else:
244 # for Qt 5.5
245 os.putenv('QT_DEVICE_PIXEL_RATIO', 'auto')
246 if os.name == 'nt':
247 os.environ['PATH'] = QLibraryInfo.location(
248 QLibraryInfo.BinariesPath) + os.pathsep + os.environ['PATH']
249 os.makedirs(Constants.DirErrors, exist_ok=True)
250 os.makedirs(Constants.DirProject, exist_ok=True)
251 os.makedirs(os.path.dirname(Constants.UpgradeFile), exist_ok=True)
252 # 异常捕捉
253 sys.excepthook = cgitb.Hook(1, Constants.DirErrors, 5, sys.stderr, '')
254 # 初始化日志
255 initLog(Constants.LogName, Constants.LogFile)
256 # 运行app
257 app = QSingleApplication('qtsingleapp-pyqtclient', sys.argv)
258 if app.isRunning():
259 # 激活窗口
260 app.sendMessage('show', 1000)
261 else:
262 app.setAttribute(Qt.AA_DisableWindowContextHelpButton)
263 app.setQuitOnLastWindowClosed(True)
264 app.setWindowIcon(QIcon('Resources/Images/app.ico'))
265 # 第一次运行
266 w = MainWindow()
267 app.setActivationWindow(w)
268 w.show()
269 sys.exit(app.exec_())
270
271
272if __name__ == '__main__':

Callers 1

MainWindow.pyFile · 0.85

Calls 6

isRunningMethod · 0.95
sendMessageMethod · 0.95
setActivationWindowMethod · 0.95
initLogFunction · 0.90
QSingleApplicationClass · 0.90
MainWindowClass · 0.85

Tested by

no test coverage detected