From: Vidar G. <vid...@37...> - 2005-10-13 16:07:05
|
as an addition to the toolbar (or as an alternative for users who want to turn it off), i think shortcut keys and a right-click menu for the figure window would be a useful addition to mpl. some suggested shortcut keys, (ctrl+)s = save as... z = zoom to rectangle p = pan (and zoom) alt+right arrow, backspace = back alt+left arrow = forward esc, ctrl+w = close figure window we already have the neat f for fullscreen. |
From: Tim L. <ti...@cs...> - 2005-10-14 00:05:18
|
On Thu, 13 Oct 2005, Vidar Gundersen <vid...@37...> wrote... > > as an addition to the toolbar (or as an alternative for users who > want to turn it off), i think shortcut keys and a right-click > menu for the figure window would be a useful addition to mpl. +1 on this idea. Tim > > some suggested shortcut keys, > (ctrl+)s = save as... > z = zoom to rectangle > p = pan (and zoom) > alt+right arrow, backspace = back > alt+left arrow = forward > esc, ctrl+w = close figure window > > we already have the neat f for fullscreen. > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: > Power Architecture Resource Center: Free content, downloads, discussions, > and more. http://solutions.newsforge.com/ibmarch.tmpl > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > `- |
From: Erik C. <ec...@ke...> - 2005-10-14 16:56:01
|
> some suggested shortcut keys, > (ctrl+)s = save as... > z = zoom to rectangle > p = pan (and zoom) > alt+right arrow, backspace = back > alt+left arrow = forward > esc, ctrl+w = close figure window > > we already have the neat f for fullscreen. That's a great idea! If this were implemented, I'd like to see a set of emacs-like key-bindings. Heck, if someone points me to the right place in the code, I'll do it myself. E |
From: John H. <jdh...@ac...> - 2005-10-14 17:10:38
|
>>>>> "Erik" == Erik Curiel <ec...@ke...> writes: >> some suggested shortcut keys, (ctrl+)s = save as... z = zoom >> to rectangle p = pan (and zoom) alt+right arrow, backspace = >> back alt+left arrow = forward esc, ctrl+w = close figure window >> >> we already have the neat f for fullscreen. Erik> That's a great idea! If this were implemented, I'd like to Erik> see a set of emacs-like key-bindings. Heck, if someone Erik> points me to the right place in the code, I'll do it myself. Never one to turn down free help... The code is lib/matplotlib/backend_bases.py in FigureManagerBase.key_press def key_press(self, event): # these bindings happen whether you are over an axes or not #if event.key == 'q': # self.destroy() # how cruel to have to destroy oneself! # return if event.key == 'f': self.full_screen_toggle() if event.inaxes is None: return # the mouse has to be over an axes to trigger these if event.key == 'g': event.inaxes.grid() self.canvas.draw() elif event.key == 'l': event.inaxes.toggle_log_lineary() self.canvas.draw() Some events like 'f' are applicable anywhere in the figure and some are only appropriate over and axes. event.inaxes is the axes the event occurs over, or none. If you want to simulate clicking the toolbar, you need to call the appropriate toolbar method. The class NavigationToolbar2 is in the same module, eg toolbar.home(), toolbar.press_zoom(event). For funcs that need an event, you should just be able to pass in the key event you get in key_press. You can access the toolbar as self.toolbar, where self is the FigureManager instance. Have fun! JDH |
From: Charlie M. <cw...@gm...> - 2005-10-14 17:20:18
|
In backend_bases.FigureManagerBase you can see how the full_screen_toggle event is added and handled. 'f', 'l', and 'g' seem reserved right now. One note, I believe modifier keys aren't supported in a natural way right now, so to catch "ctrl+s" for example could be a pain. Just pressing "ctrl" would generate an event. All the modifiers states would have to be maintained manually, I believe. My two cents, - Charlie On 10/14/05, Erik Curiel <ec...@ke...> wrote: > > > some suggested shortcut keys, > > (ctrl+)s =3D save as... > > z =3D zoom to rectangle > > p =3D pan (and zoom) > > alt+right arrow, backspace =3D back > > alt+left arrow =3D forward > > esc, ctrl+w =3D close figure window > > > > we already have the neat f for fullscreen. > > That's a great idea! If this were implemented, I'd like to see a set of > emacs-like key-bindings. Heck, if someone points me to the right place i= n > the code, I'll do it myself. > > E > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: > Power Architecture Resource Center: Free content, downloads, discussions, > and more. http://solutions.newsforge.com/ibmarch.tmpl > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: John H. <jdh...@ac...> - 2005-10-14 17:29:14
|
>>>>> "Charlie" == Charlie Moad <cw...@gm...> writes: Charlie> One note, I believe modifier keys aren't supported in a Charlie> natural way right now, so to catch "ctrl+s" for example Charlie> could be a pain. Just pressing "ctrl" would generate an Charlie> event. All the modifiers states would have to be Charlie> maintained manually, I believe. Good point. The first thing to be done is to add support for this in the key event itself, by modifying FigureCanvasBase to track the state of the modifier keys and add a modifier attr to the KeyEvent, so one could do, eg if event.key=='left' and event.modifier=='alt': blah Basically, you would want to add some state vars (_inalt, _inctrl, _inshift) to FigureCanvasBase, and monitor event.key in FigureCanvasBase.key_press_event and FigureCanvasBase.key_release_event. I would add a new kwarg to KeyEvent like modifier=None that would be overrridden depending on the _in* attrs. Any takers on this one? JDH |
From: John H. <jdh...@ac...> - 2005-10-14 17:41:07
|
>>>>> "John" == John Hunter <jdh...@ac...> writes: if event.key=='left' and event.modifier=='alt': blah That isn't the right approach, actually, because it doesn't support multiple modifiers. I think the better approach is to add attributes alt, ctrl and shift which are booleans, eg one would do if event.alt and event.key=='x' : blah or if event.alt and event.ctrl and event.key=='x' : blah JDH |