Skip to content

Commit

Permalink
Update list when annotations are loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
aristizabal95 committed Jul 3, 2024
1 parent 85aea9b commit d470e5a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions scripts/monitor/rano_monitor/dataset_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import yaml
from rano_monitor.messages import InvalidSubjectsUpdated
from rano_monitor.messages import ReportUpdated
from rano_monitor.messages import AnnotationsLoaded
from rano_monitor.utils import generate_full_report
from rano_monitor.widgets.subject_details import SubjectDetails
from rano_monitor.widgets.subject_list_view import SubjectListView
Expand Down Expand Up @@ -156,6 +157,9 @@ def on_input_changed(self, event: Input.Changed) -> None:
search_term = search_input.value
subjects_list.update_list(search_term)

def on_annotations_loaded(self, message: AnnotationsLoaded):
subjects_list = self.query_one("#subjects-list")
subjects_list.update_list()

def update_prompt(self, prompt: str):
self.prompt = prompt
Expand Down
3 changes: 2 additions & 1 deletion scripts/monitor/rano_monitor/messages/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from .invalid_subject_updated import InvalidSubjectsUpdated
from .report_updated import ReportUpdated
from .annotations_loaded import AnnotationsLoaded

__all__ = [InvalidSubjectsUpdated, ReportUpdated]
__all__ = [InvalidSubjectsUpdated, ReportUpdated, AnnotationsLoaded]
5 changes: 5 additions & 0 deletions scripts/monitor/rano_monitor/messages/annotations_loaded.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from textual.message import Message


class AnnotationsLoaded(Message):
pass
5 changes: 4 additions & 1 deletion scripts/monitor/rano_monitor/widgets/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from rano_monitor.constants import REVIEW_FILENAME, REVIEWED_FILENAME
from rano_monitor.messages import InvalidSubjectsUpdated
from rano_monitor.messages import ReportUpdated
from rano_monitor.messages import AnnotationsLoaded
from rano_monitor.utils import package_review_cases, unpackage_reviews
from textual.app import ComposeResult
from textual.containers import Center
Expand Down Expand Up @@ -71,7 +72,8 @@ def update_summary(self):

widgets = []
for name, val in status_percents.items():
wname = Label(name.capitalize().replace("_", " "))
count = status_counts[name] if name in status_counts else 0
wname = Label(f'{name.capitalize().replace("_", " ")} ({count}/{len(report_df)})')
wpbar = ProgressBar(total=1, show_eta=False)
wpbar.advance(val)
widget = Center(wname, wpbar, classes="pbar")
Expand Down Expand Up @@ -105,6 +107,7 @@ async def _unpackage_reviews(self):
self.notify("Annotations have been loaded")
unpkg_btn.label = label
unpkg_btn.disabled = False
self.post_message(AnnotationsLoaded())

async def on_button_pressed(self, event: Button.Pressed) -> None:
event.stop()
Expand Down

0 comments on commit d470e5a

Please sign in to comment.