diff options
| author | Jeff Carr <[email protected]> | 2025-03-02 17:05:17 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-03-02 17:05:17 -0600 |
| commit | 04406b3561f5b4109c0f5111ae25ce6ddf284999 (patch) | |
| tree | a66a4a819e368c3e85e2561a5fcf8cd3dac0f7a3 /help.go | |
| parent | 063818335663e7aa626434d5dc035f8b5455e5ae (diff) | |
support a libnotify menu
Diffstat (limited to 'help.go')
| -rw-r--r-- | help.go | 114 |
1 files changed, 0 insertions, 114 deletions
@@ -11,12 +11,9 @@ import ( "errors" "fmt" "strings" - "time" "github.com/awesome-gocui/gocui" log "go.wit.com/log" - "go.wit.com/toolkits/tree" - "go.wit.com/widget" ) /* @@ -112,114 +109,3 @@ func showHelp() error { } return nil } - -// create a new widget in the binary tree -func makeNewInternalWidget(wId int) *guiWidget { - if me.treeRoot == nil { - log.Info("GOGUI Init ERROR. treeRoot == nil") - return nil - } - n := new(tree.Node) - n.WidgetType = widget.Flag - n.WidgetId = wId - n.ParentId = 0 - - // store the internal toolkit information - tk := new(guiWidget) - tk.frame = true - - tk.node = n - tk.node.Parent = me.treeRoot - - // set the name used by gocui to the id - tk.cuiName = fmt.Sprintf("%d DR", wId) - - tk.setColorInput() - - // add this new widget on the binary tree - tk.parent = me.treeRoot.TK.(*guiWidget) - if tk.parent == nil { - panic("makeNewFlagWidget() didn't get treeRoot guiWidget") - } else { - tk.parent.children = append(tk.parent.children, tk) - } - - n.TK = tk - return tk -} - -func makeClock(wId int) { - if me.treeRoot == nil { - log.Info("gogui makeClock() error. treeRoot == nil") - return - } - me.notify.clock.tk = makeNewInternalWidget(wId) - me.notify.clock.tk.dumpWidget("init() clock") - w, h := me.baseGui.MousePosition() - me.notify.clock.tk.MoveToOffset(w, h) - me.notify.clock.tk.labelN = time.Now().Format("15:04:05") - me.notify.clock.tk.frame = false - me.notify.clock.tk.setColorLabel() - me.notify.clock.tk.Show() - me.notify.clock.active = true - me.notify.clock.tk.dumpWidget("showClock()") -} - -// in the very end of redrawing things, this will place the help and stdout on the top or botton -// depending on the state the user has chosen -func setThingsOnTop() { - if me.showHelp { // terrible variable name. FIXME - // log.Info("help does not exist") - } else { - me.baseGui.SetViewOnTop("help") - } - if me.notify.clock.tk != nil { - me.baseGui.SetViewOnTop(me.notify.clock.tk.v.Name()) - } - - if me.stdout.tk == nil { - makeOutputWidget(me.baseGui, "from setThingsOnTop()") - } - if me.stdout.tk == nil { - return - } - if me.stdout.tk.v == nil { - return - } - if me.dark { - me.stdout.tk.v.FgColor = gocui.ColorWhite - me.stdout.tk.v.BgColor = gocui.ColorBlack - } else { - me.stdout.tk.v.FgColor = gocui.ColorBlack - me.stdout.tk.v.BgColor = gocui.AttrNone - } - - if me.stdout.outputOnTop { - me.baseGui.SetViewOnTop("msg") - } else { - me.baseGui.SetViewOnBottom("msg") - } - if me.stdout.startOnscreen { - // log.Info("THIS TRIGGERS STDOUT") // todo: make a proper init() & move this there - me.stdout.tk.relocateStdout(me.stdout.lastW, me.stdout.lastH) - me.stdout.startOnscreen = false - } - setBottomBG() -} - -func setBottomBG() { - // this attempts to find the "BG" widget and set it to the background on the very very bottom - rootTK := me.treeRoot.TK.(*guiWidget) - if tk := rootTK.findBG(); tk != nil { - // log.Info("found BG. setting to bottom", tk.cuiName) - if me.dark { - tk.v.BgColor = gocui.ColorBlack - } else { - tk.v.BgColor = gocui.ColorWhite - } - tk.v.Clear() - me.baseGui.SetViewOnBottom(tk.cuiName) - w, h := me.baseGui.Size() - me.baseGui.SetView(tk.cuiName, -1, -1, w+1, h+1, 0) - } -} |
