mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 14:44:13 -06: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
2 changed files with 13 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue