more win32 wrap
This commit is contained in:
18
src/gui_2.py
18
src/gui_2.py
@@ -29,6 +29,7 @@ from src import mcp_client
|
|||||||
from src import markdown_helper
|
from src import markdown_helper
|
||||||
from src import bg_shader
|
from src import bg_shader
|
||||||
import re
|
import re
|
||||||
|
import subprocess
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
import win32gui
|
import win32gui
|
||||||
import win32con
|
import win32con
|
||||||
@@ -4024,15 +4025,16 @@ def hello():
|
|||||||
user_scale = theme.get_current_scale()
|
user_scale = theme.get_current_scale()
|
||||||
self.runner_params.dpi_aware_params.dpi_window_size_factor = user_scale
|
self.runner_params.dpi_aware_params.dpi_window_size_factor = user_scale
|
||||||
|
|
||||||
# Detect Monitor Refresh Rate for capping
|
# Detect Monitor Refresh Rate for capping (Win32 only)
|
||||||
fps_cap = 60.0
|
fps_cap = 60.0
|
||||||
try:
|
if sys.platform == "win32":
|
||||||
# Use PowerShell to get max refresh rate across all controllers
|
try:
|
||||||
cmd = "powershell -NoProfile -Command \"Get-CimInstance -ClassName Win32_VideoController | Select-Object -ExpandProperty CurrentRefreshRate\""
|
# Use PowerShell to get max refresh rate across all controllers
|
||||||
out = subprocess.check_output(cmd, shell=True).decode().splitlines()
|
cmd = "powershell -NoProfile -Command \"Get-CimInstance -ClassName Win32_VideoController | Select-Object -ExpandProperty CurrentRefreshRate\""
|
||||||
rates = [float(r.strip()) for r in out if r.strip().isdigit()]
|
out = subprocess.check_output(cmd, shell=True).decode().splitlines()
|
||||||
if rates: fps_cap = max(rates)
|
rates = [float(r.strip()) for r in out if r.strip().isdigit()]
|
||||||
except Exception: pass
|
if rates: fps_cap = max(rates)
|
||||||
|
except Exception: pass
|
||||||
|
|
||||||
# Enable idling with monitor refresh rate to effectively cap FPS
|
# Enable idling with monitor refresh rate to effectively cap FPS
|
||||||
self.runner_params.fps_idling.enable_idling = True
|
self.runner_params.fps_idling.enable_idling = True
|
||||||
|
|||||||
Reference in New Issue
Block a user