Merge pull request 'Current theme reloading' (#324) from ayumi/tangara-fw:reload-theme into main

Reviewed-on: https://codeberg.org/cool-tech-zone/tangara-fw/pulls/324
custom-try-329
ailurux 6 days ago
commit 3804b2e2e8
  1. 28
      lua/settings.lua

@ -406,24 +406,38 @@ settings.ThemeSettings = SettingsScreen:new {
selected_idx = idx selected_idx = idx
end end
local theme_chooser = self.content:Dropdown { local theme_container = self.content:Object {
w = lvgl.PCT(100),
h = lvgl.SIZE_CONTENT,
flex = {
flex_direction = "column",
justify_content = "flex-start",
align_items = "space-evenly",
align_content = "flex-start",
},
pad_row = 4,
}
theme_container:add_style(styles.list_item)
local theme_chooser = theme_container:Dropdown {
options = options, options = options,
symbol = img.chevron, symbol = img.chevron,
} }
local theme_chooser_desc = widgets.Description(theme_chooser, "Theme") local theme_chooser_desc = widgets.Description(theme_chooser, "Theme")
theme_chooser:set({ selected = selected_idx }) local theme_reload = function()
theme_chooser:onevent(lvgl.EVENT.VALUE_CHANGED, function()
local option = theme_chooser:get('selected_str') local option = theme_chooser:get('selected_str')
local selectedTheme = themeOptions[option] local selectedTheme = themeOptions[option]
if (selectedTheme) then if (selectedTheme) then
theme.load_theme(tostring(selectedTheme)) theme.load_theme(tostring(selectedTheme))
backstack.reset(main_menu:new()) backstack.reset(main_menu:new())
end end
end) end
theme_chooser:set({ selected = selected_idx })
theme_chooser:onevent(lvgl.EVENT.VALUE_CHANGED, theme_reload)
theme_chooser:focus() theme_chooser:focus()
local theme_reload_btn = theme_container:Button {}
theme_reload_btn:Label { text = "Reload" }
theme_reload_btn:onClicked(theme_reload)
end end
} }

Loading…
Cancel
Save