From 49f1a7f0dfcc5def1a2ff32b0cb1ecec4dea76a4 Mon Sep 17 00:00:00 2001 From: chenxy123 Date: Tue, 20 Dec 2016 23:55:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9vnrpc=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vn.rpc/testClient.py | 2 +- vn.rpc/vnrpc.py | 2 +- vn.trader/uiMainWindow.py | 28 +++++++++++++++------------- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/vn.rpc/testClient.py b/vn.rpc/testClient.py index 6df0305f..e613cad5 100644 --- a/vn.rpc/testClient.py +++ b/vn.rpc/testClient.py @@ -25,7 +25,7 @@ if __name__ == '__main__': subAddress = 'tcp://localhost:0602' tc = TestClient(reqAddress, subAddress) - tc.subscribe('') + tc.subscribeTopic('') tc.start() while 1: diff --git a/vn.rpc/vnrpc.py b/vn.rpc/vnrpc.py index f95d0597..7cda51f5 100644 --- a/vn.rpc/vnrpc.py +++ b/vn.rpc/vnrpc.py @@ -281,7 +281,7 @@ class RpcClient(RpcObject): raise NotImplementedError #---------------------------------------------------------------------- - def subscribe(self, topic): + def subscribeTopic(self, topic): """ 订阅特定主题的广播数据 diff --git a/vn.trader/uiMainWindow.py b/vn.trader/uiMainWindow.py index 09aa651e..de1514f1 100644 --- a/vn.trader/uiMainWindow.py +++ b/vn.trader/uiMainWindow.py @@ -132,34 +132,36 @@ class MainWindow(QtGui.QMainWindow): menubar = self.menuBar() # 设计为只显示存在的接口 + l = self.mainEngine.getAllGatewayNames() + sysMenu = menubar.addMenu(u'系统') - if 'CTP' in self.mainEngine.gatewayDict: + if 'CTP' in l: sysMenu.addAction(connectCtpAction) - if 'LTS' in self.mainEngine.gatewayDict: + if 'LTS' in l: sysMenu.addAction(connectLtsAction) - if 'FEMAS' in self.mainEngine.gatewayDict: + if 'FEMAS' in l: sysMenu.addAction(connectFemasAction) - if 'XSPEED' in self.mainEngine.gatewayDict: + if 'XSPEED' in l: sysMenu.addAction(connectXspeedAction) - if 'QDP' in self.mainEngine.gatewayDict: + if 'QDP' in l: sysMenu.addAction(connectQdpAction) - if 'KSOTP' in self.mainEngine.gatewayDict: + if 'KSOTP' in l: sysMenu.addAction(connectKsotpAction) - if 'KSGOLD' in self.mainEngine.gatewayDict: + if 'KSGOLD' in l: sysMenu.addAction(connectKsgoldAction) - if 'SGIT' in self.mainEngine.gatewayDict: + if 'SGIT' in l: sysMenu.addAction(connectSgitAction) sysMenu.addSeparator() - if 'IB' in self.mainEngine.gatewayDict: + if 'IB' in l: sysMenu.addAction(connectIbAction) - if 'SHZD' in self.mainEngine.gatewayDict: + if 'SHZD' in l: sysMenu.addAction(connectShzdAction) - if 'OANDA' in self.mainEngine.gatewayDict: + if 'OANDA' in l: sysMenu.addAction(connectOandaAction) - if 'OKCOIN' in self.mainEngine.gatewayDict: + if 'OKCOIN' in l: sysMenu.addAction(connectOkcoinAction) sysMenu.addSeparator() - if 'Wind' in self.mainEngine.gatewayDict: + if 'Wind' in l: sysMenu.addAction(connectWindAction) sysMenu.addSeparator() sysMenu.addAction(connectDbAction)