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

Class MainWindow

Widgets/MainWindow.py:37–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35
36
37class MainWindow(FramelessWindow, MainWindowBase, Ui_FormMainWindow):
38
39 def __init__(self, *args, **kwargs):
40 super(MainWindow, self).__init__(*args, **kwargs)
41 Setting.init(self)
42 self._initLanguage()
43 self._initUi()
44 self._initSignals()
45 # 加载窗口大小并恢复
46 geometry = Setting.value('geometry')
47 if geometry:
48 self.restoreGeometry(geometry)
49 # 200毫秒后显示登录对话框
50 QTimer.singleShot(200, self._initCatalog)
51 QTimer.singleShot(500, self.treeViewCatalogs.initCatalog)
52 # 初始化网页
53 QTimer.singleShot(500, self._initWebView)
54 # 检测更新
55 QTimer.singleShot(5000, UpgradeThread.start)
56 # 显示捐赠窗口
57 QTimer.singleShot(randint(1000 * 60 * 5, 2000 * 60 * 5),
58 self._initDonate)
59
60 def initLogin(self):
61 dialog = LoginDialog(self)
62 dialog.exec_()
63 # 刷新头像样式
64 if Constants._Account != '' and Constants._Password != '':
65 self.buttonHead.image = Constants.ImageAvatar
66 self.buttonHead.setToolTip(Constants._Username)
67
68 def _initDonate(self):
69 # 显示捐赠窗口
70 alipayImg = os.path.join(Constants.DirProjects, 'Donate',
71 'zhifubao.png')
72 wechatImg = os.path.join(Constants.DirProjects, 'Donate', 'weixin.png')
73 if os.path.exists(alipayImg) and os.path.exists(wechatImg):
74 dialog = DonateDialog(alipayImg, wechatImg, self)
75 dialog.exec_()
76
77 def _initUpdate(self):
78 # 显示更新对话框
79 self.udialog = UpdateDialog()
80 self.udialog.show()
81
82 def _initCatalog(self):
83 # 更新目录
84 self._showNotice(
85 QCoreApplication.translate('MainWindow', 'Update Example Started'))
86 CloneThread.start()
87
88 @pyqtSlot(str)
89 def renderCode(self, code):
90 """显示代码
91 """
92 content = repr(code)
93 self._runJs("updateCode({});".format(content))
94

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected