Merge branch 'main' of ssh://git.bullercodeworks.com:2200/brian/expds

This commit is contained in:
2026-02-01 17:36:29 -06:00
2 changed files with 35 additions and 30 deletions

View File

@@ -50,12 +50,10 @@ type ScreenHome struct {
layout *w.LinearLayout layout *w.LinearLayout
columns *w.LinearLayout columns *w.LinearLayout
activePds *models.Pds activePds *models.Pds
//pdsListing *w.SimpleListWithHelp
pdsListing *wd.TreeBrowser pdsListing *wd.TreeBrowser
jsonContent *wd.JsonContent jsonContent *wd.JsonContent
status *wd.StatusBar status *wd.StatusBar
stTmBlock *wd.StatusBlock
stPathBlock *wd.StatusBlock stPathBlock *wd.StatusBlock
pdsListingTypes []models.EntryType pdsListingTypes []models.EntryType
@@ -105,9 +103,8 @@ func (s *ScreenHome) Init(a *App) {
//s.pdsListing = w.NewSimpleListWithHelp("pdslisting", s.style) //s.pdsListing = w.NewSimpleListWithHelp("pdslisting", s.style)
s.pdsListing = wd.NewTreeBrowser("pdslisting", s.style) s.pdsListing = wd.NewTreeBrowser("pdslisting", s.style)
s.pdsListing.SetBorder( s.pdsListing.SetBorder([]rune{'─', '┬', '│', '┴', '─', '└', '│', '┌', '├', '─', '┤', '┬', '│', '┴', '┼'})
[]rune{'─', '┬', '│', '┴', '─', '└', '│', '┌', '├', '─', '┤', '┬', '│', '┴', '┼'},
)
s.pdsListing.SetTitle(strings.Repeat(" ", 30)) s.pdsListing.SetTitle(strings.Repeat(" ", 30))
s.pdsListing.SetOnSelect(s.selectPdsListingEntry) s.pdsListing.SetOnSelect(s.selectPdsListingEntry)
s.pdsListing.SetOnChange(s.changePdsList) s.pdsListing.SetOnChange(s.changePdsList)
@@ -149,8 +146,12 @@ func (s *ScreenHome) Init(a *App) {
s.columns.AddAll(s.pdsListing, s.jsonContent) s.columns.AddAll(s.pdsListing, s.jsonContent)
s.layout.AddAll(s.columns) //s.layout.AddAll(s.columns)
s.layout.SetWeight(s.columns, 4) //s.layout.SetLogger(s.Log)
//s.layout.SetWeight(s.columns, 4)
s.layout.Add(s.pdsListing)
s.layout.SetLogger(s.Log)
s.layout.SetWeight(s.pdsListing, 4)
s.menuLayout.SetWidget(s.layout) s.menuLayout.SetWidget(s.layout)
s.layout.SetLogger(s.Log) s.layout.SetLogger(s.Log)
s.columns.SetLogger(s.Log) s.columns.SetLogger(s.Log)
@@ -191,7 +192,6 @@ func (s *ScreenHome) HandleTime(ev *tcell.EventTime) {
s.menuLayout.HandleTime(ev) s.menuLayout.HandleTime(ev)
s.loading.HandleTime(ev) s.loading.HandleTime(ev)
s.status.HandleTime(ev) s.status.HandleTime(ev)
//s.stTmBlock.SetText(time.Now().Format(time.TimeOnly))
} }
func (s *ScreenHome) Draw() { func (s *ScreenHome) Draw() {
if s.doOpen { if s.doOpen {
@@ -353,23 +353,11 @@ func (s *ScreenHome) updatePdsListing() {
t.AddChild(c) t.AddChild(c)
} }
s.pdsListing.Add(t) s.pdsListing.Add(t)
/*
wrk = append(wrk, t)
wrk = append(wrk, v)
s.pdsListingTypes = append(s.pdsListingTypes, models.TypeNSID)
if _, ok := s.expandedEntries[v]; ok {
nsid := s.activePds.NSIDs[i]
rIds := s.activePds.GetRecordIdsFor(nsid)
for j := range rIds {
wrk = append(wrk, fmt.Sprintf("• %s", rIds[j]))
s.pdsListingTypes = append(s.pdsListingTypes, models.TypeRecord)
s.recordIdsToNSIDs[rIds[j]] = nsid
}
}
*/
} }
//s.pdsListing.AddChild(wrk) s.layout.ActivateWidget(s.columns)
s.columns.ActivateWidget(s.pdsListing)
s.pdsListing.SetActive(true)
s.pdsListing.SetFocusable(true)
s.hideCli() s.hideCli()
} }
@@ -393,11 +381,7 @@ func (s *ScreenHome) changePdsList(tn *wd.TreeNode) bool {
return upd return upd
} }
func (s *ScreenHome) updateStatusPathBlock(tn *wd.TreeNode) bool { func (s *ScreenHome) updateStatusPathBlock(tn *wd.TreeNode) bool {
n, err := s.pdsListing.GetActiveNode() s.stPathBlock.SetParts(tn.GetLabelPath())
if err != nil || n == nil {
return false
}
s.stPathBlock.SetParts(n.GetLabelPath())
return true return true
} }
@@ -406,6 +390,7 @@ func (s *ScreenHome) updateJsonView(tn *wd.TreeNode) bool {
return true return true
} }
/*
func (s *ScreenHome) o_selectPdsListingEntry(idx int, nm string) bool { func (s *ScreenHome) o_selectPdsListingEntry(idx int, nm string) bool {
if !s.o_updateJsonView(idx, nm) { if !s.o_updateJsonView(idx, nm) {
return false return false
@@ -461,3 +446,4 @@ func (s *ScreenHome) o_updateJsonView(idx int, nm string) bool {
return false return false
} }
*/

View File

@@ -106,6 +106,7 @@ func (w *TreeBrowser) GetKeyMap() *t.KeyMap { return w.keyMap }
func (w *TreeBrowser) SetKeyMap(km *t.KeyMap) { w.keyMap = km } func (w *TreeBrowser) SetKeyMap(km *t.KeyMap) { w.keyMap = km }
func (w *TreeBrowser) HandleKey(ev *tcell.EventKey) bool { func (w *TreeBrowser) HandleKey(ev *tcell.EventKey) bool {
w.Log("TreeBrowser Handling Key: %s", ev.Name())
if !w.active || !w.focusable { if !w.active || !w.focusable {
return false return false
} }
@@ -141,6 +142,7 @@ func (w *TreeBrowser) Draw(screen tcell.Screen) {
break break
} }
} }
th.DrawText(x, y, fmt.Sprintf("Cursor: %d", w.cursor), w.style, screen)
} }
func (w *TreeBrowser) SetStyle(s tcell.Style) { w.style = s } func (w *TreeBrowser) SetStyle(s tcell.Style) { w.style = s }
@@ -292,6 +294,9 @@ func (w *TreeBrowser) UpdateList() {
if w.cursor >= len(w.list) { if w.cursor >= len(w.list) {
w.cursor = len(w.list) - 1 w.cursor = len(w.list) - 1
} }
if w.cursor <= 0 {
w.cursor = 0
}
} }
/* /*
@@ -359,3 +364,17 @@ func (tn *TreeNode) AddChild(t *TreeNode, rest ...*TreeNode) {
} }
func (tn *TreeNode) HasChildren() bool { return len(tn.children) > 0 } func (tn *TreeNode) HasChildren() bool { return len(tn.children) > 0 }
func (tn *TreeNode) GetPath() []string {
var path []string
if tn.parent != nil {
path = tn.parent.GetPath()
}
return append(path, tn.value)
}
func (tn *TreeNode) GetLabelPath() []string {
var path []string
if tn.parent != nil {
path = tn.parent.GetLabelPath()
}
return append(path, tn.label)
}