Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaea5f7a

Browse files
waveshare: fix focusgroup handling
1 parentc70780d commitaea5f7a

File tree

6 files changed

+19
-15
lines changed

6 files changed

+19
-15
lines changed

‎internal_filesystem/apps/com.micropythonos.imageview/assets/imageview.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,23 +165,23 @@ def show_next_image_if_fullscreen(self, event=None):
165165
self.show_next_image()
166166

167167
defunfocus(self):
168-
group=lv.group_get_default()
169-
ifnotgroup:
168+
focusgroup=lv.group_get_default()
169+
ifnotfocusgroup:
170170
print("WARNING: imageview.py could not get default focus group")
171171
return
172172
print("got focus group")
173173
# group.focus_obj(self.play_button) would be better but appears missing?!
174-
focused=group.get_focused()
174+
focused=focusgroup.get_focused()
175175
print("got focus button")
176176
#focused.remove_state(lv.STATE.FOCUSED) # this doesn't seem to work to remove focus
177177
iffocused:
178178
print("checking which button is focused")
179179
iffocused==self.next_button:
180180
print("next is focused")
181-
group.focus_prev()
181+
focusgroup.focus_prev()
182182
eliffocused==self.prev_button:
183183
print("prev is focused")
184-
group.focus_next()
184+
focusgroup.focus_next()
185185
else:
186186
print("focus isn't on next or previous, leaving it...")
187187

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ def onResume(self, screen):
107107
app_cont.add_event_cb(lambdae,path=app_dir_fullpath:mpos.apps.start_app(path),lv.EVENT.CLICKED,None)
108108
app_cont.add_event_cb(lambdae,app_cont=app_cont:self.focus_app_cont(app_cont),lv.EVENT.FOCUSED,None)
109109
app_cont.add_event_cb(lambdae,app_cont=app_cont:self.defocus_app_cont(app_cont),lv.EVENT.DEFOCUSED,None)
110-
focusgroup.add_obj(app_cont)
110+
iffocusgroup:
111+
focusgroup.add_obj(app_cont)
111112

112113
end=time.ticks_ms()
113114
print(f"Redraw icons took:{end-start}ms")

‎internal_filesystem/builtin/apps/com.micropythonos.settings/assets/settings.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ def onResume(self, screen):
9292
setting_cont.add_event_cb(lambdae,s=setting:self.startSettingActivity(s),lv.EVENT.CLICKED,None)
9393
setting_cont.add_event_cb(lambdae,container=setting_cont:self.focus_container(container),lv.EVENT.FOCUSED,None)
9494
setting_cont.add_event_cb(lambdae,container=setting_cont:self.defocus_container(container),lv.EVENT.DEFOCUSED,None)
95-
focusgroup.add_obj(setting_cont)
95+
iffocusgroup:
96+
focusgroup.add_obj(setting_cont)
9697

9798
defstartSettingActivity(self,setting):
9899
intent=Intent(activity_class=SettingActivity)

‎internal_filesystem/builtin/apps/com.micropythonos.wifi/assets/wifi.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,13 +314,15 @@ def show_keyboard(self):
314314
self.cancel_button.add_flag(lv.obj.FLAG.HIDDEN)
315315
mpos.ui.anim.smooth_show(self.keyboard)
316316
focusgroup=lv.group_get_default()
317-
focusgroup.focus_next()# move the focus to the keypad
317+
iffocusgroup:
318+
focusgroup.focus_next()# move the focus to the keypad
318319

319320
defhide_keyboard(self):
320321
self.connect_button.remove_flag(lv.obj.FLAG.HIDDEN)
321322
self.cancel_button.remove_flag(lv.obj.FLAG.HIDDEN)
322323
focusgroup=lv.group_get_default()
323-
focusgroup.focus_prev()# move the focus to the close button, otherwise it goes back to the textarea, which opens the keyboard again
324+
iffocusgroup:
325+
focusgroup.focus_prev()# move the focus to the close button, otherwise it goes back to the textarea, which opens the keyboard again
324326
mpos.ui.anim.smooth_hide(self.keyboard)
325327

326328
defprint_events(self,event):

‎internal_filesystem/lib/mpos/apps.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,9 @@ def _launch_activity(intent, result_callback=None):
335335
activity._result_callback=result_callback# Pass callback to activity
336336
start_time=utime.ticks_ms()
337337
# Remove objects from previous screens from the focus group:
338-
group=lv.group_get_default()
339-
ifgroup:# on esp32 this may not be set
340-
group.remove_all_objs()# might be better to save and restore the group for "back" actions
338+
focusgroup=lv.group_get_default()
339+
iffocusgroup:# on esp32 this may not be set
340+
focusgroup.remove_all_objs()# might be better to save and restore the group for "back" actions
341341
activity.onCreate()
342342
end_time=utime.ticks_diff(utime.ticks_ms(),start_time)
343343
print(f"apps.py _launch_activity: activity.onCreate took{end_time}ms")

‎internal_filesystem/lib/mpos/clipboard.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ def get():
1010

1111
defpaste_text(text):# called when CTRL-V is pressed on the keyboard
1212
print(f"mpos.ui.clipboard.py paste_text adding{text}")
13-
group=lv.group_get_default()
14-
ifnotgroup:
13+
focusgroup=lv.group_get_default()
14+
ifnotfocusgroup:
1515
return
16-
focused_obj=group.get_focused()
16+
focused_obj=focusgroup.get_focused()
1717
iffocused_objandisinstance(focused_obj,lv.textarea):
1818
focused_obj.add_text(text)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp