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:
30
ui.py
30
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"
|
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(
|
self.status_text.insert(
|
||||||
tk.END,
|
tk.END,
|
||||||
f'[INFO] Found data: '
|
f'[INFO] Found data: '
|
||||||
@@ -2371,7 +2374,8 @@ Web site: https://github.com/Ircama/epson_print_conf
|
|||||||
)
|
)
|
||||||
if response:
|
if response:
|
||||||
self.status_text.insert(
|
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.config(cursor="watch")
|
||||||
self.update()
|
self.update()
|
||||||
@@ -2469,7 +2473,7 @@ Web site: https://github.com/Ircama/epson_print_conf
|
|||||||
return False
|
return False
|
||||||
self.status_text.insert(
|
self.status_text.insert(
|
||||||
tk.END,
|
tk.END,
|
||||||
f"[INFO] Reading EEPROM values, please wait...\n"
|
f"[INFO] Reading EEPROM values, please wait for some minutes...\n"
|
||||||
)
|
)
|
||||||
self.update()
|
self.update()
|
||||||
try:
|
try:
|
||||||
@@ -2538,14 +2542,18 @@ Web site: https://github.com/Ircama/epson_print_conf
|
|||||||
c += 1
|
c += 1
|
||||||
|
|
||||||
if "Power Off Timer" in stats["snmp_info"] and stats["snmp_info"]["Power Off Timer"]:
|
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"])
|
||||||
msb = po_mins // 256
|
if matches:
|
||||||
lsb = po_mins % 256
|
po_mins = int(matches[0])
|
||||||
result = detect_sequence(eeprom, (lsb, msb))
|
msb = po_mins // 256
|
||||||
c = 0
|
lsb = po_mins % 256
|
||||||
for i in result:
|
result = detect_sequence(eeprom, (lsb, msb))
|
||||||
conf_data["po_time[%s]" % c] = [i + 1, i]
|
c = 0
|
||||||
c += 1
|
for i in result:
|
||||||
|
conf_data["po_time[%s]" % c] = [i + 1, i]
|
||||||
|
c += 1
|
||||||
|
else:
|
||||||
|
conf_data["po_time"] = None
|
||||||
else:
|
else:
|
||||||
conf_data["po_time"] = None
|
conf_data["po_time"] = None
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user