2023-01-17 18:16:03 -07:00
|
|
|
package main
|
|
|
|
|
|
|
|
import "time"
|
|
|
|
import "git.tebibyte.media/sashakoshka/tomo"
|
2023-01-17 18:30:58 -07:00
|
|
|
import "git.tebibyte.media/sashakoshka/tomo/popups"
|
2023-02-01 23:48:16 -07:00
|
|
|
import "git.tebibyte.media/sashakoshka/tomo/layouts/basic"
|
2023-01-17 18:16:03 -07:00
|
|
|
import "git.tebibyte.media/sashakoshka/tomo/elements/basic"
|
2023-03-16 12:22:56 -06:00
|
|
|
import "git.tebibyte.media/sashakoshka/tomo/elements/containers"
|
2023-03-15 23:14:39 -06:00
|
|
|
import _ "git.tebibyte.media/sashakoshka/tomo/backends/all"
|
2023-01-17 18:16:03 -07:00
|
|
|
|
|
|
|
func main () {
|
|
|
|
tomo.Run(run)
|
|
|
|
}
|
|
|
|
|
|
|
|
func run () {
|
|
|
|
window, _ := tomo.NewWindow(2, 2)
|
|
|
|
window.SetTitle("Approaching")
|
2023-03-16 12:22:56 -06:00
|
|
|
container := containers.NewContainer(basicLayouts.Vertical { true, true })
|
2023-01-17 18:16:03 -07:00
|
|
|
window.Adopt(container)
|
|
|
|
|
2023-02-01 23:48:16 -07:00
|
|
|
container.Adopt (basicElements.NewLabel (
|
2023-01-17 18:16:03 -07:00
|
|
|
"Rapidly approaching your location...", false), false)
|
2023-02-01 23:48:16 -07:00
|
|
|
bar := basicElements.NewProgressBar(0)
|
2023-01-17 18:16:03 -07:00
|
|
|
container.Adopt(bar, false)
|
2023-02-01 23:48:16 -07:00
|
|
|
button := basicElements.NewButton("Stop")
|
2023-01-17 18:16:03 -07:00
|
|
|
button.SetEnabled(false)
|
|
|
|
container.Adopt(button, false)
|
|
|
|
|
|
|
|
window.OnClose(tomo.Stop)
|
|
|
|
window.Show()
|
|
|
|
go fill(bar)
|
|
|
|
}
|
|
|
|
|
2023-02-01 23:48:16 -07:00
|
|
|
func fill (bar *basicElements.ProgressBar) {
|
2023-01-17 18:16:03 -07:00
|
|
|
for progress := 0.0; progress < 1.0; progress += 0.01 {
|
|
|
|
time.Sleep(time.Second / 24)
|
2023-01-17 18:30:58 -07:00
|
|
|
tomo.Do (func () {
|
2023-01-17 18:16:03 -07:00
|
|
|
bar.SetProgress(progress)
|
|
|
|
})
|
|
|
|
}
|
2023-01-17 18:30:58 -07:00
|
|
|
tomo.Do (func () {
|
|
|
|
popups.NewDialog (
|
|
|
|
popups.DialogKindInfo,
|
|
|
|
"I am here",
|
|
|
|
"Don't look outside your window.")
|
|
|
|
})
|
2023-01-17 18:16:03 -07:00
|
|
|
}
|