Manage case when stats["snmp_info"]["Power Off Timer"] does not include digits
- Solves File "ui.py", line 2541, in detect_configuration IndexError: list index out of range
- Removes [INFO] Found data: {}.
- improve messages
ref #39
This commit is contained in:
16
ui.py
16
ui.py
@@ -2332,7 +2332,10 @@ Web site: https://github.com/Ircama/epson_print_conf
|
||||
f"[INFO] Models with same access keys: {rwk_kist}\n"
|
||||
)
|
||||
|
||||
if DETECTED in self.printer.PRINTER_CONFIG:
|
||||
if (
|
||||
DETECTED in self.printer.PRINTER_CONFIG
|
||||
and self.printer.PRINTER_CONFIG[DETECTED]
|
||||
):
|
||||
self.status_text.insert(
|
||||
tk.END,
|
||||
f'[INFO] Found data: '
|
||||
@@ -2371,7 +2374,8 @@ Web site: https://github.com/Ircama/epson_print_conf
|
||||
)
|
||||
if response:
|
||||
self.status_text.insert(
|
||||
tk.END, f"[INFO] Starting the operation, please wait...\n"
|
||||
tk.END,
|
||||
f"[INFO] Starting the access key detection, please wait for many minutes...\n"
|
||||
)
|
||||
self.config(cursor="watch")
|
||||
self.update()
|
||||
@@ -2469,7 +2473,7 @@ Web site: https://github.com/Ircama/epson_print_conf
|
||||
return False
|
||||
self.status_text.insert(
|
||||
tk.END,
|
||||
f"[INFO] Reading EEPROM values, please wait...\n"
|
||||
f"[INFO] Reading EEPROM values, please wait for some minutes...\n"
|
||||
)
|
||||
self.update()
|
||||
try:
|
||||
@@ -2538,7 +2542,9 @@ Web site: https://github.com/Ircama/epson_print_conf
|
||||
c += 1
|
||||
|
||||
if "Power Off Timer" in stats["snmp_info"] and stats["snmp_info"]["Power Off Timer"]:
|
||||
po_mins = int(re.findall(r'\d+', stats["snmp_info"]["Power Off Timer"])[0])
|
||||
matches = re.findall(r'\d+', stats["snmp_info"]["Power Off Timer"])
|
||||
if matches:
|
||||
po_mins = int(matches[0])
|
||||
msb = po_mins // 256
|
||||
lsb = po_mins % 256
|
||||
result = detect_sequence(eeprom, (lsb, msb))
|
||||
@@ -2548,6 +2554,8 @@ Web site: https://github.com/Ircama/epson_print_conf
|
||||
c += 1
|
||||
else:
|
||||
conf_data["po_time"] = None
|
||||
else:
|
||||
conf_data["po_time"] = None
|
||||
|
||||
result = detect_sequence(eeprom, [94])
|
||||
c = 0
|
||||
|
||||
Reference in New Issue
Block a user