use snake_case consistently in lua function names
This commit is contained in:
+1
-1
@@ -10,7 +10,7 @@ local theme = require("theme")
|
||||
local screen = require("screen")
|
||||
|
||||
return screen:new{
|
||||
createUi = function(self)
|
||||
create_ui = function(self)
|
||||
self.root = lvgl.Object(nil, {
|
||||
flex = {
|
||||
flex_direction = "column",
|
||||
|
||||
@@ -11,7 +11,7 @@ local screen = require("screen")
|
||||
local filesystem = require("filesystem")
|
||||
|
||||
return screen:new {
|
||||
createUi = function(self)
|
||||
create_ui = function(self)
|
||||
self.root = lvgl.Object(nil, {
|
||||
flex = {
|
||||
flex_direction = "column",
|
||||
|
||||
+2
-2
@@ -8,8 +8,8 @@ local function show_license(text)
|
||||
backstack.push(widgets.MenuScreen:new {
|
||||
show_back = true,
|
||||
title = "Licenses",
|
||||
createUi = function(self)
|
||||
widgets.MenuScreen.createUi(self)
|
||||
create_ui = function(self)
|
||||
widgets.MenuScreen.create_ui(self)
|
||||
self.root:Label {
|
||||
w = lvgl.PCT(100),
|
||||
h = lvgl.SIZE_CONTENT,
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ local function init_ui()
|
||||
elseif time.ticks() - lock_time > 8000 then
|
||||
local queue = require("queue")
|
||||
if queue.size:get() > 0 then
|
||||
require("playing"):pushIfNotShown()
|
||||
require("playing"):push_if_not_shown()
|
||||
end
|
||||
end
|
||||
end),
|
||||
|
||||
+2
-2
@@ -13,8 +13,8 @@ local img = require("images")
|
||||
local playback = require("playback")
|
||||
|
||||
return widgets.MenuScreen:new {
|
||||
createUi = function(self)
|
||||
widgets.MenuScreen.createUi(self)
|
||||
create_ui = function(self)
|
||||
widgets.MenuScreen.create_ui(self)
|
||||
|
||||
-- At the top, a card showing details about the current track. Hidden if
|
||||
-- there is no track currently playing.
|
||||
|
||||
+4
-4
@@ -20,7 +20,7 @@ local icon_enabled_class = "icon_enabled"
|
||||
local icon_disabled_class = "icon_disabled"
|
||||
|
||||
return screen:new {
|
||||
createUi = function(self)
|
||||
create_ui = function(self)
|
||||
self.root = lvgl.Object(nil, {
|
||||
flex = {
|
||||
flex_direction = "column",
|
||||
@@ -281,9 +281,9 @@ return screen:new {
|
||||
end),
|
||||
}
|
||||
end,
|
||||
onShown = function() is_now_playing_shown = true end,
|
||||
onHidden = function() is_now_playing_shown = false end,
|
||||
pushIfNotShown = function(self)
|
||||
on_show = function() is_now_playing_shown = true end,
|
||||
on_hide = function() is_now_playing_shown = false end,
|
||||
push_if_not_shown = function(self)
|
||||
if not is_now_playing_shown then
|
||||
backstack.push(self:new())
|
||||
end
|
||||
|
||||
+35
-35
@@ -15,8 +15,8 @@ local main_menu = require("main_menu")
|
||||
|
||||
local SettingsScreen = widgets.MenuScreen:new {
|
||||
show_back = true,
|
||||
createUi = function(self)
|
||||
widgets.MenuScreen.createUi(self)
|
||||
create_ui = function(self)
|
||||
widgets.MenuScreen.create_ui(self)
|
||||
self.content = self.root:Object {
|
||||
flex = {
|
||||
flex_direction = "column",
|
||||
@@ -35,8 +35,8 @@ local SettingsScreen = widgets.MenuScreen:new {
|
||||
|
||||
local BluetoothPairing = SettingsScreen:new {
|
||||
title = "Nearby Devices",
|
||||
createUi = function(self)
|
||||
SettingsScreen.createUi(self)
|
||||
create_ui = function(self)
|
||||
SettingsScreen.create_ui(self)
|
||||
|
||||
local devices = self.content:List {
|
||||
w = lvgl.PCT(100),
|
||||
@@ -55,14 +55,14 @@ local BluetoothPairing = SettingsScreen:new {
|
||||
end)
|
||||
}
|
||||
end,
|
||||
onShown = function() bluetooth.discovering:set(true) end,
|
||||
onHidden = function() bluetooth.discovering:set(false) end,
|
||||
on_show = function() bluetooth.discovering:set(true) end,
|
||||
on_hide = function() bluetooth.discovering:set(false) end,
|
||||
}
|
||||
|
||||
local BluetoothSettings = SettingsScreen:new {
|
||||
title = "Bluetooth",
|
||||
createUi = function(self)
|
||||
SettingsScreen.createUi(self)
|
||||
create_ui = function(self)
|
||||
SettingsScreen.create_ui(self)
|
||||
|
||||
-- Enable/Disable switch
|
||||
local enable_container = self.content:Object {
|
||||
@@ -203,8 +203,8 @@ local BluetoothSettings = SettingsScreen:new {
|
||||
|
||||
local HeadphonesSettings = SettingsScreen:new {
|
||||
title = "Headphones",
|
||||
createUi = function(self)
|
||||
SettingsScreen.createUi(self)
|
||||
create_ui = function(self)
|
||||
SettingsScreen.create_ui(self)
|
||||
|
||||
theme.set_style(self.content:Label {
|
||||
text = "Maxiumum volume limit",
|
||||
@@ -266,8 +266,8 @@ local HeadphonesSettings = SettingsScreen:new {
|
||||
|
||||
local DisplaySettings = SettingsScreen:new {
|
||||
title = "Display",
|
||||
createUi = function(self)
|
||||
SettingsScreen.createUi(self)
|
||||
create_ui = function(self)
|
||||
SettingsScreen.create_ui(self)
|
||||
|
||||
local brightness_title = self.content:Object {
|
||||
flex = {
|
||||
@@ -303,8 +303,8 @@ local DisplaySettings = SettingsScreen:new {
|
||||
|
||||
local ThemeSettings = SettingsScreen:new {
|
||||
title = "Theme",
|
||||
createUi = function(self)
|
||||
SettingsScreen.createUi(self)
|
||||
create_ui = function(self)
|
||||
SettingsScreen.create_ui(self)
|
||||
|
||||
theme.set_style(self.content:Label {
|
||||
text = "Theme",
|
||||
@@ -361,8 +361,8 @@ local ThemeSettings = SettingsScreen:new {
|
||||
|
||||
local InputSettings = SettingsScreen:new {
|
||||
title = "Input Method",
|
||||
createUi = function(self)
|
||||
SettingsScreen.createUi(self)
|
||||
create_ui = function(self)
|
||||
SettingsScreen.create_ui(self)
|
||||
|
||||
theme.set_style(self.content:Label {
|
||||
text = "Control scheme",
|
||||
@@ -420,8 +420,8 @@ local InputSettings = SettingsScreen:new {
|
||||
|
||||
local MassStorageSettings = SettingsScreen:new {
|
||||
title = "USB Storage",
|
||||
createUi = function(self)
|
||||
SettingsScreen.createUi(self)
|
||||
create_ui = function(self)
|
||||
SettingsScreen.create_ui(self)
|
||||
|
||||
local version = require("version").samd()
|
||||
if tonumber(version) < 3 then
|
||||
@@ -478,15 +478,15 @@ local MassStorageSettings = SettingsScreen:new {
|
||||
end)
|
||||
}
|
||||
end,
|
||||
canPop = function()
|
||||
can_pop = function()
|
||||
return not usb.msc_enabled:get()
|
||||
end
|
||||
}
|
||||
|
||||
local DatabaseSettings = SettingsScreen:new {
|
||||
title = "Database",
|
||||
createUi = function(self)
|
||||
SettingsScreen.createUi(self)
|
||||
create_ui = function(self)
|
||||
SettingsScreen.create_ui(self)
|
||||
|
||||
local db = require("database")
|
||||
widgets.Row(self.content, "Schema version", db.version())
|
||||
@@ -545,8 +545,8 @@ local DatabaseSettings = SettingsScreen:new {
|
||||
|
||||
local PowerSettings = SettingsScreen:new {
|
||||
title = "Power",
|
||||
createUi = function(self)
|
||||
SettingsScreen.createUi(self)
|
||||
create_ui = function(self)
|
||||
SettingsScreen.create_ui(self)
|
||||
local power = require("power")
|
||||
|
||||
local charge_pct = widgets.Row(self.content, "Charge").right
|
||||
@@ -598,8 +598,8 @@ local PowerSettings = SettingsScreen:new {
|
||||
|
||||
local SamdConfirmation = SettingsScreen:new {
|
||||
title = "Are you sure?",
|
||||
createUi = function(self)
|
||||
SettingsScreen.createUi(self)
|
||||
create_ui = function(self)
|
||||
SettingsScreen.create_ui(self)
|
||||
self.content:Label {
|
||||
w = lvgl.PCT(100),
|
||||
text = "After selecting 'flash', copy the new UF2 file onto the USB drive that appears. The screen will be blank until the update is finished.",
|
||||
@@ -630,8 +630,8 @@ local SamdConfirmation = SettingsScreen:new {
|
||||
|
||||
local FirmwareSettings = SettingsScreen:new {
|
||||
title = "Firmware",
|
||||
createUi = function(self)
|
||||
SettingsScreen.createUi(self)
|
||||
create_ui = function(self)
|
||||
SettingsScreen.create_ui(self)
|
||||
local version = require("version")
|
||||
widgets.Row(self.content, "ESP32", version.esp())
|
||||
widgets.Row(self.content, "SAMD21", version.samd())
|
||||
@@ -661,16 +661,16 @@ local FirmwareSettings = SettingsScreen:new {
|
||||
|
||||
local LicensesScreen = SettingsScreen:new {
|
||||
title = "Licenses",
|
||||
createUi = function(self)
|
||||
SettingsScreen.createUi(self)
|
||||
create_ui = function(self)
|
||||
SettingsScreen.create_ui(self)
|
||||
require("licenses")(self)
|
||||
end
|
||||
}
|
||||
|
||||
local FccStatementScreen = SettingsScreen:new {
|
||||
title = "FCC Statement",
|
||||
createUi = function(self)
|
||||
SettingsScreen.createUi(self)
|
||||
create_ui = function(self)
|
||||
SettingsScreen.create_ui(self)
|
||||
|
||||
local text_part = function(text)
|
||||
self.content:Label {
|
||||
@@ -698,8 +698,8 @@ local FccStatementScreen = SettingsScreen:new {
|
||||
|
||||
local RegulatoryScreen = SettingsScreen:new {
|
||||
title = "Regulatory",
|
||||
createUi = function(self)
|
||||
SettingsScreen.createUi(self)
|
||||
create_ui = function(self)
|
||||
SettingsScreen.create_ui(self)
|
||||
local version = require("version")
|
||||
|
||||
local small_row = function(left, right)
|
||||
@@ -770,8 +770,8 @@ local RegulatoryScreen = SettingsScreen:new {
|
||||
return widgets.MenuScreen:new {
|
||||
show_back = true,
|
||||
title = "Settings",
|
||||
createUi = function(self)
|
||||
widgets.MenuScreen.createUi(self)
|
||||
create_ui = function(self)
|
||||
widgets.MenuScreen.create_ui(self)
|
||||
local list = self.root:List {
|
||||
w = lvgl.PCT(100),
|
||||
h = lvgl.PCT(100),
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ end
|
||||
widgets.MenuScreen = screen:new {
|
||||
show_back = false,
|
||||
title = "",
|
||||
createUi = function(self)
|
||||
create_ui = function(self)
|
||||
self.root = lvgl.Object(nil, {
|
||||
flex = {
|
||||
flex_direction = "column",
|
||||
|
||||
Reference in New Issue
Block a user