Re: Using Gtk.Builder to create a menubar.

2018-04-27 Thread Luca Bacci
Yes, actions get a prefix depending on where you put them. Every "action container" has a prefix. In your case you add_action() to GtkApplicationWindow and its prefix is "win" I used your code to create an answer to my StackOverflow question > https://stackoverflow.com/a/50051155/4865723 >

Re: Using Gtk.Builder to create a menubar.

2018-04-27 Thread Marius Gedminas
On Thu, Apr 26, 2018 at 09:46:57PM +0200, c.bu...@posteo.jp wrote: > Thank you very much. Your example works for me but I don't understand > why. ;) > > > win.bar > > > action_bar = Gio.SimpleAction.new('bar', None) > > The name of the action in the XML and the code is

Re: Using Gtk.Builder to create a menubar.

2018-04-26 Thread c.buhtz
On 2018-04-26 18:10 Luca Bacci wrote: > Hi, I did test it out, here's a working version: I used your code to create an answer to my StackOverflow question https://stackoverflow.com/a/50051155/4865723 ___ gtk-app-devel-list

Re: Using Gtk.Builder to create a menubar.

2018-04-26 Thread c.buhtz
Thank you very much. Your example works for me but I don't understand why. ;) > win.bar > action_bar = Gio.SimpleAction.new('bar', None) The name of the action in the XML and the code is different. Why? What is the system behind it?

Re: Using Gtk.Builder to create a menubar.

2018-04-26 Thread Eric Cashon via gtk-app-devel-list
"1. It uses "QMenu" (from Gtk or Gio?) to build a menu structure. I would prefere this way instead of an XML string. It should be possible in Python, too? Gtk.Menu or Gio.Menu?" My understanding of this is that the GMenu is used with the GtkApplication and a GtkMenu is used with the "regular"

Re: Using Gtk.Builder to create a menubar.

2018-04-26 Thread Luca Bacci
Hi, I did test it out, here's a working version: import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk from gi.repository import Gio class Window(Gtk.ApplicationWindow): def __init__(self): Gtk.Window.__init__(self) self.set_default_size(200, 100)

Re: Using Gtk.Builder to create a menubar.

2018-04-26 Thread Luca Bacci
it should be like that (I can't test it right now, try yourself) #!/usr/bin/env python3 import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk from gi.repository import Gio class Window(Gtk.ApplicationWindow): def __init__(self): Gtk.Window.__init__(self)

Re: Using Gtk.Builder to create a menubar.

2018-04-26 Thread Luca Bacci
see here: https://wiki.gnome.org/HowDoI/GMenu https://wiki.gnome.org/HowDoI/GAction self.interface_info = """ > > > > Foo > > Bar > > > > > """ for every you

Re: Using Gtk.Builder to create a menubar.

2018-04-25 Thread c.buhtz
Dear Eric, thank you for your quick reply. > There is a basic setup for the Gtk Application in Python here > https://developer.gnome.org/gnome-devel-demos/stable/hello-world.py.html.en Nice to know. Very helpful. > For C you can check >

Re: Using Gtk.Builder to create a menubar.

2018-04-25 Thread Eric Cashon via gtk-app-devel-list
There is a basic setup for the Gtk Application in Python here https://developer.gnome.org/gnome-devel-demos/stable/hello-world.py.html.en For C you can check https://github.com/cecashon/OrderedSetVelociRaptor/blob/master/Misc/Csamples/gtk_app1.c which has a menu but doesn't use builder

Using Gtk.Builder to create a menubar.

2018-04-25 Thread c.buhtz
X-Post: I was redirected from https://mail.gnome.org/archives/python-hackers-list/2018-April/msg4.html to here. I try to use Gtk.Builder to create a menubar. It is not working because the documentation is not clear for me. There is no exmple for a IMO usual thing like a menubar. To improve