mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Enable or disable a plugin functionality added
Contributes to: CURA-8587
This commit is contained in:
parent
ea85e59e50
commit
579cc7bdbc
2 changed files with 16 additions and 4 deletions
|
@ -11,6 +11,7 @@ from UM.Qt.ListModel import ListModel
|
|||
from UM.TaskManagement.HttpRequestScope import JsonDecoratorScope
|
||||
from UM.TaskManagement.HttpRequestManager import HttpRequestData, HttpRequestManager
|
||||
from UM.Logger import Logger
|
||||
from UM import PluginRegistry
|
||||
|
||||
from cura.CuraApplication import CuraApplication
|
||||
from cura import CuraPackageManager
|
||||
|
@ -35,6 +36,7 @@ class PackageList(ListModel):
|
|||
def __init__(self, parent: Optional["QObject"] = None) -> None:
|
||||
super().__init__(parent)
|
||||
self._manager: CuraPackageManager = CuraApplication.getInstance().getPackageManager()
|
||||
self._plugin_registry: PluginRegistry = CuraApplication.getInstance().getPluginRegistry()
|
||||
self._account = CuraApplication.getInstance().getCuraAPI().account
|
||||
self._error_message = ""
|
||||
self.addRoleName(self.PackageRole, "package")
|
||||
|
@ -229,7 +231,8 @@ class PackageList(ListModel):
|
|||
package = self.getPackageModel(package_id)
|
||||
package.is_enabling = True
|
||||
Logger.debug(f"Enabling {package_id}")
|
||||
# TODO: implement enabling functionality
|
||||
self._plugin_registry.enablePlugin(package_id)
|
||||
package.is_active = True
|
||||
package.is_enabling = False
|
||||
|
||||
@pyqtSlot(str)
|
||||
|
@ -237,5 +240,6 @@ class PackageList(ListModel):
|
|||
package = self.getPackageModel(package_id)
|
||||
package.is_enabling = True
|
||||
Logger.debug(f"Disabling {package_id}")
|
||||
# TODO: implement disabling functionality
|
||||
self._plugin_registry.disablePlugin(package_id)
|
||||
package.is_active = False
|
||||
package.is_enabling = False
|
||||
|
|
|
@ -287,8 +287,6 @@ class PackageModel(QObject):
|
|||
if self._is_recently_managed:
|
||||
return "hidden"
|
||||
if self._package_type == "material":
|
||||
if self._is_bundled: # TODO: Check if a bundled material can/should be un-/install en-/disabled
|
||||
return "secondary"
|
||||
return "hidden"
|
||||
if not self._is_installed:
|
||||
return "hidden"
|
||||
|
@ -306,6 +304,16 @@ class PackageModel(QObject):
|
|||
self._is_enabling = value
|
||||
self.stateManageButtonChanged.emit()
|
||||
|
||||
@property
|
||||
def is_active(self) -> bool:
|
||||
return self._is_active
|
||||
|
||||
@is_active.setter
|
||||
def is_active(self, value: bool) -> None:
|
||||
if value != self._is_active:
|
||||
self._is_active = value
|
||||
self.stateManageButtonChanged.emit()
|
||||
|
||||
# --- Installing ---
|
||||
|
||||
@pyqtProperty(str, notify = stateManageButtonChanged)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue