diff --git a/test/trader/run.py b/test/trader/run.py new file mode 100644 index 00000000..dd519036 --- /dev/null +++ b/test/trader/run.py @@ -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() \ No newline at end of file diff --git a/vnpy/trader/ui/__init__.py b/vnpy/trader/ui/__init__.py index 709d9260..6bf350d0 100644 --- a/vnpy/trader/ui/__init__.py +++ b/vnpy/trader/ui/__init__.py @@ -2,10 +2,10 @@ import platform import ctypes import qdarkstyle -from PyQt5 import QtWidgets +from PyQt5 import QtWidgets, QtGui from .mainwindow import MainWindow - +from ..setting import SETTINGS def create_qapp(): """ @@ -14,6 +14,9 @@ def create_qapp(): qapp = QtWidgets.QApplication([]) qapp.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5()) + font = QtGui.QFont(SETTINGS["font.family"], SETTINGS["font.size"]) + qapp.setFont(font) + if 'Windows' in platform.uname(): ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID( 'VN Trader') diff --git a/vnpy/trader/ui/mainwindow.py b/vnpy/trader/ui/mainwindow.py new file mode 100644 index 00000000..dd0f5dbb --- /dev/null +++ b/vnpy/trader/ui/mainwindow.py @@ -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 \ No newline at end of file