mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-09 14:55:03 -06:00
Merge pull request #7539 from Ultimaker/CURA-7019_Move_sign_in_screen_in_front_of_add_printer_in_first_run_wizard
Cura 7019 move sign in screen in front of add printer in first run wizard
This commit is contained in:
commit
3ba284b36c
4 changed files with 76 additions and 35 deletions
|
@ -29,10 +29,12 @@ class Account(QObject):
|
|||
# Signal emitted when user logged in or out.
|
||||
loginStateChanged = pyqtSignal(bool)
|
||||
accessTokenChanged = pyqtSignal()
|
||||
cloudPrintersDetectedChanged = pyqtSignal(bool)
|
||||
|
||||
def __init__(self, application: "CuraApplication", parent = None) -> None:
|
||||
super().__init__(parent)
|
||||
self._application = application
|
||||
self._new_cloud_printers_detected = False
|
||||
|
||||
self._error_message = None # type: Optional[Message]
|
||||
self._logged_in = False
|
||||
|
@ -74,6 +76,10 @@ class Account(QObject):
|
|||
def isLoggedIn(self) -> bool:
|
||||
return self._logged_in
|
||||
|
||||
@pyqtProperty(bool, notify=cloudPrintersDetectedChanged)
|
||||
def newCloudPrintersDetected(self) -> bool:
|
||||
return self._new_cloud_printers_detected
|
||||
|
||||
def _onLoginStateChanged(self, logged_in: bool = False, error_message: Optional[str] = None) -> None:
|
||||
if error_message:
|
||||
if self._error_message:
|
||||
|
|
|
@ -243,6 +243,10 @@ class WelcomePagesModel(ListModel):
|
|||
{"id": "data_collections",
|
||||
"page_url": self._getBuiltinWelcomePagePath("DataCollectionsContent.qml"),
|
||||
},
|
||||
{"id": "cloud",
|
||||
"page_url": self._getBuiltinWelcomePagePath("CloudContent.qml"),
|
||||
"should_show_function": self.shouldShowCloudPage,
|
||||
},
|
||||
{"id": "add_network_or_local_printer",
|
||||
"page_url": self._getBuiltinWelcomePagePath("AddNetworkOrLocalPrinterContent.qml"),
|
||||
"next_page_id": "machine_actions",
|
||||
|
@ -253,12 +257,8 @@ class WelcomePagesModel(ListModel):
|
|||
},
|
||||
{"id": "machine_actions",
|
||||
"page_url": self._getBuiltinWelcomePagePath("FirstStartMachineActionsContent.qml"),
|
||||
"next_page_id": "cloud",
|
||||
"should_show_function": self.shouldShowMachineActions,
|
||||
},
|
||||
{"id": "cloud",
|
||||
"page_url": self._getBuiltinWelcomePagePath("CloudContent.qml"),
|
||||
},
|
||||
]
|
||||
|
||||
pages_to_show = all_pages_list
|
||||
|
@ -287,6 +287,17 @@ class WelcomePagesModel(ListModel):
|
|||
first_start_actions = self._application.getMachineActionManager().getFirstStartActions(definition_id)
|
||||
return len([action for action in first_start_actions if action.needsUserInteraction()]) > 0
|
||||
|
||||
def shouldShowCloudPage(self) -> bool:
|
||||
"""
|
||||
The cloud page should be shown only if the user is not logged in
|
||||
|
||||
:return: True if the user is not logged in, False if he/she is
|
||||
"""
|
||||
# Import CuraApplication locally or else it fails
|
||||
from cura.CuraApplication import CuraApplication
|
||||
api = CuraApplication.getInstance().getCuraAPI()
|
||||
return not api.account.isLoggedIn
|
||||
|
||||
def addPage(self) -> None:
|
||||
pass
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue