AddPrinterPagesModel.py 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # Copyright (c) 2021 Ultimaker B.V.
  2. # Cura is released under the terms of the LGPLv3 or higher.
  3. from typing import Optional
  4. from .WelcomePagesModel import WelcomePagesModel
  5. class AddPrinterPagesModel(WelcomePagesModel):
  6. """This Qt ListModel is more or less the same the WelcomePagesModel, except that this model is only for adding a
  7. printer, so only the steps for adding a printer is included.
  8. """
  9. def __init__(self, application: "CuraApplication") -> None:
  10. super(AddPrinterPagesModel, self).__init__(application = application)
  11. def initialize(self, cancellable: bool = True) -> None:
  12. self._pages.append({"id": "add_network_or_local_printer",
  13. "page_url": self._getBuiltinWelcomePagePath("AddNetworkOrLocalPrinterContent.qml"),
  14. "next_page_id": "machine_actions",
  15. "next_page_button_text": self._catalog.i18nc("@action:button", "Add"),
  16. })
  17. self._pages.append({"id": "add_printer_by_ip",
  18. "page_url": self._getBuiltinWelcomePagePath("AddPrinterByIpContent.qml"),
  19. "next_page_id": "machine_actions",
  20. })
  21. self._pages.append({"id": "add_cloud_printers",
  22. "page_url": self._getBuiltinWelcomePagePath("AddCloudPrintersView.qml"),
  23. "is_final_page": True,
  24. "next_page_button_text": self._catalog.i18nc("@action:button", "Finish"),
  25. })
  26. self._pages.append({"id": "machine_actions",
  27. "page_url": self._getBuiltinWelcomePagePath("FirstStartMachineActionsContent.qml"),
  28. "should_show_function": self.shouldShowMachineActions,
  29. })
  30. if cancellable:
  31. self._pages[0]["previous_page_button_text"] = self._catalog.i18nc("@action:button", "Cancel")
  32. self.setItems(self._pages)
  33. __all__ = ["AddPrinterPagesModel"]