Re: [Builder] Adding Handlers from the GUI Builder
- From: Christian Hergert <christian hergert me>
- To: builder-list gnome org
- Subject: Re: [Builder] Adding Handlers from the GUI Builder
- Date: Tue, 18 Jun 2019 16:41:05 -0700
On 06/18/2019 03:23 PM, David Strauss wrote:
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.
Possibly two things:
* You didn't tab out of the cell after adding the text (you should know
by if it added a new empty row below). It's just how the glade editor
works, even though it's a bit annoying.
* The .ui file didn't get saved. This one is pretty annoying and has to
do with some cases where our key-press are hijacked and we can't
activate the Save action. If that happened, just click somewhere on
the UI design and hit Ctrl+s to save.
-- Christian
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]