Exemplo n.º 1
0
func main() {

	app := &MyApp{}

	app.model = &model{endx: 60, endy: 15}

	if e := topsl.AppInit(); e != nil {
		fmt.Fprintln(os.Stderr, e.Error())
		os.Exit(1)
	}

	title := topsl.NewTitleBar()
	title.SetCenter("CellView Test")
	title.SetRight("Example v1.0")

	app.keybar = topsl.NewKeyBar()
	app.keybar.SetKeys([]string{"[Q] Quit"})

	app.status = topsl.NewStatusBar()
	app.status.SetStatus("My status is here.")

	app.main = topsl.NewCellView()
	app.main.SetModel(app.model)

	app.panel = topsl.NewPanel()
	app.panel.SetBottom(app.keybar)
	app.panel.SetTitle(title)
	app.panel.SetContent(app.main)
	app.panel.SetStatus(app.status)

	app.updateKeys()
	topsl.SetApplication(app)
	topsl.RunApplication()
}
Exemplo n.º 2
0
func doUI(client *rest.Client, url string, logger *log.Logger) error {
	app := ui.NewApp(client, url)
	app.SetLogger(logger)

	if e := topsl.AppInit(); e != nil {
		return e
	}
	app.Logf("Starting up user interface")
	topsl.AppInit()
	topsl.SetApplication(app)
	app.ShowMain()
	// periodic updates please
	go func() {
		for {
			topsl.AppDraw()
			time.Sleep(time.Second)
		}
	}()
	topsl.RunApplication()
	return nil
}
Exemplo n.º 3
0
func main() {

	app := &MyApp{}

	if e := topsl.AppInit(); e != nil {
		fmt.Fprintln(os.Stderr, e.Error())
		os.Exit(1)
	}

	title := topsl.NewTitleBar()
	title.SetCenter("TextArea Test")
	title.SetRight("Example v1.0")

	keyb := topsl.NewKeyBar()
	keyb.SetKeys([]string{"[Q] Quit"})

	panel := topsl.NewPanel()

	panel.SetBottom(keyb)
	panel.SetTitle(title)

	content := topsl.NewTextArea()
	content.SetContent("This is a test\nAnd another line\nAnd more and more\n" +
		"A very very very long line.  The quick brown fox jumps over the " +
		"lazy dog.  The mouse ran up the clock.  Blah blah blah.")
	content.EnableCursor(true)

	panel.SetContent(content)

	status := topsl.NewStatusBar()
	panel.SetStatus(status)
	status.SetStatus("Number 5 is Alive!")

	app.panel = panel
	topsl.SetApplication(app)
	topsl.RunApplication()
}