From 3f726d606d68ff0c99a7ddc9b0903fe19ad4f7aa Mon Sep 17 00:00:00 2001 From: Josef Haupt Date: Fri, 20 Dec 2024 15:53:34 +0100 Subject: [PATCH] dl button only interactive if regression plot is visible (#534) --- birdnet_analyzer/gui/review.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/birdnet_analyzer/gui/review.py b/birdnet_analyzer/gui/review.py index f5f07e8b..4ae3c688 100644 --- a/birdnet_analyzer/gui/review.py +++ b/birdnet_analyzer/gui/review.py @@ -103,7 +103,9 @@ def create_log_plot(positives, negatives, fig_num=None): box = ax.get_position() ax.set_position([box.x0, box.y0, box.width * 0.8, box.height]) - ax.legend(loc="center left", bbox_to_anchor=(1, 0.5)) + + if any(threshold <= 1 for threshold in thresholds): + ax.legend(loc="center left", bbox_to_anchor=(1, 0.5)) if len(y_val) > 0: ax.scatter(x_vals, y_val, 2) @@ -312,6 +314,8 @@ def update_review(next_review_state: dict, selected_species: str = None): else: update_dict |= {review_item_col: gr.Column(visible=False), no_samles_label: gr.Label(visible=True)} + update_dict[regression_dl_btn] = gr.Button(interactive=update_dict[species_regression_plot].constructor_args["visible"]) + return update_dict def undo_review(next_review_state): @@ -377,6 +381,7 @@ def download_plot(plot, filename=""): file_count_matrix, species_regression_plot, undo_btn, + regression_dl_btn ] spectrogram_dl_btn.click(