diff --git a/assets/favicon.ico b/assets/favicon.ico index c2814b4..b6d4eb1 100644 Binary files a/assets/favicon.ico and b/assets/favicon.ico differ diff --git a/assets/favicon_large.png b/assets/favicon_large.png new file mode 100644 index 0000000..29dc129 Binary files /dev/null and b/assets/favicon_large.png differ diff --git a/assets/gguf.svg b/assets/gguf.svg deleted file mode 100644 index ae5b6af..0000000 --- a/assets/gguf.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/gguf_favicon.ico b/assets/gguf_favicon.ico new file mode 100644 index 0000000..c2814b4 Binary files /dev/null and b/assets/gguf_favicon.ico differ diff --git a/assets/favicon_light.ico b/assets/gguf_favicon_light.ico similarity index 100% rename from assets/favicon_light.ico rename to assets/gguf_favicon_light.ico diff --git a/build.bat b/build.bat index 4fd4083..255498f 100644 --- a/build.bat +++ b/build.bat @@ -7,10 +7,10 @@ if "%1"=="" ( if /I "%1"=="RELEASE" ( echo Building RELEASE version... - pyinstaller --windowed --onefile --name=AutoGGUF --icon=../../assets/favicon_light.ico --distpath=build\release\dist --workpath=build\release\build --specpath=build\release src\main.py + pyinstaller --windowed --onefile --name=AutoGGUF --icon=../../assets/favicon_large.png --add-data "../../assets;assets" --distpath=build\release\dist --workpath=build\release\build --specpath=build\release src\main.py ) else if /I "%1"=="DEV" ( echo Building DEV version... - pyinstaller --onefile --name=AutoGGUF --icon=../../assets/favicon.ico --distpath=build\dev\dist --workpath=build\dev\build --specpath=build\dev src\main.py + pyinstaller --onefile --name=AutoGGUF --icon=../../assets/favicon_large.png --add-data "../../assets;assets" --distpath=build\dev\dist --workpath=build\dev\build --specpath=build\dev src\main.py ) else ( echo Invalid argument. Use RELEASE or DEV. exit /b 1 diff --git a/src/AutoGGUF.py b/src/AutoGGUF.py index a98643e..5569570 100644 --- a/src/AutoGGUF.py +++ b/src/AutoGGUF.py @@ -14,7 +14,7 @@ import zipfile import re from datetime import datetime -from imports_and_globals import ensure_directory, open_file_safe +from imports_and_globals import ensure_directory, open_file_safe, resource_path from DownloadThread import DownloadThread from ModelInfoDialog import ModelInfoDialog from TaskListItem import TaskListItem @@ -31,6 +31,7 @@ def __init__(self): self.logger.info(INITIALIZING_AUTOGGUF) self.setWindowTitle(WINDOW_TITLE) + self.setWindowIcon(QIcon(resource_path("assets/favicon.ico"))) self.setGeometry(100, 100, 1600, 1200) ensure_directory(os.path.abspath("quantized_models")) @@ -1546,7 +1547,7 @@ def generate_imatrix(self): except Exception as e: self.show_error(ERROR_STARTING_IMATRIX_GENERATION.format(str(e))) self.logger.info(IMATRIX_GENERATION_TASK_STARTED) - + def show_error(self, message): self.logger.error(ERROR_MESSAGE.format(message)) QMessageBox.critical(self, ERROR, message) diff --git a/src/imports_and_globals.py b/src/imports_and_globals.py index d54328e..ee32b53 100644 --- a/src/imports_and_globals.py +++ b/src/imports_and_globals.py @@ -27,4 +27,13 @@ def open_file_safe(file_path, mode='r'): return open(file_path, mode, encoding=encoding) except UnicodeDecodeError: continue - raise ValueError(f"Unable to open file {file_path} with any of the encodings: {encodings}") \ No newline at end of file + raise ValueError(f"Unable to open file {file_path} with any of the encodings: {encodings}") + +def resource_path(relative_path): + try: + # PyInstaller creates a temp folder and stores path in _MEIPASS + base_path = sys._MEIPASS + except Exception: + base_path = os.path.abspath(".") + + return os.path.join(base_path, relative_path) \ No newline at end of file