diff --git a/cs2tracker/app/app.py b/cs2tracker/app/app.py index c6a9eaa..4e4b4db 100644 --- a/cs2tracker/app/app.py +++ b/cs2tracker/app/app.py @@ -1,7 +1,7 @@ import ctypes import tkinter as tk from shutil import copy -from tkinter import messagebox, ttk +from tkinter import PhotoImage, messagebox, ttk from tkinter.filedialog import askopenfilename, asksaveasfile import sv_ttk @@ -63,8 +63,10 @@ def _configure_window(self): if OS == OSType.WINDOWS: app_id = "cs2tracker.unique.id" ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(app_id) - - window.iconbitmap(default=ICON_FILE) + window.iconbitmap(default=ICON_FILE) + else: + icon = PhotoImage(file=ICON_FILE) + window.iconphoto(True, icon) main_frame = MainFrame(window, self.scraper) main_frame.pack(expand=True, fill="both") diff --git a/cs2tracker/constants.py b/cs2tracker/constants.py index 0640afd..341917d 100644 --- a/cs2tracker/constants.py +++ b/cs2tracker/constants.py @@ -150,9 +150,9 @@ def copy_initial_files_with_popup(): else: MODULE_DIR = os.path.dirname(os.path.abspath(__file__)) - # The project directory doesn't really exist in this case - # (pip only installs contents of cs2tracker/cs2tracker in site-packages) - PROJECT_DIR = MODULE_DIR + # NOTE: The project directory doesn't really exist in this case when launched via pip + # (pip only installs contents of cs2tracker/cs2tracker in site-packages i.e. PROJECT_DIR = site-packages) + PROJECT_DIR = os.path.dirname(MODULE_DIR) DATA_DIR = os.path.join(MODULE_DIR, "data") CONFIG_FILE = os.path.join(DATA_DIR, "config.ini") @@ -162,7 +162,7 @@ def copy_initial_files_with_popup(): INVENTORY_IMPORT_SCRIPT = os.path.join(DATA_DIR, "get_inventory.js") NODE_MODULES = os.path.join(DATA_DIR, "node_modules") - ICON_FILE = os.path.join(DATA_DIR, "icon.ico") + ICON_FILE = os.path.join(DATA_DIR, "icon.ico" if OS == OSType.WINDOWS else "icon.png") BATCH_FILE = os.path.join(DATA_DIR, "cs2tracker_scraper.bat") INVENTORY_IMPORT_FILE = os.path.join(DATA_DIR, "inventory.json") INVENTORY_IMPORT_SCRIPT_DEPENDENCIES = [ diff --git a/cs2tracker/data/icon.png b/cs2tracker/data/icon.png new file mode 100644 index 0000000..6d8cfc8 Binary files /dev/null and b/cs2tracker/data/icon.png differ