ImageView app: simplify imports

This commit is contained in:
Thomas Farstrike
2026-01-13 11:05:27 +01:00
parent 26bfd89b8c
commit b529431c2f
3 changed files with 21 additions and 18 deletions
@@ -1,8 +1,7 @@
import gc
import os
from mpos import Activity, ui
import mpos.ui.anim
from mpos import Activity, smooth_show, smooth_hide, pct_of_display_width, pct_of_display_height
class ImageView(Activity):
@@ -103,9 +102,9 @@ class ImageView(Activity):
def no_image_mode(self):
self.label.set_text(f"No images found in {self.imagedir}...")
mpos.ui.anim.smooth_hide(self.prev_button)
mpos.ui.anim.smooth_hide(self.delete_button)
mpos.ui.anim.smooth_hide(self.next_button)
smooth_hide(self.prev_button)
smooth_hide(self.delete_button)
smooth_hide(self.next_button)
def show_prev_image(self, event=None):
print("showing previous image...")
@@ -132,21 +131,21 @@ class ImageView(Activity):
def stop_fullscreen(self):
print("stopping fullscreen")
mpos.ui.anim.smooth_show(self.label)
mpos.ui.anim.smooth_show(self.prev_button)
mpos.ui.anim.smooth_show(self.delete_button)
#mpos.ui.anim.smooth_show(self.play_button)
smooth_show(self.label)
smooth_show(self.prev_button)
smooth_show(self.delete_button)
#smooth_show(self.play_button)
self.play_button.add_flag(lv.obj.FLAG.HIDDEN) # make it not accepting focus
mpos.ui.anim.smooth_show(self.next_button)
smooth_show(self.next_button)
def start_fullscreen(self):
print("starting fullscreen")
mpos.ui.anim.smooth_hide(self.label)
mpos.ui.anim.smooth_hide(self.prev_button, hide=False)
mpos.ui.anim.smooth_hide(self.delete_button, hide=False)
#mpos.ui.anim.smooth_hide(self.play_button, hide=False)
smooth_hide(self.label)
smooth_hide(self.prev_button, hide=False)
smooth_hide(self.delete_button, hide=False)
#smooth_hide(self.play_button, hide=False)
self.play_button.remove_flag(lv.obj.FLAG.HIDDEN) # make it accepting focus
mpos.ui.anim.smooth_hide(self.next_button, hide=False)
smooth_hide(self.next_button, hide=False)
self.unfocus() # focus on the invisible center button, not previous or next
def show_prev_image_if_fullscreen(self, event=None):
@@ -272,8 +271,8 @@ class ImageView(Activity):
pct = 100
else:
pct = 70
lvgl_w = mpos.ui.pct_of_display_width(pct)
lvgl_h = mpos.ui.pct_of_display_height(pct)
lvgl_w = pct_of_display_width(pct)
lvgl_h = pct_of_display_height(pct)
print(f"scaling to size: {lvgl_w}x{lvgl_h}")
header = lv.image_header_t()
self.image.decoder_get_info(self.image.get_src(), header)
+3 -1
View File
@@ -39,6 +39,7 @@ from .ui.topmenu import open_bar, close_bar, open_drawer, drawer_open, NOTIFICAT
from .ui.focus import save_and_clear_current_focusgroup
from .ui.gesture_navigation import handle_back_swipe, handle_top_swipe
from .ui.util import shutdown, set_foreground_app, get_foreground_app
from .ui.anim import smooth_show, smooth_hide
from .ui import focus_direction
# Utility modules
@@ -78,12 +79,13 @@ __all__ = [
"save_and_clear_current_focusgroup",
"handle_back_swipe", "handle_top_swipe",
"shutdown", "set_foreground_app", "get_foreground_app",
"smooth_show", "smooth_hide",
"focus_direction",
# Testing utilities
"wait_for_render", "capture_screenshot", "simulate_click", "get_widget_coords",
"find_label_with_text", "verify_text_present", "print_screen_labels", "find_text_on_screen",
"click_button", "click_label", "click_keyboard_button", "find_button_with_text",
"get_all_widgets_with_text"
"get_all_widgets_with_text",
# Submodules
"apps", "ui", "config", "net", "content", "time", "sensor_manager",
"sdcard", "battery_voltage", "audio", "hardware", "bootloader"
@@ -16,6 +16,7 @@ from .event import get_event_name, print_event
from .util import shutdown, set_foreground_app, get_foreground_app
from .setting_activity import SettingActivity
from .settings_activity import SettingsActivity
from .anim import smooth_show, smooth_hide
from . import focus_direction
# main_display is assigned by board-specific initialization code
@@ -35,5 +36,6 @@ __all__ = [
"shutdown", "set_foreground_app", "get_foreground_app",
"SettingActivity",
"SettingsActivity",
"smooth_show", "smooth_hide",
"focus_direction"
]