mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-16 03:07:53 -06:00
Added some comments to the code and minor changes - CURA-4386 CURA-4379
This commit is contained in:
parent
f0e89b7e01
commit
1d61740d1a
2 changed files with 15 additions and 7 deletions
|
@ -41,7 +41,7 @@ class ExtruderManager(QObject):
|
||||||
def __init__(self, parent = None):
|
def __init__(self, parent = None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
self._extruder_trains = { } #Per machine, a dictionary of extruder container stack IDs. Only for separately defined extruders.
|
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 = []
|
self._selected_object_extruders = []
|
||||||
Application.getInstance().globalContainerStackChanged.connect(self.__globalContainerStackChanged)
|
Application.getInstance().globalContainerStackChanged.connect(self.__globalContainerStackChanged)
|
||||||
self._global_container_stack_definition_id = None
|
self._global_container_stack_definition_id = None
|
||||||
|
@ -74,15 +74,18 @@ class ExtruderManager(QObject):
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return 0
|
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)
|
@pyqtProperty("QVariantMap", notify = extrudersChanged)
|
||||||
def extruderIds(self):
|
def extruderIds(self):
|
||||||
map = {}
|
extruder_stack_ids = {}
|
||||||
global_stack_id = Application.getInstance().getGlobalContainerStack().getId()
|
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:
|
if global_stack_id in self._extruder_trains:
|
||||||
for position in self._extruder_trains[global_stack_id]:
|
for position in self._extruder_trains[global_stack_id]:
|
||||||
map[position] = self._extruder_trains[global_stack_id][position].getId()
|
extruder_stack_ids[position] = self._extruder_trains[global_stack_id][position].getId()
|
||||||
return map
|
return extruder_stack_ids
|
||||||
|
|
||||||
@pyqtSlot(str, result = str)
|
@pyqtSlot(str, result = str)
|
||||||
def getQualityChangesIdByExtruderStackId(self, id: str) -> str:
|
def getQualityChangesIdByExtruderStackId(self, id: str) -> str:
|
||||||
|
@ -516,7 +519,8 @@ class ExtruderManager(QObject):
|
||||||
result = []
|
result = []
|
||||||
machine_extruder_count = global_stack.getProperty("machine_extruder_count", "value")
|
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
|
return result
|
||||||
|
|
||||||
if global_stack and global_stack.getId() in self._extruder_trains:
|
if global_stack and global_stack.getId() in self._extruder_trains:
|
||||||
|
@ -537,7 +541,7 @@ class ExtruderManager(QObject):
|
||||||
if self._active_extruder_index == -1:
|
if self._active_extruder_index == -1:
|
||||||
self.setActiveExtruderIndex(0)
|
self.setActiveExtruderIndex(0)
|
||||||
else:
|
else:
|
||||||
if self._active_extruder_index > -1:
|
if self._active_extruder_index != -1:
|
||||||
self.setActiveExtruderIndex(-1)
|
self.setActiveExtruderIndex(-1)
|
||||||
|
|
||||||
self.activeExtruderChanged.emit()
|
self.activeExtruderChanged.emit()
|
||||||
|
|
|
@ -545,6 +545,10 @@ class MachineManager(QObject):
|
||||||
|
|
||||||
return result
|
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)
|
@pyqtProperty("QVariantMap", notify = activeMaterialChanged)
|
||||||
def allActiveMaterialIds(self) -> Dict[str, str]:
|
def allActiveMaterialIds(self) -> Dict[str, str]:
|
||||||
result = {}
|
result = {}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue