增加了订阅合约编辑
This commit is contained in:
parent
2ee300ad2b
commit
359504b16c
@ -183,12 +183,13 @@ class DrEditWidget(QtGui.QWidget):
|
||||
"""行情数据记录引擎管理组件"""
|
||||
signal = QtCore.pyqtSignal(type(Event()))
|
||||
|
||||
def __init__(self, mainEngine, eventEngine, parent=None):
|
||||
def __init__(self, drWidget, mainEngine, eventEngine, parent=None):
|
||||
"""Constructor"""
|
||||
super(DrEditWidget, self).__init__(parent)
|
||||
|
||||
self.drWidget = drWidget
|
||||
self.mainEngine = mainEngine
|
||||
self.eventEngine = eventEngine
|
||||
self.hasChanged = False
|
||||
|
||||
# 保存合约详细信息的字典
|
||||
self.contractDict = {}
|
||||
@ -198,6 +199,10 @@ class DrEditWidget(QtGui.QWidget):
|
||||
self.loadData()
|
||||
self.registerEvent()
|
||||
|
||||
def closeEvent(self, QCloseEvent):
|
||||
if self.hasChanged:
|
||||
self.drWidget.restart()
|
||||
|
||||
def initUi(self):
|
||||
|
||||
vbox = QtGui.QVBoxLayout()
|
||||
@ -287,9 +292,9 @@ class DrEditWidget(QtGui.QWidget):
|
||||
if item.data(3):
|
||||
setting["active"][item.parentItem.data(0)] = name
|
||||
if self.mainEngine.drEngine.saveSetting(setting):
|
||||
self.hasChanged = True
|
||||
self.close()
|
||||
|
||||
|
||||
def selectAllTick(self):
|
||||
self.selectAll(True, False, True)
|
||||
|
||||
@ -321,8 +326,7 @@ class DrEditWidget(QtGui.QWidget):
|
||||
def registerEvent(self):
|
||||
"""注册事件监听"""
|
||||
self.signal.connect(self.updateContract)
|
||||
|
||||
# self.eventEngine.register(EVENT_CONTRACT, self.signal.emit)
|
||||
self.eventEngine.register(EVENT_CONTRACT, self.signal.emit)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
@ -330,7 +334,7 @@ if __name__ == '__main__':
|
||||
|
||||
app = QtGui.QApplication(sys.argv)
|
||||
|
||||
view = DrEditWidget(DrEngine, EventEngine)
|
||||
view = DrEditWidget(None, DrEngine, EventEngine)
|
||||
view.setFixedSize(650, 500)
|
||||
view.show()
|
||||
sys.exit(app.exec_())
|
||||
|
@ -137,8 +137,11 @@ class DrEngineManager(QtGui.QWidget):
|
||||
"""显示引擎行情记录配置"""
|
||||
|
||||
self.tickTable.clearContents()
|
||||
self.tickTable.setRowCount(0)
|
||||
self.barTable.clearContents()
|
||||
self.barTable.setRowCount(0)
|
||||
self.activeTable.clearContents()
|
||||
self.activeTable.setRowCount(0)
|
||||
|
||||
with open(self.drEngine.settingFileName) as f:
|
||||
drSetting = json.load(f)
|
||||
@ -170,11 +173,11 @@ class DrEngineManager(QtGui.QWidget):
|
||||
# ----------------------------------------------------------------------
|
||||
def openDr(self):
|
||||
"""打开行情数据记录组件"""
|
||||
self.mDrEditWidget = DrEditWidget(self.mainEngine, self.eventEngine)
|
||||
self.mDrEditWidget.setFixedSize(500, 500)
|
||||
self.mDrEditWidget = DrEditWidget(self,self.mainEngine, self.eventEngine)
|
||||
self.mDrEditWidget.setFixedSize(800,800)
|
||||
self.mDrEditWidget.show()
|
||||
QObject.connect(self.mDrEditWidget, QtCore.SIGNAL('closed()'), self, QtCore.SIGNAL('restart()'))
|
||||
|
||||
def restart(self):
|
||||
self.updateSetting()
|
||||
self.mainEngine.drEngine = DrEngine(self.mainEngine, self.mainEngine.eventEngine)
|
||||
self.drEngine.stop()
|
||||
self.updateSetting()
|
||||
self.mainEngine.drEngine = DrEngine(self.mainEngine, self.mainEngine.eventEngine)
|
||||
|
@ -445,7 +445,7 @@ class MarketMonitor(BasicMonitor):
|
||||
self.setFont(BASIC_FONT)
|
||||
|
||||
# 设置允许排序
|
||||
self.setSorting(True)
|
||||
self.setSorting(False)
|
||||
|
||||
# 初始化表格
|
||||
self.initTable()
|
||||
|
@ -194,7 +194,7 @@ class MainWindow(QtGui.QMainWindow):
|
||||
try:
|
||||
self.widgetDict['drM'].showMaximized()
|
||||
except KeyError:
|
||||
self.widgetDict['drM'] = DrEngineManager(self.mainEngine, self.eventEngine)
|
||||
self.widgetDict['drM'] = DrEngineManager(self.mainEngine, self.eventEngine)
|
||||
self.widgetDict['drM'].showMaximized()
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user