Skip to content

Commit 95edcf4

Browse files
committed
scripts/python/app/NUT-Monitor-py2gtk2.in: fix ups_port_entry handler to not block TAB through the field [#3514]
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
1 parent c7f1af6 commit 95edcf4

1 file changed

Lines changed: 3 additions & 47 deletions

File tree

scripts/python/app/NUT-Monitor-py2gtk2.in

Lines changed: 3 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ class interface :
212212
"on_entry3_changed" : self.__on_password_changed,
213213
"on_checkbutton1_toggled" : self.__on_auth_check_changed,
214214
"on_spinbutton1_value_changed" : self.__check_gui_fields,
215+
"on_spinbutton1_changed" : self.__check_gui_fields,
215216
"on_button1_clicked" : self.__update_ups_list,
216217
"on_button2_clicked" : self.connect_to_ups,
217218
"on_button7_clicked" : self.disconnect_from_ups,
@@ -284,53 +285,8 @@ class interface :
284285
self.__widgets["ups_commands_combo_store"] = list_store
285286
#---------------------------------------------------------------
286287

287-
# Set initial focus chain
288-
# Note: In GTK2, focus chain is set on containers.
289-
# We try to set the focus chain for the main parameters box and its parents.
290-
try:
291-
self.__widgets["ups_host_entry"].set_property("can-focus", True)
292-
self.__widgets["ups_port_entry"].set_property("can-focus", True)
293-
self.__widgets["ups_list_combo"].set_property("can-focus", True)
294-
self.__widgets["ups_refresh_button"].set_property("can-focus", True)
295-
self.__widgets["ups_authentication_check"].set_property("can-focus", True)
296-
self.__widgets["ups_authentication_login"].set_property("can-focus", True)
297-
self.__widgets["ups_authentication_password"].set_property("can-focus", True)
298-
self.__widgets["ups_connect"].set_property("can-focus", True)
299-
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-
330-
# Set initial focus to host field
331-
self.__widgets["ups_host_entry"].grab_focus()
332-
except:
333-
pass
288+
# Set initial focus to host field
289+
self.__widgets["ups_host_entry"].grab_focus()
334290

335291
if ( cmd_opts.hidden != True ) :
336292
self.__widgets["main_window"].show()

0 commit comments

Comments
 (0)