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
path: root/cura/UI
diff options
context:
space:
mode:
authorKostas Karmas <konskarm@gmail.com>2020-06-09 16:20:15 +0300
committerKostas Karmas <konskarm@gmail.com>2020-06-09 16:20:15 +0300
commit669dcc62ddc9a091a426d2b3d90c410b56798c90 (patch)
treee255a8ccd0933a2485741d66dfd3e2b5446fd9d8 /cura/UI
parentf0dda6553b5c696b343afc45ea030508a1aa1f6f (diff)
Add extra "AddPrinterPagesModel" without the cancel button
This commit adds an additional AddPrinterPagesModel in Cura that does not have the "Cancel" button in the "Add Printer" page. To achieve that, the AddPrinterPagesModel is modified so that its initialize function decides whether or not it will add the cancel button. If Cura ends up in a state without an active machine, the AddPrinters dialog will open up using the showAddPrintersUncancellableDialog signal and display the new "Uncancellable" (is this a word?) AddPrinterPagesModel, so that the dialog cannot be dismissed. If Cura is closed at that point, the next time it is initiated, if the user is logged in and there is no ActiveMachine, then instead of displaying the entire WelcomePages wizard, it will show the uncancellable AddPrinterPagesModel, forcing the user to add a printer. CURA-7454
Diffstat (limited to 'cura/UI')
-rw-r--r--cura/UI/AddPrinterPagesModel.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/cura/UI/AddPrinterPagesModel.py b/cura/UI/AddPrinterPagesModel.py
index b06f220374..9b35dbcacc 100644
--- a/cura/UI/AddPrinterPagesModel.py
+++ b/cura/UI/AddPrinterPagesModel.py
@@ -10,12 +10,11 @@ from .WelcomePagesModel import WelcomePagesModel
#
class AddPrinterPagesModel(WelcomePagesModel):
- def initialize(self) -> None:
+ def initialize(self, cancellable: bool = True) -> None:
self._pages.append({"id": "add_network_or_local_printer",
"page_url": self._getBuiltinWelcomePagePath("AddNetworkOrLocalPrinterContent.qml"),
"next_page_id": "machine_actions",
"next_page_button_text": self._catalog.i18nc("@action:button", "Add"),
- "previous_page_button_text": self._catalog.i18nc("@action:button", "Cancel"),
})
self._pages.append({"id": "add_printer_by_ip",
"page_url": self._getBuiltinWelcomePagePath("AddPrinterByIpContent.qml"),
@@ -30,6 +29,9 @@ class AddPrinterPagesModel(WelcomePagesModel):
"page_url": self._getBuiltinWelcomePagePath("FirstStartMachineActionsContent.qml"),
"should_show_function": self.shouldShowMachineActions,
})
+ if cancellable:
+ self._pages[0]["previous_page_button_text"] = self._catalog.i18nc("@action:button", "Cancel")
+
self.setItems(self._pages)