From e88e1afcc47460ee0be2c9e214f71b006fecc83d Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Thu, 6 Jun 2024 23:05:22 -0400 Subject: [PATCH] #403 started work on guide searching --- pocket/ui/apps/guide.lua | 30 ++++++++++++++++++++++-------- pocket/ui/pages/guide_section.lua | 20 ++++++++++---------- 2 files changed, 32 insertions(+), 18 deletions(-) diff --git a/pocket/ui/apps/guide.lua b/pocket/ui/apps/guide.lua index f30d9278..07f22d1b 100644 --- a/pocket/ui/apps/guide.lua +++ b/pocket/ui/apps/guide.lua @@ -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") @@ -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) @@ -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 = {} @@ -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} diff --git a/pocket/ui/pages/guide_section.lua b/pocket/ui/pages/guide_section.lua index b788a2aa..dbb7348c 100644 --- a/pocket/ui/pages/guide_section.lua +++ b/pocket/ui/pages/guide_section.lua @@ -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