The GTK handling of drag 'n' drop looks a little bit convoluted at first, but can be quite handy once you get the hang of it. Unfortunately, there is a bug in PyGObject versions below 3.0.3 that makes things a little bit harder than they should.
Long story short, when using PyGObject in Ubuntu 11.10 Oneiric Ocelot, you can't pass detailed parameters to widget.drag_dest_set and expect GTK to take care of everything. You need to handle the drag-motion, drag-leave, and drag-drop signals yourself.
Showing posts with label oneiric. Show all posts
Showing posts with label oneiric. Show all posts
Sunday, January 8, 2012
Heads Up: Missing Pango text scale constants in PyGObject 3.0 (Ubuntu 11.10)
If you are using PyGI in Ubuntu 11.10 Oneiric Ocelot and desperately trying to find the introspected versions of the Pango text scale constants, don't bother. I have confirmed on the development IRC channel that those constants are not introspected yet.
Since those are all #defines, I suggest simply using the values directly until this is fixed upstream. It's not like those will change any time soon...
Since those are all #defines, I suggest simply using the values directly until this is fixed upstream. It's not like those will change any time soon...
Heads Up: Sensitivity bug in GTK 3.2 (Ubuntu 11.10)
The GTK 3.2 package in Ubuntu 11.10 Oneiric Ocelot has a small bug that I confirmed on the GTK IRC channel: if you set the "sensitive" property of a widget to true, the widget will become sensitive even when its parent is not. So weird things like this can happen.
In the image above, the password entry has the "sensitive" property set to true because the SOCKS5 protocol allows passwords. However, "send credentials to proxy server" is not checked, so the entire GtkHBox that contains both the username and password entries is not sensitive. Notice how the password entry is sensitive anyway.
A workaround for this bug is "reminding" GTK that the parent is insensitive when the child becomes sensitive. So instead of just
password_entry.set_sensitive(True)
you have something like
password_entry.set_sensitive(True)
if not authentication_box.get_sensitive():
authentication_box.set_sensitive(True)
authentication_box.set_sensitive(False)
and when the upstream bug is fixed you can simply remove the extra lines.
In the image above, the password entry has the "sensitive" property set to true because the SOCKS5 protocol allows passwords. However, "send credentials to proxy server" is not checked, so the entire GtkHBox that contains both the username and password entries is not sensitive. Notice how the password entry is sensitive anyway.
A workaround for this bug is "reminding" GTK that the parent is insensitive when the child becomes sensitive. So instead of just
password_entry.set_sensitive(True)
you have something like
password_entry.set_sensitive(True)
if not authentication_box.get_sensitive():
authentication_box.set_sensitive(True)
authentication_box.set_sensitive(False)
and when the upstream bug is fixed you can simply remove the extra lines.
Subscribe to:
Posts (Atom)
