[Add] Disable maximun button

[Add] Added an icon
[Add] Popup an message if market data is fully loaded

[Mod] combobox: remove Prefix
[Mod] rename: CSV行情载入器
This commit is contained in:
nanoric 2019-03-20 02:53:18 -04:00
parent 6c47c869dd
commit a7a647a3b8
4 changed files with 16 additions and 9 deletions

View File

@ -13,4 +13,4 @@ class CsvLoaderApp(BaseApp):
display_name = "CSV行情载入器" display_name = "CSV行情载入器"
engine_class = CsvLoader engine_class = CsvLoader
widget_name = "CsvLoaderWidget" widget_name = "CsvLoaderWidget"
icon_name = "cta.ico" icon_name = "csv.ico"

View File

@ -3,7 +3,7 @@
<class>CsvLoader</class> <class>CsvLoader</class>
<widget class="QDialog" name="CsvLoader"> <widget class="QDialog" name="CsvLoader">
<property name="windowTitle"> <property name="windowTitle">
<string>Csv载入器</string> <string>CSV行情载入器</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>

View File

@ -7,15 +7,17 @@ compile:
pyuic5 csv_loader.ui -o uic/uic_csv_loader.py 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.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.engine import MainEngine
from vnpy.trader.ui import QtWidgets from vnpy.trader.ui import QtWidgets
from .uic.uic_csv_loader import Ui_CsvLoader from .uic.uic_csv_loader import Ui_CsvLoader
from ..csv_loader import CsvLoader from ..csv_loader import CsvLoader
from gettext import gettext as _
class CsvLoaderWidget(QtWidgets.QWidget): class CsvLoaderWidget(QtWidgets.QWidget):
"""""" """"""
@ -30,13 +32,17 @@ class CsvLoaderWidget(QtWidgets.QWidget):
def init_ui(self): def init_ui(self):
"""""" """"""
# someone ask me to disable maximum button
self.setWindowFlags(
(self.windowFlags() | Qt.CustomizeWindowHint)
& ~Qt.WindowMaximizeButtonHint)
self.ui.setupUi(self) self.ui.setupUi(self)
for i in Interval: 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: 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): 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.volume_head = self.ui.volume_edit.text()
self.loader.load() self.loader.load()
QMessageBox.information(self, _("载入成功!"), _("CSV行情载入成功"))

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- 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 # Created by: PyQt5 UI code generator 5.11.3
# #
@ -94,7 +94,7 @@ class Ui_CsvLoader(object):
def retranslateUi(self, CsvLoader): def retranslateUi(self, CsvLoader):
_translate = QtCore.QCoreApplication.translate _translate = QtCore.QCoreApplication.translate
CsvLoader.setWindowTitle(_translate("CsvLoader", "Csv载入器")) CsvLoader.setWindowTitle(_translate("CsvLoader", "CSV行情载入器"))
self.choose_button.setText(_translate("CsvLoader", "选择文件")) self.choose_button.setText(_translate("CsvLoader", "选择文件"))
self.label_8.setText(_translate("CsvLoader", "合约信息")) self.label_8.setText(_translate("CsvLoader", "合约信息"))
self.label_9.setText(_translate("CsvLoader", "Symbol")) self.label_9.setText(_translate("CsvLoader", "Symbol"))