mirror of
https://github.com/markqvist/Sideband.git
synced 2025-05-15 04:42:28 -04:00
Adjust window size on small devices
This commit is contained in:
parent
b1678a1532
commit
a24f1f1073
2 changed files with 21 additions and 5 deletions
|
@ -25,8 +25,8 @@ import base64
|
||||||
import threading
|
import threading
|
||||||
import RNS.vendor.umsgpack as msgpack
|
import RNS.vendor.umsgpack as msgpack
|
||||||
|
|
||||||
WINDOW_DEFAULT_WIDTH = "494"
|
WINDOW_DEFAULT_WIDTH = 494
|
||||||
WINDOW_DEFAULT_HEIGHT = "800"
|
WINDOW_DEFAULT_HEIGHT = 800
|
||||||
|
|
||||||
app_ui_scaling_path = None
|
app_ui_scaling_path = None
|
||||||
def apply_ui_scale():
|
def apply_ui_scale():
|
||||||
|
@ -176,9 +176,25 @@ if not args.daemon:
|
||||||
sys.path.append(local)
|
sys.path.append(local)
|
||||||
|
|
||||||
if not RNS.vendor.platformutils.is_android():
|
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
|
from kivy.config import Config
|
||||||
Config.set("graphics", "width", WINDOW_DEFAULT_WIDTH)
|
Config.set("graphics", "width", str(window_width))
|
||||||
Config.set("graphics", "height", WINDOW_DEFAULT_HEIGHT)
|
Config.set("graphics", "height", str(window_height))
|
||||||
|
|
||||||
if args.daemon:
|
if args.daemon:
|
||||||
from .sideband.core import SidebandCore
|
from .sideband.core import SidebandCore
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -123,7 +123,7 @@ setuptools.setup(
|
||||||
"ffpyplayer",
|
"ffpyplayer",
|
||||||
"sh",
|
"sh",
|
||||||
"numpy<=1.26.4",
|
"numpy<=1.26.4",
|
||||||
"lxst>=0.2.2",
|
"lxst>=0.2.4",
|
||||||
"mistune>=3.0.2",
|
"mistune>=3.0.2",
|
||||||
"beautifulsoup4",
|
"beautifulsoup4",
|
||||||
"pycodec2;sys.platform!='Windows' and sys.platform!='win32' and sys.platform!='darwin'",
|
"pycodec2;sys.platform!='Windows' and sys.platform!='win32' and sys.platform!='darwin'",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue