mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 07:33:57 -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
|
import UM.Settings
|
||||||
from UM.Settings.Validator import ValidatorState
|
from UM.Settings.Validator import ValidatorState
|
||||||
from UM.Settings.InstanceContainer import InstanceContainer
|
from UM.Settings.InstanceContainer import InstanceContainer
|
||||||
|
|
||||||
|
from cura.PrinterOutputDevice import PrinterOutputDevice
|
||||||
from UM.Settings.ContainerStack import ContainerStack
|
from UM.Settings.ContainerStack import ContainerStack
|
||||||
from . import ExtruderManager
|
from . import ExtruderManager
|
||||||
from UM.i18n import i18nCatalog
|
from UM.i18n import i18nCatalog
|
||||||
|
@ -49,6 +51,8 @@ class MachineManagerModel(QObject):
|
||||||
|
|
||||||
active_machine_id = Preferences.getInstance().getValue("cura/active_machine")
|
active_machine_id = Preferences.getInstance().getValue("cura/active_machine")
|
||||||
|
|
||||||
|
Application.getInstance().getOutputDeviceManager().outputDevicesChanged.connect(self._onOutputDevicesChanged)
|
||||||
|
|
||||||
if active_machine_id != "":
|
if active_machine_id != "":
|
||||||
# An active machine was saved, so restore it.
|
# An active machine was saved, so restore it.
|
||||||
self.setActiveMachine(active_machine_id)
|
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
|
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)
|
@pyqtProperty("QVariantMap", notify = globalContainerChanged)
|
||||||
def extrudersIds(self):
|
def extrudersIds(self):
|
||||||
## Find all extruders that reference the new stack
|
## Find all extruders that reference the new stack
|
||||||
|
@ -164,6 +173,10 @@ class MachineManagerModel(QObject):
|
||||||
|
|
||||||
Application.getInstance().setGlobalContainerStack(new_global_stack)
|
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
|
## Create a name that is not empty and unique
|
||||||
# \param container_type \type{string} Type of the container (machine, quality, ...)
|
# \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
|
# \param current_name \type{} Current name of the container, which may be an acceptable option
|
||||||
|
|
|
@ -7,6 +7,7 @@ import QtQuick.Controls.Styles 1.1
|
||||||
import QtQuick.Layouts 1.1
|
import QtQuick.Layouts 1.1
|
||||||
|
|
||||||
import UM 1.1 as UM
|
import UM 1.1 as UM
|
||||||
|
import Cura 1.0 as Cura
|
||||||
|
|
||||||
Rectangle
|
Rectangle
|
||||||
{
|
{
|
||||||
|
@ -14,6 +15,9 @@ Rectangle
|
||||||
|
|
||||||
property int currentModeIndex;
|
property int currentModeIndex;
|
||||||
|
|
||||||
|
// Is there an output device for this printer?
|
||||||
|
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
|
||||||
|
|
||||||
color: UM.Theme.getColor("sidebar");
|
color: UM.Theme.getColor("sidebar");
|
||||||
UM.I18nCatalog { id: catalog; name:"cura"}
|
UM.I18nCatalog { id: catalog; name:"cura"}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue