[Fix] potential bug of KeyError when item_info_text is empty

This commit is contained in:
vn.py 2019-07-19 17:34:08 +08:00
parent 6b8bf824c6
commit 8a43b76c96
2 changed files with 6 additions and 5 deletions

View File

@ -115,7 +115,7 @@ class ChartItem(pg.GraphicsObject):
max_ix = int(rect.right())
max_ix = min(max_ix, len(self._bar_picutures))
rect_area = (rect.left(), rect.right())
rect_area = (min_ix, max_ix)
if rect_area != self._rect_area or not self._item_picuture:
self._rect_area = rect_area
self._draw_item_picture(min_ix, max_ix)

View File

@ -470,10 +470,11 @@ class ChartCursor(QtCore.QObject):
for item, plot in self._item_plot_map.items():
item_info_text = item.get_info_text(self._x)
if item_info_text:
if plot not in buf:
buf[plot] = item_info_text
else:
if item_info_text:
buf[plot] += ("\n\n" + item_info_text)
for plot_name, plot in self._plots.items():