Skip to content

Commit

Permalink
#403 started work on guide searching
Browse files Browse the repository at this point in the history
  • Loading branch information
MikaylaFischler committed Jun 7, 2024
1 parent b457edb commit e88e1af
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 18 deletions.
30 changes: 22 additions & 8 deletions pocket/ui/apps/guide.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
-- local log = require("scada-common.log")

local iocontrol = require("pocket.iocontrol")
local TextField = require("graphics.elements.form.text_field")

local docs = require("pocket.ui.docs")
local style = require("pocket.ui.style")
Expand Down Expand Up @@ -46,9 +47,10 @@ local function new_view(root)

local list = {
{ label = " # ", tall = true, color = core.cpair(colors.black, colors.green), callback = function () db.nav.open_app(iocontrol.APP_ID.ROOT) end },
{ label = "Use", color = core.cpair(colors.black, colors.purple), callback = function () app.switcher(2) end },
{ label = "UIs", color = core.cpair(colors.black, colors.blue), callback = function () app.switcher(3) end },
{ label = "FPs", color = core.cpair(colors.black, colors.lightGray), callback = function () app.switcher(4) end }
{ label = "\x14_?", color = core.cpair(colors.black, colors.cyan), callback = function () app.switcher(2) end },
-- { label = "Use", color = core.cpair(colors.black, colors.purple), callback = function () app.switcher(2) end },
-- { label = "UIs", color = core.cpair(colors.black, colors.blue), callback = function () app.switcher(3) end },
-- { label = "FPs", color = core.cpair(colors.black, colors.lightGray), callback = function () app.switcher(4) end }
}

app.set_sidebar(list)
Expand All @@ -58,17 +60,19 @@ local function new_view(root)
local p_width = page_div.get_width() - 2

local main_page = app.new_page(nil, 1)
local use_page = app.new_page(main_page, 2)
local uis_page = app.new_page(main_page, 3)
local fps_page = app.new_page(main_page, 4)
local gls_page = app.new_page(main_page, 5)
local search_page = app.new_page(main_page, 2)
local use_page = app.new_page(main_page, 3)
local uis_page = app.new_page(main_page, 4)
local fps_page = app.new_page(main_page, 5)
local gls_page = app.new_page(main_page, 6)

local home = Div{parent=page_div,x=2,width=p_width}
local search = Div{parent=page_div,x=2}
local use = Div{parent=page_div,x=2,width=p_width}
local uis = Div{parent=page_div,x=2,width=p_width}
local fps = Div{parent=page_div,x=2,width=p_width}
local gls = Div{parent=page_div,x=2}
local panes = { home, use, uis, fps, gls }
local panes = { home, search, use, uis, fps, gls }

local doc_map = {}
local search_map = {}
Expand All @@ -83,6 +87,16 @@ local function new_view(root)
PushButton{parent=home,text="Front Panels >",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=fps_page.nav_to}
PushButton{parent=home,text="Glossary >",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=gls_page.nav_to}

TextBox{parent=search,y=1,text="Search",height=1,alignment=ALIGN.CENTER}
PushButton{parent=search,x=2,y=1,text="<",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=main_page.nav_to}

TextField{parent=search,x=1,y=3,width=18,fg_bg=cpair(colors.white,colors.gray)}
PushButton{parent=search,x=20,y=3,text="GO",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=function()end}

local search_results = ListBox{parent=search,x=1,y=5,scroll_height=100,nav_fg_bg=cpair(colors.lightGray,colors.gray),nav_active=cpair(colors.white,colors.gray)}

TextBox{parent=search_results,text="Click 'GO' to search..."}

TextBox{parent=use,y=1,text="System Usage",height=1,alignment=ALIGN.CENTER}
PushButton{parent=use,x=2,y=1,text="<",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=main_page.nav_to}

Expand Down
20 changes: 10 additions & 10 deletions pocket/ui/pages/guide_section.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ return function (data, base_page, title, items, scroll_height)
local app, page_div, panes, doc_map, search_map, btn_fg_bg, btn_active = table.unpack(data)

local section_page = app.new_page(base_page, #panes + 1)
local gls_term_div = Div{parent=page_div,x=2}
table.insert(panes, gls_term_div)
TextBox{parent=gls_term_div,y=1,text=title,height=1,alignment=ALIGN.CENTER}
PushButton{parent=gls_term_div,x=3,y=1,text="<",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=base_page.nav_to}
local section_div = Div{parent=page_div,x=2}
table.insert(panes, section_div)
TextBox{parent=section_div,y=1,text=title,height=1,alignment=ALIGN.CENTER}
PushButton{parent=section_div,x=3,y=1,text="<",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=base_page.nav_to}

local gls_term_view_page = app.new_page(section_page, #panes + 1)
local gls_term_view_div = Div{parent=page_div,x=2}
table.insert(panes, gls_term_view_div)
TextBox{parent=gls_term_view_div,y=1,text=title,height=1,alignment=ALIGN.CENTER}
PushButton{parent=gls_term_view_div,x=3,y=1,text="<",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=section_page.nav_to}
local section_view_div = Div{parent=page_div,x=2}
table.insert(panes, section_view_div)
TextBox{parent=section_view_div,y=1,text=title,height=1,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=gls_term_div,x=1,y=3,scroll_height=30,nav_fg_bg=cpair(colors.lightGray,colors.gray),nav_active=cpair(colors.white,colors.gray)}
local def_list = ListBox{parent=gls_term_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 name_list = ListBox{parent=section_div,x=1,y=3,scroll_height=30,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 = nil

Expand Down

0 comments on commit e88e1af

Please sign in to comment.