Skip to content

Commit

Permalink
feat(config): allow setting window size through env
Browse files Browse the repository at this point in the history
- allow setting window size through env
- update version to v1.7.0
  • Loading branch information
leafspark committed Aug 17, 2024
1 parent 432306d commit 9c2346b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion src/AutoGGUF.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import re
import shutil
import os

from functools import partial
from PySide6.QtCore import *
Expand Down Expand Up @@ -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"))
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/Localizations.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os

AUTOGGUF_VERSION = "v1.6.2"
AUTOGGUF_VERSION = "v1.7.0"


class _Localization:
Expand Down

0 comments on commit 9c2346b

Please sign in to comment.