[chirp_devel] [PATCH] GTK+ 2.0 can't grab button focus, handle gracefully

Tom Hayward
Sat Nov 2 08:03:53 PDT 2013


# HG changeset patch
# User Tom Hayward <tom at tomh.us>
# Date 1383404558 25200
# Node ID 57ec665333eb8c0757fbbfb6a37f7d1a40c727e4
# Parent  b989118832cb7d4a7586f026f9f205313234ea69
GTK+ 2.0 can't grab button focus, handle gracefully.

diff -r b989118832cb -r 57ec665333eb chirpui/mainapp.py
--- a/chirpui/mainapp.py	Thu Oct 10 17:17:20 2013 -0700
+++ b/chirpui/mainapp.py	Sat Nov 02 08:02:38 2013 -0700
@@ -591,10 +591,14 @@
         again = gtk.CheckButton(_("Don't show instructions for any radio again"))
         again.show()
         d.vbox.pack_start(again, 0, 0, 0)
-        h_button_box=d.vbox.get_children()[2]
-        ok_button=h_button_box.get_children()[0]
-        ok_button.grab_default()
-        ok_button.grab_focus()
+        h_button_box = d.vbox.get_children()[2]
+        try:
+            ok_button = h_button_box.get_children()[0]
+            ok_button.grab_default()
+            ok_button.grab_focus()
+        except AttributeError:
+            # don't grab focus on GTK+ 2.0
+            pass
         d.run()
         d.destroy()
         CONF.set_bool("clone_instructions", again.get_active(), "noconfirm")



More information about the chirp_devel mailing list