mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-22 22:23:57 -06:00
Remove UM2 upgrade selection machine action
Instead of choosing the Olsson block with this wizard, choose it by choosing the correct definition to start with. Contributes to issue CURA-6775.
This commit is contained in:
parent
bda7a6ce0a
commit
9b341cf604
5 changed files with 2 additions and 138 deletions
|
@ -1,76 +0,0 @@
|
||||||
# Copyright (c) 2018 Ultimaker B.V.
|
|
||||||
# Uranium is released under the terms of the LGPLv3 or higher.
|
|
||||||
|
|
||||||
from PyQt5.QtCore import pyqtSignal, pyqtProperty
|
|
||||||
|
|
||||||
from UM.Settings.ContainerRegistry import ContainerRegistry
|
|
||||||
from UM.i18n import i18nCatalog
|
|
||||||
from UM.Application import Application
|
|
||||||
from UM.Util import parseBool
|
|
||||||
|
|
||||||
from cura.MachineAction import MachineAction
|
|
||||||
|
|
||||||
catalog = i18nCatalog("cura")
|
|
||||||
|
|
||||||
|
|
||||||
## The Ultimaker 2 can have a few revisions & upgrades.
|
|
||||||
class UM2UpgradeSelection(MachineAction):
|
|
||||||
def __init__(self):
|
|
||||||
super().__init__("UM2UpgradeSelection", catalog.i18nc("@action", "Select upgrades"))
|
|
||||||
self._qml_url = "UM2UpgradeSelectionMachineAction.qml"
|
|
||||||
|
|
||||||
self._container_registry = ContainerRegistry.getInstance()
|
|
||||||
|
|
||||||
self._current_global_stack = None
|
|
||||||
|
|
||||||
Application.getInstance().globalContainerStackChanged.connect(self._onGlobalStackChanged)
|
|
||||||
self._reset()
|
|
||||||
|
|
||||||
def _reset(self):
|
|
||||||
self.hasVariantsChanged.emit()
|
|
||||||
|
|
||||||
def _onGlobalStackChanged(self):
|
|
||||||
if self._current_global_stack:
|
|
||||||
self._current_global_stack.metaDataChanged.disconnect(self._onGlobalStackMetaDataChanged)
|
|
||||||
|
|
||||||
self._current_global_stack = Application.getInstance().getGlobalContainerStack()
|
|
||||||
if self._current_global_stack:
|
|
||||||
self._current_global_stack.metaDataChanged.connect(self._onGlobalStackMetaDataChanged)
|
|
||||||
self._reset()
|
|
||||||
|
|
||||||
def _onGlobalStackMetaDataChanged(self):
|
|
||||||
self._reset()
|
|
||||||
|
|
||||||
hasVariantsChanged = pyqtSignal()
|
|
||||||
|
|
||||||
def setHasVariants(self, has_variants = True):
|
|
||||||
global_container_stack = Application.getInstance().getGlobalContainerStack()
|
|
||||||
if global_container_stack:
|
|
||||||
variant_container = global_container_stack.extruders["0"].variant
|
|
||||||
|
|
||||||
if has_variants:
|
|
||||||
global_container_stack.setMetaDataEntry("has_variants", True)
|
|
||||||
|
|
||||||
# Set the variant container to a sane default
|
|
||||||
empty_container = ContainerRegistry.getInstance().getEmptyInstanceContainer()
|
|
||||||
if type(variant_container) == type(empty_container):
|
|
||||||
search_criteria = { "type": "variant", "definition": "ultimaker2", "id": "*0.4*" }
|
|
||||||
containers = self._container_registry.findInstanceContainers(**search_criteria)
|
|
||||||
if containers:
|
|
||||||
global_container_stack.extruders["0"].variant = containers[0]
|
|
||||||
else:
|
|
||||||
# The metadata entry is stored in an ini, and ini files are parsed as strings only.
|
|
||||||
# Because any non-empty string evaluates to a boolean True, we have to remove the entry to make it False.
|
|
||||||
if "has_variants" in global_container_stack.getMetaData():
|
|
||||||
global_container_stack.removeMetaDataEntry("has_variants")
|
|
||||||
|
|
||||||
# Set the variant container to an empty variant
|
|
||||||
global_container_stack.extruders["0"].variant = ContainerRegistry.getInstance().getEmptyInstanceContainer()
|
|
||||||
|
|
||||||
Application.getInstance().globalContainerStackChanged.emit()
|
|
||||||
self._reset()
|
|
||||||
|
|
||||||
@pyqtProperty(bool, fset = setHasVariants, notify = hasVariantsChanged)
|
|
||||||
def hasVariants(self):
|
|
||||||
if self._current_global_stack:
|
|
||||||
return parseBool(self._current_global_stack.getMetaDataEntry("has_variants", "false"))
|
|
|
@ -1,55 +0,0 @@
|
||||||
// Copyright (c) 2019 Ultimaker B.V.
|
|
||||||
// Cura is released under the terms of the LGPLv3 or higher.
|
|
||||||
|
|
||||||
import QtQuick 2.10
|
|
||||||
import QtQuick.Controls 2.3
|
|
||||||
|
|
||||||
import UM 1.3 as UM
|
|
||||||
import Cura 1.1 as Cura
|
|
||||||
|
|
||||||
|
|
||||||
Cura.MachineAction
|
|
||||||
{
|
|
||||||
UM.I18nCatalog { id: catalog; name: "cura"; }
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
Item
|
|
||||||
{
|
|
||||||
id: upgradeSelectionMachineAction
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.topMargin: UM.Theme.getSize("default_margin").width * 5
|
|
||||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width * 4
|
|
||||||
|
|
||||||
Label
|
|
||||||
{
|
|
||||||
id: pageDescription
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
|
||||||
width: parent.width
|
|
||||||
wrapMode: Text.WordWrap
|
|
||||||
text: catalog.i18nc("@label", "Please select any upgrades made to this Ultimaker 2.")
|
|
||||||
font: UM.Theme.getFont("medium")
|
|
||||||
color: UM.Theme.getColor("text")
|
|
||||||
renderType: Text.NativeRendering
|
|
||||||
}
|
|
||||||
|
|
||||||
Cura.CheckBox
|
|
||||||
{
|
|
||||||
id: olssonBlockCheckBox
|
|
||||||
anchors.top: pageDescription.bottom
|
|
||||||
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
|
||||||
|
|
||||||
height: UM.Theme.getSize("setting_control").height
|
|
||||||
|
|
||||||
text: catalog.i18nc("@label", "Olsson Block")
|
|
||||||
checked: manager.hasVariants
|
|
||||||
onClicked: manager.hasVariants = checked
|
|
||||||
|
|
||||||
Connections
|
|
||||||
{
|
|
||||||
target: manager
|
|
||||||
onHasVariantsChanged: olssonBlockCheckBox.checked = manager.hasVariants
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,9 +1,8 @@
|
||||||
# Copyright (c) 2018 Ultimaker B.V.
|
# Copyright (c) 2019 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
from . import BedLevelMachineAction
|
from . import BedLevelMachineAction
|
||||||
from . import UMOUpgradeSelection
|
from . import UMOUpgradeSelection
|
||||||
from . import UM2UpgradeSelection
|
|
||||||
|
|
||||||
def getMetaData():
|
def getMetaData():
|
||||||
return {}
|
return {}
|
||||||
|
@ -11,6 +10,5 @@ def getMetaData():
|
||||||
def register(app):
|
def register(app):
|
||||||
return { "machine_action": [
|
return { "machine_action": [
|
||||||
BedLevelMachineAction.BedLevelMachineAction(),
|
BedLevelMachineAction.BedLevelMachineAction(),
|
||||||
UMOUpgradeSelection.UMOUpgradeSelection(),
|
UMOUpgradeSelection.UMOUpgradeSelection()
|
||||||
UM2UpgradeSelection.UM2UpgradeSelection()
|
|
||||||
]}
|
]}
|
||||||
|
|
|
@ -14,8 +14,6 @@
|
||||||
"has_materials": false,
|
"has_materials": false,
|
||||||
"has_machine_quality": true,
|
"has_machine_quality": true,
|
||||||
"preferred_variant_name": "0.4 mm",
|
"preferred_variant_name": "0.4 mm",
|
||||||
"first_start_actions": ["UM2UpgradeSelection"],
|
|
||||||
"supported_actions":["UM2UpgradeSelection"],
|
|
||||||
"machine_extruder_trains":
|
"machine_extruder_trains":
|
||||||
{
|
{
|
||||||
"0": "ultimaker2_extruder_0"
|
"0": "ultimaker2_extruder_0"
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
"platform": "ultimaker2go_platform.obj",
|
"platform": "ultimaker2go_platform.obj",
|
||||||
"platform_texture": "Ultimaker2Gobackplate.png",
|
"platform_texture": "Ultimaker2Gobackplate.png",
|
||||||
"platform_offset": [0, 0, 0],
|
"platform_offset": [0, 0, 0],
|
||||||
"first_start_actions": [],
|
|
||||||
"machine_extruder_trains":
|
"machine_extruder_trains":
|
||||||
{
|
{
|
||||||
"0": "ultimaker2_go_extruder_0"
|
"0": "ultimaker2_go_extruder_0"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue