[Glade-users] Using Actions + MenuItems + Accelerators + AccelLabels

On Sat, 2009-10-03 at 20:43 -0500, Manuel Alejandro Cer?n Estrada wrote:

I have a bunch of actions and a MenuBar. Every MenuItem in the MenuBar
has an associated action. I'm using "related action" and "use action
appearance" to connect the actions with the menu. Now I want to assign
some shortcut keys to each action. I haven't found a way to do that in
Glade, so I'm doing it with code. I'm creating an ActionGroup and then
adding each action to that group using add_action_with_accel. Then I
create an AccelGroup and assign each action to it using
action.set_accel_group and connect the accelerator using
action.connect_accelerator. After that, I add the AccelGroup to the
window using window.set_accel_group. This seems to work, when I press
the keyboard shortcut the action is activated, however, the menu item
does not show the AccelLabel indicating the accelerator for that item.
How do I achieve this? Is there an easier way?

I'd like to see the answer too. Currently I create only the main menu
bar and empty sub menus with Glade, and all the menu items are created
and appended to the sub menus manually in the code. It results in
hundreds of lines of clutter which I'm looking forward to get rid of.

I'm using PyGTK and glade 3.6.3

Glade-users maillist  -  Glade-users at lists.ximian.com

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]