mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 22:54:01 -06:00
Added a way to check if a printer is connected
CURA-1036
This commit is contained in:
parent
92569d63e9
commit
12faf23af8
2 changed files with 17 additions and 0 deletions
|
@ -8,6 +8,8 @@ from UM.Preferences import Preferences
|
|||
import UM.Settings
|
||||
from UM.Settings.Validator import ValidatorState
|
||||
from UM.Settings.InstanceContainer import InstanceContainer
|
||||
|
||||
from cura.PrinterOutputDevice import PrinterOutputDevice
|
||||
from UM.Settings.ContainerStack import ContainerStack
|
||||
from . import ExtruderManager
|
||||
from UM.i18n import i18nCatalog
|
||||
|
@ -49,6 +51,8 @@ class MachineManagerModel(QObject):
|
|||
|
||||
active_machine_id = Preferences.getInstance().getValue("cura/active_machine")
|
||||
|
||||
Application.getInstance().getOutputDeviceManager().outputDevicesChanged.connect(self._onOutputDevicesChanged)
|
||||
|
||||
if active_machine_id != "":
|
||||
# An active machine was saved, so restore it.
|
||||
self.setActiveMachine(active_machine_id)
|
||||
|
@ -65,6 +69,11 @@ class MachineManagerModel(QObject):
|
|||
|
||||
blurSettings = pyqtSignal() # Emitted to force fields in the advanced sidebar to un-focus, so they update properly
|
||||
|
||||
outputDevicesChanged = pyqtSignal()
|
||||
|
||||
def _onOutputDevicesChanged(self):
|
||||
self.outputDevicesChanged.emit()
|
||||
|
||||
@pyqtProperty("QVariantMap", notify = globalContainerChanged)
|
||||
def extrudersIds(self):
|
||||
## Find all extruders that reference the new stack
|
||||
|
@ -164,6 +173,10 @@ class MachineManagerModel(QObject):
|
|||
|
||||
Application.getInstance().setGlobalContainerStack(new_global_stack)
|
||||
|
||||
@pyqtProperty("QVariantList", notify = outputDevicesChanged)
|
||||
def printerOutputDevices(self):
|
||||
return [printer_output_device for printer_output_device in Application.getInstance().getOutputDeviceManager().getOutputDevices() if isinstance(printer_output_device, PrinterOutputDevice)]
|
||||
|
||||
## Create a name that is not empty and unique
|
||||
# \param container_type \type{string} Type of the container (machine, quality, ...)
|
||||
# \param current_name \type{} Current name of the container, which may be an acceptable option
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue