[bug fix]

This commit is contained in:
msincenselee 2020-05-27 18:02:55 +08:00
parent 2427598519
commit 246d4927f9

View File

@ -1427,12 +1427,13 @@ class GridKline(QtWidgets.QWidget):
self.kline_names = list(self.kline_settings.keys()) self.kline_names = list(self.kline_settings.keys())
self.kline_dict = {} self.kline_dict = {}
self.grid_layout = QtWidgets.QGridLayout()
self.setLayout(self.grid_layout)
self.init_ui() self.init_ui()
def init_ui(self): def init_ui(self):
"""""" """"""
gridLayout = QtWidgets.QGridLayout()
self.setLayout(gridLayout)
for kline_name, kline_setting in self.kline_settings.items(): for kline_name, kline_setting in self.kline_settings.items():
canvas = KLineWidget(display_vol=False, display_sub=True) canvas = KLineWidget(display_vol=False, display_sub=True)
@ -1463,7 +1464,7 @@ class GridKline(QtWidgets.QWidget):
kline_name = kline_names.pop(0) kline_name = kline_names.pop(0)
kline_layout = QtWidgets.QVBoxLayout() kline_layout = QtWidgets.QVBoxLayout()
kline_layout.addWidget(self.kline_dict[kline_name]) kline_layout.addWidget(self.kline_dict[kline_name])
gridLayout.addLayout(kline_layout, row, column) self.grid_layout.addLayout(kline_layout, row, column)
if len(kline_names) == 0: if len(kline_names) == 0:
break break
row += 1 row += 1
@ -1542,9 +1543,9 @@ class GridKline(QtWidgets.QWidget):
if canvas is not None: if canvas is not None:
canvas.relocate(window_id, t_value, count_k) canvas.relocate(window_id, t_value, count_k)
except Exception as ex: except Exception as ex:
print(f'onRelocate exception:{str(ex)}')
traceback.print_exc() traceback.print_exc()
def display_multi_grid(kline_settings={}): def display_multi_grid(kline_settings={}):
"""显示多图""" """显示多图"""
from vnpy.trader.ui import create_qapp from vnpy.trader.ui import create_qapp