Skip to content
Snippets Groups Projects

Prepare withdraw routes part of the HP managament

Merged Jakub Ziebinski requested to merge jziebinski/withdraw-routes-prepare into develop
Compare and Show latest version
6 files
+ 35
17
Compare changes
  • Side-by-side
  • Inline
Files
6
@@ -51,9 +51,14 @@ class ScrollablePart(CanFocusWithScrollbarsOnly):
class WithdrawRoutesDisplay(CliveWidget):
"""Widget used just to inform user to which account has withdrawal route and how much % it is."""
def __init__(self) -> None:
super().__init__()
self._pretty = Pretty({})
self._pretty.display = False
def compose(self) -> ComposeResult:
yield Static("Loading...", id="withdraw-routes-header")
yield Pretty({})
yield self._pretty
def on_mount(self) -> None:
self.watch(self.provider, "_content", self._update_withdraw_routes, init=False)
@@ -62,7 +67,7 @@ class WithdrawRoutesDisplay(CliveWidget):
"""Update withdraw routes pretty widget."""
if not content.withdraw_routes:
self.query_one("#withdraw-routes-header", Static).update("You have no withdraw routes")
self.query_one(Pretty).display = False
self._pretty.display = False
return
withdraw_routes = {
@@ -70,8 +75,8 @@ class WithdrawRoutesDisplay(CliveWidget):
for withdraw_route in content.withdraw_routes
}
self.query_one("#withdraw-routes-header", Static).update("Your withdraw routes")
self.query_one(Pretty).update(withdraw_routes)
self.display = True
self._pretty.update(withdraw_routes)
self._pretty.display = True
@property
def provider(self) -> HivePowerDataProvider:
Loading