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:
authorc.lamboo <casperlamboo@gmail.com>2022-08-31 00:15:54 +0300
committerc.lamboo <casperlamboo@gmail.com>2022-08-31 00:15:54 +0300
commitac732e960483b74d7e62dc919f49ab3b6c708286 (patch)
tree404449b92d2c566e7c9f8c8868e77f6730ae7203 /cura/Machines
parent401170d8dd184ccd297b01c77a8b3e4f706d8959 (diff)
Add button to hide/show connected printersCURA-9514
CURA-9514
Diffstat (limited to 'cura/Machines')
-rw-r--r--cura/Machines/Models/MachineListModel.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/cura/Machines/Models/MachineListModel.py b/cura/Machines/Models/MachineListModel.py
index 6814600307..9b1ffd16c6 100644
--- a/cura/Machines/Models/MachineListModel.py
+++ b/cura/Machines/Models/MachineListModel.py
@@ -5,7 +5,7 @@
# online cloud connected printers are represented within this ListModel. Additional information such as the number of
# connected printers for each printer type is gathered.
-from PyQt6.QtCore import Qt, QTimer
+from PyQt6.QtCore import Qt, QTimer, pyqtSlot, pyqtProperty, pyqtSignal
from UM.Qt.ListModel import ListModel
from UM.Settings.ContainerStack import ContainerStack
@@ -29,6 +29,8 @@ class MachineListModel(ListModel):
def __init__(self, parent=None) -> None:
super().__init__(parent)
+ self._show_cloud_printers = True
+
self._catalog = i18nCatalog("cura")
self.addRoleName(self.NameRole, "name")
@@ -50,6 +52,18 @@ class MachineListModel(ListModel):
CuraContainerRegistry.getInstance().containerRemoved.connect(self._onContainerChanged)
self._updateDelayed()
+ showCloutPrintersChanged = pyqtSignal(bool)
+
+ @pyqtProperty(bool, notify=showCloutPrintersChanged)
+ def showCloudPrinters(self) -> bool:
+ return self._show_cloud_printers
+
+ @pyqtSlot(bool, name="setShowCloudPrinters")
+ def set_show_cloud_printers(self, show_cloud_printers: bool) -> None:
+ self._show_cloud_printers = show_cloud_printers
+ self._updateDelayed()
+ self.showCloutPrintersChanged.emit(show_cloud_printers)
+
def _onContainerChanged(self, container) -> None:
"""Handler for container added/removed events from registry"""
@@ -80,7 +94,8 @@ class MachineListModel(ListModel):
# Create list of machines that are children of the abstract machine
for stack in online_machine_stacks:
- self.addItem(stack)
+ if self._show_cloud_printers:
+ self.addItem(stack)
# Remove this machine from the other stack list
other_machine_stacks.remove(stack)