From de23ba41def84853bb1fe2d7d9187e0f2487fd55 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Mon, 11 Sep 2023 11:36:09 +0400 Subject: [PATCH] Various fixes to support new AIO version --- main/battery-widget.lua | 7 +------ main/kodi-remote-widget.lua | 9 +++++++++ main/shell-widget.lua | 4 ++++ main/sys-info-widget.lua | 8 +------- main/uptimerobot-widget.lua | 9 +++++++++ 5 files changed, 24 insertions(+), 13 deletions(-) diff --git a/main/battery-widget.lua b/main/battery-widget.lua index f1b52f3..4d1e24d 100644 --- a/main/battery-widget.lua +++ b/main/battery-widget.lua @@ -2,17 +2,12 @@ -- description = "Simple battery info widget" -- author = "Evgeny Zobnin (zobnin@gmail.com)" -ticks = -1 - -function on_tick() +function on_tick(ticks) -- Update one time per 10 seconds - ticks = ticks + 1 if ticks % 10 ~= 0 then return end - ticks = 0 - local batt_info = system:battery_info() local batt_strings = stringify_table(batt_info) local folded_str = "Battery: "..batt_info.percent.."% | "..batt_info.temp.."° | "..batt_info.voltage.." mV" diff --git a/main/kodi-remote-widget.lua b/main/kodi-remote-widget.lua index 6c51a0c..970eb6e 100644 --- a/main/kodi-remote-widget.lua +++ b/main/kodi-remote-widget.lua @@ -28,6 +28,15 @@ local buttons_cmds = { prev_cmd, backward_cmd, play_cmd, stop_cmd, forward_cmd, local url = nil local curr_idx = nil +function on_preview() + if next(settings:get()) == nil then + ui:show_text("Remote control for Kodi multimedia player") + return + else + on_resume() + end +end + function on_resume() if next(settings:get()) == nil then ui:show_text("Tap to enter Kodi address") diff --git a/main/shell-widget.lua b/main/shell-widget.lua index a76578b..8049d41 100644 --- a/main/shell-widget.lua +++ b/main/shell-widget.lua @@ -7,6 +7,10 @@ current_output = "Click to enter command" +function on_preview() + ui:show_text("Shows the result of executing console commands") +end + function on_resume() redraw() end diff --git a/main/sys-info-widget.lua b/main/sys-info-widget.lua index 4054717..63d0cbc 100644 --- a/main/sys-info-widget.lua +++ b/main/sys-info-widget.lua @@ -4,17 +4,11 @@ -- author = "Evgeny Zobnin (zobnin@gmail.com)" -- version = "1.0" -ticks = -1 - -function on_tick() - -- Update one time per 10 seconds - ticks = ticks + 1 +function on_tick(ticks) if ticks % 10 ~= 0 then return end - ticks = 0 - local info = system:system_info() local strings = stringify_table(info) diff --git a/main/uptimerobot-widget.lua b/main/uptimerobot-widget.lua index cbfbc14..fb1a5a7 100644 --- a/main/uptimerobot-widget.lua +++ b/main/uptimerobot-widget.lua @@ -14,6 +14,15 @@ local api_url = "https://api.uptimerobot.com/v2/" local click_url = "https://uptimerobot.com/dashboard#mainDashboard" local media_type = "application/x-www-form-urlencoded" +function on_preview() + if (next(settings:get()) == nil) then + ui:show_text("Shows uptime information from uptimerobot.com") + return + else + on_alarm() + end +end + function on_alarm() if (next(settings:get()) == nil) then ui:show_text("Tap to enter API key")