Skip to content

Commit

Permalink
fix bug when select_classes_button is not updated by default
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaiPetukhov committed Feb 28, 2024
1 parent 6b2323d commit 07741f2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions train/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,8 @@ def select_input_data():
use_cache_text.disable()
classes_table.read_project_from_id(project_id)
classes_table.select_all()
selected_classes = classes_table.get_selected_classes()
_update_select_classes_button(selected_classes)
select_data_button.loading = False
select_data_button.hide()
select_done.show()
Expand All @@ -626,8 +628,7 @@ def reselect_input_data():
stepper.set_active_step(curr_step)


@classes_table.value_changed
def on_classes_selected(selected_classes):
def _update_select_classes_button(selected_classes):
n_classes = len(selected_classes)
if n_classes > 0:
if n_classes > 1:
Expand All @@ -638,6 +639,10 @@ def on_classes_selected(selected_classes):
else:
select_classes_button.hide()

@classes_table.value_changed
def on_classes_selected(selected_classes):
_update_select_classes_button(selected_classes)


@task_type_select.value_changed
def select_task(task_type):
Expand Down Expand Up @@ -1508,6 +1513,8 @@ def auto_train(request: Request):
use_cache_checkbox.uncheck()
classes_table.read_project_from_id(project_id)
classes_table.select_all()
selected_classes = classes_table.get_selected_classes()
_update_select_classes_button(selected_classes)
select_data_button.hide()
select_done.show()
reselect_data_button.show()
Expand Down

0 comments on commit 07741f2

Please sign in to comment.