mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 15:44:04 -06:00
Switch to checking enabled extruder count for showing print with Component. This is because we want the SingleSettingExtruderBar to be hidden when there are 1 or less extruders, but also when there are 1 or less enabled extruders.
CURA-9793
This commit is contained in:
parent
ca0cd5069b
commit
bcdfa808a8
2 changed files with 11 additions and 19 deletions
|
@ -7,6 +7,7 @@ from UM.Application import Application
|
||||||
from UM.FlameProfiler import pyqtSlot
|
from UM.FlameProfiler import pyqtSlot
|
||||||
|
|
||||||
import cura.CuraApplication # To get the global container stack to find the current machine.
|
import cura.CuraApplication # To get the global container stack to find the current machine.
|
||||||
|
from UM.Util import parseBool
|
||||||
from cura.Settings.GlobalStack import GlobalStack
|
from cura.Settings.GlobalStack import GlobalStack
|
||||||
from UM.Logger import Logger
|
from UM.Logger import Logger
|
||||||
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
|
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
|
||||||
|
@ -70,6 +71,13 @@ class ExtruderManager(QObject):
|
||||||
# extruderIds directly after a machine update.
|
# extruderIds directly after a machine update.
|
||||||
return self.extruderIds
|
return self.extruderIds
|
||||||
|
|
||||||
|
@pyqtProperty(int, notify = extrudersChanged)
|
||||||
|
def enabledExtruderCount(self) -> int:
|
||||||
|
global_container_stack = self._application.getGlobalContainerStack()
|
||||||
|
if global_container_stack:
|
||||||
|
return len([extruder for extruder in global_container_stack.extruderList if parseBool(extruder.getMetaDataEntry("enabled", "True"))])
|
||||||
|
return 0
|
||||||
|
|
||||||
@pyqtProperty(str, notify = activeExtruderChanged)
|
@pyqtProperty(str, notify = activeExtruderChanged)
|
||||||
def activeExtruderStackId(self) -> Optional[str]:
|
def activeExtruderStackId(self) -> Optional[str]:
|
||||||
"""Gets the unique identifier of the currently active extruder stack.
|
"""Gets the unique identifier of the currently active extruder stack.
|
||||||
|
|
|
@ -34,22 +34,6 @@ RecommendedSettingSection
|
||||||
storeIndex: 0
|
storeIndex: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
property UM.SettingPropertyProvider supportExtruderNr: UM.SettingPropertyProvider
|
|
||||||
{
|
|
||||||
containerStack: Cura.MachineManager.activeMachine
|
|
||||||
key: "support_extruder_nr"
|
|
||||||
watchedProperties: [ "value" ]
|
|
||||||
storeIndex: 0
|
|
||||||
}
|
|
||||||
|
|
||||||
property UM.SettingPropertyProvider machineExtruderCount: UM.SettingPropertyProvider
|
|
||||||
{
|
|
||||||
containerStack: Cura.MachineManager.activeMachine
|
|
||||||
key: "machine_extruder_count"
|
|
||||||
watchedProperties: ["value"]
|
|
||||||
storeIndex: 0
|
|
||||||
}
|
|
||||||
|
|
||||||
contents: [
|
contents: [
|
||||||
RecommendedSettingItem
|
RecommendedSettingItem
|
||||||
{
|
{
|
||||||
|
@ -69,9 +53,9 @@ RecommendedSettingSection
|
||||||
settingName: catalog.i18nc("@action:label", "Print with")
|
settingName: catalog.i18nc("@action:label", "Print with")
|
||||||
tooltipText: catalog.i18nc("@label", "The extruder train to use for printing the support. This is used in multi-extrusion.")
|
tooltipText: catalog.i18nc("@label", "The extruder train to use for printing the support. This is used in multi-extrusion.")
|
||||||
// Hide this component when there is only one extruder
|
// Hide this component when there is only one extruder
|
||||||
enabled: machineExtruderCount.properties.value > 1
|
enabled: Cura.ExtruderManager.enabledExtruderCount > 1
|
||||||
visible: machineExtruderCount.properties.value > 1
|
visible: Cura.ExtruderManager.enabledExtruderCount > 1
|
||||||
isCompressed: enableSupportRow.isCompressed || machineExtruderCount.properties.value <= 1
|
isCompressed: enableSupportRow.isCompressed || Cura.ExtruderManager.enabledExtruderCount <= 1
|
||||||
|
|
||||||
settingControl: Cura.SingleSettingExtruderSelectorBar
|
settingControl: Cura.SingleSettingExtruderSelectorBar
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue