@@ -297,16 +297,38 @@ class interface :
297297 self.__widgets["ups_authentication_password"].set_property("can-focus", True)
298298 self.__widgets["ups_connect"].set_property("can-focus", True)
299299
300+ # Set explicit focus chains on containers to ensure TAB/SHIFT-TAB works through all fields
301+ # table1 contains Host, Port, Device, Refresh
302+ self.__widgets["interface"].get_widget("table1").set_focus_chain([
303+ self.__widgets["ups_host_entry"],
304+ self.__widgets["ups_port_entry"],
305+ self.__widgets["ups_list_combo"],
306+ self.__widgets["ups_refresh_button"]
307+ ])
308+ # hbox1 contains Login, Password
309+ self.__widgets["interface"].get_widget("hbox1").set_focus_chain([
310+ self.__widgets["ups_authentication_login"],
311+ self.__widgets["ups_authentication_password"]
312+ ])
313+ # vbox6 contains table1, checkbutton1, hbox1
314+ self.__widgets["interface"].get_widget("vbox6").set_focus_chain([
315+ self.__widgets["interface"].get_widget("table1"),
316+ self.__widgets["ups_authentication_check"],
317+ self.__widgets["interface"].get_widget("hbox1")
318+ ])
319+ # hbox2 contains Connect, Disconnect
320+ self.__widgets["interface"].get_widget("hbox2").set_focus_chain([
321+ self.__widgets["ups_connect"],
322+ self.__widgets["ups_disconnect"]
323+ ])
324+ # vbox5 contains vbox6, hbox2
325+ self.__widgets["interface"].get_widget("vbox5").set_focus_chain([
326+ self.__widgets["interface"].get_widget("vbox6"),
327+ self.__widgets["interface"].get_widget("hbox2")
328+ ])
329+
300330 # Set initial focus to host field
301331 self.__widgets["ups_host_entry"].grab_focus()
302-
303- # Chaining focus via move-focus signal or just letting GTK handle it
304- # since we've ensured they can all focus.
305- # To be more explicit, we could set the focus chain on their common parents.
306- # But without knowing the exact hierarchy (which box contains which),
307- # it's safer to just set the 'tab-next' if we could, but GTK2 doesn't have it.
308- # However, we can use the 'key-press-event' to override TAB if needed.
309- # For now, ensuring can-focus is a good first step.
310332 except:
311333 pass
312334
0 commit comments