StoryText ignores GtkBuilder names

Bug #1022459 reported by Thomas Leonard
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
StoryText
Fix Committed
Undecided
Unassigned

Bug Description

My application has a dialog box, created using GtkBuilder, with two combo boxes. StoryText gave them both the same id.

The attached patch fixes it for me (I'm new to StoryText, so it might be wrong).

Thanks,

Revision history for this message
Thomas Leonard (talex5) wrote :
Revision history for this message
Geoff Bache (geoff.bache) wrote :

Thanks for the patch. I must admit I'm not too familiar with GtkBuilder and I'm a bit concerned that the patch as is might prefer an autogenerated "ID" from GtkBuilder over a name that had been explicitly set in the application code. But I might be on the wrong trail entirely here...

It would help to know what names you're getting out of GtkBuilder here. Did you create them yourself in the xml file or did GtkBuilder generate them somehow? Also PyGtk, Gtk+ versions would be useful.

From a brief google, I think the fix for this bug is the trigger here

https://bugzilla.gnome.org/show_bug.cgi?id=591085

which has also caused a mild panic in a few other applications e.g. see here

https://bugs.launchpad.net/ubuntu/+source/pygtk/+bug/507739

Revision history for this message
Thomas Leonard (talex5) wrote :

You're probably right. My application doesn't set any names explicitly, so everything gets named as "Button", etc. Since GtkBuilder names are unique, they might be a better choice anyway, though.

I created the .ui file using glade. Glade gives every widget a default name automatically, but you'll typically set a name explicitly for anything you want to connect up to a signal (otherwise your code will end up full of meaningless "button12" IDs and similar).

If you'd like to test using the exact files I've got:

$ git clone git://repo.or.cz/zeroinstall.git
$ storytext zeroinstall/zeroinstall/0launch-gui/0launch-gui

StoryText also doesn't detect activations of the dialog buttons, probably because it doesn't get a chance to wrap them with the storytext Dialog helper.

Versions (Debian):

gtk2.0-0 : 2.24.10-1
python-gtk2 : 2.24.0-3

Note: current versions of Glade won't edit the .ui file (they're now GTK 3 only), so I use an older version. If you're on x86_64, you can get version 3.8 and run it on the .ui file like this:

$ ./zeroinstall/0launch --before=3.9 http://repo.roscidus.com/devel/glade zeroinstall/zeroinstall/0launch-gui/zero-install.ui

Thanks,

Revision history for this message
Geoff Bache (geoff.bache) wrote :

Thanks for the UI. When I run it the "Close" button doesn't even work from StoryText, which is a strange one, I'll look into that.
I presume that's what you mean by "not detecting activations of the dialog buttons"?

The annoying thing with the GtkBuilder names is that it isn't obvious how to tell if they've been autogenerated or not. With ordinary Gtk names they all start with "Gtk" if they're autogenerated so StoryText ignores them. The problem with using autogenerated names is that they usually aren't stable across GUI changes, for example you add a new button near the start and every single number changes, very annoying if your UI map file is full of them. I suppose one solution would be to use the GtkBuilder name if it doesn't end in a digit :)
What do you reckon?

Revision history for this message
Geoff Bache (geoff.bache) wrote :

The "Close" button problem is indeed because it doesn't get a chance to wrap them with the storytext Dialog helper as you suspected.

I hope this will be easy to fix by hooking into gtk.Builder.get_object though. Any chance you could make a super-simple UI using gtk.Builder for me, with perhaps a couple of buttons, one explicitly named and one autogenerated, and a Close button that calls destroy in the way you currently do? I can then add it to my testsuite and hopefully nail these issues.

Revision history for this message
Thomas Leonard (talex5) wrote :

Here's a simple two-button dialog, as requested.

Note: the builder IDs should be stable even if you add more buttons or move them around...

Revision history for this message
Geoff Bache (geoff.bache) wrote :

Many thanks. Will try to push out a fix in the next few days (run out of time for tonight)

Good to know about the builder IDs, though there is also a readibility aspect to consider. "Label=OK" many not be unique, but it's easier to read and maintain than "Name=button1" in this example.

Revision history for this message
Geoff Bache (geoff.bache) wrote :

Pushed a fix for both issues to trunk now. For the moment, I'm ignoring gtk.Builder names which end in a digit. Added your toy example slightly modified to the test suite, and it also seems to work on your zeroinstall GUI as well from my testing.

Changed in storytext:
status: New → Fix Committed
Revision history for this message
Thomas Leonard (talex5) wrote :

It seems to work for 0install now, but I can no longer use the texttest GUI to record a test case, because those dialog buttons no longer work...

Revision history for this message
Geoff Bache (geoff.bache) wrote :

Oops, insufficient testing of TextTest / StoryText integration...

Anyway, I've committed a fix for that too now.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.