Move some widgets from main to community
This commit is contained in:
22
community/isdayoff-ru-widget.lua
Normal file
22
community/isdayoff-ru-widget.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
-- name = "Сегодня выходной?"
|
||||
-- description = "Показывает, выходной ли сегодня день."
|
||||
-- data_source = "isdayoff.ru"
|
||||
-- type = "widget"
|
||||
-- lang = "ru"
|
||||
-- author = "Evgeny Zobnin (zobnin@gmail.com)"
|
||||
-- version = "1.0"
|
||||
|
||||
function on_alarm()
|
||||
local dateStr = os.date('%Y%m%d')
|
||||
http:get("https://isdayoff.ru/"..dateStr)
|
||||
end
|
||||
|
||||
function on_network_result(result)
|
||||
if result == "0" then
|
||||
ui:show_text("Сегодня рабочий день")
|
||||
elseif result == "1" then
|
||||
ui:show_text("Сегодня выходной")
|
||||
else
|
||||
ui:show_text("Ошибка")
|
||||
end
|
||||
end
|
||||
39
community/shell-widget.lua
Normal file
39
community/shell-widget.lua
Normal file
@@ -0,0 +1,39 @@
|
||||
-- name = "Shell widget"
|
||||
-- description = "Shows the result of executing console commands"
|
||||
-- type = "widget"
|
||||
-- author = "Evgeny Zobnin (zobnin@gmail.com)"
|
||||
-- version = "1.0"
|
||||
-- foldable = "false"
|
||||
|
||||
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
|
||||
|
||||
function redraw()
|
||||
ui:show_text("%%txt%%"..current_output)
|
||||
end
|
||||
|
||||
function on_click(idx)
|
||||
dialogs:show_edit_dialog("Enter command")
|
||||
end
|
||||
|
||||
function on_dialog_action(text)
|
||||
system:exec(text)
|
||||
end
|
||||
|
||||
function on_shell_result(text)
|
||||
if text == "" then
|
||||
current_output = "no output"
|
||||
else
|
||||
current_output = text
|
||||
end
|
||||
|
||||
redraw()
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user