feat: add application icon and improve path handling for bundled executables

This commit is contained in:
Martin Tranberg
2026-03-31 16:11:08 +02:00
parent 6659ebd6ac
commit 0d8407f624
2 changed files with 12 additions and 6 deletions

BIN
icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View File

@@ -12,13 +12,15 @@ import webbrowser
# --- STIHÅNDTERING (Til EXE-brug) --- # --- STIHÅNDTERING (Til EXE-brug) ---
if getattr(sys, 'frozen', False): if getattr(sys, 'frozen', False):
# Vi kører som en kompileret .exe # RESOURCE_DIR er mapper indeni EXE-filen (ikoner, billeder)
base_dir = os.path.dirname(sys.executable) RESOURCE_DIR = getattr(sys, '_MEIPASS', os.path.dirname(os.path.abspath(__file__)))
# CONFIG_DIR er mappen hvor selve .exe filen ligger (settings.json)
CONFIG_DIR = os.path.dirname(sys.executable)
else: else:
# Vi kører som normalt script RESOURCE_DIR = os.path.dirname(os.path.abspath(__file__))
base_dir = os.path.dirname(os.path.abspath(__file__)) CONFIG_DIR = RESOURCE_DIR
SETTINGS_FILE = os.path.join(base_dir, 'settings.json') SETTINGS_FILE = os.path.join(CONFIG_DIR, 'settings.json')
def load_settings(): def load_settings():
default_settings = { default_settings = {
@@ -277,7 +279,11 @@ class SharePointApp(wx.Frame):
self.Centre() self.Centre()
self.Show() self.Show()
self.Bind(wx.EVT_CLOSE, self.on_close_window) self.Bind(wx.EVT_CLOSE, self.on_close_window)
# SÆT VINDUESIKON (øverste venstre hjørne)
icon_path = os.path.join(RESOURCE_DIR, "icon.ico")
if os.path.exists(icon_path):
self.SetIcon(wx.Icon(icon_path, wx.BITMAP_TYPE_ICO))
def get_txt(self, key, **kwargs): def get_txt(self, key, **kwargs):
text = STRINGS[self.lang].get(key, key) text = STRINGS[self.lang].get(key, key)
if kwargs: if kwargs: