added go_home alias function for pocket navigation
This commit is contained in:
parent
10b675d84d
commit
26906d10d6
@ -288,6 +288,9 @@ function pocket.init_nav(smem)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- go home (open the home screen app)
|
||||||
|
function nav.go_home() nav.open_app(APP_ID.ROOT) end
|
||||||
|
|
||||||
-- open the app that was blocked on connecting
|
-- open the app that was blocked on connecting
|
||||||
function nav.on_loader_connected()
|
function nav.on_loader_connected()
|
||||||
if self.loader_return then
|
if self.loader_return then
|
||||||
|
|||||||
@ -58,7 +58,7 @@ local function new_view(root)
|
|||||||
|
|
||||||
local load_pane = MultiPane{parent=main,x=1,y=1,panes={load_div,main}}
|
local load_pane = MultiPane{parent=main,x=1,y=1,panes={load_div,main}}
|
||||||
|
|
||||||
app.set_sidebar({ { label = " # ", tall = true, color = core.cpair(colors.black, colors.green), callback = function () db.nav.open_app(APP_ID.ROOT) end } })
|
app.set_sidebar({ { label = " # ", tall = true, color = core.cpair(colors.black, colors.green), callback = db.nav.go_home } })
|
||||||
|
|
||||||
local btn_fg_bg = cpair(colors.green, colors.black)
|
local btn_fg_bg = cpair(colors.green, colors.black)
|
||||||
local btn_active = cpair(colors.white, colors.black)
|
local btn_active = cpair(colors.white, colors.black)
|
||||||
@ -68,7 +68,7 @@ local function new_view(root)
|
|||||||
-- set sidebar to display unit-specific fields based on a specified unit
|
-- set sidebar to display unit-specific fields based on a specified unit
|
||||||
local function set_sidebar()
|
local function set_sidebar()
|
||||||
local list = {
|
local list = {
|
||||||
{ label = " # ", tall = true, color = core.cpair(colors.black, colors.green), callback = function () db.nav.open_app(APP_ID.ROOT) end },
|
{ label = " # ", tall = true, color = core.cpair(colors.black, colors.green), callback = db.nav.go_home },
|
||||||
{ label = "FAC", color = core.cpair(colors.black, colors.orange), callback = function () app.switcher(db.facility.num_units + 1) end }
|
{ label = "FAC", color = core.cpair(colors.black, colors.orange), callback = function () app.switcher(db.facility.num_units + 1) end }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,7 +215,7 @@ local function new_view(root)
|
|||||||
page_div = nil
|
page_div = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
app.set_sidebar({ { label = " # ", tall = true, color = core.cpair(colors.black, colors.green), callback = function () db.nav.open_app(APP_ID.ROOT) end } })
|
app.set_sidebar({ { label = " # ", tall = true, color = core.cpair(colors.black, colors.green), callback = db.nav.go_home } })
|
||||||
app.delete_pages()
|
app.delete_pages()
|
||||||
|
|
||||||
-- show loading screen
|
-- show loading screen
|
||||||
|
|||||||
@ -56,14 +56,14 @@ local function new_view(root)
|
|||||||
local btn_active = cpair(colors.white, colors.black)
|
local btn_active = cpair(colors.white, colors.black)
|
||||||
local btn_disable = cpair(colors.gray, colors.black)
|
local btn_disable = cpair(colors.gray, colors.black)
|
||||||
|
|
||||||
app.set_sidebar({{ label = " # ", tall = true, color = core.cpair(colors.black, colors.green), callback = function () db.nav.open_app(APP_ID.ROOT) end }})
|
app.set_sidebar({{ label = " # ", tall = true, color = core.cpair(colors.black, colors.green), callback = db.nav.go_home }})
|
||||||
|
|
||||||
local page_div = nil ---@type Div|nil
|
local page_div = nil ---@type Div|nil
|
||||||
|
|
||||||
-- load the app (create the elements)
|
-- load the app (create the elements)
|
||||||
local function load()
|
local function load()
|
||||||
local list = {
|
local list = {
|
||||||
{ label = " # ", tall = true, color = core.cpair(colors.black, colors.green), callback = function () db.nav.open_app(APP_ID.ROOT) end },
|
{ label = " # ", tall = true, color = core.cpair(colors.black, colors.green), callback = db.nav.go_home },
|
||||||
{ label = " \x14 ", color = core.cpair(colors.black, colors.cyan), callback = function () app.switcher(1) end },
|
{ label = " \x14 ", color = core.cpair(colors.black, colors.cyan), callback = function () app.switcher(1) end },
|
||||||
{ label = "__?", color = core.cpair(colors.black, colors.lightGray), callback = function () app.switcher(2) end }
|
{ label = "__?", color = core.cpair(colors.black, colors.lightGray), callback = function () app.switcher(2) end }
|
||||||
}
|
}
|
||||||
@ -263,7 +263,7 @@ local function new_view(root)
|
|||||||
page_div = nil
|
page_div = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
app.set_sidebar({ { label = " # ", tall = true, color = core.cpair(colors.black, colors.green), callback = function () db.nav.open_app(APP_ID.ROOT) end } })
|
app.set_sidebar({ { label = " # ", tall = true, color = core.cpair(colors.black, colors.green), callback = db.nav.go_home } })
|
||||||
app.delete_pages()
|
app.delete_pages()
|
||||||
|
|
||||||
-- show loading screen
|
-- show loading screen
|
||||||
|
|||||||
@ -63,7 +63,7 @@ local function new_view(root)
|
|||||||
|
|
||||||
local load_pane = MultiPane{parent=main,x=1,y=1,panes={load_div,main}}
|
local load_pane = MultiPane{parent=main,x=1,y=1,panes={load_div,main}}
|
||||||
|
|
||||||
app.set_sidebar({ { label = " # ", tall = true, color = core.cpair(colors.black, colors.green), callback = function () db.nav.open_app(APP_ID.ROOT) end } })
|
app.set_sidebar({ { label = " # ", tall = true, color = core.cpair(colors.black, colors.green), callback = db.nav.go_home } })
|
||||||
|
|
||||||
local btn_fg_bg = cpair(colors.yellow, colors.black)
|
local btn_fg_bg = cpair(colors.yellow, colors.black)
|
||||||
local btn_active = cpair(colors.white, colors.black)
|
local btn_active = cpair(colors.white, colors.black)
|
||||||
@ -76,7 +76,7 @@ local function new_view(root)
|
|||||||
local unit = db.units[id]
|
local unit = db.units[id]
|
||||||
|
|
||||||
local list = {
|
local list = {
|
||||||
{ label = " # ", tall = true, color = core.cpair(colors.black, colors.green), callback = function () db.nav.open_app(APP_ID.ROOT) end },
|
{ label = " # ", tall = true, color = core.cpair(colors.black, colors.green), callback = db.nav.go_home },
|
||||||
{ label = "U-" .. id, color = core.cpair(colors.black, colors.yellow), callback = function () app.switcher(id) end },
|
{ label = "U-" .. id, color = core.cpair(colors.black, colors.yellow), callback = function () app.switcher(id) end },
|
||||||
{ label = " \x13 ", color = core.cpair(colors.black, colors.red), callback = nav_links[id].alarm },
|
{ label = " \x13 ", color = core.cpair(colors.black, colors.red), callback = nav_links[id].alarm },
|
||||||
{ label = "RPS", tall = true, color = core.cpair(colors.black, colors.cyan), callback = nav_links[id].rps },
|
{ label = "RPS", tall = true, color = core.cpair(colors.black, colors.cyan), callback = nav_links[id].rps },
|
||||||
@ -383,7 +383,7 @@ local function new_view(root)
|
|||||||
page_div = nil
|
page_div = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
app.set_sidebar({ { label = " # ", tall = true, color = core.cpair(colors.black, colors.green), callback = function () db.nav.open_app(APP_ID.ROOT) end } })
|
app.set_sidebar({ { label = " # ", tall = true, color = core.cpair(colors.black, colors.green), callback = db.nav.go_home } })
|
||||||
app.delete_pages()
|
app.delete_pages()
|
||||||
|
|
||||||
-- show loading screen
|
-- show loading screen
|
||||||
|
|||||||
@ -78,7 +78,7 @@ local function init(main)
|
|||||||
|
|
||||||
PushButton{parent=main_pane,x=1,y=19,text="\x1b",min_width=3,fg_bg=cpair(colors.white,colors.gray),active_fg_bg=cpair(colors.gray,colors.black),callback=db.nav.nav_up}
|
PushButton{parent=main_pane,x=1,y=19,text="\x1b",min_width=3,fg_bg=cpair(colors.white,colors.gray),active_fg_bg=cpair(colors.gray,colors.black),callback=db.nav.nav_up}
|
||||||
|
|
||||||
db.nav.open_app(APP_ID.ROOT)
|
db.nav.go_home()
|
||||||
|
|
||||||
-- done with initial render, lets go!
|
-- done with initial render, lets go!
|
||||||
root_pane.set_value(2)
|
root_pane.set_value(2)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user