[Add] Show VN Trader running path in main window
This commit is contained in:
parent
91cb3d103d
commit
60a640b6d1
@ -9,7 +9,7 @@ from PyQt5 import QtWidgets, QtCore, QtGui
|
|||||||
|
|
||||||
from vnpy.event import EventEngine
|
from vnpy.event import EventEngine
|
||||||
from ..engine import MainEngine
|
from ..engine import MainEngine
|
||||||
from ..utility import get_icon_path
|
from ..utility import get_icon_path, get_trader_path
|
||||||
from .widget import (
|
from .widget import (
|
||||||
TickMonitor,
|
TickMonitor,
|
||||||
OrderMonitor,
|
OrderMonitor,
|
||||||
@ -43,7 +43,10 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
|
|
||||||
def init_ui(self):
|
def init_ui(self):
|
||||||
""""""
|
""""""
|
||||||
self.setWindowTitle("VN Trader")
|
path = get_trader_path()
|
||||||
|
title = f"VN Trader [{path}]"
|
||||||
|
self.setWindowTitle(title)
|
||||||
|
|
||||||
self.init_dock()
|
self.init_dock()
|
||||||
self.init_menu()
|
self.init_menu()
|
||||||
|
|
||||||
|
@ -28,17 +28,25 @@ class Singleton(type):
|
|||||||
return cls._instances[cls]
|
return cls._instances[cls]
|
||||||
|
|
||||||
|
|
||||||
def get_temp_path(filename: str):
|
def get_trader_path():
|
||||||
"""
|
"""
|
||||||
Get path for temp file with filename.
|
Get path where trader is running in.
|
||||||
"""
|
"""
|
||||||
home_path = Path.home()
|
home_path = Path.home()
|
||||||
temp_path = home_path.joinpath('.vntrader')
|
return home_path
|
||||||
|
|
||||||
|
|
||||||
|
def get_temp_path(file_name: str):
|
||||||
|
"""
|
||||||
|
Get path for temp file with file_name.
|
||||||
|
"""
|
||||||
|
trader_path = get_trader_path()
|
||||||
|
temp_path = trader_path.joinpath('.vntrader')
|
||||||
|
|
||||||
if not temp_path.exists():
|
if not temp_path.exists():
|
||||||
temp_path.mkdir()
|
temp_path.mkdir()
|
||||||
|
|
||||||
return temp_path.joinpath(filename)
|
return temp_path.joinpath(file_name)
|
||||||
|
|
||||||
|
|
||||||
def get_icon_path(file_path: str, ico_name: str):
|
def get_icon_path(file_path: str, ico_name: str):
|
||||||
|
Loading…
Reference in New Issue
Block a user