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