Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

pyui: auto-fit screen size #34689

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions system/ui/lib/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from enum import IntEnum
from openpilot.common.basedir import BASEDIR
from openpilot.common.swaglog import cloudlog
from openpilot.system.hardware import TICI

DEFAULT_FPS = 60
FPS_LOG_INTERVAL = 5 # Seconds between logging FPS drops
Expand Down Expand Up @@ -41,11 +42,14 @@ def __init__(self, width: int, height: int):
def init_window(self, title: str, fps: int=DEFAULT_FPS):
atexit.register(self.close) # Automatically call close() on exit

rl.set_config_flags(rl.ConfigFlags.FLAG_MSAA_4X_HINT | rl.ConfigFlags.FLAG_VSYNC_HINT)
rl.set_config_flags(rl.ConfigFlags.FLAG_MSAA_4X_HINT | rl.ConfigFlags.FLAG_VSYNC_HINT | rl.ConfigFlags.FLAG_WINDOW_UNDECORATED)
rl.init_window(self._width, self._height, title)
rl.set_target_fps(fps)

self._width = rl.get_screen_width()
self._height = rl.get_screen_height()
self._target_fps = fps

self._set_styles()
self._load_fonts()

Expand Down Expand Up @@ -138,4 +142,11 @@ def _monitor_fps(self):
os._exit(1)


gui_app = GuiApplication(2160, 1080)
def _init_gui_app():
if TICI:
return GuiApplication(2160, 1080)
else:
return GuiApplication(0, 0)


gui_app = _init_gui_app()
Comment on lines -141 to +152
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With my monitor resolution, the UI is just full black because of the current scaling