forked from IPKM/nmreval
save previews in graphics
This commit is contained in:
@ -48,6 +48,7 @@ class QGraphWindow(QtWidgets.QGraphicsView, Ui_GraphWindow):
|
||||
self.error_plots = {}
|
||||
|
||||
self._special_needs = []
|
||||
self._external_items = []
|
||||
self.closable = True
|
||||
|
||||
self.log = [False, False]
|
||||
@ -109,7 +110,7 @@ class QGraphWindow(QtWidgets.QGraphicsView, Ui_GraphWindow):
|
||||
def __len__(self):
|
||||
return len(self.active)
|
||||
|
||||
def curves(self):
|
||||
def curves(self) -> tuple:
|
||||
for a in self.active:
|
||||
if self.real_button.isChecked():
|
||||
if self.error_plots[a] is not None:
|
||||
@ -318,6 +319,7 @@ class QGraphWindow(QtWidgets.QGraphicsView, Ui_GraphWindow):
|
||||
if not hasattr(item, 'setLogMode'):
|
||||
self._special_needs.append(item)
|
||||
|
||||
self._external_items.append(item)
|
||||
self.graphic.addItem(item)
|
||||
item.setZValue(1000)
|
||||
|
||||
@ -325,12 +327,15 @@ class QGraphWindow(QtWidgets.QGraphicsView, Ui_GraphWindow):
|
||||
|
||||
@QtCore.pyqtSlot(GraphicsObject)
|
||||
def remove_external(self, item):
|
||||
if item not in self.graphic.items():
|
||||
return False
|
||||
if item in self._external_items:
|
||||
self._external_items.remove(item)
|
||||
|
||||
if item in self._special_needs:
|
||||
self._special_needs.remove(item)
|
||||
|
||||
if item not in self.graphic.items():
|
||||
return False
|
||||
|
||||
self.graphic.removeItem(item)
|
||||
|
||||
return True
|
||||
@ -599,6 +604,10 @@ class QGraphWindow(QtWidgets.QGraphicsView, Ui_GraphWindow):
|
||||
if item_dic:
|
||||
dic['items'].append(item_dic)
|
||||
|
||||
for item in self._external_items:
|
||||
dic['items'].append(item.get_data_opts())
|
||||
in_legend.append(False)
|
||||
|
||||
dic['in_legend'] = in_legend
|
||||
|
||||
return dic
|
||||
|
Reference in New Issue
Block a user