mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-19 18:19:10 +08:00
WIP: Be less wordy
This commit is contained in:
parent
02472f6ad2
commit
3364e24988
@ -49,8 +49,8 @@ class QualityProfilesModel(ListModel):
|
|||||||
Logger.log("d", "Updating quality profile model ...")
|
Logger.log("d", "Updating quality profile model ...")
|
||||||
|
|
||||||
machine_manager = Application.getInstance().getMachineManager()
|
machine_manager = Application.getInstance().getMachineManager()
|
||||||
active_global_stack = machine_manager._global_container_stack
|
global_stack = machine_manager._global_container_stack
|
||||||
if active_global_stack is None:
|
if global_stack is None:
|
||||||
self.setItems([])
|
self.setItems([])
|
||||||
Logger.log("d", "No active GlobalStack, set quality profile model as empty.")
|
Logger.log("d", "No active GlobalStack, set quality profile model as empty.")
|
||||||
return
|
return
|
||||||
@ -60,7 +60,7 @@ class QualityProfilesModel(ListModel):
|
|||||||
self.setItems([])
|
self.setItems([])
|
||||||
return
|
return
|
||||||
|
|
||||||
quality_group_dict = self._quality_manager.getQualityGroups(active_global_stack)
|
quality_group_dict = self._quality_manager.getQualityGroups(global_stack)
|
||||||
|
|
||||||
item_list = []
|
item_list = []
|
||||||
for key in sorted(quality_group_dict):
|
for key in sorted(quality_group_dict):
|
||||||
@ -83,14 +83,14 @@ class QualityProfilesModel(ListModel):
|
|||||||
self.setItems(item_list)
|
self.setItems(item_list)
|
||||||
|
|
||||||
def _fetchLayerHeight(self, quality_group: "QualityGroup"):
|
def _fetchLayerHeight(self, quality_group: "QualityGroup"):
|
||||||
active_global_stack = Application.getInstance().getMachineManager()._global_container_stack
|
global_stack = Application.getInstance().getMachineManager()._global_container_stack
|
||||||
if not self._layer_height_unit:
|
if not self._layer_height_unit:
|
||||||
unit = active_global_stack.definition.getProperty("layer_height", "unit")
|
unit = global_stack.definition.getProperty("layer_height", "unit")
|
||||||
if not unit:
|
if not unit:
|
||||||
unit = ""
|
unit = ""
|
||||||
self._layer_height_unit = unit
|
self._layer_height_unit = unit
|
||||||
|
|
||||||
default_layer_height = active_global_stack.definition.getProperty("layer_height", "value")
|
default_layer_height = global_stack.definition.getProperty("layer_height", "value")
|
||||||
|
|
||||||
# Get layer_height from the quality profile for the GlobalStack
|
# Get layer_height from the quality profile for the GlobalStack
|
||||||
container = quality_group.node_for_global.getContainer()
|
container = quality_group.node_for_global.getContainer()
|
||||||
@ -100,7 +100,7 @@ class QualityProfilesModel(ListModel):
|
|||||||
layer_height = str(container.getProperty("layer_height", "value"))
|
layer_height = str(container.getProperty("layer_height", "value"))
|
||||||
else:
|
else:
|
||||||
# Look for layer_height in the GlobalStack from material -> definition
|
# Look for layer_height in the GlobalStack from material -> definition
|
||||||
container = active_global_stack.definition
|
container = global_stack.definition
|
||||||
if container.hasProperty("layer_height", "value"):
|
if container.hasProperty("layer_height", "value"):
|
||||||
layer_height = container.getProperty("layer_height", "value")
|
layer_height = container.getProperty("layer_height", "value")
|
||||||
return str(layer_height)
|
return str(layer_height)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user