HASPmota added haspmota.page_show() to change page (#20333)

This commit is contained in:
s-hadinger 2023-12-28 22:19:58 +01:00 committed by GitHub
parent 6d94d9e766
commit 1f662a6dad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 656 additions and 619 deletions

View File

@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file.
- Matter support for password for remote Tasmota devices (#20296)
- Display of active drivers using command ``status 4``
- ESP32 used UART information
- HASPmota added `haspmota.page_show()` to change page
### Breaking Changed
- Refactoring of Berry `animate` module for WS2812 Leds (#20236)

File diff suppressed because it is too large Load Diff

View File

@ -1740,12 +1740,19 @@ class HASPmota
#====================================================================
def do_action(lvh_object, event_code)
if event_code != lv.EVENT_CLICKED return end
var action = lvh_object._action
var cur_page = self.lvh_pages[self.lvh_page_cur_idx]
# print("do_action","lvh_object",lvh_object,"action",action,"cur_page",cur_page,self.lvh_page_cur_idx)
self.page_show(lvh_object._action)
end
#====================================================================
# Execute a page changing action from string `action`
#
# Arg1 `action` can be `prev`, `next`, `back` or `p<number>`
# Returns: nil
#====================================================================
def page_show(action)
# action can be `prev`, `next`, `back`, or `p<number>` like `p1`
var to_page = nil
var cur_page = self.lvh_pages[self.lvh_page_cur_idx]
var sorted_pages_list = self.pages_list_sorted(self.lvh_page_cur_idx)
if size(sorted_pages_list) <= 1 return end # if only 1 page, do nothing
# handle prev/next/back values