def ToggleGridRight(self, evt): asel = self.GetParent().axes_selection if asel is None: return a = asel() if a is None: return ax = a.figobj value = ax.getp('grid') def grid_x(evt, self=self): value[0] = not value[0] ax.set_grid(value) a.figobj.set_bmp_update(False) canvas = self.GetParent().canvas canvas.draw() def grid_y(evt, self=self): value[1] = not value[1] ax.set_grid(value) a.figobj.set_bmp_update(False) canvas = self.GetParent().canvas canvas.draw() m = wx.Menu() menus =[ ['X', grid_x, None], ['Y', grid_y, None],] cbook.BuildPopUpMenu(m, menus) x,y = evt_GetPosition(evt) self.PopupMenu(m, [x, y]) m.Destroy()
def ToggleGridRight(self, evt): asel = self.GetParent().axes_selection if asel is None: return a = asel() if a is None: return ax = a.figobj value = ax.getp('grid') def grid_x(evt, self=self): value[0] = not value[0] ax.set_grid(value) a.figobj.set_bmp_update(False) canvas = self.GetParent().canvas canvas.draw() def grid_y(evt, self=self): value[1] = not value[1] ax.set_grid(value) a.figobj.set_bmp_update(False) canvas = self.GetParent().canvas canvas.draw() m = wx.Menu() menus = [ ['X', grid_x, None], ['Y', grid_y, None], ] cbook.BuildPopUpMenu(m, menus) x, y = evt_GetPosition(evt) self.PopupMenu(m, [x, y]) m.Destroy()
def MailPicRight(self, evt): def mailpic_set_pdf(evt, self=self): self.GetParent()._mailpic_format = 'pdf' def mailpic_set_eps(evt, self=self): self.GetParent()._mailpic_format = 'eps' def mailpic_set_svg(evt, self=self): self.GetParent()._mailpic_format = 'svg' def mailpic_set_jpeg(evt, self=self): self.GetParent()._mailpic_format = 'jpeg' def mailpic_set_png(evt, self=self): self.GetParent()._mailpic_format = 'png' def mailpic_set_pdfall(evt, self=self): self.GetParent()._mailpic_format = 'pdfall' def mailpic_set_gifanim(evt, self=self): self.GetParent()._mailpic_format = 'gifanim' data = ['eps', 'pdf', 'svg', 'png', 'jpeg', 'pdfall', 'gifanim'] idx = data.index(self.GetParent()._mailpic_format) m = wx.Menu() menus =[ ['EPS', mailpic_set_eps, None], ['PDF', mailpic_set_pdf, None], ['SVG', mailpic_set_svg, None], ['PNG', mailpic_set_png, None], ['JPEG', mailpic_set_jpeg, None], ['Multipage PDF', mailpic_set_pdfall, None], ['Animated Gif', mailpic_set_gifanim, None],] menus[idx][0] = '^'+ menus[idx][0] cbook.BuildPopUpMenu(m, menus) x,y = evt_GetPosition(evt) self.PopupMenu(m, [x, y]) m.Destroy()
def OnLeftUp(self, evt): ret = self.HitTest(evt_GetPosition(evt)) if ret[0]==wx.NOT_FOUND: return bp.ButtonPanel.OnLeftUp(self, evt) bp.ButtonPanel.OnLeftUp(self, evt) btask = self.allbinfo[ret[0]].btask self.OnButton(evt, btask)
def OnLeftUp(self, evt): ret = self.HitTest(evt_GetPosition(evt)) if ret[0] == wx.NOT_FOUND: return super(navibar, self).OnLeftUp(evt) super(navibar, self).OnLeftUp(evt) btask = self.allbinfo[ret[0]].btask self.OnButton(evt, btask)
def OnLeftUp(self, evt): ret = self.HitTest(evt_GetPosition(evt)) if ret[0] == wx.NOT_FOUND: return bp.ButtonPanel.OnLeftUp(self, evt) bp.ButtonPanel.OnLeftUp(self, evt) btask = self.allbinfo[ret[0]].btask self.OnButton(evt, btask)
def OnLeftUp(self, evt): ret = self.HitTest(evt_GetPosition(evt)) if ret[0]==wx.NOT_FOUND: return super(navibar, self).OnLeftUp(evt) super(navibar, self).OnLeftUp(evt) btask = self.allbinfo[ret[0]].btask self.OnButton(evt, btask)
def OnLeftUp(self, evt): ret = self.HitTest(evt_GetPosition(evt)) if ret[0] == wx.NOT_FOUND: return bp.ButtonPanel.OnLeftUp(self, evt) bp.ButtonPanel.OnLeftUp(self, evt) btask = self.allbinfo[ret[0]].btask self._mouse_inside = False self.OnButtonUp(evt, btask) evt.Skip()
def CurveRight(self, evt): def curve_set_freehand(evt, self=self): self._curve_mode = 'fh' def curve_set_pickpoints(evt, self=self): self._curve_mode = 'pp' data = ['pp', 'fh'] idx = data.index(self._curve_mode) m = wx.Menu() menus =[ ['PickPoints', curve_set_pickpoints, None], ['Freehand', curve_set_freehand, None],] menus[idx][0] = '^'+ menus[idx][0] cbook.BuildPopUpMenu(m, menus) x,y = evt_GetPosition(evt) self.PopupMenu(m, [x, y]) m.Destroy()
def CurveRight(self, evt): def curve_set_freehand(evt, self=self): self._curve_mode = 'fh' def curve_set_pickpoints(evt, self=self): self._curve_mode = 'pp' data = ['pp', 'fh'] idx = data.index(self._curve_mode) m = wx.Menu() menus = [ ['PickPoints', curve_set_pickpoints, None], ['Freehand', curve_set_freehand, None], ] menus[idx][0] = '^' + menus[idx][0] cbook.BuildPopUpMenu(m, menus) x, y = evt_GetPosition(evt) self.PopupMenu(m, [x, y]) m.Destroy()
def OnLeftDown(self, evt): ret = self.HitTest(evt_GetPosition(evt)) if ret[0] == wx.NOT_FOUND: return bp.ButtonPanel.OnLeftDown(self, evt) bp.ButtonPanel.OnLeftDown(self, evt) btask = self.allbinfo[ret[0]].btask self._mouse_inside = True self.OnButtonDown(evt, btask) win = self.GetTopLevelParent() canvas = win.canvas ax = win.canvas.axes_selection() if ax is None: return figax = ax.figobj if not figax.get_3d(): return wx.CallLater(dtime, self.timed_event, btask, canvas, ax) evt.Skip()
def MailPicRight(self, evt): def mailpic_set_pdf(evt, self=self): self.GetParent()._mailpic_format = 'pdf' def mailpic_set_eps(evt, self=self): self.GetParent()._mailpic_format = 'eps' def mailpic_set_svg(evt, self=self): self.GetParent()._mailpic_format = 'svg' def mailpic_set_jpeg(evt, self=self): self.GetParent()._mailpic_format = 'jpeg' def mailpic_set_png(evt, self=self): self.GetParent()._mailpic_format = 'png' def mailpic_set_pdfall(evt, self=self): self.GetParent()._mailpic_format = 'pdfall' def mailpic_set_gifanim(evt, self=self): self.GetParent()._mailpic_format = 'gifanim' data = ['eps', 'pdf', 'svg', 'png', 'jpeg', 'pdfall', 'gifanim'] idx = data.index(self.GetParent()._mailpic_format) m = wx.Menu() menus = [ ['EPS', mailpic_set_eps, None], ['PDF', mailpic_set_pdf, None], ['SVG', mailpic_set_svg, None], ['PNG', mailpic_set_png, None], ['JPEG', mailpic_set_jpeg, None], ['Multipage PDF', mailpic_set_pdfall, None], ['Animated Gif', mailpic_set_gifanim, None], ] menus[idx][0] = '^' + menus[idx][0] cbook.BuildPopUpMenu(m, menus) x, y = evt_GetPosition(evt) self.PopupMenu(m, [x, y]) m.Destroy()