38 lines
575 B
Go
38 lines
575 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"log"
|
||
|
|
||
|
"github.com/jroimartin/gocui"
|
||
|
)
|
||
|
|
||
|
func DoUIMode() {
|
||
|
g, err := gocui.NewGui(gocui.Output256)
|
||
|
if err != nil {
|
||
|
log.Panicln(err)
|
||
|
}
|
||
|
defer g.Close()
|
||
|
g.Cursor = true
|
||
|
g.SetManagerFunc(uiLayout)
|
||
|
|
||
|
if err := g.MainLoop(); err != nil && err != gocui.ErrQuit {
|
||
|
log.Panicln(err)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func updateUiViews(g *gocui.Gui) {
|
||
|
for _, v := range g.Views() {
|
||
|
v.Clear()
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func uiLayout(g *gocui.Gui) error {
|
||
|
if v, err := g.SetView("cal_view", 0, 0, 20, 20); err != nil {
|
||
|
if err != gocui.ErrUnknownView {
|
||
|
return err
|
||
|
}
|
||
|
_ = v
|
||
|
}
|
||
|
return nil
|
||
|
}
|