修复行情记录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:
|
||||||
@ -104,6 +108,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,32 +115,23 @@ 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)
|
|
||||||
|
|
||||||
if 'tick' in drSetting:
|
for d in setting.values():
|
||||||
l = drSetting['tick']
|
if d['tick']:
|
||||||
|
self.tickTable.insertRow(0)
|
||||||
|
self.tickTable.setItem(0, 0, TableCell(d['symbol']))
|
||||||
|
self.tickTable.setItem(0, 1, TableCell(d['gateway']))
|
||||||
|
|
||||||
for setting in l:
|
if d['bar']:
|
||||||
self.tickTable.insertRow(0)
|
self.barTable.insertRow(0)
|
||||||
self.tickTable.setItem(0, 0, TableCell(setting[0]))
|
self.barTable.setItem(0, 0, TableCell(d['symbol']))
|
||||||
self.tickTable.setItem(0, 1, TableCell(setting[1]))
|
self.barTable.setItem(0, 1, TableCell(d['gateway']))
|
||||||
|
|
||||||
if 'bar' in drSetting:
|
if d['active']:
|
||||||
l = drSetting['bar']
|
self.activeTable.insertRow(0)
|
||||||
|
self.activeTable.setItem(0, 0, TableCell(d['active']))
|
||||||
for setting in l:
|
self.activeTable.setItem(0, 1, TableCell(d['symbol']))
|
||||||
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))
|
|
||||||
|
|
||||||
self.tickTable.resizeColumnsToContents()
|
self.tickTable.resizeColumnsToContents()
|
||||||
self.barTable.resizeColumnsToContents()
|
self.barTable.resizeColumnsToContents()
|
||||||
|
Loading…
Reference in New Issue
Block a user