Skip to content

Commit

Permalink
refresh trees when database update
Browse files Browse the repository at this point in the history
  • Loading branch information
kraanzu committed Sep 23, 2024
1 parent b22dfaa commit 83062d6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion dooit/ui/tui.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from dooit.ui.widgets.bars import StatusBar
from dooit.ui.widgets.trees import WorkspacesTree
from dooit.ui.screens import MainScreen, HelpScreen
from dooit.ui.widgets.trees.model_tree import ModelTree
from dooit.utils import CssManager
from .api import DooitAPI
from ..api import manager
Expand Down Expand Up @@ -67,7 +68,14 @@ def current_theme(self) -> DooitThemeBase:
return self.api.css_manager.theme

async def poll(self):
return
def refresh_all_trees():
trees = self.query(ModelTree)
self.notify(f"{len(trees)}")
for tree in trees:
tree.force_refresh()

if manager.has_changed():
refresh_all_trees()

@on(DooitEvent)
def global_message(self, event: DooitEvent):
Expand Down

0 comments on commit 83062d6

Please sign in to comment.