From ecf5b3524c12ee8312fa6a053fb2cd69b6eebe17 Mon Sep 17 00:00:00 2001 From: Adam Saudagar Date: Thu, 9 Mar 2023 16:30:15 +0530 Subject: [PATCH] #156 added logs --- fishy/gui/main_gui.py | 6 +++++- fishy/helper/helper.py | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/fishy/gui/main_gui.py b/fishy/gui/main_gui.py index ed84abe..ea8274a 100644 --- a/fishy/gui/main_gui.py +++ b/fishy/gui/main_gui.py @@ -8,7 +8,7 @@ from functools import partial from fishy.gui import update_dialog from ttkthemes import ThemedTk -from fishy import helper +from fishy.helper import helper from fishy.web import web from ..constants import fishyqr @@ -87,9 +87,13 @@ def _create(gui: 'GUI'): 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()}") 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) diff --git a/fishy/helper/helper.py b/fishy/helper/helper.py index b1813c6..4b377cf 100644 --- a/fishy/helper/helper.py +++ b/fishy/helper/helper.py @@ -18,7 +18,6 @@ import cv2 import requests from playsound import playsound - import fishy from fishy.constants import libgps, lam2, fishyqr, libmapping, libdl, libchatmsg from fishy.helper.config import config @@ -185,6 +184,7 @@ def log_raise(msg): logging.error(msg) raise Exception(msg) + # noinspection PyProtectedMember,PyUnresolvedReferences def _get_id(thread): # returns id of the respective thread @@ -209,8 +209,12 @@ def print_exc(): traceback.print_exc() +def save_img_path(): + return os.path.join(os_services.get_documents_path(), "fishy_debug", "imgs") + + def save_img(show_name, img, half=False): - img_path = os.path.join(os_services.get_documents_path(), "fishy_debug", "imgs", show_name) + img_path = os.path.join(save_img_path(), show_name) if not os.path.exists(img_path): os.makedirs(img_path)