#403 improved guide UI and added supervisor front panel docs
This commit is contained in:
@@ -42,10 +42,11 @@ return function (data, base_page, title, items, scroll_height)
|
||||
TextBox{parent=section_view_div,y=1,text=title,alignment=ALIGN.CENTER}
|
||||
PushButton{parent=section_view_div,x=3,y=1,text="<",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=section_page.nav_to}
|
||||
|
||||
local name_list = ListBox{parent=section_div,x=1,y=3,scroll_height=40,nav_fg_bg=cpair(colors.lightGray,colors.gray),nav_active=cpair(colors.white,colors.gray)}
|
||||
local name_list = ListBox{parent=section_div,x=1,y=3,scroll_height=60,nav_fg_bg=cpair(colors.lightGray,colors.gray),nav_active=cpair(colors.white,colors.gray)}
|
||||
local def_list = ListBox{parent=section_view_div,x=1,y=3,scroll_height=scroll_height,nav_fg_bg=cpair(colors.lightGray,colors.gray),nav_active=cpair(colors.white,colors.gray)}
|
||||
|
||||
local _end
|
||||
local sect_id = 1
|
||||
local page_end
|
||||
|
||||
for i = 1, #items do
|
||||
local item = items[i] ---@type pocket_doc_sect|pocket_doc_subsect|pocket_doc_text|pocket_doc_list
|
||||
@@ -53,12 +54,17 @@ return function (data, base_page, title, items, scroll_height)
|
||||
if item.type == DOC_TYPE.SECTION then
|
||||
---@cast item pocket_doc_sect
|
||||
|
||||
local anchor = TextBox{parent=def_list,text=item.name,anchor=true,fg_bg=cpair(colors.green,colors.black)}
|
||||
local title_text = sect_id.."."
|
||||
local title_offs = string.len(title_text) + 2
|
||||
|
||||
_end = Div{parent=def_list,height=1,can_focus=true}
|
||||
local sect_title = Div{parent=def_list,height=1}
|
||||
TextBox{parent=sect_title,x=1,text=title_text,fg_bg=cpair(colors.lightGray,colors.black)}
|
||||
local anchor = TextBox{parent=sect_title,x=title_offs,y=1,text=item.name,anchor=true,fg_bg=cpair(colors.green,colors.black)}
|
||||
|
||||
page_end = Div{parent=def_list,height=1,can_focus=true}
|
||||
|
||||
local function view()
|
||||
_end.focus()
|
||||
page_end.focus()
|
||||
view_page.nav_to()
|
||||
anchor.focus()
|
||||
end
|
||||
@@ -67,7 +73,11 @@ return function (data, base_page, title, items, scroll_height)
|
||||
local _ = Div{parent=name_list,height=1}
|
||||
end
|
||||
|
||||
PushButton{parent=name_list,text=item.name,fg_bg=cpair(colors.green,colors.black),active_fg_bg=btn_active,callback=view}
|
||||
local name_title = Div{parent=name_list,height=1}
|
||||
TextBox{parent=name_title,x=1,text=title_text,fg_bg=cpair(colors.lightGray,colors.black)}
|
||||
PushButton{parent=name_title,x=title_offs,y=1,text=item.name,alignment=ALIGN.LEFT,fg_bg=cpair(colors.green,colors.black),active_fg_bg=btn_active,callback=view}
|
||||
|
||||
sect_id = sect_id + 1
|
||||
elseif item.type == DOC_TYPE.SUBSECTION then
|
||||
---@cast item pocket_doc_subsect
|
||||
|
||||
@@ -79,10 +89,10 @@ return function (data, base_page, title, items, scroll_height)
|
||||
|
||||
TextBox{parent=def_list,text=item.body}
|
||||
|
||||
_end = Div{parent=def_list,height=1,can_focus=true}
|
||||
page_end = Div{parent=def_list,height=1,can_focus=true}
|
||||
|
||||
local function view()
|
||||
_end.focus()
|
||||
page_end.focus()
|
||||
view_page.nav_to()
|
||||
anchor.focus()
|
||||
end
|
||||
@@ -90,13 +100,15 @@ return function (data, base_page, title, items, scroll_height)
|
||||
doc_map[item.key] = view
|
||||
table.insert(search_db, { string.lower(item.name), item.name, title, view })
|
||||
|
||||
PushButton{parent=name_list,text=item.name,fg_bg=cpair(colors.blue,colors.black),active_fg_bg=btn_active,callback=view}
|
||||
local name_entry = Div{parent=name_list,height=#util.strwrap(item.name,name_list.get_width()-3)}
|
||||
TextBox{parent=name_entry,x=1,text="\x10",fg_bg=cpair(colors.gray,colors.black)}
|
||||
PushButton{parent=name_entry,x=3,y=1,text=item.name,alignment=ALIGN.LEFT,fg_bg=cpair(colors.blue,colors.black),active_fg_bg=btn_active,callback=view}
|
||||
elseif item.type == DOC_TYPE.TEXT then
|
||||
---@cast item pocket_doc_text
|
||||
|
||||
TextBox{parent=def_list,text=item.text}
|
||||
|
||||
_end = Div{parent=def_list,height=1,can_focus=true}
|
||||
page_end = Div{parent=def_list,height=1,can_focus=true}
|
||||
elseif item.type == DOC_TYPE.LIST then
|
||||
---@cast item pocket_doc_list
|
||||
|
||||
@@ -121,13 +133,13 @@ return function (data, base_page, title, items, scroll_height)
|
||||
end
|
||||
end
|
||||
|
||||
_end = Div{parent=def_list,height=1,can_focus=true}
|
||||
page_end = Div{parent=def_list,height=1,can_focus=true}
|
||||
end
|
||||
|
||||
if i % 12 == 0 then util.nop() end
|
||||
end
|
||||
|
||||
log.debug("guide section " .. title .. " generated with final height ".. _end.get_y())
|
||||
log.debug("guide section " .. title .. " generated with final height ".. page_end.get_y())
|
||||
|
||||
util.nop()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user