UI refinements

This commit is contained in:
Ircama 2024-07-27 16:36:43 +02:00
parent eac2b41375
commit 6c5a631d97
4 changed files with 151 additions and 26 deletions

View file

@ -53,12 +53,14 @@ class PrinterScanner:
return {"ip": ip, "hostname": hostname, "name": "Unknown"}
return None
def get_all_printers(self, ip_addr=""):
def get_all_printers(self, ip_addr="", local=False):
if ip_addr:
result = self.scan_ip(ip_addr)
if result:
return [result]
local_device_ip_list = socket.gethostbyname_ex(socket.gethostname())[2]
if local:
return local_device_ip_list
printers = []
for local_device_ip in local_device_ip_list:
if ip_addr and not local_device_ip.startswith(ip_addr):