Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/RemovableDriveOutputDevice/WindowsRemovableDrivePlugin.py3
-rw-r--r--plugins/Toolbox/src/CloudSync/CloudPackageChecker.py2
-rw-r--r--plugins/Toolbox/src/CloudSync/SubscribedPackagesModel.py17
3 files changed, 13 insertions, 9 deletions
diff --git a/plugins/RemovableDriveOutputDevice/WindowsRemovableDrivePlugin.py b/plugins/RemovableDriveOutputDevice/WindowsRemovableDrivePlugin.py
index c89bd31e21..8a183c25f4 100644
--- a/plugins/RemovableDriveOutputDevice/WindowsRemovableDrivePlugin.py
+++ b/plugins/RemovableDriveOutputDevice/WindowsRemovableDrivePlugin.py
@@ -47,7 +47,10 @@ class WindowsRemovableDrivePlugin(RemovableDrivePlugin.RemovableDrivePlugin):
def checkRemovableDrives(self):
drives = {}
+ # The currently available disk drives, e.g.: bitmask = ...1100 <-- ...DCBA
bitmask = ctypes.windll.kernel32.GetLogicalDrives()
+ # Since we are ignoring drives A and B, the bitmask has has to shift twice to the right
+ bitmask >>= 2
# Check possible drive letters, from C to Z
# Note: using ascii_uppercase because we do not want this to change with locale!
# Skip A and B, since those drives are typically reserved for floppy disks.
diff --git a/plugins/Toolbox/src/CloudSync/CloudPackageChecker.py b/plugins/Toolbox/src/CloudSync/CloudPackageChecker.py
index 14db1a992d..f848f818d7 100644
--- a/plugins/Toolbox/src/CloudSync/CloudPackageChecker.py
+++ b/plugins/Toolbox/src/CloudSync/CloudPackageChecker.py
@@ -83,7 +83,7 @@ class CloudPackageChecker(QObject):
package_discrepancy = list(set(user_subscribed_packages).difference(user_installed_packages))
if package_discrepancy:
self._model.addDiscrepancies(package_discrepancy)
- self._model.initialize(subscribed_packages_payload)
+ self._model.initialize(self._package_manager, subscribed_packages_payload)
self._handlePackageDiscrepancies()
def _handlePackageDiscrepancies(self) -> None:
diff --git a/plugins/Toolbox/src/CloudSync/SubscribedPackagesModel.py b/plugins/Toolbox/src/CloudSync/SubscribedPackagesModel.py
index 614d397d91..db16c5ea84 100644
--- a/plugins/Toolbox/src/CloudSync/SubscribedPackagesModel.py
+++ b/plugins/Toolbox/src/CloudSync/SubscribedPackagesModel.py
@@ -2,9 +2,12 @@
# Cura is released under the terms of the LGPLv3 or higher.
from PyQt5.QtCore import Qt, pyqtProperty, pyqtSlot
+
+from UM.PackageManager import PackageManager
from UM.Qt.ListModel import ListModel
+from UM.Version import Version
+
from cura import ApplicationMetadata
-from UM.Logger import Logger
from typing import List, Dict, Any
@@ -46,7 +49,7 @@ class SubscribedPackagesModel(ListModel):
def getIncompatiblePackages(self) -> List[str]:
return [package["package_id"] for package in self._items if not package["is_compatible"]]
- def initialize(self, subscribed_packages_payload: List[Dict[str, Any]]) -> None:
+ def initialize(self, package_manager: PackageManager, subscribed_packages_payload: List[Dict[str, Any]]) -> None:
self._items.clear()
for item in subscribed_packages_payload:
if item["package_id"] not in self._discrepancies:
@@ -59,15 +62,13 @@ class SubscribedPackagesModel(ListModel):
"md5_hash": item["md5_hash"],
"is_dismissed": False,
}
- if self._sdk_version not in item["sdk_versions"]:
- package.update({"is_compatible": False})
- else:
- package.update({"is_compatible": True})
+
+ compatible = any(package_manager.isPackageCompatible(Version(version)) for version in item["sdk_versions"])
+ package.update({"is_compatible": compatible})
+
try:
package.update({"icon_url": item["icon_url"]})
except KeyError: # There is no 'icon_url" in the response payload for this package
package.update({"icon_url": ""})
self._items.append(package)
self.setItems(self._items)
-
-