mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 07:33:57 -06:00
Introduce the SyncOrchestrator
CURA-6983
This commit is contained in:
parent
6eab5e2492
commit
1a816ad010
8 changed files with 84 additions and 21 deletions
33
plugins/Toolbox/src/CloudSync/DiscrepanciesPresenter.py
Normal file
33
plugins/Toolbox/src/CloudSync/DiscrepanciesPresenter.py
Normal file
|
@ -0,0 +1,33 @@
|
|||
import os
|
||||
from typing import Optional
|
||||
|
||||
from PyQt5.QtCore import QObject
|
||||
|
||||
from UM.Qt.QtApplication import QtApplication
|
||||
from UM.Signal import Signal
|
||||
from plugins.Toolbox.src.CloudSync.SubscribedPackagesModel import SubscribedPackagesModel
|
||||
|
||||
|
||||
## Shows a list of packages to be added or removed. The user can select which packages to (un)install. The user's
|
||||
# choices are emitted on the `packageMutations` Signal.
|
||||
class DiscrepanciesPresenter(QObject):
|
||||
|
||||
def __init__(self, app: QtApplication):
|
||||
super().__init__(app)
|
||||
|
||||
self.packageMutations = Signal() # {"SettingsGuide" : "install", "PrinterSettings" : "uninstall"}
|
||||
|
||||
self._app = app
|
||||
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.accepted.connect(lambda: self._onConfirmClicked(model))
|
||||
|
||||
def _onConfirmClicked(self, model: SubscribedPackagesModel):
|
||||
# For now, all packages presented to the user should be installed.
|
||||
# Later, we will support uninstall ?or ignoring? of a certain package
|
||||
choices = {item["package_id"]: "install" for item in model.items}
|
||||
self.packageMutations.emit(choices)
|
Loading…
Add table
Add a link
Reference in a new issue