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

Commit7ef6ca2

Browse files
imageview: update
1 parent127809c commit7ef6ca2

File tree

4 files changed

+64
-11
lines changed

4 files changed

+64
-11
lines changed

‎draft_code/saved_functions.py‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,3 +677,27 @@ def print_fps():
677677
#img.set_src("P:/data/images/icon_64x64.jpg")
678678
img.set_src("P:../artwork/icon_64x64.jpg")
679679

680+
681+
682+
group=sdlkeyboard.get_group()
683+
#group.remove_all_objs()
684+
group=lv.group_create()
685+
#group.set_default()
686+
687+
group=lv.group_get_default()
688+
group.get_focused()
689+
690+
group.remove_all_objs()
691+
692+
screen=lv.obj()
693+
lv.screen_load(screen)
694+
695+
ta1=lv.textarea(screen)
696+
ta1.align(lv.ALIGN.TOP_MID,0,0)
697+
#group.add_obj(ta1)
698+
699+
b=lv.button(screen)
700+
b.center()
701+
702+
importtask_handler
703+
task_handler.TaskHandler(duration=5)# 5ms is recommended for MicroPython+LVGL on desktop

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

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
importtime
33

44
frommpos.appsimportActivity
5+
importmpos.ui
56

67
classImageView(Activity):
78

@@ -19,20 +20,27 @@ def onCreate(self):
1920
screen=lv.obj()
2021
self.image=lv.image(screen)
2122
self.image.set_size(128,128)
22-
self.image.align(lv.ALIGN.BOTTOM_MID,0,0)
23+
self.image.center()
2324
self.label=lv.label(screen)
2425
self.label.set_text('Hello Images!')
2526
self.label.align(lv.ALIGN.TOP_MID,0,0)
26-
self.next_button=lv.button(screen)
27-
self.next_button.align(lv.ALIGN.BOTTOM_RIGHT,0,0)
28-
self.next_button.add_event_cb(lambdae:self.show_next_image(),lv.EVENT.CLICKED,None)
29-
next_label=lv.label(self.next_button)
30-
next_label.set_text(">")
3127
self.prev_button=lv.button(screen)
3228
self.prev_button.align(lv.ALIGN.BOTTOM_LEFT,0,0)
3329
self.prev_button.add_event_cb(lambdae:self.show_prev_image(),lv.EVENT.CLICKED,None)
3430
prev_label=lv.label(self.prev_button)
35-
prev_label.set_text("<")
31+
prev_label.set_text(lv.SYMBOL.LEFT)
32+
self.play_button=lv.button(screen)
33+
self.play_button.align(lv.ALIGN.BOTTOM_MID,0,0)
34+
self.play_button.add_event_cb(lambdae:self.play(),lv.EVENT.CLICKED,None)
35+
play_label=lv.label(self.play_button)
36+
play_label.set_text(lv.SYMBOL.PLAY)
37+
self.next_button=lv.button(screen)
38+
self.next_button.align(lv.ALIGN.BOTTOM_RIGHT,0,0)
39+
self.next_button.add_event_cb(lambdae:self.show_next_image(),lv.EVENT.CLICKED,None)
40+
#self.next_button.add_event_cb(self.touch_cb, lv.EVENT.ALL, None)
41+
next_label=lv.label(self.next_button)
42+
next_label.set_text(lv.SYMBOL.RIGHT)
43+
#screen.add_event_cb(self.touch_cb, lv.EVENT.ALL, None)
3644
self.setContentView(screen)
3745

3846
defonResume(self,screen):
@@ -55,6 +63,27 @@ def onStop(self, screen):
5563
ifself.image_timer:
5664
print("ImageView: deleting image_timer")
5765
self.image_timer.delete()
66+
67+
deftouch_cb(self,event):
68+
globalcanvas
69+
event_code=event.get_code()
70+
#print(f"got event {event_code}")
71+
# Ignore:
72+
# =======
73+
# 19: HIT_TEST
74+
# COVER_CHECK
75+
# DRAW_MAIN
76+
# DRAW_MAIN_BEGIN
77+
# DRAW_MAIN_END
78+
# DRAW_POST
79+
# DRAW_POST_BEGIN
80+
# DRAW_POST_END
81+
# 39: CHILD_CHANGED
82+
# GET_SELF_SIZE
83+
ifevent_codenotin [19,23,25,26,27,28,29,30,39,49]:
84+
name=mpos.ui.get_event_name(event_code)
85+
print(f"lv_event_t: code={event_code}, name={name}")# target={event.get_target()}, user_data={event.get_user_data()}, param={event.get_param()}
86+
5887

5988
defshow_prev_image(self,event=None):
6089
print("showing previous image...")
@@ -68,6 +97,9 @@ def show_prev_image(self, event=None):
6897
print(f"show_prev_image showing{name}")
6998
self.show_image(name)
7099

100+
defplay(self,event=None):
101+
print("playing...")
102+
71103
defshow_next_image(self,event=None):
72104
print("showing next image...")
73105
iflen(self.images)<1:

‎internal_filesystem/boot_unix.py‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ def catch_escape_key(indev, indev_data):
4040
mpos.ui.back_screen()
4141
sdlkeyboard._read(indev,indev_data)
4242

43-
4443
importsdl_keyboard
4544
sdlkeyboard=sdl_keyboard.SDLKeyboard()
4645
sdlkeyboard._indev_drv.set_read_cb(catch_escape_key)# check for escape
@@ -50,9 +49,6 @@ def catch_escape_key(indev, indev_data):
5049
# global canvas
5150
# event_code=event.get_code()
5251
# print(f"boot_unix: code={event_code}") # target={event.get_target()}, user_data={event.get_user_data()}, param={event.get_param()}
53-
5452
#keyboard.add_event_cb(keyboard_cb, lv.EVENT.ALL, None)
5553

56-
5754
print("boot_unix.py finished")
58-

‎internal_filesystem/main.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
print("main.py: WARNING: could not import/run freezefs_mount_builtin: ",e)
3333

3434
frommposimportapps
35+
3536
apps.execute_script("builtin/system/button.py",True)# Install button handler through IRQ
3637

3738
apps.auto_connect()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp