每次调整列宽,影响显示性能。

This commit is contained in:
msincenselee 2019-02-17 13:47:11 +08:00
parent 6a0f8476e1
commit 628dee6230

View File

@ -359,7 +359,7 @@ class BasicMonitor(QtWidgets.QTableWidget):
self.setItem(0, n, cell)
# 调整列宽
self.resizeColumns()
#self.resizeColumns()
# 重新打开排序
if self.sorting:
@ -1111,6 +1111,7 @@ class TradingWidget(QtWidgets.QFrame):
#----------------------------------------------------------------------
def sendOrder(self):
"""发单"""
try:
symbol = str(self.lineSymbol.text())
vtSymbol = symbol
exchange = self.comboExchange.currentText()
@ -1131,6 +1132,13 @@ class TradingWidget(QtWidgets.QFrame):
gatewayName = contract.gatewayName
exchange = contract.exchange # 保证有交易所代码
if gatewayName not in self.mainEngine.connected_gw_names:
if len(self.mainEngine.connected_gw_names) == 1:
gatewayName = self.mainEngine.connected_gw_names[0]
else:
self.mainEngine.writeError(u'没有连接网关:{}'.format(gatewayName))
return
req = VtOrderReq()
req.symbol = symbol
req.vtSymbol = vtSymbol
@ -1144,6 +1152,9 @@ class TradingWidget(QtWidgets.QFrame):
req.productClass = productClass
self.mainEngine.sendOrder(req, gatewayName)
except Exception as ex:
self.mainEngine.writeError(
u'tradingWg.sendOrder exception:{},{}'.format(str(ex), traceback.format_exc()))
def canelOrder(self):
"""撤单"""
@ -1290,7 +1301,8 @@ class ContractMonitor(BasicMonitor):
l = self.mainEngine.getAllContracts()
d = {'.'.join([contract.exchange, contract.symbol]):contract for contract in l}
l2 = d.keys()
l2.sort(reverse=True)
#l2.sort(reverse=True)
l2 = sorted(l2, reverse=True)
self.setRowCount(len(l2))
row = 0