mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-09 07:56:22 -06:00
Fix update should show logic
CURA-6447
This commit is contained in:
parent
0665076018
commit
01c0fe1ffb
1 changed files with 18 additions and 16 deletions
|
@ -202,29 +202,31 @@ class WelcomePagesModel(ListModel):
|
|||
# FIXME: HACKs for optimization that we don't update the model every time the active machine gets changed.
|
||||
def _onActiveMachineChanged(self) -> None:
|
||||
self._application.getMachineManager().globalContainerChanged.disconnect(self._onActiveMachineChanged)
|
||||
self.initialize()
|
||||
self._initialize(update_should_show_flag = False)
|
||||
|
||||
def initialize(self) -> None:
|
||||
self._application.getMachineManager().globalContainerChanged.connect(self._onActiveMachineChanged)
|
||||
self._initialize()
|
||||
|
||||
def _initialize(self) -> None:
|
||||
has_active_machine = self._application.getMachineManager().activeMachine is not None
|
||||
has_app_just_upgraded = self._application.hasJustUpgradedToNewVersion()
|
||||
def _initialize(self, update_should_show_flag: bool = True) -> None:
|
||||
show_whatsnew_only = False
|
||||
if update_should_show_flag:
|
||||
has_active_machine = self._application.getMachineManager().activeMachine is not None
|
||||
has_app_just_upgraded = self._application.hasJustUpgradedToNewVersion()
|
||||
|
||||
# Only show the what's new dialog if there's no machine and we have just upgraded
|
||||
show_complete_flow = not has_active_machine
|
||||
show_whatsnew_only = has_active_machine and has_app_just_upgraded
|
||||
# Only show the what's new dialog if there's no machine and we have just upgraded
|
||||
show_complete_flow = not has_active_machine
|
||||
show_whatsnew_only = has_active_machine and has_app_just_upgraded
|
||||
|
||||
# FIXME: This is a hack. Because of the circular dependency between MachineManager, ExtruderManager, and
|
||||
# possibly some others, setting the initial active machine is not done when the MachineManager gets initialized.
|
||||
# So at this point, we don't know if there will be an active machine or not. It could be that the active machine
|
||||
# files are corrupted so we cannot rely on Preferences either. This makes sure that once the active machine
|
||||
# gets changed, this model updates the flags, so it can decide whether to show the welcome flow or not.
|
||||
should_show_welcome_flow = show_complete_flow or show_whatsnew_only
|
||||
if should_show_welcome_flow != self._should_show_welcome_flow:
|
||||
self._should_show_welcome_flow = should_show_welcome_flow
|
||||
self.shouldShowWelcomeFlowChanged.emit()
|
||||
# FIXME: This is a hack. Because of the circular dependency between MachineManager, ExtruderManager, and
|
||||
# possibly some others, setting the initial active machine is not done when the MachineManager gets initialized.
|
||||
# So at this point, we don't know if there will be an active machine or not. It could be that the active machine
|
||||
# files are corrupted so we cannot rely on Preferences either. This makes sure that once the active machine
|
||||
# gets changed, this model updates the flags, so it can decide whether to show the welcome flow or not.
|
||||
should_show_welcome_flow = show_complete_flow or show_whatsnew_only
|
||||
if should_show_welcome_flow != self._should_show_welcome_flow:
|
||||
self._should_show_welcome_flow = should_show_welcome_flow
|
||||
self.shouldShowWelcomeFlowChanged.emit()
|
||||
|
||||
# All pages
|
||||
all_pages_list = [{"id": "welcome",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue