diff --git a/hikyuu/gui/HikyuuTDX.py b/hikyuu/gui/HikyuuTDX.py
index dcf26d65..3b1c9c80 100644
--- a/hikyuu/gui/HikyuuTDX.py
+++ b/hikyuu/gui/HikyuuTDX.py
@@ -146,12 +146,33 @@ class MyMainWindow(QMainWindow, Ui_MainWindow):
#初始化hdf5设置
hdf5_enable = import_config.getboolean('hdf5', 'enable', fallback=True)
+ self.enable_hdf55_radioButton.setChecked(hdf5_enable)
hdf5_dir = import_config.get(
'hdf5',
'dir',
fallback="c:\stock" if sys.platform == "win32" else os.path.expanduser('~') + "/stock"
)
self.hdf5_dir_lineEdit.setText(hdf5_dir)
+ self.hdf5_dir_lineEdit.setEnabled(hdf5_enable)
+
+ #初始化MYSQL设置
+ mysql_enable = import_config.getboolean('mysql', 'enable', fallback=False)
+ if hdf5_enable:
+ mysql_enable = False
+ self.enable_mysql_radioButton.setChecked(mysql_enable)
+ mysql_ip = import_config.get('mysql', 'ip', fallback='127.0.0.1')
+ self.mysql_ip_lineEdit.setText(mysql_ip)
+ self.mysql_ip_lineEdit.setEnabled(mysql_enable)
+ mysql_port = import_config.get('mysql', 'port', fallback='3306')
+ self.mysql_port_lineEdit.setText(mysql_port)
+ self.mysql_port_lineEdit.setEnabled(mysql_enable)
+ mysql_usr = import_config.get('mysql', 'usr', fallback='root')
+ self.mysql_usr_lineEdit.setText(mysql_usr)
+ self.mysql_usr_lineEdit.setEnabled(mysql_enable)
+ mysql_pwd = import_config.get('mysql', 'pwd', fallback='')
+ self.mysql_pwd_lineEdit.setText(mysql_pwd)
+ self.mysql_pwd_lineEdit.setEnabled(mysql_enable)
+ self.mysql_test_pushButton.setEnabled(mysql_enable)
self.on_tdx_or_pytdx_toggled()
@@ -185,7 +206,17 @@ class MyMainWindow(QMainWindow, Ui_MainWindow):
'enable': self.pytdx_radioButton.isChecked(),
'use_tdx_number': self.use_tdx_number_spinBox.value()
}
- import_config['hdf5'] = {'enable': True, 'dir': self.hdf5_dir_lineEdit.text()}
+ import_config['hdf5'] = {
+ 'enable': self.enable_hdf55_radioButton.isChecked(),
+ 'dir': self.hdf5_dir_lineEdit.text()
+ }
+ import_config['mysql'] = {
+ 'enable': self.enable_mysql_radioButton.isChecked(),
+ 'ip': self.mysql_ip_lineEdit.text(),
+ 'port': self.mysql_port_lineEdit.text(),
+ 'usr': self.mysql_usr_lineEdit.text(),
+ 'pwd': self.mysql_pwd_lineEdit.text()
+ }
return import_config
def initThreads(self):
@@ -242,6 +273,28 @@ class MyMainWindow(QMainWindow, Ui_MainWindow):
dirname = dlg.selectedFiles()
self.hdf5_dir_lineEdit.setText(dirname[0])
+ @pyqtSlot()
+ def on_enable_hdf55_radioButton_clicked(self):
+ if self.enable_hdf55_radioButton.isChecked():
+ self.enable_mysql_radioButton.setChecked(False)
+ self.on_enable_hdf5_or_mysql_toggled()
+
+ @pyqtSlot()
+ def on_enable_mysql_radioButton_clicked(self):
+ if self.enable_mysql_radioButton.isChecked():
+ self.enable_hdf55_radioButton.setChecked(False)
+ self.on_enable_hdf5_or_mysql_toggled()
+
+ def on_enable_hdf5_or_mysql_toggled(self):
+ hdf5_enable = self.enable_hdf55_radioButton.isChecked()
+ mysql_enable = not hdf5_enable
+ self.hdf5_dir_lineEdit.setEnabled(hdf5_enable)
+ self.mysql_ip_lineEdit.setEnabled(mysql_enable)
+ self.mysql_port_lineEdit.setEnabled(mysql_enable)
+ self.mysql_usr_lineEdit.setEnabled(mysql_enable)
+ self.mysql_pwd_lineEdit.setEnabled(mysql_enable)
+ self.mysql_test_pushButton.setEnabled(mysql_enable)
+
def reset_progress_bar(self):
self.hdf5_weight_label.setText('')
self.hdf5_day_progressBar.setValue(0)
diff --git a/hikyuu/gui/data/MainWindow.py b/hikyuu/gui/data/MainWindow.py
index ae110311..ace48502 100644
--- a/hikyuu/gui/data/MainWindow.py
+++ b/hikyuu/gui/data/MainWindow.py
@@ -14,7 +14,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
- MainWindow.resize(638, 559)
+ MainWindow.resize(593, 559)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.tabWidget = QtWidgets.QTabWidget(self.centralwidget)
@@ -23,10 +23,10 @@ class Ui_MainWindow(object):
self.tab_4 = QtWidgets.QWidget()
self.tab_4.setObjectName("tab_4")
self.groupBox_2 = QtWidgets.QGroupBox(self.tab_4)
- self.groupBox_2.setGeometry(QtCore.QRect(20, 20, 481, 131))
+ self.groupBox_2.setGeometry(QtCore.QRect(20, 20, 551, 131))
self.groupBox_2.setObjectName("groupBox_2")
self.layoutWidget_3 = QtWidgets.QWidget(self.groupBox_2)
- self.layoutWidget_3.setGeometry(QtCore.QRect(20, 90, 451, 25))
+ self.layoutWidget_3.setGeometry(QtCore.QRect(20, 90, 521, 25))
self.layoutWidget_3.setObjectName("layoutWidget_3")
self.gridLayout_2 = QtWidgets.QGridLayout(self.layoutWidget_3)
self.gridLayout_2.setContentsMargins(0, 0, 0, 0)
@@ -49,7 +49,7 @@ class Ui_MainWindow(object):
self.tdx_radioButton.setGeometry(QtCore.QRect(20, 70, 481, 16))
self.tdx_radioButton.setObjectName("tdx_radioButton")
self.layoutWidget_4 = QtWidgets.QWidget(self.groupBox_2)
- self.layoutWidget_4.setGeometry(QtCore.QRect(20, 30, 371, 22))
+ self.layoutWidget_4.setGeometry(QtCore.QRect(20, 30, 411, 22))
self.layoutWidget_4.setObjectName("layoutWidget_4")
self.horizontalLayout = QtWidgets.QHBoxLayout(self.layoutWidget_4)
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
@@ -71,7 +71,7 @@ class Ui_MainWindow(object):
self.label_17.setObjectName("label_17")
self.horizontalLayout.addWidget(self.label_17)
self.groupBox_7 = QtWidgets.QGroupBox(self.tab_4)
- self.groupBox_7.setGeometry(QtCore.QRect(20, 170, 481, 261))
+ self.groupBox_7.setGeometry(QtCore.QRect(20, 170, 551, 261))
self.groupBox_7.setObjectName("groupBox_7")
self.layoutWidget_5 = QtWidgets.QWidget(self.groupBox_7)
self.layoutWidget_5.setGeometry(QtCore.QRect(20, 60, 155, 18))
@@ -168,59 +168,68 @@ class Ui_MainWindow(object):
self.tab_3 = QtWidgets.QWidget()
self.tab_3.setObjectName("tab_3")
self.groupBox = QtWidgets.QGroupBox(self.tab_3)
- self.groupBox.setGeometry(QtCore.QRect(20, 120, 551, 191))
+ self.groupBox.setGeometry(QtCore.QRect(20, 250, 551, 191))
self.groupBox.setObjectName("groupBox")
- self.widget = QtWidgets.QWidget(self.groupBox)
- self.widget.setGeometry(QtCore.QRect(20, 30, 371, 131))
- self.widget.setObjectName("widget")
- self.gridLayout_5 = QtWidgets.QGridLayout(self.widget)
+ self.layoutWidget = QtWidgets.QWidget(self.groupBox)
+ self.layoutWidget.setGeometry(QtCore.QRect(20, 30, 401, 131))
+ self.layoutWidget.setObjectName("layoutWidget")
+ self.gridLayout_5 = QtWidgets.QGridLayout(self.layoutWidget)
self.gridLayout_5.setContentsMargins(0, 0, 0, 0)
self.gridLayout_5.setObjectName("gridLayout_5")
- self.label_18 = QtWidgets.QLabel(self.widget)
+ self.label_18 = QtWidgets.QLabel(self.layoutWidget)
self.label_18.setObjectName("label_18")
self.gridLayout_5.addWidget(self.label_18, 0, 0, 1, 1)
- self.lineEdit = QtWidgets.QLineEdit(self.widget)
- self.lineEdit.setObjectName("lineEdit")
- self.gridLayout_5.addWidget(self.lineEdit, 0, 1, 1, 1)
- self.label_19 = QtWidgets.QLabel(self.widget)
+ self.mysql_ip_lineEdit = QtWidgets.QLineEdit(self.layoutWidget)
+ self.mysql_ip_lineEdit.setObjectName("mysql_ip_lineEdit")
+ self.gridLayout_5.addWidget(self.mysql_ip_lineEdit, 0, 1, 1, 1)
+ self.label_19 = QtWidgets.QLabel(self.layoutWidget)
self.label_19.setObjectName("label_19")
self.gridLayout_5.addWidget(self.label_19, 1, 0, 1, 1)
- self.lineEdit_2 = QtWidgets.QLineEdit(self.widget)
- self.lineEdit_2.setObjectName("lineEdit_2")
- self.gridLayout_5.addWidget(self.lineEdit_2, 1, 1, 1, 1)
- self.label_11 = QtWidgets.QLabel(self.widget)
+ self.mysql_port_lineEdit = QtWidgets.QLineEdit(self.layoutWidget)
+ self.mysql_port_lineEdit.setObjectName("mysql_port_lineEdit")
+ self.gridLayout_5.addWidget(self.mysql_port_lineEdit, 1, 1, 1, 1)
+ self.label_11 = QtWidgets.QLabel(self.layoutWidget)
self.label_11.setObjectName("label_11")
self.gridLayout_5.addWidget(self.label_11, 2, 0, 1, 1)
- self.lineEdit_3 = QtWidgets.QLineEdit(self.widget)
- self.lineEdit_3.setObjectName("lineEdit_3")
- self.gridLayout_5.addWidget(self.lineEdit_3, 2, 1, 1, 1)
- self.label_13 = QtWidgets.QLabel(self.widget)
+ self.mysql_usr_lineEdit = QtWidgets.QLineEdit(self.layoutWidget)
+ self.mysql_usr_lineEdit.setObjectName("mysql_usr_lineEdit")
+ self.gridLayout_5.addWidget(self.mysql_usr_lineEdit, 2, 1, 1, 1)
+ self.label_13 = QtWidgets.QLabel(self.layoutWidget)
self.label_13.setObjectName("label_13")
self.gridLayout_5.addWidget(self.label_13, 3, 0, 1, 1)
- self.lineEdit_4 = QtWidgets.QLineEdit(self.widget)
- self.lineEdit_4.setObjectName("lineEdit_4")
- self.gridLayout_5.addWidget(self.lineEdit_4, 3, 1, 1, 1)
- self.pushButton = QtWidgets.QPushButton(self.groupBox)
- self.pushButton.setGeometry(QtCore.QRect(420, 80, 75, 23))
- self.pushButton.setObjectName("pushButton")
+ self.mysql_pwd_lineEdit = QtWidgets.QLineEdit(self.layoutWidget)
+ self.mysql_pwd_lineEdit.setObjectName("mysql_pwd_lineEdit")
+ self.gridLayout_5.addWidget(self.mysql_pwd_lineEdit, 3, 1, 1, 1)
+ self.mysql_test_pushButton = QtWidgets.QPushButton(self.groupBox)
+ self.mysql_test_pushButton.setGeometry(QtCore.QRect(450, 80, 75, 23))
+ self.mysql_test_pushButton.setObjectName("mysql_test_pushButton")
self.groupBox_3 = QtWidgets.QGroupBox(self.tab_3)
- self.groupBox_3.setGeometry(QtCore.QRect(20, 20, 551, 71))
+ self.groupBox_3.setGeometry(QtCore.QRect(20, 130, 551, 71))
self.groupBox_3.setObjectName("groupBox_3")
- self.layoutWidget = QtWidgets.QWidget(self.groupBox_3)
- self.layoutWidget.setGeometry(QtCore.QRect(20, 30, 521, 25))
- self.layoutWidget.setObjectName("layoutWidget")
- self.gridLayout_3 = QtWidgets.QGridLayout(self.layoutWidget)
+ self.layoutWidget1 = QtWidgets.QWidget(self.groupBox_3)
+ self.layoutWidget1.setGeometry(QtCore.QRect(20, 30, 521, 25))
+ self.layoutWidget1.setObjectName("layoutWidget1")
+ self.gridLayout_3 = QtWidgets.QGridLayout(self.layoutWidget1)
self.gridLayout_3.setContentsMargins(0, 0, 0, 0)
self.gridLayout_3.setObjectName("gridLayout_3")
- self.hdf5_dir_lineEdit = QtWidgets.QLineEdit(self.layoutWidget)
+ self.hdf5_dir_lineEdit = QtWidgets.QLineEdit(self.layoutWidget1)
self.hdf5_dir_lineEdit.setObjectName("hdf5_dir_lineEdit")
self.gridLayout_3.addWidget(self.hdf5_dir_lineEdit, 0, 1, 1, 1)
- self.hdf5_dir_pushButton = QtWidgets.QPushButton(self.layoutWidget)
+ self.hdf5_dir_pushButton = QtWidgets.QPushButton(self.layoutWidget1)
self.hdf5_dir_pushButton.setObjectName("hdf5_dir_pushButton")
self.gridLayout_3.addWidget(self.hdf5_dir_pushButton, 0, 2, 1, 1)
- self.label = QtWidgets.QLabel(self.layoutWidget)
+ self.label = QtWidgets.QLabel(self.layoutWidget1)
self.label.setObjectName("label")
self.gridLayout_3.addWidget(self.label, 0, 0, 1, 1)
+ self.groupBox_4 = QtWidgets.QGroupBox(self.tab_3)
+ self.groupBox_4.setGeometry(QtCore.QRect(20, 20, 551, 80))
+ self.groupBox_4.setObjectName("groupBox_4")
+ self.enable_hdf55_radioButton = QtWidgets.QRadioButton(self.groupBox_4)
+ self.enable_hdf55_radioButton.setGeometry(QtCore.QRect(30, 40, 89, 16))
+ self.enable_hdf55_radioButton.setObjectName("enable_hdf55_radioButton")
+ self.enable_mysql_radioButton = QtWidgets.QRadioButton(self.groupBox_4)
+ self.enable_mysql_radioButton.setGeometry(QtCore.QRect(130, 40, 89, 16))
+ self.enable_mysql_radioButton.setObjectName("enable_mysql_radioButton")
self.tabWidget.addTab(self.tab_3, "")
self.tab_2 = QtWidgets.QWidget()
self.tab_2.setObjectName("tab_2")
@@ -228,10 +237,10 @@ class Ui_MainWindow(object):
self.start_import_pushButton.setGeometry(QtCore.QRect(30, 20, 75, 23))
self.start_import_pushButton.setObjectName("start_import_pushButton")
self.groupBox_5 = QtWidgets.QGroupBox(self.tab_2)
- self.groupBox_5.setGeometry(QtCore.QRect(20, 70, 481, 451))
+ self.groupBox_5.setGeometry(QtCore.QRect(20, 70, 551, 451))
self.groupBox_5.setObjectName("groupBox_5")
self.layoutWidget_2 = QtWidgets.QWidget(self.groupBox_5)
- self.layoutWidget_2.setGeometry(QtCore.QRect(10, 20, 461, 151))
+ self.layoutWidget_2.setGeometry(QtCore.QRect(10, 20, 531, 151))
self.layoutWidget_2.setObjectName("layoutWidget_2")
self.gridLayout = QtWidgets.QGridLayout(self.layoutWidget_2)
self.gridLayout.setContentsMargins(0, 0, 0, 0)
@@ -278,7 +287,7 @@ class Ui_MainWindow(object):
self.hdf5_weight_label.setObjectName("hdf5_weight_label")
self.gridLayout.addWidget(self.hdf5_weight_label, 5, 1, 1, 1)
self.import_detail_textEdit = QtWidgets.QTextEdit(self.groupBox_5)
- self.import_detail_textEdit.setGeometry(QtCore.QRect(10, 180, 461, 261))
+ self.import_detail_textEdit.setGeometry(QtCore.QRect(10, 180, 531, 261))
self.import_detail_textEdit.setFrameShape(QtWidgets.QFrame.NoFrame)
self.import_detail_textEdit.setReadOnly(True)
self.import_detail_textEdit.setObjectName("import_detail_textEdit")
@@ -323,10 +332,13 @@ class Ui_MainWindow(object):
self.label_19.setText(_translate("MainWindow", "端口号:"))
self.label_11.setText(_translate("MainWindow", "用户名:"))
self.label_13.setText(_translate("MainWindow", "密码"))
- self.pushButton.setText(_translate("MainWindow", "测试连接"))
+ self.mysql_test_pushButton.setText(_translate("MainWindow", "测试连接"))
self.groupBox_3.setTitle(_translate("MainWindow", "HDF5存储设置"))
self.hdf5_dir_pushButton.setText(_translate("MainWindow", "选择"))
self.label.setText(_translate("MainWindow", "目标数据(HDF5)存放目录:"))
+ self.groupBox_4.setTitle(_translate("MainWindow", "存储引擎设置"))
+ self.enable_hdf55_radioButton.setText(_translate("MainWindow", "使用HDF5"))
+ self.enable_mysql_radioButton.setText(_translate("MainWindow", "使用MYSQL"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), _translate("MainWindow", "存储设置"))
self.start_import_pushButton.setText(_translate("MainWindow", "执行导入"))
self.groupBox_5.setTitle(_translate("MainWindow", "导入进展"))
diff --git a/hikyuu/gui/data/MainWindow.ui b/hikyuu/gui/data/MainWindow.ui
index 441aff91..9d1324ae 100644
--- a/hikyuu/gui/data/MainWindow.ui
+++ b/hikyuu/gui/data/MainWindow.ui
@@ -6,7 +6,7 @@
0
0
- 638
+ 593
559
@@ -35,7 +35,7 @@
20
20
- 481
+ 551
131
@@ -47,7 +47,7 @@
20
90
- 451
+ 521
25
@@ -95,7 +95,7 @@
20
30
- 371
+ 411
22
@@ -145,7 +145,7 @@
20
170
- 481
+ 551
261
@@ -372,7 +372,7 @@
20
- 120
+ 250
551
191
@@ -380,12 +380,12 @@
MYSQL存储设置
-
+
20
30
- 371
+ 401
131
@@ -398,7 +398,7 @@
-
-
+
-
@@ -408,7 +408,7 @@
-
-
+
-
@@ -418,7 +418,7 @@
-
-
+
-
@@ -428,14 +428,14 @@
-
-
+
-
+
- 420
+ 450
80
75
23
@@ -450,7 +450,7 @@
20
- 20
+ 130
551
71
@@ -488,6 +488,45 @@
+
+
+
+ 20
+ 20
+ 551
+ 80
+
+
+
+ 存储引擎设置
+
+
+
+
+ 30
+ 40
+ 89
+ 16
+
+
+
+ 使用HDF5
+
+
+
+
+
+ 130
+ 40
+ 89
+ 16
+
+
+
+ 使用MYSQL
+
+
+
@@ -511,7 +550,7 @@
20
70
- 481
+ 551
451
@@ -523,7 +562,7 @@
10
20
- 461
+ 531
151
@@ -619,7 +658,7 @@
10
180
- 461
+ 531
261