예제 #1
0
파일: ansidemo3.go 프로젝트: hotei/ansiterm
func progressBar(prompt string, row, col, barWidth int, p chan int, alldone int) {
	var progress int
	z := new(ansiterm.ScreenField)
	z.SetTag("progress")
	z.SetPrompt(prompt)
	z.SetRCW(row, col, barWidth+len(prompt))
	g_Form.AddField(z)
	fmt.Printf("Progress bar started\n")
	bar := "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
	nobar := "...................................................................."
	g_Form.UpdateMsg("progress", nobar)
	for {
		progress = <-p
		var barlen int = (progress * barWidth) / alldone
		s := bar[:barlen] + nobar[:barWidth-barlen]
		g_Form.UpdateMsg("progress", s)
	}
}
예제 #2
0
파일: ansidemo3.go 프로젝트: hotei/ansiterm
func setupForm() {

	{
		x := new(ansiterm.ScreenField)
		x.SetTag("title")
		x.SetRCW(2, 35, 15)
		x.SetPrompt("ansiterm Demo 3")
		g_Form.AddField(x)
	}
	x := new(ansiterm.ScreenField)
	x.SetTag("temp")
	x.SetRCW(10, 4, 21)
	x.SetPrompt("Drive Temp: ")
	g_Form.AddField(x)

	y := new(ansiterm.ScreenField)
	y.SetTag("seekerr")
	y.SetRCW(11, 6, 15)
	y.SetPrompt("SeekErrs: ")
	g_Form.AddField(y)

	z := new(ansiterm.ScreenField)
	z.SetTag("time")
	z.SetRCW(12, 10, 15)
	z.SetPrompt("Time: ")
	g_Form.AddField(z)

	fmt.Printf("setupForm() fini\n")
}