-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbacktester.py
69 lines (48 loc) · 1.68 KB
/
backtester.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# encoding: utf-8
import os, sys
from PySide2.QtWidgets import QApplication, QSplashScreen, QSystemTrayIcon, QMenu
from PySide2.QtGui import QPixmap, QIcon
os.chdir("ui")
os.environ["QT_API"] = "PySide2"
from libs import BT
class App:
def __init__(self):
# Create a Qt application
self.app = QApplication(sys.argv)
self.main = BT('main.ui')
self.splash = QSplashScreen(QPixmap('../images/boot.jpg'))
self.splash.show()
menu = QMenu()
showAction = menu.addAction("显示")
hideAction = menu.addAction("隐藏")
closeAction = menu.addAction("退出")
showAction.triggered.connect(lambda event: self.show(showAction, hideAction))
hideAction.triggered.connect(lambda event: self.hide(showAction, hideAction))
closeAction.triggered.connect(self.exit)
self.tray = QSystemTrayIcon()
self.tray.setIcon(QIcon("../icon/icon.ico"))
self.tray.setContextMenu(menu)
self.tray.show()
self.tray.setToolTip("")
def run(self):
# Enter Qt application main loop
self.app.processEvents()
self.main.window.show()
self.splash.finish(self.main.window)
sys.exit(self.app.exec_())
def hide(self, show_action, hiden_actoin):
hiden_actoin.setDisabled(True)
show_action.setEnabled(True)
self.main.window.hide()
return
def show(self, show_action, hiden_actoin):
hiden_actoin.setEnabled(True)
show_action.setDisabled(True)
self.main.window.show()
return
def exit(self):
self.main.window.close()
return
if __name__ == '__main__':
app = App()
app.run()