Merge pull request #1505 from nanoric/csv_loader_opt
Optimize CSV loader
This commit is contained in:
commit
b201ace4d1
@ -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"
|
||||||
|
@ -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>
|
||||||
|
@ -7,12 +7,15 @@ 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 gettext import gettext as _
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
@ -30,13 +33,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 +66,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行情载入成功!"))
|
||||||
|
@ -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"))
|
||||||
|
Loading…
Reference in New Issue
Block a user