Re: Programatically activate menu like a mouse click



Le 24/02/2017 à 10:24, John Lane a écrit :
On 23/02/17 21:02, Colomban Wendling wrote:


Sounds odd to do that manually.  Do you know about mnemonic keys?
Basically if you mark some part of the label to be the mnemonic letter,
you'll be able to trigger that element with Alt+letter.

Additionally, F10 already pops up the first menu of the window's menubar.


I sent a reply to Eric's message with an example of what I am doing.
Whay you suggest is valid for a "window" application that has the input
focus but I am trying to write a "dock" application that isn't focussed.
Sorry I should have made that clearer.

OK.  But it's also actually what e.g. MATE's panel (which is a dock too)
uses:
https://github.com/mate-desktop/mate-panel/blob/master/mate-panel/panel-menu-bar.c#L415

    self.menubar1.select_item(self.menuitem1)

Thanks for that tip - I tried it and (see my other msg) it selects the
first menu item but the app doesn't respond after that.

There really seems to be something funky in relation to that Keybinder.
GTK emits warning when poping up the menu, I guess because it doesn't
see the "current event".

Initially:
(menu2.py:24105): Gtk-WARNING **: no trigger event for menu popup

And then, if playing with arrows:
(menu2.py:24105): Gdk-CRITICAL **: Window 0x55a411e7d660 has not been made visible in GdkSeatGrabPrepareFunc

(menu2.py:24105): Gdk-CRITICAL **: Window 0x55a411e7d660 has not been made visible in GdkSeatGrabPrepareFunc

(menu2.py:24105): Gdk-CRITICAL **: Window 0x55a411e7d660 has not been made visible in GdkSeatGrabPrepareFunc

(menu2.py:24105): Gdk-CRITICAL **: gdk_window_get_window_type: assertion 'GDK_IS_WINDOW (window)' failed

(menu2.py:24105): Gtk-CRITICAL **: _gtk_widget_captured_event: assertion 'WIDGET_REALIZED_FOR_EVENT 
(widget, event)' failed

(menu2.py:24105): Gtk-CRITICAL **: _gtk_widget_captured_event: assertion 'WIDGET_REALIZED_FOR_EVENT 
(widget, event)' failed

(menu2.py:24105): Gtk-CRITICAL **: _gtk_widget_captured_event: assertion 'WIDGET_REALIZED_FOR_EVENT 
(widget, event)' failed

I can't help with that, but I think it's related with the issue ;)

Cheers,
Colomban


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