Re: 'color-activated' signal not emitting
Hi, Thanks for your responses. On Mon, Jul 25, 2016 at 6:15 AM, Emmanuele Bassiwrote: > Hi; > > On 23 July 2016 at 21:25, Craig Cabrey wrote: > > According to the docs [0], the "color-activated" signal is emitted upon > > the user making any changes to the current color. > > Not really. The documentation says: > > """ > Emitted when a color is activated from the color chooser. This usually > happens > when the user clicks a color swatch, or a color is selected and the user > presses > one of the keys Space, Shift+Space, Return or Enter. > """ > > i.e. you need to activate the color, just like you'd activate a widget > or a menu item. > That seems confusing to me. The way its written (or rather, the way I'm reading it) implies the signal will be emitted on any color change ("activated"). However, using the "notify" signal seems to work as well, although the signal is emitted a few times on startup that I'll have to ignore. > > > I'm having trouble with this signal in two scenarios: > > > > 1) When a GtkColorChooserWidget is inside of a GtkPopover [1, 2] > > 2) When a GtkColorChooserWidget is inside of a GtkWindow [3, 4] > > > > I am not sure if I'm using GtkBuilder, signals, or pygobject > > incorrectly. The signal is being picked up correctly, because > > when I comment it out, GtkBuilder complains. However, even > > when I change a color, nothing is fired (and yes, I put a quick > > print statement in as a sanity check). > > Can you create a small, self-contained test case that reproduces the > behaviour you experience, so that we don't have to clone, build, and > run a whole application? > I through together a standalone Python3 script really quick, hopefully this works for you. https://gist.github.com/craigcabrey/367eb0b411c0ffb3c4851f6dcd921837 > Ciao, > Emmanuele. > > -- > https://www.bassi.io > [@] ebassi [@gmail.com] > ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list
Re: 'color-activated' signal not emitting
That makes much more sense and now it's working as I expect it. Thank you! On Mon, Jul 25, 2016 at 9:02 AM, Emmanuele Bassiwrote: > Hi; > > On 25 July 2016 at 13:47, Craig Cabrey wrote: > > >> Not really. The documentation says: > >> > >> """ > >> Emitted when a color is activated from the color chooser. This usually > >> happens > >> when the user clicks a color swatch, or a color is selected and the user > >> presses > >> one of the keys Space, Shift+Space, Return or Enter. > >> """ > >> > >> i.e. you need to activate the color, just like you'd activate a widget > >> or a menu item. > > > > > > That seems confusing to me. The way its written (or rather, the way I'm > > reading it) implies the signal will be emitted on any color change > > ("activated"). > > Nope. The term "activated" has a fairly specific meaning, in GTK+, and > it usually refers to the behaviour of widgets with regards to keyboard > interaction. See, for instance: > > > https://lazka.github.io/pgi-docs/#Gtk-3.0/classes/Widget.html#Gtk.Widget.activate > > In your case, you're using the color editor, which does not have > "activatable" parts. > > > However, using the "notify" signal seems to work as well, > > although the signal is emitted a few times on startup that I'll have to > > ignore. > > The `notify` signal is emitted every time a property changes; if you > use `notify::rgba` signal you'll, thus, be notified every time the > `rgba` property changes to a different value. > > In general, GTK+ uses ::changed signals on classes where multiple > properties can change at the same time, or if what changes is not > mapped to a property at all; if there are readable properties, it's > much easier to get notification of changes straight from them. > > Ciao, > Emmanuele. > > -- > https://www.bassi.io > [@] ebassi [@gmail.com] > ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list
Re: 'color-activated' signal not emitting
Hi; On 25 July 2016 at 13:47, Craig Cabreywrote: >> Not really. The documentation says: >> >> """ >> Emitted when a color is activated from the color chooser. This usually >> happens >> when the user clicks a color swatch, or a color is selected and the user >> presses >> one of the keys Space, Shift+Space, Return or Enter. >> """ >> >> i.e. you need to activate the color, just like you'd activate a widget >> or a menu item. > > > That seems confusing to me. The way its written (or rather, the way I'm > reading it) implies the signal will be emitted on any color change > ("activated"). Nope. The term "activated" has a fairly specific meaning, in GTK+, and it usually refers to the behaviour of widgets with regards to keyboard interaction. See, for instance: https://lazka.github.io/pgi-docs/#Gtk-3.0/classes/Widget.html#Gtk.Widget.activate In your case, you're using the color editor, which does not have "activatable" parts. > However, using the "notify" signal seems to work as well, > although the signal is emitted a few times on startup that I'll have to > ignore. The `notify` signal is emitted every time a property changes; if you use `notify::rgba` signal you'll, thus, be notified every time the `rgba` property changes to a different value. In general, GTK+ uses ::changed signals on classes where multiple properties can change at the same time, or if what changes is not mapped to a property at all; if there are readable properties, it's much easier to get notification of changes straight from them. Ciao, Emmanuele. -- https://www.bassi.io [@] ebassi [@gmail.com] ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list
Re: 'color-activated' signal not emitting
On Mon, 2016-07-25 at 11:12 +0100, Emmanuele Bassi wrote: > I think you mean the `notify` signal. Yes, sorry. ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list
Re: 'color-activated' signal not emitting
Hi; On 23 July 2016 at 21:25, Craig Cabreywrote: > According to the docs [0], the "color-activated" signal is emitted upon > the user making any changes to the current color. Not really. The documentation says: """ Emitted when a color is activated from the color chooser. This usually happens when the user clicks a color swatch, or a color is selected and the user presses one of the keys Space, Shift+Space, Return or Enter. """ i.e. you need to activate the color, just like you'd activate a widget or a menu item. > I'm having trouble with this signal in two scenarios: > > 1) When a GtkColorChooserWidget is inside of a GtkPopover [1, 2] > 2) When a GtkColorChooserWidget is inside of a GtkWindow [3, 4] > > I am not sure if I'm using GtkBuilder, signals, or pygobject > incorrectly. The signal is being picked up correctly, because > when I comment it out, GtkBuilder complains. However, even > when I change a color, nothing is fired (and yes, I put a quick > print statement in as a sanity check). Can you create a small, self-contained test case that reproduces the behaviour you experience, so that we don't have to clone, build, and run a whole application? Ciao, Emmanuele. -- https://www.bassi.io [@] ebassi [@gmail.com] ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list
Re: 'color-activated' signal not emitting
Hi; On 25 July 2016 at 09:19, Stefan Salewskiwrote: > On Sat, 2016-07-23 at 16:25 -0400, Craig Cabrey wrote: >> According to the docs [0], the "color-activated" signal is emitted >> upon >> the user making any changes to the current color. > > No -- read again. ("changes" are not mentioned) > > For changes you may try the changed signal. The GtkColorChooser has the > rgba property, so signal name is "changed::rgba" . I think you mean the `notify` signal. Ciao, Emmanuele. -- https://www.bassi.io [@] ebassi [@gmail.com] ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list
Re: 'color-activated' signal not emitting
On 07/25/2016 10:19 AM, Stefan Salewski wrote: > On Sat, 2016-07-23 at 16:25 -0400, Craig Cabrey wrote: >> According to the docs [0], the "color-activated" signal is emitted >> upon >> the user making any changes to the current color. > > No -- read again. ("changes" are not mentioned) > > For changes you may try the changed signal. The GtkColorChooser has the > rgba property, so signal name is "changed::rgba" . > > I can not really help, not using Python. Try and report. > I’m not sure and haven’t tried, but IIRC you may have to press enter after choosing a color. ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list
Re: 'color-activated' signal not emitting
On Sat, 2016-07-23 at 16:25 -0400, Craig Cabrey wrote: > According to the docs [0], the "color-activated" signal is emitted > upon > the user making any changes to the current color. No -- read again. ("changes" are not mentioned) For changes you may try the changed signal. The GtkColorChooser has the rgba property, so signal name is "changed::rgba" . I can not really help, not using Python. Try and report. ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list