Merge branch 'master' of github.com:ultimaker/Cura into feature_material_editing

* 'master' of github.com:ultimaker/Cura: (38 commits)
  Fixed profile file case-sensitivity.
  Fix UMO Checkup button size
  Remove debug statement and commented-out code CURA-1385
  Show "ready" state when a printer is connected but jobstate is not yet set
  Added deepcopy function
  Made exception handling of slice info plugin way more robust
  Restart timer after slicing is performed when not enabled.
  Update GUID for PLA to match the GUID in the official repository
  Set default extruder index to -1 (so global is default)
  Ensure that the display matches with the backend active extruder data
  Update UM2 Extended build volume height to value published in marketing materials
  Fixed firmware upgrade for um2+
  Capitalise setting label
  CHeckup action now correctly resets every time you start it
  Remove unused name/id when importing a profile from a gcode file
  Just a little typo
  BQ Hephestos2: Heat up nozzle while leveling
  Saving g-code no longer crashes
  Removed update firmware from extensions; This is now handled by machine actions
  Changing active extruder no longer trigger re-slice
  ...
This commit is contained in:
Arjen Hiemstra 2016-07-07 11:29:18 +02:00
commit d8555fe57d
25 changed files with 311 additions and 175 deletions

View file

@ -5,6 +5,7 @@ from PyQt5.QtCore import QObject, pyqtSlot, pyqtProperty, pyqtSignal
from UM.Application import Application
from UM.Preferences import Preferences
from UM.Logger import Logger
import UM.Settings
@ -50,6 +51,7 @@ class MachineManager(QObject):
active_machine_id = Preferences.getInstance().getValue("cura/active_machine")
self._printer_output_devices = []
Application.getInstance().getOutputDeviceManager().outputDevicesChanged.connect(self._onOutputDevicesChanged)
if active_machine_id != "":
@ -71,8 +73,52 @@ class MachineManager(QObject):
outputDevicesChanged = pyqtSignal()
def _onOutputDevicesChanged(self):
for printer_output_device in self._printer_output_devices:
printer_output_device.hotendIdChanged.disconnect(self._onHotendIdChanged)
printer_output_device.materialIdChanged.disconnect(self._onMaterialIdChanged)
self._printer_output_devices.clear()
for printer_output_device in Application.getInstance().getOutputDeviceManager().getOutputDevices():
if isinstance(printer_output_device, PrinterOutputDevice):
self._printer_output_devices.append(printer_output_device)
printer_output_device.hotendIdChanged.connect(self._onHotendIdChanged)
printer_output_device.materialIdChanged.connect(self._onMaterialIdChanged)
self.outputDevicesChanged.emit()
@pyqtProperty("QVariantList", notify = outputDevicesChanged)
def printerOutputDevices(self):
return self._printer_output_devices
def _onHotendIdChanged(self, index, hotend_id):
if not self._global_container_stack:
return
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(type = "variant", definition = self._global_container_stack.getBottom().getId(), name = hotend_id)
if containers:
Logger.log("d", "Setting hotend variant of hotend %d to %s" % (index, containers[0].getId()))
ExtruderManager.ExtruderManager.getInstance().setActiveExtruderIndex(index)
self.setActiveVariant(containers[0].getId())
def _onMaterialIdChanged(self, index, material_id):
# TODO: fix this
if not self._global_container_stack:
return
definition_id = "fdmprinter"
if self._global_container_stack.getMetaDataEntry("has_machine_materials", False):
definition_id = self._global_container_stack.getBottom().getId()
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(type = "material", definition = definition_id, GUID = material_id)
if containers:
Logger.log("d", "Setting material of hotend %d to %s" % (index, containers[0].getId()))
ExtruderManager.ExtruderManager.getInstance().setActiveExtruderIndex(index)
self.setActiveMaterial(containers[0].getId())
else:
Logger.log("w", "No material definition found for printer definition %s and GUID %s" % (definition_id, material_id))
def _onGlobalPropertyChanged(self, key, property_name):
if property_name == "value":
self.globalValueChanged.emit()
@ -164,9 +210,6 @@ class MachineManager(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, ...)
@ -235,6 +278,13 @@ class MachineManager(QObject):
return ""
@pyqtProperty(str, notify = activeStackChanged)
def activeStackId(self):
if self._active_container_stack:
return self._active_container_stack.getId()
return ""
@pyqtProperty(str, notify = activeMaterialChanged)
def activeMaterialName(self):
if self._active_container_stack: