Re: Weather API
Op 02/23/2017 om 12:37 PM schreef Emmanuele Bassi: >> Yeah gnome documentation sucks. > You may want to avoid insulting people that work really hard at > writing the documentation. Why would anyone be insulted with me stating a fact that has been true for over a decade. Also it does not say anything about the work that people have done on it, it says more on how much the api docs suck. Ignoring for the moment proper developer documentation with buildable examples. And lets have a look how much work has been done on the libgweather documentation.. Last commit is for the api docs is almost 2 years ago and looking at how broken they are today it seems nobody from the gnome team cares. Don't you think it is a shame that the python binding api docs for libgweather is better than the official ones? So I have no problem is saying gnome documentation sucks. ~infirit ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Programatically activate menu like a mouse click
Le 23/02/2017 à 15:57, John Lane a écrit : > […] > > The UIManager provides the menu bar, a few items in the bar each leading > to menus containing a few items. The user can click operate the menu > with a mouse and selecting a menu item triggers a callback that prints > the name of the selected item. Nothing special thus far, but it works. > > Once the user has clicked on a menu bar item with the mouse, she can > then navigate the menu with the keyboard (or continue using the mouse). > > I have wired up a global key binding using the 'keybinder' module and > receive a callback when a mapped key is pressed. 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. > […] > > How can I trigger the menu activation (like a mouse click does) ? Read https://developer.gnome.org/gtk3/stable/GtkMenuShell.html and use Gtk.MenuShell.select_item(). As menubars and menus are shells, assuming Eric's sample, use: self.menubar1.select_item(self.menuitem1) instead of manually poping the menu up. But still, you should consider using memnonics Regards, Colomban ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Programatically activate menu like a mouse click
Hi John, Give this a try. It might be close to what you are after. Eric #!/usr/bin/python import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk, Gdk class MainWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title="Menu Popup") self.set_default_size(200, 100) self.set_position(Gtk.WindowPosition.CENTER) self.menubar1 = Gtk.MenuBar() self.menu1 = Gtk.Menu() self.menuitem1 = Gtk.MenuItem("Menu") self.menuitem1.set_submenu(self.menu1) self.menuitem2 = Gtk.MenuItem("Save") self.menuitem2.connect("activate", self.save_file) self.menuitem3 = Gtk.MenuItem("Print") self.menuitem3.connect("activate", self.print_file) self.menu1.append(self.menuitem2) self.menu1.append(self.menuitem3) self.menubar1.append(self.menuitem1) self.connect("key-press-event", self.key_pressed) self.grid = Gtk.Grid() self.grid.attach(self.menubar1, 0, 0, 1, 1) self.add(self.grid) def save_file(self, menuitem2): print("Save File") def print_file(self, menuitem3): print("Print File") def key_pressed(self, widget, event): print("Key Pressed") print(str(event.keyval)) self.menu1.popup(None, None, None, None, 0, event.time) return False win = MainWindow() win.connect("delete-event", Gtk.main_quit) win.show_all() Gtk.main() ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Split TextView
Hello, I'm trying to make a simple word processor with GTK+, but I got stuck on a seemingly simple issue: I would like to break down the content in multiple pages, like Microsoft word and LibreOffice do, but I can't figure out how to do that. I have a few ideas, but they all sound very complicated and would require a lot of work. Ideally, every page would be a TextView, all backed by 1 TextBuffer, but that doesn't seem to be possible (out of the box)... How would you do this? Tuur Dutoit ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Does gtk2 provide a case 'in'-sensitive text search via 'gtk_text_iter_..._search'?
Hi David, I tried out gtkedit and it compiled and worked fine. Did a few searches and it found the words. When I compiled I got a few warnings like the following. gtk_common_dlg.c: In function ‘err_dialog’: gtk_common_dlg.c:8:9: warning: format not a string literal and no format arguments [-Wformat-security] g_warning (errmsg); /* log to terminal window */ I don't know if they are coming up on your computer but they are easy ones to fix. Are you going to give finding ligatures and accents a try? I am not very good with languages, stuck with English, but it is pretty interesting how things are put together with UTF-8 to allow for all different types of characters in languages. Eric ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Programatically activate menu like a mouse click
On 23/02/17 15:23, Norbert de Jonge wrote: > I would guess with: > https://developer.gnome.org/gtk3/stable/GtkMenu.html#gtk-menu-popup-at-widget Thanks, I have 3.22.5. I had tried `gtk-menu-popup-at-widget` but it didn't work. I've tried lots of combinations to try and get it to work without success. Like this: self.menu.popup_at_widget(self.anchor,Gdk.Gravity.SOUTH_WEST,Gdk.Gravity.NORTH_WEST,None) I tried with self.menu being the first menu out of the uibuilder and also with menu that I built manually (using Gtk.Menu, Gtk.MenuItem, etc) and attached to the menubar. Both kinds of menu appear as expected and work with the mouse just fine but they are different: * The uimanager menu is * The manually built menu is This leads to different behaviour when I call popup_at_widget. If I pull 'self.menu' out of UIManager then I get an error: self.menu.popup_at_widget(self.anchor, Gdk.Gravity.SOUTH_WEST,Gdk.Gravity.NORTH_WEST,None) AttributeError: 'ImageMenuItem' object has no attribute 'popup_at_widget' Whereas if I use the manually built menu I get warnings: Gtk-WARNING **: no trigger event for menu popup Warning: g_object_set_data: assertion 'G_IS_OBJECT (object)' failed self.menu.popup_at_widget(self.anchor,Gdk.Gravity.SOUTH_WEST, Gdk.Gravity.NORTH_WEST,None) It makes no difference whether self.anchor is the box widget or the menubar widget pulled from UI manager. The menubar widget is The box widget is box > It's available for GTK+ 3.22 and up, so I cannot test it to verify. My other thought is that popup_at_widget is only 3.22+. I wanted to find a solution that worked in Gtk3 and Gtk2 because I am evaluating both of them (there are things I need that can't be done using Gtk3 without falling back on Xlib). So perhaps the above isn't the way, and there is another way to achieve this... I appreciate any help. John ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Programatically activate menu like a mouse click
> How can I trigger the menu activation (like a mouse click does) ? I would guess with: https://developer.gnome.org/gtk3/stable/GtkMenu.html#gtk-menu-popup-at-widget It's available for GTK+ 3.22 and up, so I cannot test it to verify. This should tell you your GTK+ version: $ pkg-config --modversion gtk+-3.0 Best regards, Norbert ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Programatically activate menu like a mouse click
I am trying to write a small test app using Python and Gtk+3 It's basically a bar across the top of the display that contains a menu implemented as a Gtk.Window containing a Gtk.Bar containing a menu bar populated using UIManager. Essentially this (where 'self' is an object derived from `Gtk.Window`): box = Gtk.Box(); menubar = uimanager.get_widget("/MenuBar") self.menu = menubar box.pack_start(menubar, False, False, 0) self.add(box) The UIManager provides the menu bar, a few items in the bar each leading to menus containing a few items. The user can click operate the menu with a mouse and selecting a menu item triggers a callback that prints the name of the selected item. Nothing special thus far, but it works. Once the user has clicked on a menu bar item with the mouse, she can then navigate the menu with the keyboard (or continue using the mouse). I have wired up a global key binding using the 'keybinder' module and receive a callback when a mapped key is pressed. I want to activate the menu in the same way as that initial mouse click. I can't work out how to do that, despite reading and searching for days! Here's my keybinder callback (it is called when the key is hit but it does not activate the menu): def keybinder_callback(self, keystr, user_data): print("Handling", keystr, user_data) print("Event time:", Keybinder.get_current_event_time()) self.menu.popup(None,None,None,None,1, Keybinder.get_current_event_time()) How can I trigger the menu activation (like a mouse click does) ? ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Weather API
Hi, Thanks all. I'm new in gtk+ so it's dificult to understand how to use this library without documentation or examples..Anyone could help me? Again, thanks everyone. Às 11:08 de 23/02/2017, infirit escreveu: > Op 02/22/2017 om 07:44 PM schreef Norbert de Jonge: >>> gnome-weather [...] I can i use this libraries with C? >> I think, in theory, the GWeather Reference Manual... >> https://developer.gnome.org/libgweather/stable/ >> ...should have information about its C functions in the Functions >> sections. But they are empty, e.g.: >> https://developer.gnome.org/libgweather/stable/GWeatherLocationEntry.html >> Maybe someone needs to run GTK-Doc to create the manual? > Yeah gnome documentation sucks. > > A reasonable C example can be found in gnome-applets [1]. > > ~infirit > > [1] https://git.gnome.org/browse/gnome-applets/tree/gweather --- Este e-mail foi verificado em termos de vírus pelo software antivírus Avast. https://www.avast.com/antivirus ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Weather API
On 23 February 2017 at 11:08, infirit wrote: > Op 02/22/2017 om 07:44 PM schreef Norbert de Jonge: >>> gnome-weather [...] I can i use this libraries with C? >> I think, in theory, the GWeather Reference Manual... >> https://developer.gnome.org/libgweather/stable/ >> ...should have information about its C functions in the Functions >> sections. But they are empty, e.g.: >> https://developer.gnome.org/libgweather/stable/GWeatherLocationEntry.html >> Maybe someone needs to run GTK-Doc to create the manual? > > Yeah gnome documentation sucks. You may want to avoid insulting people that work really hard at writing the documentation. You may also want to contribute to the GWeather API reference, since "it sucks". Ciao, Emmanuele. -- https://www.bassi.io [@] ebassi [@gmail.com] ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Weather API
Op 02/22/2017 om 07:44 PM schreef Norbert de Jonge: >> gnome-weather [...] I can i use this libraries with C? > I think, in theory, the GWeather Reference Manual... > https://developer.gnome.org/libgweather/stable/ > ...should have information about its C functions in the Functions > sections. But they are empty, e.g.: > https://developer.gnome.org/libgweather/stable/GWeatherLocationEntry.html > Maybe someone needs to run GTK-Doc to create the manual? Yeah gnome documentation sucks. A reasonable C example can be found in gnome-applets [1]. ~infirit [1] https://git.gnome.org/browse/gnome-applets/tree/gweather ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list