mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-09 07:56:22 -06:00
Removed unnecessary function and a call to it. Added some typing.
CURA-7090
This commit is contained in:
parent
7359492e11
commit
e8f22beb27
2 changed files with 4 additions and 13 deletions
|
@ -5,7 +5,7 @@ from PyQt5.QtCore import Qt
|
||||||
from UM.Qt.ListModel import ListModel
|
from UM.Qt.ListModel import ListModel
|
||||||
from cura import ApplicationMetadata
|
from cura import ApplicationMetadata
|
||||||
from UM.Logger import Logger
|
from UM.Logger import Logger
|
||||||
from typing import List
|
from typing import List, Dict, Any
|
||||||
|
|
||||||
|
|
||||||
class SubscribedPackagesModel(ListModel):
|
class SubscribedPackagesModel(ListModel):
|
||||||
|
@ -23,12 +23,12 @@ class SubscribedPackagesModel(ListModel):
|
||||||
self.addRoleName(Qt.UserRole + 4, "is_compatible")
|
self.addRoleName(Qt.UserRole + 4, "is_compatible")
|
||||||
self.addRoleName(Qt.UserRole + 5, "is_dismissed")
|
self.addRoleName(Qt.UserRole + 5, "is_dismissed")
|
||||||
|
|
||||||
def setMetadata(self, data) -> None:
|
def setMetadata(self, data: List[Dict[str, List[Any]]]) -> None:
|
||||||
if self._metadata != data:
|
if self._metadata != data:
|
||||||
self._metadata = data
|
self._metadata = data
|
||||||
|
|
||||||
def addDiscrepancies(self, discrepancy: List[str]) -> None:
|
def addDiscrepancies(self, discrepancy: List[str]) -> None:
|
||||||
if self._discrepancies != discrepancy:
|
if set(self._discrepancies) != set(discrepancy): # convert to set() to check if they are same list, regardless of list order
|
||||||
self._discrepancies = discrepancy
|
self._discrepancies = discrepancy
|
||||||
|
|
||||||
def initialize(self) -> None:
|
def initialize(self) -> None:
|
||||||
|
@ -73,10 +73,3 @@ class SubscribedPackagesModel(ListModel):
|
||||||
if package != -1:
|
if package != -1:
|
||||||
self.setProperty(package, property="is_dismissed", value=True)
|
self.setProperty(package, property="is_dismissed", value=True)
|
||||||
Logger.debug("Package {} has been dismissed".format(package_id))
|
Logger.debug("Package {} has been dismissed".format(package_id))
|
||||||
|
|
||||||
# Reads the dismissed_packages from user config file and applies them so they won't be shown in the Compatibility Dialog
|
|
||||||
def applyDismissedPackages(self, dismissed_packages: List[str]) -> None:
|
|
||||||
for package in dismissed_packages:
|
|
||||||
exists = self.find(key="package_id", value=package)
|
|
||||||
if exists != -1:
|
|
||||||
self.setProperty(exists, property="is_dismissed", value=True)
|
|
||||||
|
|
|
@ -676,8 +676,7 @@ class Toolbox(QObject, Extension):
|
||||||
if package_discrepancy:
|
if package_discrepancy:
|
||||||
self._models["subscribed_packages"].addDiscrepancies(package_discrepancy)
|
self._models["subscribed_packages"].addDiscrepancies(package_discrepancy)
|
||||||
self._models["subscribed_packages"].initialize()
|
self._models["subscribed_packages"].initialize()
|
||||||
self._models["subscribed_packages"].applyDismissedPackages(user_dismissed_packages)
|
Logger.debug("Discrepancy found between Cloud subscribed packages and Cura installed packages")
|
||||||
Logger.log("d", "Discrepancy found between Cloud subscribed packages and Cura installed packages")
|
|
||||||
sync_message = Message(i18n_catalog.i18nc(
|
sync_message = Message(i18n_catalog.i18nc(
|
||||||
"@info:generic",
|
"@info:generic",
|
||||||
"\nDo you want to sync material and software packages with your account?"),
|
"\nDo you want to sync material and software packages with your account?"),
|
||||||
|
@ -688,7 +687,6 @@ class Toolbox(QObject, Extension):
|
||||||
icon="",
|
icon="",
|
||||||
description="Sync your Cloud subscribed packages to your local environment.",
|
description="Sync your Cloud subscribed packages to your local environment.",
|
||||||
button_align=Message.ActionButtonAlignment.ALIGN_RIGHT)
|
button_align=Message.ActionButtonAlignment.ALIGN_RIGHT)
|
||||||
|
|
||||||
sync_message.actionTriggered.connect(self._onSyncButtonClicked)
|
sync_message.actionTriggered.connect(self._onSyncButtonClicked)
|
||||||
sync_message.show()
|
sync_message.show()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue