Skip to content
Snippets Groups Projects

Implementation of the delegation part of HP management

Merged Jakub Ziebinski requested to merge jziebinski/prepare-delegations into develop
All threads resolved!
Compare and Show latest version
17 files
+ 165
69
Compare changes
  • Side-by-side
  • Inline
Files
17
@@ -6,6 +6,7 @@ from textual import on
from textual.containers import Horizontal, Vertical
from textual.widgets import Static, TabPane
from clive.__private.core.commands.data_retrieval.hive_power_data import HivePowerData
from clive.__private.core.hive_to_vests import hive_to_vests
from clive.__private.core.vests_to_hive import vests_to_hive
from clive.__private.ui.data_providers.hive_power_data_provider import HivePowerDataProvider
@@ -33,7 +34,6 @@ if TYPE_CHECKING:
from textual.app import ComposeResult
from textual.widget import Widget
from clive.__private.core.commands.data_retrieval.hive_power_data import HivePowerData
from clive.models.aliased import DynamicGlobalProperties
from schemas.apis.database_api.fundaments_of_reponses import VestingDelegationsFundament as VestingDelegation
@@ -84,12 +84,12 @@ class Delegation(CliveCheckerboardTableRow):
self.app.push_screen(RemoveDelegation(self._delegation, self._dgpo))
class DelegationsTable(CliveCheckerboardTable):
class DelegationsTable(CliveCheckerboardTable[HivePowerData]):
"""Table with delegations."""
def __init__(self) -> None:
super().__init__(
Static("Your delegations", id="delegations-table-title"), DelegationsTableHeader(), dynamic=True
Static("Current delegations", id="delegations-table-title"), DelegationsTableHeader(), dynamic=True
)
def create_dynamic_rows(self, content: HivePowerData) -> list[Widget]:
@@ -107,7 +107,7 @@ class DelegationsTable(CliveCheckerboardTable):
@property
def creature_to_reconstruction_check(self) -> list[VestingDelegation[Asset.Vests]]:
return self.provider.content.delegations
return self.data_checker_supplier.delegations
class DelegateHivePower(TabPane, OperationActionBindings):
@@ -128,7 +128,7 @@ class DelegateHivePower(TabPane, OperationActionBindings):
self._shares_input = HPVestsAmountInput()
def compose(self) -> ComposeResult:
yield Static("Delegate your shares:", id="delegatee-title")
yield Static("Delegate your shares", id="delegatee-title")
with Vertical(id="inputs-container"):
yield self._delegatee_input
yield self._shares_input
@@ -155,10 +155,11 @@ class DelegateHivePower(TabPane, OperationActionBindings):
"""Clear input when shares type was changed and hide factor display when vests selected."""
self._shares_input.input.value = ""
hp_vests_factor = self.query_one(HpVestsFactor)
if self._shares_input.selected_asset_type is Asset.Vests:
self.query_one(HpVestsFactor).display = False
hp_vests_factor.display = False
return
self.query_one(HpVestsFactor).display = True
hp_vests_factor.display = True
@property
def provider(self) -> HivePowerDataProvider:
Loading