'Activate the pan/zoom tool. pan with left button, zoom with right'

def pan(self, *args):

    if (self._active == u'PAN'):
        self._active = None
    else:
        self._active = u'PAN'
    if (self._idPress is not None):
        self._idPress = self.canvas.mpl_disconnect(self._idPress)
        self.mode = u''
    if (self._idRelease is not None):
        self._idRelease = self.canvas.mpl_disconnect(self._idRelease)
        self.mode = u''
    if self._active:
        self._idPress = self.canvas.mpl_connect(u'button_press_event', self.press_pan)
        self._idRelease = self.canvas.mpl_connect(u'button_release_event', self.release_pan)
        self.mode = u'pan/zoom'
        self.canvas.widgetlock(self)
    else:
        self.canvas.widgetlock.release(self)
    for a in self.canvas.figure.get_axes():
        a.set_navigate_mode(self._active)
    self.set_message(self.mode)
