ANN: ShortcutEditor for wxPython :-D

95 views
Skip to first unread message

Andrea Gavana

unread,
Mar 5, 2012, 4:00:11 PM3/5/12
to wxPython-users
Hi All,

it's been a while since my last announcement, so I thought I'd
jump in and make another one. I am happy to announce the birth of my
latest child, ShortcutEditor.

NOTE: ShortcutEditor requires AGW 0.9.3 or the latest SVN, due to the
enhancements I made to GenericMessageDialog, CustomTreeCtrl and
HyperTreeList.


Description
===========

ShortcutEditor is a widget that allows the user to customize and change keyboard
shortcuts via a dialog. It can be used to edit `wx.MenuItem` shortcuts
or accelerators
defined in a `wx.AcceleratorTable`.

The interface itself is very much inpired by the GIMP shortcut editor:

http://graphicssoft.about.com/od/gimptutorials/tp/keyboard-shortcut-editor.htm

There are very few minor UI differences between ShortcutEditor and the GIMP one,
although the behaviour should be pretty much equivalent.

Various features:

* Shortcuts are listed in a tree-like structure, pretty much reflecting a menu
hierarchy (as most of the time ShortcutEditor is used to edit `wx.MenuItem`
shortcuts);
* Accelerators defined via `wx.AcceleratorTable` are handled in a similar way;
* Support for I18N;
* Ability to restore default shortcuts/accelerators via a UI button;
* Possibility to send back the new/updated shortcuts to the original
`wx.MenuBar` or the original `wx.AcceleratorTable`;
* Filters on the shortcuts label (case-insensitive);
* Basic help window with instructions (customizable via SetHTMLHelpFile),
via the ``Help`` button.

The docstrings should explain relatively well how to use it, and I am
currently re-building the AGW documentation for the new 0.9.3 version.

Source code: the wxPython SVN repository (please remember to update
the whole of AGW).

Please let me know if you encounter any issue, although patches are
much more welcome :-)

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

>>> import PyQt4.QtGui
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
ImportError: No module named PyQt4.QtGui
>>>
>>> import pygtk
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
ImportError: No module named pygtk
>>>
>>> import wx
>>>
>>>

Frank Niessink

unread,
Mar 18, 2012, 4:16:56 PM3/18/12
to wxpytho...@googlegroups.com
Hi Andrea,

2012/3/5 Andrea Gavana <andrea...@gmail.com>:


> Hi All,
>
>    it's been a while since my last announcement, so I thought I'd
> jump in and make another one. I am happy to announce the birth of my
> latest child, ShortcutEditor.

That's great! I will surely look into making good use of this widget
for Task Coach.

Thanks, Frank

Mike Driscoll

unread,
Jun 21, 2012, 10:57:29 AM6/21/12
to wxpytho...@googlegroups.com, wxPython-users

I realize this post is old, but I was working on a short article about this widget and noticed that the example application in the source didn't work.  You have

wx.Frame.__init(self, parent, -1, "ShortcutEditor Demo")

instead of

wx.Frame.__init__(self, parent, -1, "ShortcutEditor Demo")

in the "usage example" portion. I'll be posting my little blurb later this week. Thanks for the cool new tool, Andrea!

- Mike

Andrea Gavana

unread,
Jun 21, 2012, 1:59:27 PM6/21/12
to wxpytho...@googlegroups.com
Thanks Mike, it should be fixed now in SVN.

Steven Sproat

unread,
Nov 24, 2012, 8:56:00 PM11/24/12
to wxpytho...@googlegroups.com, wxPython-users
Excuse the late reply to this announcement, but I've just installed wx 2.9.4 and am playing about, getting this into my program. This is fantastic bit of work here Andrea, but minimal code to consume its service! Brilliant.

I'm going to look into saving the state of the user's choice so the app can restore it on startup.

thanks again

Werner

unread,
Nov 25, 2012, 2:46:05 AM11/25/12
to wxpytho...@googlegroups.com
Steven,

On 25/11/2012 02:56, Steven Sproat wrote:
> Excuse the late reply to this announcement, but I've just installed wx
> 2.9.4 and am playing about, getting this into my program. This is
> fantastic bit of work here Andrea, but minimal code to consume its
> service! Brilliant.
>
> I'm going to look into saving the state of the user's choice so the
> app can restore it on startup.
I assume you are aware of Andrea's "persist" module, I haven't used the
ShortcutEditor so don't know if persist is saving/restoring the actual data.

I use "persist" in my latest version of my stuff, but "data" type
entries are stored in a database in my case, so don't use "persist" for
that at all.

Werner

Steven Sproat

unread,
Nov 25, 2012, 11:08:57 AM11/25/12
to wxpytho...@googlegroups.com
Hey Werner!

Yes I'm aware of the persistent controls - I was looking at the demo
last night. Seems fun but I may need to do some custom things, e.g. only
save what's changed.

I thought of another enhancement - if you open the editor and change
some keys and save them, then re-open the dialog, the "restore defaults"
button will restore your previously saved settings. I'd expect it to
restore the application defaults. Not sure what's the right approach
there and doing it my way would be much harder.

Regards,
Steven
--
Steven Sproat, BSc
http://www.whyteboard.org/

Reply all
Reply to author
Forward
0 new messages