Skip to content
Snippets Groups Projects

Async guard

Merged Mateusz Żebrak requested to merge mzebrak/async-guard into develop
All threads resolved!
2 files
+ 22
21
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -16,9 +16,6 @@ from clive.__private.core.node import Node
from clive.__private.core.profile import Profile
from clive.__private.core.wallet_container import WalletContainer
from clive.__private.ui.clive_dom_node import CliveDOMNode
from clive.__private.ui.forms.create_profile.create_profile_form import CreateProfileForm
from clive.__private.ui.screens.dashboard import Dashboard
from clive.__private.ui.screens.unlock import Unlock
from clive.exceptions import ProfileNotLoadedError
if TYPE_CHECKING:
@@ -271,16 +268,7 @@ class TUIWorld(World, CliveDOMNode):
self.node.change_related_profile(profile)
async def _on_going_into_locked_mode(self, source: LockSource) -> None:
if source == "beekeeper_wallet_lock_status_update_worker":
self.app.notify("Switched to the LOCKED mode due to timeout.", timeout=10)
self.app.pause_refresh_node_data_interval()
self.app.pause_refresh_alarms_data_interval()
self.node.cached.clear()
self._add_welcome_modes()
await self.app.switch_mode("unlock")
await self._restart_dashboard_mode()
await self.switch_profile(None)
await self.app._switch_mode_into_locked(source)
async def _on_going_into_unlocked_mode(self) -> None:
self.app.trigger_app_state_watchers()
@@ -288,14 +276,6 @@ class TUIWorld(World, CliveDOMNode):
def _setup_commands(self) -> TUICommands:
return TUICommands(self)
def _add_welcome_modes(self) -> None:
self.app.add_mode("create_profile", CreateProfileForm)
self.app.add_mode("unlock", Unlock)
async def _restart_dashboard_mode(self) -> None:
await self.app.remove_mode("dashboard")
self.app.add_mode("dashboard", Dashboard)
def _update_profile_related_reactive_attributes(self) -> None:
# There's no proper way to add some proxy reactive property on textual reactives that could raise error if
# not set yet, and still can be watched. See: https://github.com/Textualize/textual/discussions/4007
Loading