From ad05372411ad774c21ebf868288f8b28653e7aa9 Mon Sep 17 00:00:00 2001 From: ChocoScaff Date: Thu, 23 May 2024 22:13:27 +0200 Subject: [PATCH] fix --- fileListApp.py | 16 +++++++++------- openSLN.py | 35 ----------------------------------- 2 files changed, 9 insertions(+), 42 deletions(-) delete mode 100644 openSLN.py diff --git a/fileListApp.py b/fileListApp.py index 03dab61..3c8badb 100644 --- a/fileListApp.py +++ b/fileListApp.py @@ -87,22 +87,24 @@ def load_files(self, folder): def load_thumbnail(self, file_path): try: image = None + base_path = os.path.dirname(os.path.abspath(__file__)) + if file_path.endswith(".vtf"): - image = Image.open(os.path.join("icons", "VTFEdit.png")) + image = Image.open(os.path.join(base_path, "icons", "VTFEdit.png")) elif file_path.endswith(".mdl"): - image = Image.open(os.path.join("icons", "hlmv.png")) + image = Image.open(os.path.join(base_path, "icons", "hlmv.png")) elif file_path.endswith(".tga"): image = Image.open(file_path) elif file_path.endswith(".vmf"): - image = Image.open(os.path.join("icons", "hammer.png")) + image = Image.open(os.path.join(base_path, "icons", "hammer.png")) elif file_path.endswith(".vcd"): - image = Image.open(os.path.join("icons", "hlposer.png")) + image = Image.open(os.path.join(base_path, "icons", "hlposer.png")) elif file_path.endswith(".bsp"): - image = Image.open(os.path.join("icons", "source.png")) + image = Image.open(os.path.join(base_path, "icons", "source.png")) elif os.path.isdir(file_path): - image = Image.open(os.path.join("icons", "fileexplorer.png")) + image = Image.open(os.path.join(base_path, "icons", "fileexplorer.png")) elif file_path.endswith(".txt") or file_path.endswith(".res") or file_path.endswith(".vmt") or file_path.endswith(".qc") or file_path.endswith(".smd"): - image = Image.open(os.path.join("icons", "txt.png")) + image = Image.open(os.path.join(base_path, "icons", "txt.png")) if image: image.thumbnail((50, 50)) diff --git a/openSLN.py b/openSLN.py deleted file mode 100644 index c49d20f..0000000 --- a/openSLN.py +++ /dev/null @@ -1,35 +0,0 @@ -import sourceSDK -import os - -class OpenSLN: - """ - @brief Class OpenSLN - """ - - sdk : sourceSDK - - def __init__(self, sourceSDK) -> None: - """ - """ - self.sdk = sourceSDK - - def open_games(self): - """ - """ - self.open_sln_file(self.sdk.selected_folder + "/src/games.sln") - - def open_everything(self): - """ - """ - self.open_sln_file(self.sdk.selected_folder + "/src/everything.sln") - - def open_sln_file(self, sln_file_path): - """ - """ - - # Check if the .sln file exists - if os.path.exists(sln_file_path): - # Open the .sln file with the default application - os.startfile(sln_file_path) - else: - print("Error: .sln file not found!") \ No newline at end of file