forked from Support/sp-hydra-veil-gui
31 lines
848 B
Python
31 lines
848 B
Python
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
|