Skip to content

Commit dda84ac

Browse files
launcher: redraw every time
1 parent 9de4953 commit dda84ac

1 file changed

Lines changed: 8 additions & 17 deletions

File tree

  • internal_filesystem/builtin/apps/com.micropythonos.launcher/assets

internal_filesystem/builtin/apps/com.micropythonos.launcher/assets/launcher.py

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,22 @@
1717

1818
class Launcher(mpos.apps.Activity):
1919

20-
seen_base_names = set()
21-
2220
def onCreate(self):
2321
print("launcher.py onCreate()")
2422
main_screen = lv.obj()
2523
main_screen.set_style_border_width(0, 0)
2624
main_screen.set_style_radius(0, 0)
2725
main_screen.set_pos(0, mpos.ui.NOTIFICATION_BAR_HEIGHT) # leave some margin for the notification bar
28-
main_screen.set_size(lv.pct(100), lv.pct(100))
29-
main_screen.set_style_pad_hor(5, 0)
26+
#main_screen.set_size(lv.pct(100), lv.pct(100))
27+
main_screen.set_style_pad_hor(mpos.ui.pct_of_display_width(2), 0)
3028
main_screen.set_style_pad_ver(mpos.ui.NOTIFICATION_BAR_HEIGHT, 0)
3129
main_screen.set_flex_flow(lv.FLEX_FLOW.ROW_WRAP)
3230
self.setContentView(main_screen)
3331

3432
def onResume(self, screen):
35-
redraw = False
3633
app_list = []
37-
# Check and collect subdirectories from existing directories
34+
seen_base_names = set()
35+
# Check and collect subdirectories from existing directories
3836
apps_dir = "apps"
3937
apps_dir_builtin = "builtin/apps"
4038
# Grid parameters
@@ -43,6 +41,7 @@ def onResume(self, screen):
4341
iconcont_width = icon_size + label_height
4442
iconcont_height = icon_size + label_height
4543

44+
4645
# Check and collect unique subdirectories
4746
for dir_path in [apps_dir, apps_dir_builtin]:
4847
try:
@@ -52,27 +51,19 @@ def onResume(self, screen):
5251
#print(f"full_path: {full_path}")
5352
if uos.stat(full_path)[0] & 0x4000: # Check if it's a directory
5453
base_name = d
55-
if base_name not in self.seen_base_names: # Avoid duplicates
56-
self.seen_base_names.add(base_name)
57-
#print(f"seen_base_names: {self.seen_base_names}")
54+
if base_name not in seen_base_names: # Avoid duplicates
55+
seen_base_names.add(base_name)
5856
app = mpos.apps.parse_manifest(f"{full_path}/META-INF/MANIFEST.JSON")
5957
if app.category != "launcher": # Skip launchers
6058
main_launcher = mpos.apps.find_main_launcher_activity(app)
6159
if main_launcher:
62-
redraw = True
6360
app_list.append((app.name, full_path))
6461
except OSError:
6562
pass
66-
67-
if not redraw:
68-
print("Launcher doesn't need redraw, done.")
69-
return
70-
else:
71-
print("Launcher redrawing...")
7263

7364
import time
7465
start = time.ticks_ms()
75-
66+
7667
screen.clean()
7768

7869
# Sort apps alphabetically by app.name

0 commit comments

Comments
 (0)