From 9c2346baecb7d7ff0ed3b92bb085852fc4bac84f Mon Sep 17 00:00:00 2001 From: BuildTools Date: Fri, 16 Aug 2024 17:29:23 -0700 Subject: [PATCH] feat(config): allow setting window size through env - allow setting window size through env - update version to v1.7.0 --- src/AutoGGUF.py | 15 ++++++++++++++- src/Localizations.py | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/AutoGGUF.py b/src/AutoGGUF.py index 019c7d5..d1d97c6 100644 --- a/src/AutoGGUF.py +++ b/src/AutoGGUF.py @@ -1,6 +1,7 @@ import json import re import shutil +import os from functools import partial from PySide6.QtCore import * @@ -89,10 +90,12 @@ def __init__(self): super().__init__() self.logger = Logger("AutoGGUF", "logs") + width, height = self.parse_resolution() + self.logger.info(INITIALIZING_AUTOGGUF) self.setWindowTitle(WINDOW_TITLE) self.setWindowIcon(QIcon(resource_path("assets/favicon.ico"))) - self.setGeometry(100, 100, 1700, 1200) + self.setGeometry(100, 100, width, height) self.setWindowFlag(Qt.FramelessWindowHint) ensure_directory(os.path.abspath("quantized_models")) @@ -755,6 +758,16 @@ def __init__(self): self.load_models() self.logger.info(AUTOGGUF_INITIALIZATION_COMPLETE) + def parse_resolution(self): + res = os.environ.get('AUTOGGUF_RESOLUTION', '1650x1100') + try: + width, height = map(int, res.split('x')) + if width <= 0 or height <= 0: + raise ValueError + return width, height + except (ValueError, AttributeError): + return 1650, 1100 + def resizeEvent(self, event): super().resizeEvent(event) path = QPainterPath() diff --git a/src/Localizations.py b/src/Localizations.py index 7c88132..d9944a8 100644 --- a/src/Localizations.py +++ b/src/Localizations.py @@ -1,6 +1,6 @@ import os -AUTOGGUF_VERSION = "v1.6.2" +AUTOGGUF_VERSION = "v1.7.0" class _Localization: