From 42897c2b43efa450606a7373dde14b8c1dddc392 Mon Sep 17 00:00:00 2001 From: 5axes <5axes@users.noreply.github.com> Date: Thu, 2 Jun 2022 10:49:41 +0200 Subject: [PATCH] add text --- CustomSupportsCylinder.py | 19 ++++++++++++++++++- qml_qt6/CustomSupport.qml | 8 ++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/CustomSupportsCylinder.py b/CustomSupportsCylinder.py index a24472c..c193086 100644 --- a/CustomSupportsCylinder.py +++ b/CustomSupportsCylinder.py @@ -112,6 +112,7 @@ def __init__(self): self._MirrorSupport = False self._SType = 'cylinder' self._SubType = 'cross' + self._SMsg = 'Remove All' # Shortcut if not VERSION_QT5: @@ -128,7 +129,7 @@ def __init__(self): self._application = CuraApplication.getInstance() - self.setExposedProperties("SSize", "MSize", "ISize", "AAngle", "SType" , "YDirection" , "EHeights" , "SMain" , "SubType" , "SMirror") + self.setExposedProperties("SSize", "MSize", "ISize", "AAngle", "SType" , "YDirection" , "EHeights" , "SMain" , "SubType" , "SMirror", "SMsg") CuraApplication.getInstance().globalContainerStackChanged.connect(self._updateEnabled) @@ -395,6 +396,8 @@ def _createSupportMesh(self, parent: CuraSceneNode, position: Vector , position2 op.push() node.setPosition(position, CuraSceneNode.TransformSpace.World) self._all_picked_node.append(node) + self._SMsg = 'Remove Last' + Ret = self.getSMsg CuraApplication.getInstance().getController().getScene().sceneChanged.emit(node) @@ -941,6 +944,7 @@ def removeAllSupportMesh(self): if node_stack.getProperty("support_mesh", "value"): self._removeSupportMesh(node) self._all_picked_node = [] + self._SMsg = 'Remove All' else: for node in DepthFirstIterator(self._application.getController().getScene().getRoot()): if node.callDecoration("isSliceable"): @@ -1044,7 +1048,20 @@ def setAAngle(self, AAngle: str) -> None: # Logger.log('d', 's_value : ' + str(s_value)) self._UseAngle = s_value self._preferences.setValue("customsupportcylinder/a_angle", s_value) + + def getSMsg(self) -> bool: + """ + return: golabl _SMsg as text paramater. + """ + return self._SMsg + def setSMsg(self, SMsg: str) -> None: + """ + param SType: SMsg as text paramater. + """ + self._SMsg = SMsg + + def getSType(self) -> bool: """ return: golabl _SType as text paramater. diff --git a/qml_qt6/CustomSupport.qml b/qml_qt6/CustomSupport.qml index 1028747..03c11c4 100644 --- a/qml_qt6/CustomSupport.qml +++ b/qml_qt6/CustomSupport.qml @@ -426,8 +426,12 @@ Item width: UM.Theme.getSize("setting_control").width height: UM.Theme.getSize("setting_control").height highlighted : true - text: catalog.i18nc("@label", "Remove All") - onClicked: UM.ActiveTool.triggerAction("removeAllSupportMesh") + text: catalog.i18nc("@label", UM.ActiveTool.properties.getValue("SMsg")) + onClicked: + { + UM.ActiveTool.triggerAction("removeAllSupportMesh") + text: catalog.i18nc("@label", "Remove All") + } } }