hydraveil-gui/gui/v2/infrastructure/screen_size.py
2026-08-21 11:39:18 -04:00

31 lines
848 B
Python
Executable file

from core.errors.logger import logger
from PyQt6.QtWidgets import QApplication
from PyQt6.QtGui import QGuiApplication
import sys
max_screen_size = None
DEFAULT_VALUE = "800x800"
def calculate_max_screensize(app):
global max_screen_size
try:
screen = app.primaryScreen()
available = screen.availableGeometry()
dpi_ratio = screen.devicePixelRatio()
actual_width = int(available.width() * dpi_ratio)
actual_height = int(available.height() * dpi_ratio)
max_screen_size = f"{actual_width}x{actual_height}"
except Exception as e:
logger.error(f"Critical Error with calculating the screen size: {str(e)}")
max_screen_size = DEFAULT_VALUE
def get_max_screensize():
if max_screen_size is not None:
return max_screen_size
else:
return DEFAULT_VALUE