Skip to content
Snippets Groups Projects
Verified Commit db0e980c authored by Mateusz Żebrak's avatar Mateusz Żebrak
Browse files

Rename DynamicPropertiesClock callbacks

parent bc978a2a
No related branches found
No related tags found
3 merge requests!186V1.27.5.0 release,!174RELEASE: 1,!102Redesign header
This commit is part of merge request !102. Comments created here will be created in the context of that merge request.
......@@ -67,17 +67,17 @@ class AlarmsSummary(Container, CliveWidget):
class DynamicPropertiesClock(Horizontal, CliveWidget):
def compose(self) -> ComposeResult:
yield DynamicLabel(self.app.world, "app_state", self.__update_block_num, id_="block_num")
yield DynamicLabel(self.app.world, "app_state", self.__update_chain_time, id_="chain_time")
yield DynamicLabel(self.app.world, "app_state", self.__update_last_update, id_="last_update")
yield DynamicLabel(self.app.world, "app_state", self.__get_block_num, id_="block_num")
yield DynamicLabel(self.app.world, "app_state", self.__get_chain_time, id_="chain_time")
yield DynamicLabel(self.app.world, "app_state", self.__get_last_update, id_="last_update")
def __update_block_num(self, app_state: AppState) -> str:
def __get_block_num(self, app_state: AppState) -> str:
return f"block: {app_state.get_dynamic_global_properties().head_block_number}"
def __update_chain_time(self, app_state: AppState) -> str:
def __get_chain_time(self, app_state: AppState) -> str:
return f"{app_state.get_dynamic_global_properties().time.time()} UTC"
def __update_last_update(self, app_state: AppState) -> str:
def __get_last_update(self, app_state: AppState) -> str:
gdpo = app_state.get_dynamic_global_properties()
last_update = humanize.naturaltime(datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc) - gdpo.time)
return f"last update: {last_update}"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment