Changeset 3794


Ignore:
Timestamp:
Jan 23, 2019 4:59:06 PM (3 years ago)
Author:
toby
Message:

add routine to turn off zoom/pan

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIplot.py

    r3770 r3794  
    840840                    return
    841841            dlg.Destroy()
     842
     843    # these routines are not currently in use, but there are probably good
     844    # places in the graphics to disable the zoom/pan to release the mouse bind
     845    #
     846    # use as Page.canvas.toolbar.reset_zoompan()
     847    #
     848    def get_zoompan(self):
     849        """Return "ZOOM" if Zoom is active, , "PAN" if Pan is active,
     850        or None if neither
     851        """
     852        return self._active
     853
     854    def reset_zoompan(self):
     855        '''Turns off Zoom or Pan mode, if on. Ignored if neither is set
     856        '''
     857        if self._active == 'ZOOM':
     858            self._active = None
     859            if self._idPress is not None:
     860                self._idPress = self.canvas.mpl_disconnect(self._idPress)
     861                self.mode = ''
     862
     863            if self._idRelease is not None:
     864                self._idRelease = self.canvas.mpl_disconnect(self._idRelease)
     865                self.mode = ''
     866            self.canvas.widgetlock.release(self)
     867            if hasattr(self,'_NTB2_ZOOM'):
     868                self.ToggleTool(self._NTB2_ZOOM, False)
     869            elif hasattr(self,'wx_ids'):
     870                self.ToggleTool(self.wx_ids['Zoom'], False)
     871            else:
     872                print('Unable to reset Zoom button, please report this with matplotlib version')
     873        elif self._active == 'PAN':
     874            self._active = None
     875            if self._idPress is not None:
     876                self._idPress = self.canvas.mpl_disconnect(self._idPress)
     877                self.mode = ''
     878
     879            if self._idRelease is not None:
     880                self._idRelease = self.canvas.mpl_disconnect(self._idRelease)
     881                self.mode = ''
     882            self.canvas.widgetlock.release(self)
     883            if hasattr(self,'_NTB2_PAN'):
     884                self.ToggleTool(self._NTB2_PAN, False)
     885            elif hasattr(self,'wx_ids'):
     886                self.ToggleTool(self.wx_ids['Pan'], False)
     887            else:
     888                print('Unable to reset Pan button, please report this with matplotlib version')
    842889           
    843890################################################################################
Note: See TracChangeset for help on using the changeset viewer.