[Add] Add mainwindow and test code of VN Trader
This commit is contained in:
parent
c304c2b125
commit
fe5b994b0e
19
test/trader/run.py
Normal file
19
test/trader/run.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
from vnpy.event import EventEngine
|
||||||
|
from vnpy.trader.engine import MainEngine
|
||||||
|
from vnpy.trader.ui import MainWindow, create_qapp
|
||||||
|
|
||||||
|
from vnpy.trader.ui.widget import TickMonitor
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
qapp = create_qapp()
|
||||||
|
|
||||||
|
event_engine = EventEngine()
|
||||||
|
main_engine = MainEngine(event_engine)
|
||||||
|
|
||||||
|
main_window = MainWindow(main_engine, event_engine)
|
||||||
|
main_window.showMaximized()
|
||||||
|
|
||||||
|
monitor = TickMonitor(main_engine, event_engine)
|
||||||
|
monitor.show()
|
||||||
|
|
||||||
|
qapp.exec()
|
@ -2,10 +2,10 @@ import platform
|
|||||||
import ctypes
|
import ctypes
|
||||||
|
|
||||||
import qdarkstyle
|
import qdarkstyle
|
||||||
from PyQt5 import QtWidgets
|
from PyQt5 import QtWidgets, QtGui
|
||||||
|
|
||||||
from .mainwindow import MainWindow
|
from .mainwindow import MainWindow
|
||||||
|
from ..setting import SETTINGS
|
||||||
|
|
||||||
def create_qapp():
|
def create_qapp():
|
||||||
"""
|
"""
|
||||||
@ -14,6 +14,9 @@ def create_qapp():
|
|||||||
qapp = QtWidgets.QApplication([])
|
qapp = QtWidgets.QApplication([])
|
||||||
qapp.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())
|
qapp.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())
|
||||||
|
|
||||||
|
font = QtGui.QFont(SETTINGS["font.family"], SETTINGS["font.size"])
|
||||||
|
qapp.setFont(font)
|
||||||
|
|
||||||
if 'Windows' in platform.uname():
|
if 'Windows' in platform.uname():
|
||||||
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(
|
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(
|
||||||
'VN Trader')
|
'VN Trader')
|
||||||
|
26
vnpy/trader/ui/mainwindow.py
Normal file
26
vnpy/trader/ui/mainwindow.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
from PyQt5 import QtWidgets
|
||||||
|
|
||||||
|
from vnpy.event import EventEngine
|
||||||
|
from ..engine import MainEngine
|
||||||
|
|
||||||
|
|
||||||
|
class MainWindow(QtWidgets.QMainWindow):
|
||||||
|
"""
|
||||||
|
Main window of VN Trader.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, main_engine: MainEngine, event_engine: EventEngine):
|
||||||
|
""""""
|
||||||
|
super(MainWindow, self).__init__()
|
||||||
|
self.main_engine = main_engine
|
||||||
|
self.event_engine = event_engine
|
||||||
|
|
||||||
|
self.init_ui()
|
||||||
|
|
||||||
|
def init_ui(self):
|
||||||
|
""""""
|
||||||
|
self.setWindowTitle("VN Trader")
|
||||||
|
|
||||||
|
def register_event(self):
|
||||||
|
""""""
|
||||||
|
pass
|
Loading…
Reference in New Issue
Block a user