Small code improvements

This commit is contained in:
ChrisTerBeke 2018-05-15 13:28:33 +02:00
parent 82a1c95d98
commit c9145c6661
2 changed files with 5 additions and 7 deletions

View File

@ -18,13 +18,11 @@ Column
readyLabel: catalog.i18nc("@action:button", "Update") readyLabel: catalog.i18nc("@action:button", "Update")
activeLabel: catalog.i18nc("@action:button", "Updating") activeLabel: catalog.i18nc("@action:button", "Updating")
completeLabel: catalog.i18nc("@action:button", "Updated") completeLabel: catalog.i18nc("@action:button", "Updated")
readyAction: function() { readyAction: {
toolbox.activePackage = model toolbox.activePackage = model
toolbox.update(model.id) toolbox.update(model.id)
} }
activeAction: function() { activeAction: toolbox.cancelDownload()
toolbox.cancelDownload()
}
// Don't allow installing while another download is running // Don't allow installing while another download is running
enabled: !(toolbox.isDownloading && toolbox.activePackage != model) enabled: !(toolbox.isDownloading && toolbox.activePackage != model)
opacity: enabled ? 1.0 : 0.5 opacity: enabled ? 1.0 : 0.5

View File

@ -313,9 +313,9 @@ class Toolbox(QObject, Extension):
if remote_package is None: if remote_package is None:
return False return False
local_version = local_package["package_version"] local_version = Version(local_package["package_version"])
remote_version = remote_package["package_version"] remote_version = Version(remote_package["package_version"])
return Version(remote_version) > Version(local_version) return remote_version > local_version
@pyqtSlot(str, result = bool) @pyqtSlot(str, result = bool)
def isInstalled(self, package_id: str) -> bool: def isInstalled(self, package_id: str) -> bool: