diff options
author | Diego Prado Gesto <d.pradogesto@ultimaker.com> | 2017-09-29 12:39:52 +0300 |
---|---|---|
committer | Diego Prado Gesto <d.pradogesto@ultimaker.com> | 2017-09-29 12:39:52 +0300 |
commit | 1d61740d1a330da47fc0df70dc04de183fc4529b (patch) | |
tree | e7842f5155025d704dba143fb576f94d8dd8b4bb /cura/Settings | |
parent | f0e89b7e01b4e0005760b5fc04f90518057110f9 (diff) |
Added some comments to the code and minor changes - CURA-4386 CURA-4379
Diffstat (limited to 'cura/Settings')
-rwxr-xr-x | cura/Settings/ExtruderManager.py | 18 | ||||
-rwxr-xr-x | cura/Settings/MachineManager.py | 4 |
2 files changed, 15 insertions, 7 deletions
diff --git a/cura/Settings/ExtruderManager.py b/cura/Settings/ExtruderManager.py index 12277f9641..0ffaca4992 100755 --- a/cura/Settings/ExtruderManager.py +++ b/cura/Settings/ExtruderManager.py @@ -41,7 +41,7 @@ class ExtruderManager(QObject): def __init__(self, parent = None): super().__init__(parent) self._extruder_trains = { } #Per machine, a dictionary of extruder container stack IDs. Only for separately defined extruders. - self._active_extruder_index = -1 + self._active_extruder_index = -1 # Indicates the index of the active extruder stack. -1 means no active extruder stack self._selected_object_extruders = [] Application.getInstance().globalContainerStackChanged.connect(self.__globalContainerStackChanged) self._global_container_stack_definition_id = None @@ -74,15 +74,18 @@ class ExtruderManager(QObject): except KeyError: return 0 + ## Gets a dict with the extruder stack ids with the extruder number as the key. + # The key "-1" indicates the global stack id. + # @pyqtProperty("QVariantMap", notify = extrudersChanged) def extruderIds(self): - map = {} + extruder_stack_ids = {} global_stack_id = Application.getInstance().getGlobalContainerStack().getId() - map["-1"] = global_stack_id + extruder_stack_ids["-1"] = global_stack_id if global_stack_id in self._extruder_trains: for position in self._extruder_trains[global_stack_id]: - map[position] = self._extruder_trains[global_stack_id][position].getId() - return map + extruder_stack_ids[position] = self._extruder_trains[global_stack_id][position].getId() + return extruder_stack_ids @pyqtSlot(str, result = str) def getQualityChangesIdByExtruderStackId(self, id: str) -> str: @@ -516,7 +519,8 @@ class ExtruderManager(QObject): result = [] machine_extruder_count = global_stack.getProperty("machine_extruder_count", "value") - if machine_extruder_count is 1: + # In case the printer is using one extruder, shouldn't exist active extruder stacks + if machine_extruder_count == 1: return result if global_stack and global_stack.getId() in self._extruder_trains: @@ -537,7 +541,7 @@ class ExtruderManager(QObject): if self._active_extruder_index == -1: self.setActiveExtruderIndex(0) else: - if self._active_extruder_index > -1: + if self._active_extruder_index != -1: self.setActiveExtruderIndex(-1) self.activeExtruderChanged.emit() diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 9ce288e0c0..69cebc26c0 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -545,6 +545,10 @@ class MachineManager(QObject): return result + ## Gets a dict with the active materials ids set in all extruder stacks and the global stack + # (when there is one extruder, the material is set in the global stack) + # + # \return The material ids in all stacks @pyqtProperty("QVariantMap", notify = activeMaterialChanged) def allActiveMaterialIds(self) -> Dict[str, str]: result = {} |