From a7a647a3b848f237c78da97df33047634c8aae55 Mon Sep 17 00:00:00 2001 From: nanoric Date: Wed, 20 Mar 2019 02:53:18 -0400 Subject: [PATCH 1/2] [Add] Disable maximun button [Add] Added an icon [Add] Popup an message if market data is fully loaded MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [Mod] combobox: remove Prefix [Mod] rename: CSV行情载入器 --- vnpy/app/csv_loader/__init__.py | 2 +- vnpy/app/csv_loader/ui/csv_loader.ui | 2 +- vnpy/app/csv_loader/ui/csv_loader_widget.py | 17 ++++++++++++----- vnpy/app/csv_loader/ui/uic/uic_csv_loader.py | 4 ++-- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/vnpy/app/csv_loader/__init__.py b/vnpy/app/csv_loader/__init__.py index f97d4319..390f61c2 100644 --- a/vnpy/app/csv_loader/__init__.py +++ b/vnpy/app/csv_loader/__init__.py @@ -13,4 +13,4 @@ class CsvLoaderApp(BaseApp): display_name = "CSV行情载入器" engine_class = CsvLoader widget_name = "CsvLoaderWidget" - icon_name = "cta.ico" + icon_name = "csv.ico" diff --git a/vnpy/app/csv_loader/ui/csv_loader.ui b/vnpy/app/csv_loader/ui/csv_loader.ui index 73b21e96..44b6542c 100644 --- a/vnpy/app/csv_loader/ui/csv_loader.ui +++ b/vnpy/app/csv_loader/ui/csv_loader.ui @@ -3,7 +3,7 @@ CsvLoader - Csv载入器 + CSV行情载入器 diff --git a/vnpy/app/csv_loader/ui/csv_loader_widget.py b/vnpy/app/csv_loader/ui/csv_loader_widget.py index 4264ac65..d9b03997 100644 --- a/vnpy/app/csv_loader/ui/csv_loader_widget.py +++ b/vnpy/app/csv_loader/ui/csv_loader_widget.py @@ -7,15 +7,17 @@ compile: pyuic5 csv_loader.ui -o uic/uic_csv_loader.py ``` """ -from PyQt5.QtWidgets import QFileDialog +from PyQt5.QtCore import Qt +from PyQt5.QtWidgets import QFileDialog, QMessageBox + from vnpy.event import EventEngine -from vnpy.trader.constant import Interval, Exchange +from vnpy.trader.constant import Exchange, Interval from vnpy.trader.engine import MainEngine from vnpy.trader.ui import QtWidgets - from .uic.uic_csv_loader import Ui_CsvLoader from ..csv_loader import CsvLoader +from gettext import gettext as _ class CsvLoaderWidget(QtWidgets.QWidget): """""" @@ -30,13 +32,17 @@ class CsvLoaderWidget(QtWidgets.QWidget): def init_ui(self): """""" + # someone ask me to disable maximum button + self.setWindowFlags( + (self.windowFlags() | Qt.CustomizeWindowHint) + & ~Qt.WindowMaximizeButtonHint) self.ui.setupUi(self) for i in Interval: - self.ui.interval_combo.addItem(str(i), i) + self.ui.interval_combo.addItem(str(i.name), i) for i in Exchange: - self.ui.exchange_combo.addItem(str(i), i) + self.ui.exchange_combo.addItem(str(i.name), i) def on_choose_button_pressed(self): """""" @@ -59,3 +65,4 @@ class CsvLoaderWidget(QtWidgets.QWidget): self.loader.volume_head = self.ui.volume_edit.text() self.loader.load() + QMessageBox.information(self, _("载入成功!"), _("CSV行情载入成功!")) diff --git a/vnpy/app/csv_loader/ui/uic/uic_csv_loader.py b/vnpy/app/csv_loader/ui/uic/uic_csv_loader.py index 48789519..b96bd980 100644 --- a/vnpy/app/csv_loader/ui/uic/uic_csv_loader.py +++ b/vnpy/app/csv_loader/ui/uic/uic_csv_loader.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file 'csv_loader.ui' +# Form implementation generated from reading ui file '../csv_loader.ui' # # Created by: PyQt5 UI code generator 5.11.3 # @@ -94,7 +94,7 @@ class Ui_CsvLoader(object): def retranslateUi(self, CsvLoader): _translate = QtCore.QCoreApplication.translate - CsvLoader.setWindowTitle(_translate("CsvLoader", "Csv载入器")) + CsvLoader.setWindowTitle(_translate("CsvLoader", "CSV行情载入器")) self.choose_button.setText(_translate("CsvLoader", "选择文件")) self.label_8.setText(_translate("CsvLoader", "合约信息")) self.label_9.setText(_translate("CsvLoader", "Symbol")) From d640c8c8997539e3309eed3a231c160bbb9ffbe7 Mon Sep 17 00:00:00 2001 From: nanoric Date: Wed, 20 Mar 2019 04:08:26 -0400 Subject: [PATCH 2/2] [Mod] Added blank lines: make flake8 happy --- vnpy/app/csv_loader/ui/csv_loader_widget.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vnpy/app/csv_loader/ui/csv_loader_widget.py b/vnpy/app/csv_loader/ui/csv_loader_widget.py index d9b03997..adcb2cc8 100644 --- a/vnpy/app/csv_loader/ui/csv_loader_widget.py +++ b/vnpy/app/csv_loader/ui/csv_loader_widget.py @@ -7,6 +7,8 @@ compile: pyuic5 csv_loader.ui -o uic/uic_csv_loader.py ``` """ +from gettext import gettext as _ + from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QFileDialog, QMessageBox @@ -17,7 +19,6 @@ from vnpy.trader.ui import QtWidgets from .uic.uic_csv_loader import Ui_CsvLoader from ..csv_loader import CsvLoader -from gettext import gettext as _ class CsvLoaderWidget(QtWidgets.QWidget): """"""