mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 14:37:29 -06:00
Merge branch 'master' into python_type_hinting
This commit is contained in:
commit
d4619da358
132 changed files with 42584 additions and 952 deletions
|
@ -8,6 +8,8 @@ from UM.i18n import i18nCatalog
|
|||
catalog = i18nCatalog("cura")
|
||||
|
||||
|
||||
## A simple action to handle manual bed leveling procedure for printers that don't have it on the firmware.
|
||||
# This is currently only used by the Ultimaker Original+
|
||||
class BedLevelMachineAction(MachineAction):
|
||||
def __init__(self):
|
||||
super().__init__("BedLevel", catalog.i18nc("@action", "Level build plate"))
|
||||
|
|
|
@ -8,6 +8,7 @@ from UM.i18n import i18nCatalog
|
|||
catalog = i18nCatalog("cura")
|
||||
|
||||
|
||||
## Action to check up if the self-built UMO was done correctly.
|
||||
class UMOCheckupMachineAction(MachineAction):
|
||||
def __init__(self):
|
||||
super().__init__("UMOCheckup", catalog.i18nc("@action", "Checkup"))
|
||||
|
@ -27,7 +28,6 @@ class UMOCheckupMachineAction(MachineAction):
|
|||
|
||||
Application.getInstance().getOutputDeviceManager().outputDevicesChanged.connect(self._onOutputDevicesChanged)
|
||||
|
||||
|
||||
onBedTestCompleted = pyqtSignal()
|
||||
onHotendTestCompleted = pyqtSignal()
|
||||
|
||||
|
|
|
@ -7,6 +7,11 @@ from UM.i18n import i18nCatalog
|
|||
from UM.Application import Application
|
||||
catalog = i18nCatalog("cura")
|
||||
|
||||
import UM.Settings.InstanceContainer
|
||||
|
||||
|
||||
## The Ultimaker Original can have a few revisions & upgrades. This action helps with selecting them, so they are added
|
||||
# as a variant.
|
||||
class UMOUpgradeSelection(MachineAction):
|
||||
def __init__(self):
|
||||
super().__init__("UMOUpgradeSelection", catalog.i18nc("@action", "Select upgrades"))
|
||||
|
@ -27,19 +32,23 @@ class UMOUpgradeSelection(MachineAction):
|
|||
def setHeatedBed(self, heated_bed = True):
|
||||
global_container_stack = Application.getInstance().getGlobalContainerStack()
|
||||
if global_container_stack:
|
||||
variant = global_container_stack.findContainer({"type": "variant"})
|
||||
if variant:
|
||||
if variant.getId() == "empty_variant":
|
||||
variant_index = global_container_stack.getContainerIndex(variant)
|
||||
variant = self._createVariant(global_container_stack, variant_index)
|
||||
variant.setProperty("machine_heated_bed", "value", heated_bed)
|
||||
self.heatedBedChanged.emit()
|
||||
# Make sure there is a definition_changes container to store the machine settings
|
||||
definition_changes_container = global_container_stack.findContainer({"type": "definition_changes"})
|
||||
if not definition_changes_container:
|
||||
definition_changes_container = self._createDefinitionChangesContainer(global_container_stack)
|
||||
|
||||
def _createVariant(self, global_container_stack, variant_index):
|
||||
# Create and switch to a variant to store the settings in
|
||||
new_variant = InstanceContainer(global_container_stack.getName() + "_variant")
|
||||
new_variant.addMetaDataEntry("type", "variant")
|
||||
new_variant.setDefinition(global_container_stack.getBottom())
|
||||
ContainerRegistry.getInstance().addContainer(new_variant)
|
||||
global_container_stack.replaceContainer(variant_index, new_variant)
|
||||
return new_variant
|
||||
definition_changes_container.setProperty("machine_heated_bed", "value", heated_bed)
|
||||
self.heatedBedChanged.emit()
|
||||
|
||||
def _createDefinitionChangesContainer(self, global_container_stack):
|
||||
# Create a definition_changes container to store the settings in and add it to the stack
|
||||
definition_changes_container = UM.Settings.InstanceContainer(global_container_stack.getName() + "_settings")
|
||||
definition = global_container_stack.getBottom()
|
||||
definition_changes_container.setDefinition(definition)
|
||||
definition_changes_container.addMetaDataEntry("type", "definition_changes")
|
||||
|
||||
UM.Settings.ContainerRegistry.getInstance().addContainer(definition_changes_container)
|
||||
# Insert definition_changes between the definition and the variant
|
||||
global_container_stack.insertContainer(-1, definition_changes_container)
|
||||
|
||||
return definition_changes_container
|
||||
|
|
|
@ -6,6 +6,7 @@ from UM.Settings.ContainerRegistry import ContainerRegistry
|
|||
|
||||
catalog = i18nCatalog("cura")
|
||||
|
||||
## Upgrade the firmware of a machine by USB with this action.
|
||||
class UpgradeFirmwareMachineAction(MachineAction):
|
||||
def __init__(self):
|
||||
super().__init__("UpgradeFirmware", catalog.i18nc("@action", "Upgrade Firmware"))
|
||||
|
@ -13,6 +14,6 @@ class UpgradeFirmwareMachineAction(MachineAction):
|
|||
ContainerRegistry.getInstance().containerAdded.connect(self._onContainerAdded)
|
||||
|
||||
def _onContainerAdded(self, container):
|
||||
# Add this action as a supported action to all machine definitions
|
||||
# Add this action as a supported action to all machine definitions if they support USB connection
|
||||
if isinstance(container, DefinitionContainer) and container.getMetaDataEntry("type") == "machine" and container.getMetaDataEntry("supports_usb_connection"):
|
||||
Application.getInstance().getMachineActionManager().addSupportedAction(container.getId(), self.getKey())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue