Skip to content

Commit ca014e1

Browse files
committed
scripts/python/app/NUT-Monitor-py2gtk2.in: __check_gui_fields(): get port value more reliably [#3514]
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
1 parent 447cd5e commit ca014e1

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,13 @@ class interface :
400400
def __check_gui_fields( self, widget=None ) :
401401
host = self.__widgets["ups_host_entry"].get_text()
402402
try:
403-
port = int( self.__widgets["ups_port_entry"].get_value() )
403+
# Note: get_value() might not reflect currently typed text until focused out or Enter pressed.
404+
# get_text() + conversion is safer for real-time typing response.
405+
port_text = self.__widgets["ups_port_entry"].get_text()
406+
if not port_text:
407+
port = 3493
408+
else:
409+
port = int(float(port_text))
404410
except:
405411
port = 3493
406412

0 commit comments

Comments
 (0)