Adjust window size on small devices

This commit is contained in:
Mark Qvist 2025-03-11 17:35:04 +01:00
parent b1678a1532
commit a24f1f1073
2 changed files with 21 additions and 5 deletions

View File

@ -25,8 +25,8 @@ import base64
import threading
import RNS.vendor.umsgpack as msgpack
WINDOW_DEFAULT_WIDTH = "494"
WINDOW_DEFAULT_HEIGHT = "800"
WINDOW_DEFAULT_WIDTH = 494
WINDOW_DEFAULT_HEIGHT = 800
app_ui_scaling_path = None
def apply_ui_scale():
@ -176,9 +176,25 @@ if not args.daemon:
sys.path.append(local)
if not RNS.vendor.platformutils.is_android():
model = None
max_width = WINDOW_DEFAULT_WIDTH
max_height = WINDOW_DEFAULT_HEIGHT
try:
if os.path.isfile("/sys/firmware/devicetree/base/model"):
with open("/sys/firmware/devicetree/base/model", "r") as mf:
model = mf.read()
except: pass
if model:
if model.startswith("Raspberry Pi "): max_height = 625
window_width = min(WINDOW_DEFAULT_WIDTH, max_width)
window_height = min(WINDOW_DEFAULT_HEIGHT, max_height)
from kivy.config import Config
Config.set("graphics", "width", WINDOW_DEFAULT_WIDTH)
Config.set("graphics", "height", WINDOW_DEFAULT_HEIGHT)
Config.set("graphics", "width", str(window_width))
Config.set("graphics", "height", str(window_height))
if args.daemon:
from .sideband.core import SidebandCore

View File

@ -123,7 +123,7 @@ setuptools.setup(
"ffpyplayer",
"sh",
"numpy<=1.26.4",
"lxst>=0.2.2",
"lxst>=0.2.4",
"mistune>=3.0.2",
"beautifulsoup4",
"pycodec2;sys.platform!='Windows' and sys.platform!='win32' and sys.platform!='darwin'",