From 46ab11847c26540c581bdc6c51f595c84b5554f8 Mon Sep 17 00:00:00 2001 From: CodeByMrFinchum Date: Thu, 2 Jan 2025 15:11:31 +0100 Subject: [PATCH] Moved a function to this class, more fitting. --- utils/utility.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/utils/utility.py b/utils/utility.py index c8b0850..9c17036 100644 --- a/utils/utility.py +++ b/utils/utility.py @@ -20,6 +20,16 @@ class Utilities: except PermissionError as e: print(f"Error saving setings: {e}") + def append_number_to_name(self, base_name: str, current_image: int, total_images: int, invert: bool): + """"Returns name, combination of base_name and ending number.""" + total_digits = len(str(total_images)) + if invert: + ending_number = total_images - (current_image - 1) + else: + ending_number = current_image + ending = f"{ending_number:0{total_digits}}" + return f"{base_name}_{ending}" + def yes_no(self, str): """Ask user y/n question""" while True: