[Builder] Adding Handlers from the GUI Builder



I'm having trouble adding handlers to components I'm graphically editing, and I'm not sure if I'm running into a bug or just part of the Builder learning curve.

Let's say I have an ApplicationWindow with a GtkSwitch widget. While the GtkSwitch has focus in the GUI editor, at the bottom of the Builder window, I select the "Signals" tab. For "state-set", I configure a handler: "_on_set_state". Yet, I don't see the handler written to the XML for the window. Finally, I add a callback method to the corresponding Python class with theĀ @Gtk.Template.Callback() decorator.

If I run the app, I get "RuntimeError: Handler '_on_set_state' was declared with @Gtk.Template.Callback but was not present in template".

I feel like the XML should get the following added to <object class="GtkSwitch">:

<signal name="state-set" handler="_on_state_set" swapped="no"/>

I actually see nothing written to the project, and the signal is missing if I re-open the project in Builder.


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