This commit is contained in:
@@ -1245,7 +1245,8 @@ class EpsonPrinter:
|
|||||||
def stats(self):
|
def stats(self):
|
||||||
"""Return all available information about a printer."""
|
"""Return all available information about a printer."""
|
||||||
stat_set = {}
|
stat_set = {}
|
||||||
for method in self.list_methods:
|
# Run "list(self.printer.list_methods)" to get the list of all methods
|
||||||
|
for method in self.list_methods: # Run one by one all functions starting with "get_"
|
||||||
ret = self.__getattribute__(method)()
|
ret = self.__getattribute__(method)()
|
||||||
if ret:
|
if ret:
|
||||||
stat_set[method[4:]] = ret
|
stat_set[method[4:]] = ret
|
||||||
@@ -1374,7 +1375,7 @@ class EpsonPrinter:
|
|||||||
logging.error(
|
logging.error(
|
||||||
"MIB '%s' not in config. Operation: %s", oid, label
|
"MIB '%s' not in config. Operation: %s", oid, label
|
||||||
)
|
)
|
||||||
return None, False
|
return [(None, False)]
|
||||||
return self.mib_dict[oid]
|
return self.mib_dict[oid]
|
||||||
else:
|
else:
|
||||||
# list case: map through dict
|
# list case: map through dict
|
||||||
@@ -1396,7 +1397,7 @@ class EpsonPrinter:
|
|||||||
|
|
||||||
# Build or reuse SNMP network config
|
# Build or reuse SNMP network config
|
||||||
if not self.hostname:
|
if not self.hostname:
|
||||||
return None, False
|
return [(None, False)]
|
||||||
|
|
||||||
net_val = (self.hostname, self.port, self.timeout, self.retries)
|
net_val = (self.hostname, self.port, self.timeout, self.retries)
|
||||||
if net_val != self.used_net_val:
|
if net_val != self.used_net_val:
|
||||||
@@ -1413,12 +1414,12 @@ class EpsonPrinter:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.critical("fetch_oid_values invalid address: %s", e)
|
logging.critical("fetch_oid_values invalid address: %s", e)
|
||||||
self.used_net_val = ()
|
self.used_net_val = ()
|
||||||
return None, False
|
return [(None, False)]
|
||||||
|
|
||||||
self.used_net_val = net_val
|
self.used_net_val = net_val
|
||||||
|
|
||||||
if not self.snmp_conf:
|
if not self.snmp_conf:
|
||||||
return None, False
|
return [(None, False)]
|
||||||
|
|
||||||
# SNMP lookup
|
# SNMP lookup
|
||||||
def _single_lookup(single_oid: str) -> Tuple[str, Any]:
|
def _single_lookup(single_oid: str) -> Tuple[str, Any]:
|
||||||
@@ -1437,7 +1438,7 @@ class EpsonPrinter:
|
|||||||
elif errorInd is not None:
|
elif errorInd is not None:
|
||||||
logging.info("fetch_oid_values error: %s. OID: %s. Label: %s",
|
logging.info("fetch_oid_values error: %s. OID: %s. Label: %s",
|
||||||
errorInd, single_oid, label)
|
errorInd, single_oid, label)
|
||||||
return None, False
|
return [(None, False)]
|
||||||
|
|
||||||
# SNMP-level errorStatus
|
# SNMP-level errorStatus
|
||||||
if int(errorStat) != 0:
|
if int(errorStat) != 0:
|
||||||
@@ -1447,7 +1448,7 @@ class EpsonPrinter:
|
|||||||
"fetch_oid_values PDU error: %s at %s. OID: %s. Label: %s",
|
"fetch_oid_values PDU error: %s at %s. OID: %s. Label: %s",
|
||||||
errorStat.prettyPrint(), bad_oid, single_oid, label
|
errorStat.prettyPrint(), bad_oid, single_oid, label
|
||||||
)
|
)
|
||||||
return None, False
|
return [(None, False)]
|
||||||
|
|
||||||
# unpack the varBinds
|
# unpack the varBinds
|
||||||
final = []
|
final = []
|
||||||
|
|||||||
2
ui.py
2
ui.py
@@ -37,7 +37,7 @@ from find_printers import PrinterScanner
|
|||||||
from text_console import TextConsole
|
from text_console import TextConsole
|
||||||
|
|
||||||
|
|
||||||
VERSION = "6.2.11"
|
VERSION = "6.2.12"
|
||||||
|
|
||||||
NO_CONF_ERROR = (
|
NO_CONF_ERROR = (
|
||||||
" Please select a printer model and a valid IP address,"
|
" Please select a printer model and a valid IP address,"
|
||||||
|
|||||||
Reference in New Issue
Block a user