removed all Img path dependencies

This commit is contained in:
Falko Victor Habel 2024-04-04 12:31:08 +02:00
parent 32f0b2fe1c
commit d4141612b2
2 changed files with 10 additions and 9 deletions

View File

@ -2,6 +2,7 @@ import customtkinter as Ctk
import os import os
from PIL import Image, ImageTk, ImageDraw from PIL import Image, ImageTk, ImageDraw
from scripts.SaveData import SaveData from scripts.SaveData import SaveData
from icons.icons import Icons
import scripts.get_sys_info as system_code import scripts.get_sys_info as system_code
@ -9,6 +10,7 @@ import scripts.get_sys_info as system_code
class Labeling(Ctk.CTkFrame): class Labeling(Ctk.CTkFrame):
def __init__(self,master,img_paths, output_path, callback, window_information, **kwargs): def __init__(self,master,img_paths, output_path, callback, window_information, **kwargs):
super().__init__(master, **kwargs) super().__init__(master, **kwargs)
self.icons = Icons()
system_code.load_json_file() system_code.load_json_file()
self.data_saver = SaveData() self.data_saver = SaveData()
self.my_font = Ctk.CTkFont(family="Berlin Sans FB", size=22) self.my_font = Ctk.CTkFont(family="Berlin Sans FB", size=22)
@ -16,14 +18,11 @@ class Labeling(Ctk.CTkFrame):
#callback #callback
self.callback = callback self.callback = callback
self.window_information = window_information self.window_information = window_information
# Image resources
self.create_folder_image_path = r"./icons/create_folder.png"
self.open_folder_image_path = r"./icons/open_folder.png"
self.source_folder_image_path = r"./icons/source_folder.png"
# Load and resize image as before # Load and resize image as before
self.create_folder_raw_image = Image.open(self.create_folder_image_path) self.create_folder_raw_image = self.icons.get_image("CreateFolder")
self.open_folder_raw_image = Image.open(self.open_folder_image_path) self.open_folder_raw_image = self.icons.get_image("OpenFolder")
self.source_folder_raw_image = Image.open(self.source_folder_image_path) self.source_folder_raw_image = self.icons.get_image("SourceFolder")
self.load_button_images() self.load_button_images()
# for the image show_process # for the image show_process
self.image_scale_init() self.image_scale_init()

View File

@ -1,6 +1,6 @@
import customtkinter as Ctk import customtkinter as Ctk
import os import os
from PIL import Image from icons.icons import Icons
from ..SaveData import SaveData from ..SaveData import SaveData
import scripts.get_sys_info as system_code import scripts.get_sys_info as system_code
@ -10,10 +10,12 @@ FONT = "Berlin Sans FB"
class OpenFolder(Ctk.CTkScrollableFrame): class OpenFolder(Ctk.CTkScrollableFrame):
def __init__(self,master,output_path, callback, **kwargs, ): def __init__(self,master,output_path, callback, **kwargs, ):
super().__init__(master, **kwargs) super().__init__(master, **kwargs)
self.icons = Icons()
self.my_font = Ctk.CTkFont(family=FONT, size=16) self.my_font = Ctk.CTkFont(family=FONT, size=16)
self.warning_font = Ctk.CTkFont(family=FONT, size=20) self.warning_font = Ctk.CTkFont(family=FONT, size=20)
# the variables needed to get from the upper class # the variables needed to get from the upper class
self.button_image = Ctk.CTkImage(Image.open(r"./icons/folder.png"), size=(63, 63))
self.button_image = Ctk.CTkImage(self.icons.get_image("Folder"), size=(63, 63))
self.output_path = output_path self.output_path = output_path
self.callback = callback # Store the callback function self.callback = callback # Store the callback function
system_code.load_json_file() system_code.load_json_file()