diff --git a/vnpy/trader/ui/mainwindow.py b/vnpy/trader/ui/mainwindow.py index 5ef5ab2d..dc37547a 100644 --- a/vnpy/trader/ui/mainwindow.py +++ b/vnpy/trader/ui/mainwindow.py @@ -9,7 +9,7 @@ from PyQt5 import QtWidgets, QtCore, QtGui from vnpy.event import EventEngine from ..engine import MainEngine -from ..utility import get_icon_path +from ..utility import get_icon_path, get_trader_path from .widget import ( TickMonitor, OrderMonitor, @@ -43,7 +43,10 @@ class MainWindow(QtWidgets.QMainWindow): 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_menu() diff --git a/vnpy/trader/utility.py b/vnpy/trader/utility.py index 8c6a7789..25bdf57e 100644 --- a/vnpy/trader/utility.py +++ b/vnpy/trader/utility.py @@ -28,17 +28,25 @@ class Singleton(type): 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() - 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(): temp_path.mkdir() - return temp_path.joinpath(filename) + return temp_path.joinpath(file_name) def get_icon_path(file_path: str, ico_name: str):