From ad77ac85b95122742b14c29b650c1697ed99dbe0 Mon Sep 17 00:00:00 2001 From: Dadmehr <134191240+BDadmehr0@users.noreply.github.com> Date: Tue, 6 Jun 2023 19:42:49 +0330 Subject: [PATCH] Update main_gui.py This code modifies the toggle_show_grab function to show a warning message when "Save Screenshots" is enabled. When "Save Screenshots" is disabled, it shows a confirmation message asking the user if they want to delete the saved screenshots. Depending on the user's choice, you can add the necessary code to delete the screenshots or perform any other desired action. --- fishy/gui/main_gui.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/fishy/gui/main_gui.py b/fishy/gui/main_gui.py index ea8274a..cbe50e9 100644 --- a/fishy/gui/main_gui.py +++ b/fishy/gui/main_gui.py @@ -2,6 +2,7 @@ import logging import time import tkinter as tk import tkinter.ttk as ttk +from tkinter import messagebox import typing from functools import partial @@ -83,18 +84,30 @@ 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.") + else: + logging.info("Saved screenshots were not deleted.") + show_grab_var = tk.IntVar() show_grab_var.set(config.get("show_grab", 0)) debug_menu.add_checkbutton(label="Save Screenshots", variable=show_grab_var, command=lambda: toggle_show_grab(), onvalue=1) if config.get("show_grab", 0): logging.info(f"Save Screenshots is On, images will be saved in {helper.save_img_path()}") + def select_sslib(selected_i): config.set("sslib", selected_i) sslib_var.set(selected_i)