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

@ -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