get rid of get_ prefixes in main scripts

This commit is contained in:
Evgeny
2022-10-23 09:32:39 +04:00
parent ff5fc7648e
commit f8cfa4facf
8 changed files with 17 additions and 17 deletions

View File

@@ -13,7 +13,7 @@ function on_tick()
ticks = 0 ticks = 0
local batt_info = system:get_battery_info() local batt_info = system:battery_info()
local batt_strings = stringify_table(batt_info) local batt_strings = stringify_table(batt_info)
local folded_str = "Battery: "..batt_info.percent.."% | "..batt_info.temp.."° | "..batt_info.voltage.." mV" local folded_str = "Battery: "..batt_info.percent.."% | "..batt_info.temp.."° | "..batt_info.voltage.." mV"

View File

@@ -3,7 +3,7 @@
-- author = "Evgeny Zobnin (zobnin@gmail.com)" -- author = "Evgeny Zobnin (zobnin@gmail.com)"
-- type = "search" -- type = "search"
local events = calendar:get_events() local events = calendar:events()
local results = {} local results = {}
function on_search(str) function on_search(str)

View File

@@ -27,7 +27,7 @@ function on_alarm()
tab = get_cal(year,month) tab = get_cal(year,month)
line = get_line() line = get_line()
ui:show_table(table_to_tables(tab,8),0, true, line) ui:show_table(table_to_tables(tab,8),0, true, line)
ui:set_title(ui:get_default_title().." ("..get_date(month,year)..")") ui:set_title(ui:default_title().." ("..get_date(month,year)..")")
widget_type = "table" widget_type = "table"
end end
@@ -111,7 +111,7 @@ function on_dialog_action(data)
end end
function get_cal(y,m) function get_cal(y,m)
local color = ui:get_colors() local color = ui:colors()
local events = get_my_events(y,m,0) local events = get_my_events(y,m,0)
local from = os.time{year=y,month=m,day=1} local from = os.time{year=y,month=m,day=1}
local tab = { local tab = {
@@ -146,7 +146,7 @@ function get_cal(y,m)
end end
function format_day(y,m,d,events) function format_day(y,m,d,events)
local color = ui:get_colors() local color = ui:colors()
local from = os.time{year=y,month=m,day=d,hour=0,min=0,sec=0} local from = os.time{year=y,month=m,day=d,hour=0,min=0,sec=0}
local to = os.time{year=y,month=m,day=d,hour=23,min=59,sec=59} local to = os.time{year=y,month=m,day=d,hour=23,min=59,sec=59}
local yes = false local yes = false
@@ -207,7 +207,7 @@ function get_my_events(y,m,d)
end end
local events = {} local events = {}
if next(settings:get()) then if next(settings:get()) then
events = calendar:get_events(from,to,settings:get()) events = calendar:events(from,to,settings:get())
end end
for i=1,#events do for i=1,#events do
local v = events[i] local v = events[i]
@@ -227,7 +227,7 @@ function get_line()
local date = os.date("*t") local date = os.date("*t")
local from = os.time{year=date.year,month=date.month,day=date.day,hour=0,min=0,sec=0} local from = os.time{year=date.year,month=date.month,day=date.day,hour=0,min=0,sec=0}
local to = os.time{year=date.year,month=date.month,day=date.day,hour=23,min=59,sec=59} local to = os.time{year=date.year,month=date.month,day=date.day,hour=23,min=59,sec=59}
local events = calendar:get_events(from,to,settings:get()) local events = calendar:events(from,to,settings:get())
if next(events) == nil then if next(events) == nil then
line = "No events today" line = "No events today"
else else
@@ -237,7 +237,7 @@ function get_line()
end end
function get_my_calendar(id) function get_my_calendar(id)
local cals = calendar:get_calendars() local cals = calendar:calendars()
for i=1,#cals do for i=1,#cals do
local v = cals[i] local v = cals[i]
if id == v.id then if id == v.id then
@@ -256,7 +256,7 @@ function get_day_tab(events)
end end
function get_lines(events) function get_lines(events)
local color = ui:get_colors() local color = ui:colors()
local lines = {} local lines = {}
for i,v in ipairs(events) do for i,v in ipairs(events) do
table.insert(lines,"<font color = \""..v[9].."\">•</font>") table.insert(lines,"<font color = \""..v[9].."\">•</font>")
@@ -280,7 +280,7 @@ function get_lines(events)
end end
function get_all_cals() function get_all_cals()
local cals = calendar:get_calendars() local cals = calendar:calendars()
local idx = {} local idx = {}
local id = {} local id = {}
local name = {} local name = {}
@@ -295,7 +295,7 @@ function get_all_cals()
end end
function id_to_cal_id(ids) function id_to_cal_id(ids)
local cals = calendar:get_calendars() local cals = calendar:calendars()
local tab = {} local tab = {}
for i,v in ipairs(ids) do for i,v in ipairs(ids) do
table.insert(tab,cals[v].id) table.insert(tab,cals[v].id)
@@ -304,7 +304,7 @@ function id_to_cal_id(ids)
end end
function cal_id_to_id(cal_ids) function cal_id_to_id(cal_ids)
local cals = calendar:get_calendars() local cals = calendar:calendars()
local tab = {} local tab = {}
for i,v in ipairs(cal_ids) do for i,v in ipairs(cal_ids) do
for ii,vv in ipairs(cals) do for ii,vv in ipairs(cals) do

View File

@@ -5,7 +5,7 @@
-- author = "Evgeny Zobnin (zobnin@gmail.com)" -- author = "Evgeny Zobnin (zobnin@gmail.com)"
-- version = "1.0" -- version = "1.0"
equals = "<font color=\""..ui:get_colors().secondary_text.."\"> = </font>" equals = "<font color=\""..ui:colors().secondary_text.."\"> = </font>"
function on_alarm() function on_alarm()
http:get("https://api.covid19api.com/summary") http:get("https://api.covid19api.com/summary")

View File

@@ -19,6 +19,6 @@ end
function on_click() function on_click()
if quote ~= nil then if quote ~= nil then
system:copy_to_clipboard(quote) system:to_clipboard(quote)
end end
end end

View File

@@ -15,7 +15,7 @@ function on_tick()
ticks = 0 ticks = 0
local info = system:get_system_info() local info = system:system_info()
local strings = stringify_table(info) local strings = stringify_table(info)
ui:show_lines(strings) ui:show_lines(strings)

View File

@@ -18,7 +18,7 @@ function on_alarm()
end end
function redraw() function redraw()
local color = ui:get_colors() local color = ui:colors()
if unit == "temperature" then if unit == "temperature" then
sum = round(f[units[unit][unit_from]..units[unit][unit_to]](amount),3) sum = round(f[units[unit][unit_from]..units[unit][unit_to]](amount),3)
else else

View File

@@ -10,7 +10,7 @@ json = require "json"
url = require "url" url = require "url"
function on_alarm() function on_alarm()
lang = system:get_lang() lang = system:lang()
random_url = "https://"..lang..".wikipedia.org/w/api.php?action=query&format=json&list=random&rnnamespace=0&rnlimit=1" random_url = "https://"..lang..".wikipedia.org/w/api.php?action=query&format=json&list=random&rnnamespace=0&rnlimit=1"
summary_url = "https://"..lang..".wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro&explaintext&redirects=1" summary_url = "https://"..lang..".wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro&explaintext&redirects=1"
article_url = "https://"..lang..".wikipedia.org/wiki/" article_url = "https://"..lang..".wikipedia.org/wiki/"