Fix merge issues

CURA-6983
This commit is contained in:
Nino van Hooff 2020-01-15 16:14:17 +01:00
parent 182bab6467
commit 248a4cbb94
4 changed files with 15 additions and 12 deletions

View file

@ -44,13 +44,15 @@ class CloudPackageChecker(QObject):
def _handleCompatibilityData(self, json_data) -> None:
user_subscribed_packages = [plugin["package_id"] for plugin in json_data]
user_installed_packages = self._package_manager.getUserInstalledPackages()
# We check if there are packages installed in Cloud Marketplace but not in Cura marketplace (discrepancy)
user_dismissed_packages = self._package_manager.getDismissedPackages()
if user_dismissed_packages:
user_installed_packages += user_dismissed_packages
# We check if there are packages installed in Cloud Marketplace but not in Cura marketplace
package_discrepancy = list(set(user_subscribed_packages).difference(user_installed_packages))
self._model.setMetadata(json_data)
self._model.addValue(package_discrepancy)
self._model.update()
self._model.addDiscrepancies(package_discrepancy)
self._model.initialize()
if package_discrepancy:
self._handlePackageDiscrepancies()

View file

@ -1,7 +1,7 @@
import os
from typing import Optional, Dict
from PyQt5.QtCore import QObject
from PyQt5.QtCore import QObject, pyqtSlot
from UM.Qt.QtApplication import QtApplication
from UM.Signal import Signal
@ -18,15 +18,21 @@ class DiscrepanciesPresenter(QObject):
self.packageMutations = Signal() # Emits SubscribedPackagesModel
self._app = app
self._package_manager = app.getPackageManager()
self._dialog = None # type: Optional[QObject]
self._compatibility_dialog_path = "resources/qml/dialogs/CompatibilityDialog.qml"
def present(self, plugin_path: str, model: SubscribedPackagesModel):
path = os.path.join(plugin_path, self._compatibility_dialog_path)
self._dialog = self._app.createQmlComponent(path, {"subscribedPackagesModel": model})
self._dialog = self._app.createQmlComponent(path, {"subscribedPackagesModel": model, "handler": self})
assert self._dialog
self._dialog.accepted.connect(lambda: self._onConfirmClicked(model))
@pyqtSlot("QVariant", str)
def dismissIncompatiblePackage(self, model: SubscribedPackagesModel, package_id: str):
model.dismissPackage(package_id) # update the model to update the view
self._package_manager.dismissPackage(package_id) # adds this package_id as dismissed in the user config file
def _onConfirmClicked(self, model: SubscribedPackagesModel):
# For now, all compatible packages presented to the user should be installed.
# Later, we might remove items for which the user unselected the package

View file

@ -528,11 +528,6 @@ class Toolbox(QObject, Extension):
populated += 1
return populated == len(self._server_response_data.items())
@pyqtSlot(str)
def dismissIncompatiblePackage(self, package_id: str):
self._models["subscribed_packages"].dismissPackage(package_id) # sets "is_compatible" to True, in-memory
self._package_manager.dismissPackage(package_id) # adds this package_id as dismissed in the user config file
# Make API Calls
# --------------------------------------------------------------------------
def _makeRequestByType(self, request_type: str) -> None: