修复行情记录UI的界面初始化Bug
This commit is contained in:
parent
bed06834e3
commit
676ce4a649
@ -50,6 +50,9 @@ class DrEngine(object):
|
|||||||
# K线对象字典
|
# K线对象字典
|
||||||
self.barDict = {}
|
self.barDict = {}
|
||||||
|
|
||||||
|
# 配置字典
|
||||||
|
self.settingDict = OrderedDict()
|
||||||
|
|
||||||
# 负责执行数据库插入的单独线程相关
|
# 负责执行数据库插入的单独线程相关
|
||||||
self.active = False # 工作状态
|
self.active = False # 工作状态
|
||||||
self.queue = Queue() # 队列
|
self.queue = Queue() # 队列
|
||||||
@ -96,6 +99,7 @@ class DrEngine(object):
|
|||||||
|
|
||||||
# 设置需要记录的数据
|
# 设置需要记录的数据
|
||||||
if recordTick:
|
if recordTick:
|
||||||
|
tick = VtTickData()
|
||||||
self.tickDict[vtSymbol] = VtTickData()
|
self.tickDict[vtSymbol] = VtTickData()
|
||||||
|
|
||||||
if recordBar:
|
if recordBar:
|
||||||
@ -103,6 +107,14 @@ class DrEngine(object):
|
|||||||
|
|
||||||
if activeSymbol:
|
if activeSymbol:
|
||||||
self.activeSymbolDict[vtSymbol] = activeSymbol
|
self.activeSymbolDict[vtSymbol] = activeSymbol
|
||||||
|
|
||||||
|
# 保存配置到缓存中
|
||||||
|
self.settingDict[vtSymbol] = d
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
def getSetting(self):
|
||||||
|
"""获取配置"""
|
||||||
|
return self.settingDict
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
def procecssTickEvent(self, event):
|
def procecssTickEvent(self, event):
|
||||||
|
@ -4,14 +4,10 @@
|
|||||||
行情记录模块相关的GUI控制组件
|
行情记录模块相关的GUI控制组件
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import json
|
|
||||||
|
|
||||||
from qtpy import QtWidgets, QtGui, QtCore
|
|
||||||
|
|
||||||
from vnpy.event import Event
|
from vnpy.event import Event
|
||||||
from vnpy.trader.vtEvent import *
|
from vnpy.trader.uiQt import QtWidgets, QtCore
|
||||||
|
from .drBase import EVENT_DATARECORDER_LOG
|
||||||
from vnpy.trader.app.dataRecorder.language import text
|
from .language import text
|
||||||
|
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
@ -119,33 +115,24 @@ class DrEngineManager(QtWidgets.QWidget):
|
|||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
def updateSetting(self):
|
def updateSetting(self):
|
||||||
"""显示引擎行情记录配置"""
|
"""显示引擎行情记录配置"""
|
||||||
with open(self.drEngine.settingFileName) as f:
|
setting = self.drEngine.getSetting()
|
||||||
drSetting = json.load(f)
|
|
||||||
|
for d in setting.values():
|
||||||
if 'tick' in drSetting:
|
if d['tick']:
|
||||||
l = drSetting['tick']
|
self.tickTable.insertRow(0)
|
||||||
|
self.tickTable.setItem(0, 0, TableCell(d['symbol']))
|
||||||
for setting in l:
|
self.tickTable.setItem(0, 1, TableCell(d['gateway']))
|
||||||
self.tickTable.insertRow(0)
|
|
||||||
self.tickTable.setItem(0, 0, TableCell(setting[0]))
|
if d['bar']:
|
||||||
self.tickTable.setItem(0, 1, TableCell(setting[1]))
|
self.barTable.insertRow(0)
|
||||||
|
self.barTable.setItem(0, 0, TableCell(d['symbol']))
|
||||||
if 'bar' in drSetting:
|
self.barTable.setItem(0, 1, TableCell(d['gateway']))
|
||||||
l = drSetting['bar']
|
|
||||||
|
if d['active']:
|
||||||
for setting in l:
|
self.activeTable.insertRow(0)
|
||||||
self.barTable.insertRow(0)
|
self.activeTable.setItem(0, 0, TableCell(d['active']))
|
||||||
self.barTable.setItem(0, 0, TableCell(setting[0]))
|
self.activeTable.setItem(0, 1, TableCell(d['symbol']))
|
||||||
self.barTable.setItem(0, 1, TableCell(setting[1]))
|
|
||||||
|
|
||||||
if 'active' in drSetting:
|
|
||||||
d = drSetting['active']
|
|
||||||
|
|
||||||
for activeSymbol, symbol in d.items():
|
|
||||||
self.activeTable.insertRow(0)
|
|
||||||
self.activeTable.setItem(0, 0, TableCell(activeSymbol))
|
|
||||||
self.activeTable.setItem(0, 1, TableCell(symbol))
|
|
||||||
|
|
||||||
self.tickTable.resizeColumnsToContents()
|
self.tickTable.resizeColumnsToContents()
|
||||||
self.barTable.resizeColumnsToContents()
|
self.barTable.resizeColumnsToContents()
|
||||||
self.activeTable.resizeColumnsToContents()
|
self.activeTable.resizeColumnsToContents()
|
||||||
|
Loading…
Reference in New Issue
Block a user