diff --git a/PanGUI/main.py b/PanGUI/main.py index a80d88d..24dd5ed 100644 --- a/PanGUI/main.py +++ b/PanGUI/main.py @@ -36,6 +36,8 @@ def __init__(self, plotobjs, rows=None, cols=None, indexer=None, else: self.plotobjs = [plotobjs] self.plotopts = [plotobj.plot(getPlotOpts=True) for plotobj in self.plotobjs] + self.preOpts = [] + for plotopts in self.plotopts: for (k, v) in kwargs.items(): if k in plotopts.keys(): @@ -44,6 +46,11 @@ def __init__(self, plotobjs, rows=None, cols=None, indexer=None, else: plotopts[k] = v + current_opt = None + if "PlotType" in plotopts: + current_opt = plotopts["PlotType"].selected() + self.preOpts += [current_opt] + self.currentIndex.setText(str(self.index)) fig1 = Figure() fig1.set_facecolor((0.92, 0.92, 0.92)) @@ -218,7 +225,7 @@ def setplotopts(self, q): if ii != idx: self.plotobjs[ii].plot(self.index, ax=self.fig.axes[ii], **self.plotopts[ii]) - numEvents, nidx = self.active_plotobj.plot(self.index, getNumEvents=True, **self.plotopts[idx]) + numEvents, nidx = self.active_plotobj.plot(self.index, getNumEvents=True, preOpt=self.preOpts[idx], **self.plotopts[idx]) if numEvents != self.numEvents: msg = QtWidgets.QMessageBox() msg.setIcon(QtWidgets.QMessageBox.Warning) @@ -315,8 +322,8 @@ def update_level(self, level): # crazy high intial values so that the new value is always lower num_events = 100_000 newIdx = 100_000 - for (plotobj, plotopts) in zip(self.plotobjs, self.plotopts): - nn, _newIdx = plotobj.plot(self.index, getNumEvents=True, **plotopts) + for (i, plotobj) in enumerate(self.plotobjs): + nn, _newIdx = plotobj.plot(self.index, getNumEvents=True, preOpt=self.preOpts[i], **self.plotopts[i]) num_events = min(num_events, nn) newIdx = min(newIdx, _newIdx) self.numEvents = num_events