This commit is contained in:
Adam Saudagar
2023-03-09 16:30:15 +05:30
parent cc61caf12d
commit ecf5b3524c
2 changed files with 11 additions and 3 deletions

View File

@ -8,7 +8,7 @@ from functools import partial
from fishy.gui import update_dialog from fishy.gui import update_dialog
from ttkthemes import ThemedTk from ttkthemes import ThemedTk
from fishy import helper from fishy.helper import helper
from fishy.web import web from fishy.web import web
from ..constants import fishyqr from ..constants import fishyqr
@ -87,9 +87,13 @@ def _create(gui: 'GUI'):
new_val = 1 - config.get("show_grab", 0) new_val = 1 - config.get("show_grab", 0)
show_grab_var.set(new_val) show_grab_var.set(new_val)
config.set("show_grab", 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 = tk.IntVar()
show_grab_var.set(config.get("show_grab", 0)) 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) 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): def select_sslib(selected_i):
config.set("sslib", selected_i) config.set("sslib", selected_i)

View File

@ -18,7 +18,6 @@ import cv2
import requests import requests
from playsound import playsound from playsound import playsound
import fishy import fishy
from fishy.constants import libgps, lam2, fishyqr, libmapping, libdl, libchatmsg from fishy.constants import libgps, lam2, fishyqr, libmapping, libdl, libchatmsg
from fishy.helper.config import config from fishy.helper.config import config
@ -185,6 +184,7 @@ def log_raise(msg):
logging.error(msg) logging.error(msg)
raise Exception(msg) raise Exception(msg)
# noinspection PyProtectedMember,PyUnresolvedReferences # noinspection PyProtectedMember,PyUnresolvedReferences
def _get_id(thread): def _get_id(thread):
# returns id of the respective thread # returns id of the respective thread
@ -209,8 +209,12 @@ def print_exc():
traceback.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): 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): if not os.path.exists(img_path):
os.makedirs(img_path) os.makedirs(img_path)