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

Commit46526c6

Browse files
fix imageview back while fullscreen issue
1 parentca57a5a commit46526c6

File tree

1 file changed

+20
-6
lines changed
  • internal_filesystem/apps/com.micropythonos.imageview/assets

1 file changed

+20
-6
lines changed

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

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class ImageView(Activity):
1616
image_nr=None
1717
image_timer=None
1818
fullscreen=False
19+
stopping=False
1920

2021
# Widgets
2122
image=None
@@ -62,6 +63,7 @@ def onCreate(self):
6263
self.setContentView(screen)
6364

6465
defonResume(self,screen):
66+
self.stopping=False
6567
self.images.clear()
6668
foriteminos.listdir(self.imagedir):
6769
print(item)
@@ -80,6 +82,8 @@ def onResume(self, screen):
8082
#self.image_timer = lv.timer_create(self.show_next_image, 1000, None)
8183

8284
defonStop(self,screen):
85+
print("ImageView stopping")
86+
self.stopping=True
8387
ifself.image_timer:
8488
print("ImageView: deleting image_timer")
8589
self.image_timer.delete()
@@ -145,28 +149,34 @@ def start_fullscreen(self):
145149
self.unfocus()# focus on the invisible center button, not previous or next
146150

147151
defshow_prev_image_if_fullscreen(self,event=None):
152+
ifself.stopping:# closing the window results in a focus shift, which can trigger the next action in fullscreen
153+
return
148154
ifself.fullscreen:
149155
self.unfocus()
150156
self.show_prev_image()
151157

152158
defshow_next_image_if_fullscreen(self,event=None):
159+
ifself.stopping:# closing the window results in a focus shift, which can trigger the next action in fullscreen
160+
return
153161
ifself.fullscreen:
154162
self.unfocus()
155163
self.show_next_image()
156164

157165
defunfocus(self):
158166
group=lv.group_get_default()
167+
ifnotgroup:
168+
return
159169
print("got focus group")
160170
# group.focus_obj(self.play_button) would be better but appears missing?!
161-
b=group.get_focused()
171+
focused=group.get_focused()
162172
print("got focus button")
163-
#b.remove_state(lv.STATE.FOCUSED) # this doesn't seem to work to remove focus
164-
ifb:
173+
#focused.remove_state(lv.STATE.FOCUSED) # this doesn't seem to work to remove focus
174+
iffocused:
165175
print("checking which button is focused")
166-
ifb==self.next_button:
176+
iffocused==self.next_button:
167177
print("next is focused")
168178
group.focus_prev()
169-
elifb==self.prev_button:
179+
eliffocused==self.prev_button:
170180
print("prev is focused")
171181
group.focus_next()
172182
else:
@@ -213,7 +223,11 @@ def show_image(self, name):
213223
image_data=f.read()
214224
print(f"loaded{len(image_data)} bytes from .raw file")
215225
f.close()
216-
width,height,color_format=self.extract_dimensions_and_format(name)
226+
try:
227+
width,height,color_format=self.extract_dimensions_and_format(name)
228+
exceptValueErrorase:
229+
print(f"Warning: could not extract dimensions and format from raw image:{e}")
230+
return
217231
print(f"Raw image has width:{width}, Height:{height}, Color Format:{color_format}")
218232
stride=width*2
219233
cf=lv.COLOR_FORMAT.RGB565

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp