@@ -19,10 +19,10 @@ def show_widget(self, widget, anim_type="fade", duration=500, delay=0):
1919 anim .set_values (0 , 255 )
2020 anim .set_time (duration )
2121 anim .set_delay (delay )
22- anim .set_custom_exec_cb (lambda anim , value : widget .set_style_opacity (value , 0 ))
22+ anim .set_custom_exec_cb (lambda anim , value : widget .set_style_opa (value , 0 ))
2323 anim .set_path_cb (lv .anim_t .path_ease_in_out )
2424 # Ensure opacity is reset after animation
25- anim .set_completed_cb (lambda * args : widget .set_style_opacity (255 , 0 ))
25+ anim .set_completed_cb (lambda * args : widget .set_style_opa (255 , 0 ))
2626 elif anim_type == "slide_down" :
2727 print ("doing slide_down" )
2828 # Create slide-down animation (y from -height to original y)
@@ -40,6 +40,7 @@ def show_widget(self, widget, anim_type="fade", duration=500, delay=0):
4040 anim .set_completed_cb (lambda * args : widget .set_y (original_y ))
4141 elif anim_type == "slide_up" :
4242 # Create slide-up animation (y from +height to original y)
43+ # Seems to cause scroll bars to be added somehow if done to a keyboard at the bottom of the screen...
4344 original_y = widget .get_y ()
4445 height = widget .get_height ()
4546 anim = lv .anim_t ()
@@ -67,12 +68,13 @@ def hide_widget(self, widget, anim_type="fade", duration=500, delay=0):
6768 anim .set_values (255 , 0 )
6869 anim .set_time (duration )
6970 anim .set_delay (delay )
70- anim .set_custom_exec_cb (lambda anim , value : widget .set_style_opacity (value , 0 ))
71+ anim .set_custom_exec_cb (lambda anim , value : widget .set_style_opa (value , 0 ))
7172 anim .set_path_cb (lv .anim_t .path_ease_in_out )
7273 # Set HIDDEN flag after animation
73- anim .set_completed_cb (lambda * args : self .hide_complete_cb (widget , original_y ))
74+ anim .set_completed_cb (lambda * args : self .hide_complete_cb (widget ))
7475 elif anim_type == "slide_down" :
7576 # Create slide-down animation (y from original y to +height)
77+ # Seems to cause scroll bars to be added somehow if done to a keyboard at the bottom of the screen...
7678 original_y = widget .get_y ()
7779 height = widget .get_height ()
7880 anim = lv .anim_t ()
@@ -84,7 +86,7 @@ def hide_widget(self, widget, anim_type="fade", duration=500, delay=0):
8486 anim .set_custom_exec_cb (lambda anim , value : widget .set_y (value ))
8587 anim .set_path_cb (lv .anim_t .path_ease_in_out )
8688 # Set HIDDEN flag after animation
87- anim .set_completed_cb (lambda * args : self .hide_complete_cb (widget , original_y ))
89+ anim .set_completed_cb (lambda * args : self .hide_complete_cb (widget ))
8890 elif anim_type == "slide_up" :
8991 print ("hide with slide_up" )
9092 # Create slide-up animation (y from original y to -height)
@@ -99,16 +101,17 @@ def hide_widget(self, widget, anim_type="fade", duration=500, delay=0):
99101 anim .set_custom_exec_cb (lambda anim , value : widget .set_y (value ))
100102 anim .set_path_cb (lv .anim_t .path_ease_in_out )
101103 # Set HIDDEN flag after animation
102- anim .set_completed_cb (lambda * args : self .hide_complete_cb (widget , original_y ))
104+ anim .set_completed_cb (lambda * args : self .hide_complete_cb (widget ))
103105
104106 # Store and start animation
105107 self .animations [widget ] = anim
106108 anim .start ()
107109
108- def hide_complete_cb (self , widget , original_y ):
110+ def hide_complete_cb (self , widget ):
109111 #print("hide_complete_cb")
110112 widget .add_flag (lv .obj .FLAG .HIDDEN )
111- widget .set_y (original_y )
113+ #if original_y:
114+ # widget.set_y(original_y) # in case it shifted slightly due to rounding etc
112115
113116
114117 def stop_animation (self , widget ):
0 commit comments