Skip to content

Commit

Permalink
remove reload all answers button
Browse files Browse the repository at this point in the history
reload button can too easily remove all existing results while the
functionality an be reproduced by two button click (chose other
file + load file)
  • Loading branch information
agoscinski committed Dec 22, 2023
1 parent d7f901f commit ef3e710
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions src/scwidgets/answer/_widget_answer_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,16 +202,10 @@ def __init__(self, filename_prefix: Optional[str] = None, *args, **kwargs):
disabled=True,
tooltip="Save all answers saved into a .json file.",
)
self._reload_all_answers_button = Button(
description="Reload all answers",
disabled=True,
tooltip="Reload answers saved in .json file to notebook.",
)
self._lower_panel_box = HBox(
[
self._choose_other_file_button,
self._save_all_answers_button,
self._reload_all_answers_button,
]
)
# lower panel appears when file has been loaded and is there display within an
Expand Down Expand Up @@ -251,9 +245,6 @@ def __init__(self, filename_prefix: Optional[str] = None, *args, **kwargs):
# lower panel box events
self._choose_other_file_button.on_click(self._on_click_choose_other_file_button)
self._save_all_answers_button.on_click(self._on_click_save_all_answers_button)
self._reload_all_answers_button.on_click(
self._on_click_reload_all_answers_button
)

# confirmation box events
self._confirm_save_button.on_click(self._on_click_confirm_save_button)
Expand Down Expand Up @@ -473,18 +464,6 @@ def _on_click_confirm_save_button(self, change: dict):
Printer.print_error_message("Error raised while saving file:")
raise exception

def _on_click_reload_all_answers_button(self, change: dict):
self._output.clear_output(wait=True)
with self._output:
try:
self.load_file()
Printer.print_success_message(
f"All answers were reloaded from file {self._loaded_file_name!r}."
)
except Exception as exception:
Printer.print_error_message("Error raised while loading file:")
raise exception

def _on_click_choose_other_file_button(self, change: dict):
self._output.clear_output()
with self._output:
Expand Down

0 comments on commit ef3e710

Please sign in to comment.