AcceleratorTable and ShortcutEditor

Hi,

I am experimenting with the ShortcutEditor - another one of Andrea's nice widgets!

How are people persisting the short cut data between sessions? Is there some magic function available for this? Or do I need to setup e.g. a config file where I store it and then load it on startup and save it if user uses the SCE.

Btw, the SCE doesn't like combined key codes (i.e. throws an exception), e.g. "wx.ACCEL_SHIFT|wx.ACCEL_ALT", I looked at the code but I don't know how to handle all the possible different combinations nicely.

Andrea, I also noticed in the Phoenix documentation two things:

Control Appearance is overlapping Known Superclasses on e.g. this page:

http://wxpython.org/Phoenix/docs/html/lib.agw.shortcuteditor.ShortcutEditor.html

The signature is wrong here - "cmd" should be "cmdID" - created a ticket 15134 as I believe this comes from wxWidgets doc.

wxpython.org/Phoenix/docs/html/AcceleratorEntry.html

Werner

Hi Werner,

···

On 3 April 2013 13:56, Werner wrote:

Hi,

I am experimenting with the ShortcutEditor - another one of Andrea’s nice widgets!

How are people persisting the short cut data between sessions? Is there some magic function available for this? Or do I need to setup e.g. a config file where I store it and then load it on startup and save it if user uses the SCE.

There is currently no support for this, but I agree that it should be added (maybe with the manager returning the accelerator tuples and the menus accelerator tuples, plus the integration with wx.lib.agw.persist). I’ll take a look at it in the next few days.

Btw, the SCE doesn’t like combined key codes (i.e. throws an exception), e.g. “wx.ACCEL_SHIFT|wx.ACCEL_ALT”, I looked at the code but I don’t know how to handle all the possible different combinations nicely.

Uhm, are you sure about this? I just run the demo and there are a few menus with “Ctrl+Shift” accelerators (see attached image). Maybe I am missing something…

Andrea, I also noticed in the Phoenix documentation two things:

Control Appearance is overlapping Known Superclasses on e.g. this page:

http://wxpython.org/Phoenix/docs/html/lib.agw.shortcuteditor.ShortcutEditor.html

I know, the problem is that I only have a screenshot for Windows and the floatleft CSS attribute does not play very nicely with that… I’ll have to find a solution in the docs generator.

The signature is wrong here - “cmd” should be “cmdID” - created a ticket 15134 as I believe this comes from wxWidgets doc.

wxpython.org/Phoenix/docs/html/AcceleratorEntry.html

Werner

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.


Andrea.

“Imagination Is The Only Weapon In The War Against Reality.”
http://www.infinity77.net

-------------------------------------------------------------

def ask_mailing_list_support(email):

if mention_platform_and_version() and include_sample_app():
    send_message(email)
else:

    install_malware()
    erase_hard_drives()

-------------------------------------------------------------

Of course I forgot the attachment...

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."

···

On 3 April 2013 14:49, Andrea Gavana wrote:

Hi Werner,

On 3 April 2013 13:56, Werner wrote:

Hi,

I am experimenting with the ShortcutEditor - another one of Andrea's nice
widgets!

How are people persisting the short cut data between sessions? Is there
some magic function available for this? Or do I need to setup e.g. a
config file where I store it and then load it on startup and save it if
user uses the SCE.

There is currently no support for this, but I agree that it should be
added (maybe with the manager returning the accelerator tuples and the
menus accelerator tuples, plus the integration with wx.lib.agw.persist).
I'll take a look at it in the next few days.

Btw, the SCE doesn't like combined key codes (i.e. throws an exception),
e.g. "wx.ACCEL_SHIFT|wx.ACCEL_ALT", I looked at the code but I don't know
how to handle all the possible different combinations nicely.

Uhm, are you sure about this? I just run the demo and there are a few
menus with "Ctrl+Shift" accelerators (see attached image). Maybe I am
missing something...

That would be great - will be happy to help in the testing
Yeap, I am sure, but should have given more detail.
Attached is my testing code for it, based on Mike’s blog post with a
few additions. The problem is with entries in the accelerator
table, didn’t try with menus.
The exception I get is:
KeyError: 5
File “h:\devProjectsT\aaTests\aaMisc\shortcuttesting.py”, line 108,
in
app.MainLoop()
File “c:\Python27\Lib\site-packages\wx-2.9.5-msw\wx_core.py”, line
8660, in MainLoop
wx.PyApp.MainLoop(self)
File “c:\Python27\Lib\site-packages\wx-2.9.5-msw\wx_core.py”, line
7952, in MainLoop
return core.PyApp_MainLoop(*args, **kwargs)
File “h:\devProjectsT\aaTests\aaMisc\shortcuttesting.py”, line 73,
in onSCE
dlg.FromAcceleratorTable(self.accel_tbl)
File
“c:\Python27\Lib\site-packages\wx-2.9.5-msw\wx\lib\agw\shortcuteditor.py”,
line 2424, in FromAcceleratorTable
modifier = ACCELERATORS[modifier]
Werner

shortcuttesting.py (3.89 KB)

···

Hi Andrea,

  On 03/04/2013 14:49, Andrea Gavana wrote:

Hi Werner,

On 3 April 2013 13:56, Werner wrote:

Hi,

          I am experimenting with the ShortcutEditor - another one

of Andrea’s nice widgets!

          How are people persisting the short cut data between

sessions? Is there some magic function available for
this? Or do I need to setup e.g. a config file where I
store it and then load it on startup and save it if user
uses the SCE.

          There is currently no support for this, but I

agree that it should be added (maybe with the manager
returning the accelerator tuples and the menus accelerator
tuples, plus the integration with wx.lib.agw.persist).
I’ll take a look at it in the next few days.

:slight_smile:

          Btw, the SCE doesn't like combined key codes (i.e. throws

an exception), e.g. “wx.ACCEL_SHIFT|wx.ACCEL_ALT”, I
looked at the code but I don’t know how to handle all the
possible different combinations nicely.

          Uhm, are you sure about this? I just run the

demo and there are a few menus with “Ctrl+Shift”
accelerators (see attached image). Maybe I am missing
something…

:slight_smile:

Hi,

Can one assign a shortcut (via AcceleratorTable) to a button, i.e. so it's handler is called without having a corresponding menu item?

If yes, is there a different/special syntax for that?

Werner

Hi Andrea,

Noticed a little aesthetic issue.

On menu bar texts the "&" is not removed as it is done on the items.

Werner

jiiajfdg.png

Don’t want to push, just curious, did you manage to have a look at
this?
Werner
P.S.
What do you think about the persist and supertooltip patch - are
they o.k./acceptable?

···

Hi Andrea,

  On 03/04/2013 14:49, Andrea Gavana wrote:

Hi Werner,

On 3 April 2013 13:56, Werner wrote:

Hi,

          I am experimenting with the ShortcutEditor - another one

of Andrea’s nice widgets!

          How are people persisting the short cut data between

sessions? Is there some magic function available for
this? Or do I need to setup e.g. a config file where I
store it and then load it on startup and save it if user
uses the SCE.

          There is currently no support for this, but I

agree that it should be added (maybe with the manager
returning the accelerator tuples and the menus accelerator
tuples, plus the integration with wx.lib.agw.persist).
I’ll take a look at it in the next few days.

Hi Werner,

···

On 2 May 2013 14:47, werner wrote:

Hi Andrea,

  On 03/04/2013 14:49, Andrea Gavana wrote:

Hi Werner,

Don't want to push, just curious, did you manage to have a look at

this?

Werner



P.S.

What do you think about the persist and supertooltip patch - are

they o.k./acceptable?

I am sorry for being late, it’s a bit of a complicated period for me. I hope to be back full speed soon enough, and I had indeed looked at your patches on STT and the persist library and they look OK to me. I’ll try and apply them as soon as I get home.

Thank you for all your work.

Andrea.

“Imagination Is The Only Weapon In The War Against Reality.”
http://www.infinity77.net

On 3 April 2013 13:56, Werner wrote:

Hi,

          I am experimenting with the ShortcutEditor - another one

of Andrea’s nice widgets!

          How are people persisting the short cut data between

sessions? Is there some magic function available for
this? Or do I need to setup e.g. a config file where I
store it and then load it on startup and save it if user
uses the SCE.

          There is currently no support for this, but I

agree that it should be added (maybe with the manager
returning the accelerator tuples and the menus accelerator
tuples, plus the integration with wx.lib.agw.persist).
I’ll take a look at it in the next few days.