mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-24 23:23:57 -06:00
CURA-5357 Prevent uninstall of plugins that are not-yet-installed
This commit is contained in:
parent
2fbcc22123
commit
74ba10444e
3 changed files with 18 additions and 3 deletions
|
@ -158,14 +158,17 @@ class CuraPackageManager(QObject):
|
||||||
# Add bundled plugins
|
# Add bundled plugins
|
||||||
if package_id in self._bundled_package_dict:
|
if package_id in self._bundled_package_dict:
|
||||||
package_info = self._bundled_package_dict[package_id]["package_info"]
|
package_info = self._bundled_package_dict[package_id]["package_info"]
|
||||||
|
package_info["is_installed"] = True
|
||||||
|
|
||||||
# Add installed plugins
|
# Add installed plugins
|
||||||
if package_id in self._installed_package_dict:
|
if package_id in self._installed_package_dict:
|
||||||
package_info = self._installed_package_dict[package_id]["package_info"]
|
package_info = self._installed_package_dict[package_id]["package_info"]
|
||||||
|
package_info["is_installed"] = True
|
||||||
|
|
||||||
# Add to install plugins
|
# Add to install plugins
|
||||||
if package_id in self._to_install_package_dict:
|
if package_id in self._to_install_package_dict:
|
||||||
package_info = self._to_install_package_dict[package_id]["package_info"]
|
package_info = self._to_install_package_dict[package_id]["package_info"]
|
||||||
|
package_info["is_installed"] = False
|
||||||
|
|
||||||
if package_info is None:
|
if package_info is None:
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -13,6 +13,16 @@ Column
|
||||||
width: UM.Theme.getSize("toolbox_action_button").width
|
width: UM.Theme.getSize("toolbox_action_button").width
|
||||||
spacing: UM.Theme.getSize("narrow_margin").height
|
spacing: UM.Theme.getSize("narrow_margin").height
|
||||||
|
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
visible: !model.is_installed
|
||||||
|
text: catalog.i18nc("@label", "Will install upon restarting")
|
||||||
|
color: UM.Theme.getColor("lining")
|
||||||
|
font: UM.Theme.getFont("default")
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
width: parent.width
|
||||||
|
}
|
||||||
|
|
||||||
ToolboxProgressButton
|
ToolboxProgressButton
|
||||||
{
|
{
|
||||||
id: updateButton
|
id: updateButton
|
||||||
|
@ -39,7 +49,7 @@ Column
|
||||||
{
|
{
|
||||||
id: removeButton
|
id: removeButton
|
||||||
text: canDowngrade ? catalog.i18nc("@action:button", "Downgrade") : catalog.i18nc("@action:button", "Uninstall")
|
text: canDowngrade ? catalog.i18nc("@action:button", "Downgrade") : catalog.i18nc("@action:button", "Uninstall")
|
||||||
visible: !model.is_bundled
|
visible: !model.is_bundled && model.is_installed
|
||||||
enabled: !toolbox.isDownloading
|
enabled: !toolbox.isDownloading
|
||||||
style: ButtonStyle
|
style: ButtonStyle
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,8 +29,9 @@ class PackagesModel(ListModel):
|
||||||
self.addRoleName(Qt.UserRole + 12, "last_updated")
|
self.addRoleName(Qt.UserRole + 12, "last_updated")
|
||||||
self.addRoleName(Qt.UserRole + 13, "is_bundled")
|
self.addRoleName(Qt.UserRole + 13, "is_bundled")
|
||||||
self.addRoleName(Qt.UserRole + 14, "is_enabled")
|
self.addRoleName(Qt.UserRole + 14, "is_enabled")
|
||||||
self.addRoleName(Qt.UserRole + 15, "has_configs")
|
self.addRoleName(Qt.UserRole + 15, "is_installed") # Scheduled pkgs are included in the model but should not be marked as actually installed
|
||||||
self.addRoleName(Qt.UserRole + 16, "supported_configs")
|
self.addRoleName(Qt.UserRole + 16, "has_configs")
|
||||||
|
self.addRoleName(Qt.UserRole + 17, "supported_configs")
|
||||||
|
|
||||||
# List of filters for queries. The result is the union of the each list of results.
|
# List of filters for queries. The result is the union of the each list of results.
|
||||||
self._filter = {} # type: Dict[str, str]
|
self._filter = {} # type: Dict[str, str]
|
||||||
|
@ -73,6 +74,7 @@ class PackagesModel(ListModel):
|
||||||
"last_updated": package["last_updated"] if "last_updated" in package else None,
|
"last_updated": package["last_updated"] if "last_updated" in package else None,
|
||||||
"is_bundled": package["is_bundled"] if "is_bundled" in package else False,
|
"is_bundled": package["is_bundled"] if "is_bundled" in package else False,
|
||||||
"is_enabled": package["is_enabled"] if "is_enabled" in package else False,
|
"is_enabled": package["is_enabled"] if "is_enabled" in package else False,
|
||||||
|
"is_installed": package["is_installed"] if "is_installed" in package else False,
|
||||||
"has_configs": has_configs,
|
"has_configs": has_configs,
|
||||||
"supported_configs": configs_model
|
"supported_configs": configs_model
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue