Re: gtk_text_buffer_delete ?
> - Original Message - >> From: "Stefan Salewski" >> Sent: Wednesday, October 7, 2015 7:36:05 PM > >> On Wed, 2015-10-07 at 13:14 +0200, Pierre Wieser wrote: >>> I so connected to the 'changed' signal of the GtkTextBuffer, >> >> Maybe try connecting to insert-text signal -- changed signal may be >> emitted again when you delete. See >> >> http://stackoverflow.com/questions/2791035/how-do-i-set-buffer-limit-for >> -gtk-text-view-in-c > > Humm.. I've seen this thread too, but didn't understand the proposed behavior. Oop's. Sorry ! I've clicked on the bad button !! Please, do not consider this mail, as I have to worked a bit more on it.. Thanks Pierre ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: gtk_text_buffer_delete ?
On Thu, 2015-10-08 at 10:30 +0200, Pierre Wieser wrote: > Oop's. Sorry ! I've clicked on the bad button !! Yes, it is sad that this trivial task is so hard, and that no one can really help. I was hoping that it could be possible to simple block input when buffer has a maximum length, but I got that not working. But deleting works at least. https://developer.gnome.org/gtk3/stable/GtkTextBuffer.html#GtkTextBuffer -insert-text >Note that if your handler runs before the default handler it must not >invalidate the location iter (or has to revalidate it). So our callback have to reset the iter! I did some test in Nim, a change to test my bindings and become some more comfortable with that language. There we have discard g_signal_connect_after(buffer, "insert-text", g_callback(clip), nil) proc clip*(buffer: TextBuffer, iter: TextIter; text: cstring; len: gint; data: gpointer) {.cdecl.} = const max = 8 var i, j: TextIterObj var cc = buffer.char_count if cc > max: buffer.get_iter_at_offset(i, cc) j = i # copy iter object discard j.backward_chars(cc - max) buffer.delete(j, i) buffer.get_iter_at_offset(iter[], max) # set iter to valid value again, value seems to be arbitray So the trick is just the last line, reset the iter callback parameter to a valid value after deletion. It is strange, I have the feeling that the callback is executed after the new text was already inserted, but in spite of that gtk complains about invalid iter. Strange. I guess you can understand the idea of that Nim code. I connected to "insert-text" signal, so no danger of recursion. I used g_signal_connect_after here, seems to make more sense when we delete last char. g_signal_connect works similar, but we seem to get one char more? Maybe Emmanuele Bassi can comment on this later... ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
TypeError in GtkWindow
Hello guys, This is my first time posting in this list. My name is Germán, I'm from Argentina (currently living in Brazil) and I'm Astronomer. I use Fedora 22 with Gnome. I did some work with Python and Gtk+ before, but had to learn mostly everything again. I'm programming an interface to retrieve data from an online astronomical catalog, and I'm programming the main window. I have created a HeaderBar, put a Button and associated a PopOver to that button. The popover contains others buttons, something like this (see TitleBar class, https://gist.github.com/gracca/41a9cf28fa942d924e84#file-q2mass-py). The other file contains the GtkDialog that will open when clicking the button in the popover (see here, https://gist.github.com/gracca/41a9cf28fa942d924e84#file-opts-py). The problem is that I got the following error when I click that button: In [1] run q2MASS.py --- TypeError Traceback (most recent call last) /home/german/Documents/Python/myprogs/q2MASS/q2MASS.py in on_button_coor_clicked(self, widget) 132 """Close popover and show Coordinates options""" 133 self.popover_opts.hide() --> 134 coor = Coor2MASS(self) 135 resp = coor.run() 136 if resp == Gtk.ResponseType.OK: /home/german/Documents/Python/myprogs/q2MASS/opts.py in __init__(self, parent) 22 Gtk.Dialog.__init__(self, "Select columns to retrieve:", parent, 0, 23 (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, ---> 24 Gtk.STOCK_OK, Gtk.ResponseType.OK)) 25 self.set_modal(True) 26 #self.set_decorated(False) /usr/lib64/python2.7/site-packages/gi/overrides/Gtk.pyc in __init__(self, *args, **kwargs) 535 new_kwargs['destroy_with_parent'] = True 536 --> 537 self._init(*args, **new_kwargs) 538 539 if add_buttons: /usr/lib64/python2.7/site-packages/gi/overrides/__init__.pyc in new_init(self, *args, **kwargs) 311 new_kwargs.pop(key) 312 --> 313 return super_init_func(self, **new_kwargs) 314 315 return new_init /usr/lib64/python2.7/site-packages/gi/overrides/__init__.pyc in new_init(self, *args, **kwargs) 311 new_kwargs.pop(key) 312 --> 313 return super_init_func(self, **new_kwargs) 314 315 return new_init TypeError: could not convert value for property `transient_for' from instance to GtkWindow Any help is appreciated, thanks!! Germán. -- Germán A. Racca Fedora Package Maintainer https://fedoraproject.org/wiki/User:Skytux ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Vala API causing double definition ?
Hi, consider the following Vala API file: namespace CAjami { [CCode (cprefix = "io_", cheader_filename = "io.h")] namespace IO { [CCode (cname = "io_init")] public void init(); [CCode (cname = "io_cleanup")] public void cleanup(); } } there's something wrong with that ?, every time I use CAjami.IO.cleanup(); inside a member the class get duplicated definition, if i just comment out the line with cleanup(); function it compiles normal. the vala code: public override void shutdown() { base.shutdown(); CAjami.IO.cleanup(); } and the error: build/src/ajamiapp.c:66:8: error: redefinition of '_AjamiAjami' struct _AjamiAjami { build/src/ajamiobjects.h:111:8: note: previous definition is here struct _AjamiAjami { build/src/ajamiapp.c:71:8: error: redefinition of '_AjamiAjamiClass' struct _AjamiAjamiClass { build/src/ajamiobjects.h:116:8: note: previous definition is here struct _AjamiAjamiClass { if I just comment out the call the function in the shutdown() signal is build normal. Thanks. -- Victor Aurélio Santos ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
close button
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Hi all: I want to fix the problem in GTK, that doesn't show the "close" button when it is put at the left side and the left panel is visible. But to do so in a consisten way I need a way of painting a standard "close" button, the one used in gtk_header_bar when "layout" specifies "close", with the appearance of a true "close" button. Is it possible to do it with a classic GTK button? Thanks. - -- Nos leemos RASTER(Linux user #228804) ras...@rastersoft.com http://www.rastersoft.com -BEGIN PGP SIGNATURE- Version: GnuPG v2 iQIcBAEBCgAGBQJWFtfmAAoJED690wQnnlF128IP/0yvOwsn8ftgyyzezdr8iQgq kj6peG42KKtyFX0FnV8DBfYk5mp133oKCEZtocQjUyeTdHqBsbdsT7FwlbeBe+Nn RqBgd9CIpONjX4vXchxUgterlHS7O+VL8KiKBkm8X8TYdrdoHPNBSa8P9y0GpaHX 7cAg32iOfAPpXj3f0N1C12XmgsHfxJDLDTuYtu8xnIhDWT0t1LjQZ4r4plYCZQn7 4LSkloZ7Cuz2d5qgPP7VNe+8D1tebJU9gFPAMefBcAbcQMO4rG70daeMaKTHM7dw N/bD93uUrLhGQd3etwzMhP4c3ayCtOEI8WnK2KorEKXd1MZF/p5/LMQd3/MWKcLq /ZVTuNiZHg4x33w65+40yglGJ1KMoOAcP4V3h35RHdEo7RM+zbzcpAXaEewojs6r qCQpg0C8SS3lNiR8etJl8E7whGendSxr4gHpDHrhvNGzAroxsqh6yUpOZhEaJXrb QlhQCWxge7v7ihlb2JcQiTdYn8DaZE3wRlxjKOSSD2EmnejjPBO62iBQymn2s61R JgDIfUtAFd7FoMseUpVx1I8LrpEgN3YWkXjRQfQwFkLp6hRpb1xiJkNg1RLiEiuL 8rBhu74Yud4+zOaJ3j6VJdrQs41nr3EwjskN+HtOYOnvSAsqxFmbBgVwvLvNBc0b 0OlmobL7Z3hDYG4MpDlc =kic/ -END PGP SIGNATURE- ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: TypeError in GtkWindow
On Thu, 2015-10-08 at 17:09 -0300, Germán Racca wrote: > --> 134 coor = Coor2MASS(self) I do not use Python, but that line seems to make no sense. Self is class TitleBar: but later you call resp = coor.run(). So I guess for coor you want something like a dialog, so you have to create it. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: close button
On Thu, Oct 08, 2015 at 10:54:01PM +0200, rastersoft wrote: > Hi all: > > I want to fix the problem in GTK, that doesn't show the "close" button > when it is put at the left side and the left panel is visible. I'm affraid it's not clear what you mean here. What doesn't show what button? > But to do so in a consisten way I need a way of painting a standard > "close" button, the one used in gtk_header_bar when "layout" specifies > "close", with the appearance of a true "close" button. Is it possible > to do it with a classic GTK button? If what you want to do is create a button with a "close" symbol then you can set its icon to either the "window-close" or "window-close-symbolic" icon. Marcus ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Vala API causing double definition ?
Hi; You likely want to send this email to vala-list, since it has nothing to do with GTK. Ciao, Emmanuele. On Thursday, October 8, 2015, Victor Aurélio Santos < victoraur.san...@gmail.com> wrote: > Hi, consider the following Vala API file: > > namespace CAjami { > [CCode (cprefix = "io_", cheader_filename = "io.h")] > namespace IO { > [CCode (cname = "io_init")] > public void init(); > [CCode (cname = "io_cleanup")] > public void cleanup(); > } > } > > there's something wrong with that ?, every time I use > CAjami.IO.cleanup(); inside a member the class get duplicated > definition, if i just comment out the line with cleanup(); function it > compiles normal. > > the vala code: > public override void shutdown() { > base.shutdown(); > > CAjami.IO.cleanup(); > } > > and the error: > > build/src/ajamiapp.c:66:8: error: redefinition of '_AjamiAjami' > struct _AjamiAjami { > build/src/ajamiobjects.h:111:8: note: previous definition is here > struct _AjamiAjami { > build/src/ajamiapp.c:71:8: error: redefinition of '_AjamiAjamiClass' > struct _AjamiAjamiClass { > build/src/ajamiobjects.h:116:8: note: previous definition is here > struct _AjamiAjamiClass { > > if I just comment out the call the function in the shutdown() signal > is build normal. > > Thanks. > > -- > Victor Aurélio Santos > ___ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- 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: Filechooserbuttons and gtk_widget_set_sensitive
On Thu, 2015-10-08 at 14:04 +1030, Roger Matthews wrote: > To someone willing to help, Of course the file chooser example from the book of Andrew Krause does not really open a file. What should it open? A Video, a picture, a text? It shows you how you can get a file path, if I remember correctly. For a text file, you may use that path and load the text in a textview. Maybe that is shown in the book also. gtk_widget_set_sensitive() should work. And the example what you refer to, it may be this: https://developer.gnome.org/gtk3/stable/ch01s04.html#id-1.2.3.12.5 Yes that is GTK3 application style using builder and XML files. I have just made a Nim version from that. Does work fine, but I do not understand all currently. Converting that into a version without builder should be some hard work. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: TypeError in GtkWindow
On 10/08/2015 06:45 PM, Stefan Salewski wrote: On Thu, 2015-10-08 at 17:09 -0300, Germán Racca wrote: --> 134 coor = Coor2MASS(self) I do not use Python, but that line seems to make no sense. Self is class TitleBar: but later you call resp = coor.run(). So I guess for coor you want something like a dialog, so you have to create it. Thanks for your comment Stefan. I removed "self", and I get this: Traceback (most recent call last): File "./q2MASS.py", line 134, in on_button_coor_clicked coor = Coor2MASS() TypeError: __init__() takes exactly 2 arguments (1 given) About "coor.run()", I have followed the exact steps in the official PyGObject tutorial: https://python-gtk-3-tutorial.readthedocs.org/en/latest/dialogs.html#custom-dialogs Regards, Germán. -- Germán A. Racca Fedora Package Maintainer https://fedoraproject.org/wiki/User:Skytux ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: close button
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Hi: Thanks! El 08/10/15 a las 23:46, Marcus Karlsson escribió: > On Thu, Oct 08, 2015 at 10:54:01PM +0200, rastersoft wrote: >> Hi all: >> >> I want to fix the problem in GTK, that doesn't show the "close" button >> when it is put at the left side and the left panel is visible. > > I'm affraid it's not clear what you mean here. What doesn't show what > button? > >> But to do so in a consisten way I need a way of painting a standard >> "close" button, the one used in gtk_header_bar when "layout" specifies >> "close", with the appearance of a true "close" button. Is it possible >> to do it with a classic GTK button? > > If what you want to do is create a button with a "close" symbol then you > can set its icon to either the "window-close" or "window-close-symbolic" > icon. > > Marcus - -- Nos leemos RASTER(Linux user #228804) ras...@rastersoft.com http://www.rastersoft.com -BEGIN PGP SIGNATURE- Version: GnuPG v2 iQIcBAEBCgAGBQJWF1bQAAoJED690wQnnlF1nlsQAIVMDqNhJT72KKOUEiKy9p3C nB4OKyjwUrBLd0Kqq6it8rrJKAJXfH38dAB7NsCpDGmPrZGiQiaSM9Y1tvJPlmFN 5qNGWljTIev4OSgYJgvmIx+pOWEEhkvkE6oAm7mVAPugkU8JJEuxCv9gh8l5NnRf OLRVAw8ENoedZYtvyg4A5tvgHjcIe61YCUlE2D32Uf4YQSBqeoVexIjH757zcknu +3EJzIiPi8zt5sZVl2s9/fGSQaxBGFRo3QLrzyMjtR67xBp//BCA0HMxjVKCcU8l LTQ/vjlCo4Rfi17BRlfXLILRfy8/GS8W1nqEgqKcaf7pSMxEw5qhyjPfcicbUfUT OPhHd65W9MnY6ixot9CmrYlHzBfTUCe+ieQxupOphwA2AJ8dn6X8+pBki4sHQeCM B43ekOqaGQkj/yJ+wf55QgIpceBbtspBaWgVZmi1kBfShy++AUIBjk413OjK1raE SIfaqS1kSzNhgyPpoRrNmZ0nMYP9yIB76d0jLsP+5eU6A7qto9vZoZRFwnAUoy0/ WEqMmQvWwoqomajR9oYuaSJPC9cL+RfXkmx4gfL9GOZGoKqZzTB+QH1PFoZYsgxT lRBgS/xmsPKThI+UqgQnrS0rWCp2CBQ/4nO2Nz+p5FfIsCJfMkfHnu97hlnAljeT 4Wmv+ZXNtlhpm3i0PRWr =ZNzS -END PGP SIGNATURE- ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: gtk_text_buffer_delete ?
On Thu, 08 Oct 2015 20:59:21 +0200 Stefan Salewski wrote: > I was hoping that it could be possible to simple block input when buffer > has a maximum length, but I got that not working. Note that this can give an unpleasant user experience. It might be more helpful just to have a count of characters available that becomes negative and changes from grey to red (change both lightness and colour, for people who can't differentiate black from red) - you see this approach on Web sites quite often. Then people can paste a longer text and delete it, or can add a new word and then delete a longer one. Best, Liam -- Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/ Pictures from old books: http://fromoldbooks.org/ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list