mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Adding functionality to the manageButtons
Contributes to: CURA-8587
This commit is contained in:
parent
327b434788
commit
ff5a4a4f5a
4 changed files with 34 additions and 4 deletions
|
@ -60,7 +60,9 @@ class LocalPackageList(PackageList):
|
|||
bundled_or_installed = "installed" if self._manager.isUserInstalledPackage(package_info["package_id"]) else "bundled"
|
||||
package_type = package_info["package_type"]
|
||||
section_title = self.PACKAGE_CATEGORIES[bundled_or_installed][package_type]
|
||||
return PackageModel(package_info, section_title = section_title, parent = self)
|
||||
package = PackageModel(package_info, section_title = section_title, parent = self)
|
||||
self._connectManageButtonSignals(package)
|
||||
return package
|
||||
|
||||
def checkForUpdates(self, packages: List[Dict[str, Any]]):
|
||||
installed_packages = "installed_packages=".join([f"{package['package_id']}:{package['package_version']}&" for package in packages])
|
||||
|
|
|
@ -101,3 +101,30 @@ class PackageList(ListModel):
|
|||
""" Indicating if the PackageList should have a Footer visible. For paginated PackageLists
|
||||
:return: ``True`` if a Footer should be displayed in the ListView, e.q.: paginated lists, ``False`` Otherwise"""
|
||||
return self._has_footer
|
||||
|
||||
def _connectManageButtonSignals(self, package):
|
||||
package.installPackageTriggered.connect(self.installPackage)
|
||||
package.uninstallPackageTriggered.connect(self.uninstallPackage)
|
||||
package.updatePackageTriggered.connect(self.updatePackage)
|
||||
package.enablePackageTriggered.connect(self.enablePackage)
|
||||
package.disablePackageTriggered.connect(self.disablePackage)
|
||||
|
||||
@pyqtSlot(str)
|
||||
def installPackage(self, package_id):
|
||||
Logger.debug(f"Installing {package_id}")
|
||||
|
||||
@pyqtSlot(str)
|
||||
def uninstallPackage(self, package_id):
|
||||
Logger.debug(f"Uninstalling {package_id}")
|
||||
|
||||
@pyqtSlot(str)
|
||||
def updatePackage(self, package_id):
|
||||
Logger.debug(f"Updating {package_id}")
|
||||
|
||||
@pyqtSlot(str)
|
||||
def enablePackage(self, package_id):
|
||||
Logger.debug(f"Enabling {package_id}")
|
||||
|
||||
@pyqtSlot(str)
|
||||
def disablePackage(self, package_id):
|
||||
Logger.debug(f"Disabling {package_id}")
|
||||
|
|
|
@ -133,6 +133,7 @@ class RemotePackageList(PackageList):
|
|||
continue # We should only show packages which are not already installed
|
||||
try:
|
||||
package = PackageModel(package_data, parent = self)
|
||||
self._connectManageButtonSignals(package)
|
||||
self.appendItem({"package": package}) # Add it to this list model.
|
||||
except RuntimeError:
|
||||
# Setting the ownership of this object to not qml can still result in a RuntimeError. Which can occur when quickly toggling
|
||||
|
|
|
@ -17,7 +17,7 @@ RowLayout
|
|||
property string busySecondaryText: busyMessageText.text
|
||||
property string mainState: "primary"
|
||||
|
||||
signal clicked
|
||||
signal clicked(bool primary_action)
|
||||
|
||||
state: mainState
|
||||
|
||||
|
@ -28,7 +28,7 @@ RowLayout
|
|||
|
||||
onClicked:
|
||||
{
|
||||
manageButton.clicked()
|
||||
manageButton.clicked(true)
|
||||
manageButton.state = "busy"
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ RowLayout
|
|||
|
||||
onClicked:
|
||||
{
|
||||
manageButton.clicked()
|
||||
manageButton.clicked(false)
|
||||
manageButton.state = "busy"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue