mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 15:19:00 +08:00
Added machine action buttons dynamic visibility
Based on this change, users now will be able to manage the visibility of their machine action plugin implementations. For example, a machine action only visible when loggedIn.
This commit is contained in:
parent
a8f0e330ad
commit
ed14e3bd44
@ -114,3 +114,15 @@ class MachineAction(QObject, PluginObject):
|
|||||||
@pyqtSlot(result = QObject)
|
@pyqtSlot(result = QObject)
|
||||||
def getDisplayItem(self) -> Optional["QObject"]:
|
def getDisplayItem(self) -> Optional["QObject"]:
|
||||||
return self._createViewFromQML()
|
return self._createViewFromQML()
|
||||||
|
|
||||||
|
@pyqtSlot(result = bool)
|
||||||
|
def isVisible(self) -> bool:
|
||||||
|
"""Whether this action button will be visible.
|
||||||
|
|
||||||
|
Example: Show only when isLoggedIn
|
||||||
|
|
||||||
|
:return: Defaults to true to be in line with the old behaviour.
|
||||||
|
"""
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
@ -67,6 +67,7 @@ UM.ManagementPage
|
|||||||
{
|
{
|
||||||
width: Math.round(childrenRect.width + 2 * screenScaleFactor)
|
width: Math.round(childrenRect.width + 2 * screenScaleFactor)
|
||||||
height: childrenRect.height
|
height: childrenRect.height
|
||||||
|
visible: machineActionRepeater.model[index].isVisible()
|
||||||
Cura.SecondaryButton
|
Cura.SecondaryButton
|
||||||
{
|
{
|
||||||
text: machineActionRepeater.model[index].label
|
text: machineActionRepeater.model[index].label
|
||||||
|
Loading…
x
Reference in New Issue
Block a user