From 726544bf3ba18b92f375456d3909bcfbccb334dd Mon Sep 17 00:00:00 2001 From: Marcel Date: Thu, 24 Aug 2017 17:16:21 +0200 Subject: [PATCH] [update] canvas finally working again --- pylot/core/util/widgets.py | 448 +++++++++++++++++++------------------ 1 file changed, 227 insertions(+), 221 deletions(-) diff --git a/pylot/core/util/widgets.py b/pylot/core/util/widgets.py index 68ec58d5..4da7968b 100644 --- a/pylot/core/util/widgets.py +++ b/pylot/core/util/widgets.py @@ -614,11 +614,19 @@ class PylotCanvas(FigureCanvas): self.multiCursor = MultiCursor(self.figure.canvas, self.axes, horizOn=True, useblit=True, color='m', lw=1) - # update labels of the entire widget - #self.updateWidget(xlabel, ylabel, title) - self.limits = {'x': (-np.inf, np.inf), - 'y': (-np.inf, np.inf)} + # initialize panning attributes + self.press = None + self.xpress = None + self.ypress = None + self.cur_xlim = None + self.cur_ylim = None + + self.limits = {} + + for ax in self.axes: + self.limits[ax] = {'x': (-np.inf, np.inf), + 'y': (-np.inf, np.inf)} if connect_events: self.connectEvents() @@ -628,23 +636,124 @@ class PylotCanvas(FigureCanvas): except: pass + def panPress(self, gui_event): + ax_check = False + for ax in self.axes: + if gui_event.inaxes == ax: + ax_check = True + break + if not ax_check: return + self.cur_xlim = ax.get_xlim() + self.cur_ylim = ax.get_ylim() + self.press = gui_event.xdata, gui_event.ydata + self.xpress, self.ypress = self.press + + def panMotion(self, gui_event): + if self.press is None: return + ax_check = False + for ax in self.axes: + if gui_event.inaxes == ax: + ax_check = True + break + if not ax_check: return + dx = gui_event.xdata - self.xpress + dy = gui_event.ydata - self.ypress + self.cur_xlim -= dx + self.cur_ylim -= dy + ax.set_xlim(self.cur_xlim) + ax.set_ylim(self.cur_ylim) + ax.figure.canvas.draw() + + def panRelease(self, gui_event): + self.press = None + self.figure.canvas.draw() + + def scrollZoom(self, gui_event, factor=2.): + if not gui_event.xdata or not gui_event.ydata: + return + ax_check = False + for ax in self.axes: + if gui_event.inaxes == ax: + ax_check = True + break + if not ax_check: return + + self.updateCurrentLimits() + + if gui_event.button == 'up': + scale_factor = 1 / factor + elif gui_event.button == 'down': + # deal with zoom out + scale_factor = factor + else: + # deal with something that should never happen + scale_factor = 1 + print(gui_event.button) + + new_xlim = gui_event.xdata - \ + scale_factor * (gui_event.xdata - self.getXLims(ax)) + new_ylim = gui_event.ydata - \ + scale_factor * (gui_event.ydata - self.getYLims(ax)) + + new_xlim.sort() + global_x = self.getGlobalLimits(ax, 'x') + global_y = self.getGlobalLimits(ax, 'y') + new_xlim[0] = max(new_xlim[0], global_x[0]) + new_xlim[1] = min(new_xlim[1], global_x[1]) + new_ylim.sort() + new_ylim[0] = max(new_ylim[0], global_y[0]) + new_ylim[1] = min(new_ylim[1], global_y[1]) + + self.setXLims(ax, new_xlim) + self.setYLims(ax, new_ylim) + self.draw() + def connectEvents(self): self.cidscroll = self.connectScrollEvent(self.scrollZoom) + self.cidpress = self.connectPressEvent(self.panPress) + self.cidmotion = self.connectMotionEvent(self.panMotion) + self.cidrelease = self.connectReleaseEvent(self.panRelease) def disconnectEvents(self): - self.mpl_disconnect(self.cidscroll) + self.disconnectScrollEvent() + self.disconnectMotionEvent() + self.disconnectPressEvent() + self.disconnectReleaseEvent() + def disconnectPressEvent(self): + self.mpl_disconnect(self.cidpress) + self.cidpress = None + + def connectPressEvent(self, slot): + return self.mpl_connect('button_press_event', slot) + + def disconnectMotionEvent(self): + self.mpl_disconnect(self.cidmotion) + self.cidmotion = None + + def connectMotionEvent(self, slot): + return self.mpl_connect('motion_notify_event', slot) + + def disconnectReleaseEvent(self): + self.mpl_disconnect(self.cidrelease) + self.cidrelease = None + + def connectReleaseEvent(self, slot): + return self.mpl_connect('button_release_event', slot) + + def disconnectScrollEvent(self): + self.mpl_disconnect(self.cidscroll) self.cidscroll = None + def connectScrollEvent(self, slot): + return self.mpl_connect('scroll_event', slot) + def getPlotDict(self): return self.plotdict def setPlotDict(self, key, value): self.plotdict[key] = value - def connectScrollEvent(self, slot): - return self.mpl_connect('scroll_event', slot) - def clearPlotDict(self): self.plotdict = dict() @@ -657,7 +766,9 @@ class PylotCanvas(FigureCanvas): def plotWFData(self, wfdata, title=None, zoomx=None, zoomy=None, noiselevel=None, scaleddata=False, mapping=True, component='*', nth_sample=1, iniPick=None, verbosity=0): - self.getAxes().cla() + ax = self.axes[0] + ax.cla() + self.clearPlotDict() wfstart, wfend = full_range(wfdata) nmax = 0 @@ -704,58 +815,54 @@ class PylotCanvas(FigureCanvas): trace.normalize(np.max(np.abs(trace.data)) * 2) times = [time for index, time in enumerate(time_ax) if not index % nth_sample] data = [datum + n for index, datum in enumerate(trace.data) if not index % nth_sample] - self.getAxes().plot(times, data, 'k', linewidth=0.7) + ax.plot(times, data, 'k', linewidth=0.7) if noiselevel is not None: for level in noiselevel: - self.getAxes().plot([time_ax[0], time_ax[-1]], + ax.plot([time_ax[0], time_ax[-1]], [level, level], '--k') - if iniPick: - ax = self.getAxes() - ax.vlines(iniPick, ax.get_ylim()[0], ax.get_ylim()[1], - colors='m', linestyles='dashed', - linewidth=2) self.setPlotDict(n, (station, channel, network)) + if iniPick: + ax.vlines(iniPick, ax.get_ylim()[0], ax.get_ylim()[1], + colors='m', linestyles='dashed', + linewidth=2) xlabel = 'seconds since {0}'.format(wfstart) ylabel = '' self.updateWidget(xlabel, ylabel, title) - self.setXLims([0, wfend - wfstart]) - self.setYLims([-0.5, nmax + 0.5]) + self.setXLims(ax, [0, wfend - wfstart]) + self.setYLims(ax, [-0.5, nmax + 0.5]) if zoomx is not None: - self.setXLims(zoomx) + self.setXLims(ax, zoomx) if zoomy is not None: - self.setYLims(zoomy) + self.setYLims(ax, zoomy) self.draw() - def getAxes(self): - return self.axes[0] + def getXLims(self, ax): + return ax.get_xlim() - def getXLims(self): - return self.getAxes().get_xlim() + def getYLims(self, ax): + return ax.get_ylim() - def getYLims(self): - return self.getAxes().get_ylim() + def setXLims(self, ax, lims): + ax.set_xlim(lims) - def setXLims(self, lims): - self.getAxes().set_xlim(lims) - - def setYLims(self, lims): - self.getAxes().set_ylim(lims) + def setYLims(self, ax, lims): + ax.set_ylim(lims) def setYTickLabels(self, pos, labels): - self.getAxes().set_yticks(list(pos)) - self.getAxes().set_yticklabels(labels) + self.axes[0].set_yticks(list(pos)) + self.axes[0].set_yticklabels(labels) self.draw() def updateXLabel(self, text): - self.getAxes().set_xlabel(text) + self.axes[0].set_xlabel(text) self.draw() def updateYLabel(self, text): - self.getAxes().set_ylabel(text) + self.axes[0].set_ylabel(text) self.draw() def updateTitle(self, text): - self.getAxes().set_title(text, verticalalignment='bottom') + self.axes[0].set_title(text, verticalalignment='bottom') self.draw() def updateWidget(self, xlabel, ylabel, title): @@ -764,67 +871,40 @@ class PylotCanvas(FigureCanvas): self.updateTitle(title) def insertLabel(self, pos, text): - pos = pos / max(self.getAxes().ylim) - axann = self.getAxes().annotate(text, xy=(.03, pos), + pos = pos / max(self.axes[0].ylim) + axann = self.axes[0].annotate(text, xy=(.03, pos), xycoords='axes fraction') axann.set_bbox(dict(facecolor='lightgrey', alpha=.6)) - def scrollZoom(self, gui_event, factor=2.): - - if not gui_event.xdata or not gui_event.ydata: - return - - self.updateCurrentLimits() - - if gui_event.button == 'up': - scale_factor = 1 / factor - elif gui_event.button == 'down': - # deal with zoom out - scale_factor = factor - else: - # deal with something that should never happen - scale_factor = 1 - print(gui_event.button) - - new_xlim = gui_event.xdata - \ - scale_factor * (gui_event.xdata - self.getXLims()) - new_ylim = gui_event.ydata - \ - scale_factor * (gui_event.ydata - self.getYLims()) - - new_xlim.sort() - global_x = self.getGlobalLimits('x') - global_y = self.getGlobalLimits('y') - new_xlim[0] = max(new_xlim[0], global_x[0]) - new_xlim[1] = min(new_xlim[1], global_x[1]) - new_ylim.sort() - new_ylim[0] = max(new_ylim[0], global_y[0]) - new_ylim[1] = min(new_ylim[1], global_y[1]) - - self.setXLims(new_xlim) - self.setYLims(new_ylim) - self.draw() - def setZoomBorders2content(self): if not self.axes: return - xlims = self.getXLims() - ylims = self.getYLims() + for ax in self.limits.keys(): + xlims = self.getXLims(ax) + ylims = self.getYLims(ax) - self.limits = {'x': xlims, - 'y': ylims} + self.limits[ax] = {'x': xlims, + 'y': ylims} - for ax, limit in self.limits.items(): - self.setGlobalLimits(ax, limit) + for axis, limit in self.limits[ax].items(): + self.setGlobalLimits(ax, axis, limit) def updateCurrentLimits(self): - self.setXLims(self.getXLims()) - self.setYLims(self.getYLims()) + for ax in self.limits.keys(): + self.setXLims(ax, self.getXLims(ax)) + self.setYLims(ax, self.getYLims(ax)) - def getGlobalLimits(self, axis): - return self.limits[axis] + def getGlobalLimits(self, ax, axis): + return self.limits[ax][axis] - def setGlobalLimits(self, axis, limits): - self.limits[axis] = limits + def setGlobalLimits(self, ax, axis, limits): + self.limits[ax][axis] = limits + + def resetZoom(self): + for ax in self.figure.axes: + self.setXLims(ax, self.getGlobalLimits(ax, 'x')) + self.setYLims(ax, self.getGlobalLimits(ax, 'y')) + self.draw() class PhaseDefaults(QtGui.QDialog): @@ -960,20 +1040,22 @@ class PickDlg(QDialog): self.stime, self.etime = full_range(self.getWFData()) # initialize plotting widget - self.multicompfig = PylotCanvas(parent=self, connect_events=False, multicursor=True) + self.multicompfig = PylotCanvas(parent=self, multicursor=True) self.phaseplot = PhasePlotWidget(self) self.phaseplot.hide() - # setup ui - self.setupUi() - # plot data - self.getPlotWidget().plotWFData(wfdata=self.getWFData(), + self.multicompfig.plotWFData(wfdata=self.getWFData(), title=self.getStation()) - self.getPlotWidget().setZoomBorders2content() + self.multicompfig.setZoomBorders2content() - self.updateCurrentLimits() + self.multicompfig.updateCurrentLimits() + + self.connectScrollEvent() + + # setup ui + self.setupUi() # set plot labels self.setPlotLabels() @@ -981,11 +1063,6 @@ class PickDlg(QDialog): # draw picks if present self.drawAllPicks() - # connect button press event to an action - self.connectEvents() - self.cidscroll_arr = self.connectScrollEvent(self.refreshArrivalsText) - self.cidscroll_ph = self.connectScrollEvent(self.refreshPhaseText) - # init expected picks using obspy Taup try: if self.parent().metadata: @@ -1013,7 +1090,7 @@ class PickDlg(QDialog): self.addPickPhases(menuBar) # create matplotlib toolbar to inherit functionality - self.figToolBar = NavigationToolbar2QT(self.getPlotWidget(), self) + self.figToolBar = NavigationToolbar2QT(self.multicompfig, self) self.figToolBar.hide() # create icons @@ -1037,7 +1114,7 @@ class PickDlg(QDialog): tip='Zoom into waveform', checkable=True) self.resetZoomAction = createAction(parent=self, text='Home', - slot=self.resetZoom, icon=home_icon, + slot=self.multicompfig.resetZoom, icon=home_icon, tip='Reset zoom to original limits') self.resetPicksAction = createAction(parent=self, text='Delete Picks', slot=self.delPicks, icon=del_icon, @@ -1184,11 +1261,11 @@ class PickDlg(QDialog): def drawArrivals(self, textOnly=False): if not self.arrivals: return - ax = self.getPlotWidget().axes + ax = self.multicompfig.axes[0] if not textOnly: ylims = self.getGlobalLimits('y') else: - ylims = self.getPlotWidget().getYLims() + ylims = self.multicompfig.getYLims(ax) stime = self.getStartTime() source_origin = self.parent().get_current_event().origins[0] source_time = source_origin.time @@ -1268,45 +1345,16 @@ class PickDlg(QDialog): if phaseIndex == 0: picksMenu.addSeparator() - def disconnectPressEvent(self): - widget = self.getPlotWidget() - widget.mpl_disconnect(self.cidpress) - self.cidpress = None - - def connectPressEvent(self, slot): - widget = self.getPlotWidget() - return widget.mpl_connect('button_press_event', slot) - def disconnectScrollEvent(self): - widget = self.getPlotWidget() - widget.mpl_disconnect(self.cidscroll) + widget = self.multicompfig widget.mpl_disconnect(self.cidscroll_arr) widget.mpl_disconnect(self.cidscroll_ph) - self.cidscroll = None self.cidscroll_arr = None self.cidscroll_ph = None - def connectScrollEvent(self, slot): - widget = self.getPlotWidget() - return widget.mpl_connect('scroll_event', slot) - - def disconnectMotionEvent(self): - widget = self.getPlotWidget() - widget.mpl_disconnect(self.cidmotion) - self.cidmotion = None - - def connectMotionEvent(self, slot): - widget = self.getPlotWidget() - return widget.mpl_connect('motion_notify_event', slot) - - def disconnectReleaseEvent(self): - widget = self.getPlotWidget() - widget.mpl_disconnect(self.cidrelease) - self.cidrelease = None - - def connectReleaseEvent(self, slot): - widget = self.getPlotWidget() - return widget.mpl_connect('button_release_event', slot) + def connectScrollEvent(self): + self.cidscroll_arr = self.multicompfig.connectScrollEvent(self.refreshArrivalsText) + self.cidscroll_ph = self.multicompfig.connectScrollEvent(self.refreshPhaseText) def disable_ar_buttons(self): self.enable_ar_buttons(False) @@ -1355,13 +1403,11 @@ class PickDlg(QDialog): def init_p_pick(self): self.set_button_color(self.p_button, 'yellow') - self.updateCurrentLimits() self.activatePicking() self.currentPhase = str(self.p_button.text()) def init_s_pick(self): self.set_button_color(self.s_button, 'yellow') - self.updateCurrentLimits() self.activatePicking() self.currentPhase = str(self.s_button.text()) @@ -1394,7 +1440,7 @@ class PickDlg(QDialog): self.currentPhase = None self.reset_p_button() self.reset_s_button() - self.getPlotWidget().plotWFData(wfdata=self.getWFData(), + self.multicompfig.plotWFData(wfdata=self.getWFData(), title=self.getStation()) self.drawAllPicks() self.drawArrivals() @@ -1403,20 +1449,20 @@ class PickDlg(QDialog): self.deactivatePicking() def activatePicking(self): + self.resetZoom() if self.zoomAction.isChecked(): self.zoomAction.trigger() - self.disconnectReleaseEvent() + self.multicompfig.disconnectEvents() self.disconnectScrollEvent() - self.disconnectMotionEvent() - self.disconnectPressEvent() - self.cidpress = self.connectPressEvent(self.setIniPick) + self.cidpress = self.multicompfig.connectPressEvent(self.setIniPick) self.filterWFData() - self.pick_block = self.togglePickBlocker() + #self.pick_block = self.togglePickBlocker() self.disconnect_pick_delete() def deactivatePicking(self): self.disconnectPressEvent() - self.connectEvents() + self.connectScrollEvent() + self.multicompfig.connectEvents() self.connect_pick_delete() def getParameter(self): @@ -1436,14 +1482,11 @@ class PickDlg(QDialog): return self.network + '.' + self.station return self.station - def getPlotWidget(self): - return self.multicompfig - def getChannelID(self, key): - return self.getPlotWidget().getPlotDict()[int(key)][1] + return self.multicompfig.getPlotDict()[int(key)][1] def getTraceID(self, channels): - plotDict = self.getPlotWidget().getPlotDict() + plotDict = self.multicompfig.getPlotDict() traceIDs = [] for channel in channels: channel = channel.upper() @@ -1475,11 +1518,7 @@ class PickDlg(QDialog): self.cur_ylim = limits def getGlobalLimits(self, axis): - return self.getPlotWidget().getGlobalLimits(axis) - - def updateCurrentLimits(self): - self.setXLims(self.getPlotWidget().getXLims()) - self.setYLims(self.getPlotWidget().getYLims()) + return self.multicompfig.getGlobalLimits(axis) def getWFData(self): return self.data @@ -1528,11 +1567,9 @@ class PickDlg(QDialog): channel = self.getChannelID(trace_number) wfdata = self.selectWFData(channel) - self.disconnectScrollEvent() + self.multicompfig.disconnectEvents() self.disconnectPressEvent() - self.disconnectReleaseEvent() - self.disconnectMotionEvent() - self.cidpress = self.connectPressEvent(self.setPick) + self.cidpress = self.multicompfig.connectPressEvent(self.setPick) if self.getPhaseID(self.currentPhase) == 'P': self.set_button_color(self.p_button, 'green') @@ -1600,7 +1637,7 @@ class PickDlg(QDialog): self.setXLims([ini_pick - x_res, ini_pick + x_res]) self.setYLims(np.array([-noiselevel * 3.5, noiselevel * 3.5]) + trace_number) - self.getPlotWidget().plotWFData(wfdata=data, + self.multicompfig.plotWFData(wfdata=data, title=self.getStation() + ' picking mode', zoomx=self.getXLims(), @@ -1668,7 +1705,7 @@ class PickDlg(QDialog): noiselevels = [trace + 1 / (2.5 * 2) for trace in traces] + \ [trace - 1 / (2.5 * 2) for trace in traces] - self.getPlotWidget().plotWFData(wfdata=data, + self.multicompfig.plotWFData(wfdata=data, title=self.getStation() + ' picking mode', zoomx=self.getXLims(), @@ -1682,7 +1719,7 @@ class PickDlg(QDialog): parameter = self.parameter # get axes limits - self.updateCurrentLimits() + self.multicompfig.updateCurrentLimits() # setting pick pick = gui_event.xdata # get pick time relative to the traces timeaxis not to the global @@ -1760,10 +1797,14 @@ class PickDlg(QDialog): self.disconnectPressEvent() self.enable_ar_buttons() self.zoomAction.setEnabled(True) - self.pick_block = self.togglePickBlocker() + #self.pick_block = self.togglePickBlocker() self.leave_picking_mode() self.setDirty(True) + def disconnectPressEvent(self): + self.multicompfig.mpl_disconnect(self.cidpress) + self.cidpress = None + def drawAllPicks(self): self.removePhaseText() self.drawPicks(picktype='manual') @@ -1771,11 +1812,11 @@ class PickDlg(QDialog): def drawPicks(self, phase=None, picktype='manual', textOnly=False): # plotting picks - ax = self.getPlotWidget().axes + ax = self.multicompfig.axes[0] if not textOnly: - ylims = self.getPlotWidget().getGlobalLimits('y') + ylims = self.multicompfig.getGlobalLimits(ax, 'y') else: - ylims = self.getPlotWidget().getYLims() + ylims = ax.get_ylim() if self.getPicks(picktype): if phase is not None and not phase == 'SPt': if (type(self.getPicks(picktype)[phase]) is dict @@ -1842,11 +1883,11 @@ class PickDlg(QDialog): ax.legend(loc=1) def connect_pick_delete(self): - self.cidpick = self.getPlotWidget().mpl_connect('pick_event', self.onpick_delete) + self.cidpick = self.multicompfig.mpl_connect('pick_event', self.onpick_delete) def disconnect_pick_delete(self): if hasattr(self, 'cidpick'): - self.getPlotWidget().mpl_disconnect(self.cidpick) + self.multicompfig.mpl_disconnect(self.cidpick) def onpick_delete(self, event): if not event.mouseevent.button == 3: @@ -1897,43 +1938,15 @@ class PickDlg(QDialog): self.removePhaseText() self.drawPhaseText() - def panPress(self, gui_event): - ax = self.getPlotWidget().axes[0] - if gui_event.inaxes != ax: return - self.cur_xlim = ax.get_xlim() - self.cur_ylim = ax.get_ylim() - self.press = gui_event.xdata, gui_event.ydata - self.xpress, self.ypress = self.press - - def panRelease(self, gui_event): - figure = self.getPlotWidget().figure - self.press = None - self.refreshPhaseText() - self.refreshArrivalsText() - figure.canvas.draw() - - def panMotion(self, gui_event): - if self.press is None: return - ax = self.getPlotWidget().axes[0] - if gui_event.inaxes != ax: return - dx = gui_event.xdata - self.xpress - dy = gui_event.ydata - self.ypress - self.cur_xlim -= dx - self.cur_ylim -= dy - ax.set_xlim(self.cur_xlim) - ax.set_ylim(self.cur_ylim) - - ax.figure.canvas.draw() - def togglePickBlocker(self): return not self.pick_block def filterWFData(self): if self.pick_block: return - self.updateCurrentLimits() + self.multicompfig.updateCurrentLimits() data = self.getWFData().copy() - old_title = self.getPlotWidget().getAxes().get_title() + old_title = self.multicompfig.axes[0].get_title() title = None phase = self.currentPhase filtoptions = None @@ -1956,7 +1969,7 @@ class PickDlg(QDialog): title = old_title.replace(', filtered)', ')') if title is None: title = old_title - self.getPlotWidget().plotWFData(wfdata=data, title=title, + self.multicompfig.plotWFData(wfdata=data, title=title, zoomx=self.getXLims(), zoomy=self.getYLims()) self.setPlotLabels() @@ -1964,52 +1977,45 @@ class PickDlg(QDialog): self.draw() def resetPlot(self): - self.updateCurrentLimits() + self.resetZoom() data = self.getWFData().copy() - title = self.getPlotWidget().getAxes().get_title() - self.getPlotWidget().plotWFData(wfdata=data, title=title, + title = self.multicompfig.axes[0].get_title() + self.multicompfig.plotWFData(wfdata=data, title=title, zoomx=self.getXLims(), zoomy=self.getYLims()) self.setPlotLabels() self.drawAllPicks() self.draw() + def resetZoom(self): + ax = self.multicompfig.axes[0] + self.setXLims(self.multicompfig.getGlobalLimits(ax, 'x')) + self.setYLims(self.multicompfig.getGlobalLimits(ax, 'y')) + def setPlotLabels(self): # get channel labels - pos = self.getPlotWidget().getPlotDict().keys() - labels = [self.getPlotWidget().getPlotDict()[key][1] for key in pos] + pos = self.multicompfig.getPlotDict().keys() + labels = [self.multicompfig.getPlotDict()[key][1] for key in pos] + + ax = self.multicompfig.figure.axes[0] # set channel labels - self.getPlotWidget().setYTickLabels(pos, labels) - self.getPlotWidget().setXLims(self.getXLims()) - self.getPlotWidget().setYLims(self.getYLims()) - - def connectEvents(self): - self.cidpress = self.connectPressEvent(self.panPress) - self.cidmotion = self.connectMotionEvent(self.panMotion) - self.cidrelease = self.connectReleaseEvent(self.panRelease) - self.cidscroll = self.connectScrollEvent(self.multicompfig.scrollZoom) + self.multicompfig.setYTickLabels(pos, labels) + self.multicompfig.setXLims(ax, self.getXLims()) + self.multicompfig.setYLims(ax, self.getYLims()) def zoom(self): if self.zoomAction.isChecked() and self.pick_block: self.zoomAction.setChecked(False) elif self.zoomAction.isChecked(): - self.disconnectPressEvent() - self.disconnectMotionEvent() - self.disconnectReleaseEvent() - self.disconnectScrollEvent() + self.multicompfig.disconnectEvents() self.figToolBar.zoom() else: self.figToolBar.zoom() - def resetZoom(self): - self.getPlotWidget().setXLims(self.getGlobalLimits('x')) - self.getPlotWidget().setYLims(self.getGlobalLimits('y')) - self.draw() - def draw(self): - self.getPlotWidget().draw() + self.multicompfig.draw() def apply(self): picks = self.getPicks()