mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
Added logging for bonjour discovery/undiscovery
CURA-1851
This commit is contained in:
parent
f052129171
commit
b08bdb206b
1 changed files with 3 additions and 0 deletions
|
@ -2,6 +2,7 @@ from UM.OutputDevice.OutputDevicePlugin import OutputDevicePlugin
|
|||
from . import NetworkPrinterOutputDevice
|
||||
|
||||
from zeroconf import Zeroconf, ServiceBrowser, ServiceStateChange
|
||||
from UM.Logger import Logger
|
||||
from UM.Signal import Signal, signalemitter
|
||||
from UM.Application import Application
|
||||
|
||||
|
@ -75,6 +76,7 @@ class NetworkPrinterOutputDevicePlugin(OutputDevicePlugin):
|
|||
## Handler for zeroConf detection
|
||||
def _onServiceChanged(self, zeroconf, service_type, name, state_change):
|
||||
if state_change == ServiceStateChange.Added:
|
||||
Logger.log("d", "Bonjour service added: %s" % name)
|
||||
info = zeroconf.get_service_info(service_type, name)
|
||||
if info:
|
||||
if info.properties.get(b"type", None) == b'printer':
|
||||
|
@ -82,4 +84,5 @@ class NetworkPrinterOutputDevicePlugin(OutputDevicePlugin):
|
|||
self.addPrinterSignal.emit(str(name), address, info.properties)
|
||||
|
||||
elif state_change == ServiceStateChange.Removed:
|
||||
Logger.log("d", "Bonjour service removed: %s" % name)
|
||||
self.removePrinterSignal.emit(str(name))
|
Loading…
Add table
Add a link
Reference in a new issue