From cab56da6e48b79c19aa2734274c640db9735d42a Mon Sep 17 00:00:00 2001 From: Dadmehr <134191240+BDadmehr0@users.noreply.github.com> Date: Thu, 8 Jun 2023 18:51:15 +0330 Subject: [PATCH] Update main_gui.py --- fishy/gui/main_gui.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/fishy/gui/main_gui.py b/fishy/gui/main_gui.py index cbe50e9..9a736c3 100644 --- a/fishy/gui/main_gui.py +++ b/fishy/gui/main_gui.py @@ -5,6 +5,7 @@ import tkinter.ttk as ttk from tkinter import messagebox import typing from functools import partial +import os from fishy.gui import update_dialog from ttkthemes import ThemedTk @@ -84,22 +85,27 @@ def _create(gui: 'GUI'): debug_menu.add_command(label="Check QR Value", command=lambda: gui.engine.check_qr_val()) - def toggle_show_grab(): new_val = 1 - config.get("show_grab", 0) show_grab_var.set(new_val) config.set("show_grab", new_val) if new_val: + logging.info(f"Screenshots taken by fishy will be saved in {helper.save_img_path()}") messagebox.showwarning("Warning", "Screenshots taken by Fishy will be saved in Documents.") logging.info(f"Screenshots taken by Fishy will be saved in {helper.save_img_path()}") else: delete_screenshots = messagebox.askyesno("Confirmation", "Do you want to delete the saved screenshots?") if delete_screenshots: # Delete the saved screenshots - # Add your code here to delete the screenshots - logging.info("Saved screenshots have been deleted.") + folder_path = helper.save_img_path() + try: + os.rmdir(folder_path) # Deletes the folder + logging.info("Saved screenshots folder has been deleted.") + except OSError as e: + logging.error(f"Error occurred while deleting the folder: {e}") else: - logging.info("Saved screenshots were not deleted.") + logging.info("Saved screenshots will be preserved.") + show_grab_var = tk.IntVar() show_grab_var.set(config.get("show_grab", 0))