func main() { //test color/additional functions here ansiterm.ResetTerm(ansiterm.NORMAL) ansiterm.ClearPage() ansiterm.MoveToXY(10, 10) sleepOne() ansiterm.HideCursor() sleepOne() ansiterm.SetFGColor(5) fmt.Printf("TEST MOVE HIDDEN CURSOR / OUT IN PURPLE") sleepOne() ansiterm.MoveToXY(10, 12) ansiterm.SetColorBright() fmt.Printf("BRIGHT COLORS") sleepOne() ansiterm.MoveToXY(10, 14) ansiterm.SetColorNormal() fmt.Printf("NORMAL COLORS AGAIN") sleepOne() ansiterm.ShowCursor() sleepOne() ansiterm.ResetTerm(ansiterm.NORMAL) }
func main() { ansiterm.ResetTerm(0) ansiterm.ClearPage() // ansiterm.MoveToRC(13,13) // ansiterm.QueryPosn() hangs // os.Exit(0) ansiterm.HideCursor() defer ansiterm.ShowCursor() setupForm() startSensors() runfor = 1 prog := make(chan int) // prompt, row,col,barWidth,listen chan, alldone go progressBar("Progress: ", 20, 20, 50, prog, 60*runfor) done := time.After(time.Duration(runfor) * time.Minute) // set up a timeout channel fmt.Printf("This demo will stop after %d minute(s)\n", runfor) time.Sleep(2 * time.Second) L1: for { select { case t := <-sensors[0]: g_Form.UpdateMsg("temp", fmt.Sprintf("%5d", t)) case t := <-sensors[1]: g_Form.UpdateMsg("seekerr", fmt.Sprintf("%5d", t)) case t := <-sensors[2]: g_Form.UpdateMsg("time", fmt.Sprintf("%5d", t)) g_Form.UpdateMsg("progress", fmt.Sprintf("%5d", t)) prog <- t g_Form.Draw() // note: label is required else it 'breaks' the select, not the for case _ = <-done: break L1 } } if true { // optional wrapup stats ansiterm.ClearPage() ansiterm.ResetTerm(ansiterm.NORMAL) fmt.Printf("<done>\n") } }