From 483b754f09c709f650050fd5434f3540eedf3737 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Mon, 24 Dec 2018 20:34:09 +0800 Subject: [PATCH] =?UTF-8?q?[Mod]=E5=8F=8D=E8=BD=ACSpreadTrading=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E4=B8=8A=E7=AE=97=E6=B3=95=E6=98=BE=E7=A4=BA=E7=9A=84?= =?UTF-8?q?=E9=A1=BA=E5=BA=8F=EF=BC=8C=E6=94=B9=E4=B8=BA=E5=92=8C=E4=BB=B7?= =?UTF-8?q?=E5=B7=AE=E4=B8=80=E8=87=B4=20Close=20#1083?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnpy/trader/app/spreadTrading/uiStWidget.py | 27 +++++++++++---------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/vnpy/trader/app/spreadTrading/uiStWidget.py b/vnpy/trader/app/spreadTrading/uiStWidget.py index d206745e..d382b894 100644 --- a/vnpy/trader/app/spreadTrading/uiStWidget.py +++ b/vnpy/trader/app/spreadTrading/uiStWidget.py @@ -462,9 +462,10 @@ class StAlgoManager(QtWidgets.QTableWidget): algoEngine = self.algoEngine l = self.algoEngine.getAllAlgoParams() - self.setRowCount(len(l)) - for row, d in enumerate(l): + for d in l: + self.insertRow(0) + cellSpreadName = QtWidgets.QTableWidgetItem(d['spreadName']) cellAlgoName = QtWidgets.QTableWidgetItem(d['algoName']) cellNetPos = QtWidgets.QTableWidgetItem('0') @@ -477,17 +478,17 @@ class StAlgoManager(QtWidgets.QTableWidget): comboMode = StModeComboBox(algoEngine, d['spreadName'], d['mode']) buttonActive = StActiveButton(algoEngine, d['spreadName']) - self.setItem(row, 0, cellSpreadName) - self.setItem(row, 1, cellAlgoName) - self.setItem(row, 2, cellNetPos) - self.setCellWidget(row, 3, spinBuyPrice) - self.setCellWidget(row, 4, spinSellPrice) - self.setCellWidget(row, 5, spinCoverPrice) - self.setCellWidget(row, 6, spinShortPrice) - self.setCellWidget(row, 7, spinMaxOrderSize) - self.setCellWidget(row, 8, spinMaxPosSize) - self.setCellWidget(row, 9, comboMode) - self.setCellWidget(row, 10, buttonActive) + self.setItem(0, 0, cellSpreadName) + self.setItem(0, 1, cellAlgoName) + self.setItem(0, 2, cellNetPos) + self.setCellWidget(0, 3, spinBuyPrice) + self.setCellWidget(0, 4, spinSellPrice) + self.setCellWidget(0, 5, spinCoverPrice) + self.setCellWidget(0, 6, spinShortPrice) + self.setCellWidget(0, 7, spinMaxOrderSize) + self.setCellWidget(0, 8, spinMaxPosSize) + self.setCellWidget(0, 9, comboMode) + self.setCellWidget(0, 10, buttonActive) buttonActive.signalActive.connect(spinBuyPrice.algoActiveChanged) buttonActive.signalActive.connect(spinSellPrice.algoActiveChanged)