File tree Expand file tree Collapse file tree
internal_filesystem/lib/mpos/ui Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66
77th = None
88
9+ # These get set by init_rootscreen():
10+ horizontal_resolution = None
11+ vertical_resolution = None
12+
913NOTIFICATION_BAR_HEIGHT = 24
1014
1115CLOCK_UPDATE_INTERVAL = 1000 # 10 or even 1 ms doesn't seem to change the framerate but 100ms is enough
@@ -109,7 +113,10 @@ def show_launcher():
109113 mpos .apps .restart_launcher ()
110114
111115def init_rootscreen ():
116+ global horizontal_resolution , vertical_resolution
112117 rootscreen = lv .screen_active ()
118+ horizontal_resolution = rootscreen .get_display ().get_horizontal_resolution ()
119+ vertical_resolution = rootscreen .get_display ().get_vertical_resolution ()
113120 # Create a style for the undecorated screen
114121 style = lv .style_t ()
115122 style .init ()
@@ -624,3 +631,11 @@ def handle_top_swipe():
624631 rect .add_event_cb (top_swipe_cb , lv .EVENT .RELEASED , None )
625632
626633
634+ def pct_of_display_width (percent ):
635+ return round (horizontal_resolution * percent / 100 )
636+
637+ def min_resolution ():
638+ return min (mpos .ui .horizontal_resolution ,mpos .ui .vertical_resolution )
639+
640+ def max_resolution ():
641+ return max (mpos .ui .horizontal_resolution ,mpos .ui .vertical_resolution )
You can’t perform that action at this time.
0 commit comments