mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-21 21:29:41 +08:00
Show a conformation message after a successful manage action
Contributes to: CURA-8587
This commit is contained in:
parent
1c0e484069
commit
ca76bcc29c
@ -187,7 +187,6 @@ class PackageList(ListModel):
|
|||||||
if update:
|
if update:
|
||||||
package.is_updating = False
|
package.is_updating = False
|
||||||
else:
|
else:
|
||||||
package.is_recently_managed = True
|
|
||||||
package.is_installing = False
|
package.is_installing = False
|
||||||
self.subscribeUserToPackage(package_id, str(package.sdk_version))
|
self.subscribeUserToPackage(package_id, str(package.sdk_version))
|
||||||
|
|
||||||
@ -293,7 +292,6 @@ class PackageList(ListModel):
|
|||||||
self._manager.removePackage(package_id)
|
self._manager.removePackage(package_id)
|
||||||
self.unsunscribeUserFromPackage(package_id)
|
self.unsunscribeUserFromPackage(package_id)
|
||||||
package.is_installing = False
|
package.is_installing = False
|
||||||
package.is_recently_managed = True
|
|
||||||
|
|
||||||
@pyqtSlot(str)
|
@pyqtSlot(str)
|
||||||
def updatePackage(self, package_id: str) -> None:
|
def updatePackage(self, package_id: str) -> None:
|
||||||
|
@ -61,7 +61,10 @@ class PackageModel(QObject):
|
|||||||
self._icon_url = author_data.get("icon_url", "")
|
self._icon_url = author_data.get("icon_url", "")
|
||||||
|
|
||||||
self._is_installing = False
|
self._is_installing = False
|
||||||
self._is_recently_managed = False
|
self._is_recently_installed = False
|
||||||
|
self._is_recently_updated = False
|
||||||
|
self._is_recently_enabled = False
|
||||||
|
|
||||||
self._can_update = False
|
self._can_update = False
|
||||||
self._is_updating = False
|
self._is_updating = False
|
||||||
self._is_enabling = False
|
self._is_enabling = False
|
||||||
@ -287,7 +290,9 @@ class PackageModel(QObject):
|
|||||||
"""The state of the manage Enable Button of this package"""
|
"""The state of the manage Enable Button of this package"""
|
||||||
if self._is_enabling:
|
if self._is_enabling:
|
||||||
return "busy"
|
return "busy"
|
||||||
if self._is_recently_managed or self._package_type == "material" or not self._is_installed:
|
if self._is_recently_enabled:
|
||||||
|
return "confirmed"
|
||||||
|
if self._package_type == "material" or not self._is_installed:
|
||||||
return "hidden"
|
return "hidden"
|
||||||
if self._is_installed and self._is_active:
|
if self._is_installed and self._is_active:
|
||||||
return "secondary"
|
return "secondary"
|
||||||
@ -301,6 +306,8 @@ class PackageModel(QObject):
|
|||||||
@is_enabling.setter
|
@is_enabling.setter
|
||||||
def is_enabling(self, value: bool) -> None:
|
def is_enabling(self, value: bool) -> None:
|
||||||
if value != self._is_enabling:
|
if value != self._is_enabling:
|
||||||
|
if not value:
|
||||||
|
self._is_recently_enabled = True
|
||||||
self._is_enabling = value
|
self._is_enabling = value
|
||||||
self.stateManageButtonChanged.emit()
|
self.stateManageButtonChanged.emit()
|
||||||
|
|
||||||
@ -322,8 +329,8 @@ class PackageModel(QObject):
|
|||||||
"""The state of the Manage Install package card"""
|
"""The state of the Manage Install package card"""
|
||||||
if self._is_installing:
|
if self._is_installing:
|
||||||
return "busy"
|
return "busy"
|
||||||
if self._is_recently_managed:
|
if self._is_recently_installed:
|
||||||
return "hidden"
|
return "confirmed"
|
||||||
if self._is_installed:
|
if self._is_installed:
|
||||||
if self._is_bundled and not self._can_downgrade:
|
if self._is_bundled and not self._can_downgrade:
|
||||||
return "hidden"
|
return "hidden"
|
||||||
@ -332,17 +339,6 @@ class PackageModel(QObject):
|
|||||||
else:
|
else:
|
||||||
return "primary"
|
return "primary"
|
||||||
|
|
||||||
@property
|
|
||||||
def is_recently_managed(self) -> bool:
|
|
||||||
"""Flag if the package has been recently managed by the user, either un-/installed updated etc"""
|
|
||||||
return self._is_recently_managed
|
|
||||||
|
|
||||||
@is_recently_managed.setter
|
|
||||||
def is_recently_managed(self, value: bool) -> None:
|
|
||||||
if value != self._is_recently_managed:
|
|
||||||
self._is_recently_managed = value
|
|
||||||
self.stateManageButtonChanged.emit()
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_installing(self) -> bool:
|
def is_installing(self) -> bool:
|
||||||
"""Flag is we're currently installing"""
|
"""Flag is we're currently installing"""
|
||||||
@ -351,6 +347,8 @@ class PackageModel(QObject):
|
|||||||
@is_installing.setter
|
@is_installing.setter
|
||||||
def is_installing(self, value: bool) -> None:
|
def is_installing(self, value: bool) -> None:
|
||||||
if value != self._is_installing:
|
if value != self._is_installing:
|
||||||
|
if not value:
|
||||||
|
self._is_recently_installed = True
|
||||||
self._is_installing = value
|
self._is_installing = value
|
||||||
self.stateManageButtonChanged.emit()
|
self.stateManageButtonChanged.emit()
|
||||||
|
|
||||||
@ -372,6 +370,8 @@ class PackageModel(QObject):
|
|||||||
"""The state of the manage Update button for this card """
|
"""The state of the manage Update button for this card """
|
||||||
if self._is_updating:
|
if self._is_updating:
|
||||||
return "busy"
|
return "busy"
|
||||||
|
if self._is_recently_updated:
|
||||||
|
return "confirmed"
|
||||||
if self._can_update:
|
if self._can_update:
|
||||||
return "primary"
|
return "primary"
|
||||||
return "hidden"
|
return "hidden"
|
||||||
@ -384,6 +384,8 @@ class PackageModel(QObject):
|
|||||||
@is_updating.setter
|
@is_updating.setter
|
||||||
def is_updating(self, value: bool) -> None:
|
def is_updating(self, value: bool) -> None:
|
||||||
if value != self._is_updating:
|
if value != self._is_updating:
|
||||||
|
if not value:
|
||||||
|
self._is_recently_updated = True
|
||||||
self._is_updating = value
|
self._is_updating = value
|
||||||
self.stateManageButtonChanged.emit()
|
self.stateManageButtonChanged.emit()
|
||||||
|
|
||||||
|
@ -15,6 +15,8 @@ RowLayout
|
|||||||
property alias secondaryText: secondaryButton.text
|
property alias secondaryText: secondaryButton.text
|
||||||
property string busyPrimaryText: busyMessageText.text
|
property string busyPrimaryText: busyMessageText.text
|
||||||
property string busySecondaryText: busyMessageText.text
|
property string busySecondaryText: busyMessageText.text
|
||||||
|
property string confirmedPrimaryText: confirmedMessageText.text
|
||||||
|
property string confirmedSecondaryText: confirmedMessageText.text
|
||||||
property bool enabled: true
|
property bool enabled: true
|
||||||
property bool busy: state == "busy"
|
property bool busy: state == "busy"
|
||||||
|
|
||||||
@ -28,7 +30,8 @@ RowLayout
|
|||||||
|
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
busyMessageText.text = manageButton.busyPrimaryText
|
busyMessage.text = manageButton.busyPrimaryText
|
||||||
|
confirmedMessage.text = manageButton.confirmedPrimaryText
|
||||||
manageButton.clicked(true)
|
manageButton.clicked(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -41,7 +44,8 @@ RowLayout
|
|||||||
|
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
busyMessageText.text = manageButton.busySecondaryText
|
busyMessage.text = manageButton.busySecondaryText
|
||||||
|
confirmedMessage.text = manageButton.confirmedSecondaryText
|
||||||
manageButton.clicked(false)
|
manageButton.clicked(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -50,6 +54,7 @@ RowLayout
|
|||||||
{
|
{
|
||||||
id: busyMessage
|
id: busyMessage
|
||||||
visible: false
|
visible: false
|
||||||
|
property alias text: busyMessageText.text
|
||||||
height: UM.Theme.getSize("action_button").height
|
height: UM.Theme.getSize("action_button").height
|
||||||
width: childrenRect.width
|
width: childrenRect.width
|
||||||
|
|
||||||
@ -90,6 +95,26 @@ RowLayout
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
id: confirmedMessage
|
||||||
|
property alias text: confirmedMessageText.text
|
||||||
|
|
||||||
|
visible: false
|
||||||
|
height: UM.Theme.getSize("action_button").height
|
||||||
|
width: childrenRect.width
|
||||||
|
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
id: confirmedMessageText
|
||||||
|
visible: parent.visble
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
font: UM.Theme.getFont("medium_bold")
|
||||||
|
color: UM.Theme.getColor("primary")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
states:
|
states:
|
||||||
[
|
[
|
||||||
State
|
State
|
||||||
@ -110,6 +135,11 @@ RowLayout
|
|||||||
target: busyMessage
|
target: busyMessage
|
||||||
visible: false
|
visible: false
|
||||||
}
|
}
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: confirmedMessage
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
State
|
State
|
||||||
{
|
{
|
||||||
@ -129,6 +159,11 @@ RowLayout
|
|||||||
target: busyMessage
|
target: busyMessage
|
||||||
visible: false
|
visible: false
|
||||||
}
|
}
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: confirmedMessage
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
State
|
State
|
||||||
{
|
{
|
||||||
@ -157,6 +192,35 @@ RowLayout
|
|||||||
target: busyMessage
|
target: busyMessage
|
||||||
visible: manageButton.visible
|
visible: manageButton.visible
|
||||||
}
|
}
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: confirmedMessage
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
State
|
||||||
|
{
|
||||||
|
name: "confirmed"
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: primaryButton
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: secondaryButton
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: busyMessage
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: confirmedMessage
|
||||||
|
visible: manageButton.visible
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -326,9 +326,11 @@ Rectangle
|
|||||||
state: packageData.stateManageEnableButton
|
state: packageData.stateManageEnableButton
|
||||||
Layout.alignment: Qt.AlignTop
|
Layout.alignment: Qt.AlignTop
|
||||||
primaryText: catalog.i18nc("@button", "Enable")
|
primaryText: catalog.i18nc("@button", "Enable")
|
||||||
busyPrimaryText: catalog.i18nc("@button", "Inabling...")
|
busyPrimaryText: catalog.i18nc("@button", "Enabling...")
|
||||||
|
confirmedPrimaryText: catalog.i18nc("@button", "Enabled")
|
||||||
secondaryText: catalog.i18nc("@button", "Disable")
|
secondaryText: catalog.i18nc("@button", "Disable")
|
||||||
busySecondaryText: catalog.i18nc("@button", "Disabling...")
|
busySecondaryText: catalog.i18nc("@button", "Disabling...")
|
||||||
|
confirmedSecondaryText: catalog.i18nc("@button", "Disabled")
|
||||||
enabled: !(installManageButton.busy || updateManageButton.busy)
|
enabled: !(installManageButton.busy || updateManageButton.busy)
|
||||||
visible: root.manageableInListView || root.expanded
|
visible: root.manageableInListView || root.expanded
|
||||||
|
|
||||||
@ -351,10 +353,12 @@ Rectangle
|
|||||||
Layout.alignment: Qt.AlignTop
|
Layout.alignment: Qt.AlignTop
|
||||||
primaryText: catalog.i18nc("@button", "Install")
|
primaryText: catalog.i18nc("@button", "Install")
|
||||||
busyPrimaryText: catalog.i18nc("@button", "Installing...")
|
busyPrimaryText: catalog.i18nc("@button", "Installing...")
|
||||||
|
confirmedPrimaryText: catalog.i18nc("@button", "Installed")
|
||||||
secondaryText: catalog.i18nc("@button", "Uninstall")
|
secondaryText: catalog.i18nc("@button", "Uninstall")
|
||||||
busySecondaryText: catalog.i18nc("@button", "Uninstalling...")
|
busySecondaryText: catalog.i18nc("@button", "Uninstalling...")
|
||||||
|
confirmedSecondaryText: catalog.i18nc("@button", "Uninstalled")
|
||||||
enabled: !(enableManageButton.busy || updateManageButton.busy)
|
enabled: !(enableManageButton.busy || updateManageButton.busy)
|
||||||
visible: root.manageableInListView || root.expanded
|
visible: state == "confirmed" || root.manageableInListView || root.expanded
|
||||||
|
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
@ -375,7 +379,8 @@ Rectangle
|
|||||||
state: packageData.stateManageUpdateButton
|
state: packageData.stateManageUpdateButton
|
||||||
Layout.alignment: Qt.AlignTop
|
Layout.alignment: Qt.AlignTop
|
||||||
primaryText: catalog.i18nc("@button", "Update")
|
primaryText: catalog.i18nc("@button", "Update")
|
||||||
busyPrimaryText: catalog.i18nc("@button", "updating...")
|
busyPrimaryText: catalog.i18nc("@button", "Updating...")
|
||||||
|
confirmedPrimaryText: catalog.i18nc("@button", "Updated")
|
||||||
enabled: !(installManageButton.busy || enableManageButton.busy)
|
enabled: !(installManageButton.busy || enableManageButton.busy)
|
||||||
visible: root.manageableInListView || root.expanded
|
visible: root.manageableInListView || root.expanded
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user