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-03-30 21:19:04 -06:00
|
|
|
import "git.tebibyte.media/sashakoshka/tomo/elements"
|
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 () {
|
2023-04-10 00:58:52 -06:00
|
|
|
window, _ := tomo.NewWindow(tomo.Bounds(0, 0, 0, 0))
|
2023-01-17 18:16:03 -07:00
|
|
|
window.SetTitle("Approaching")
|
2023-04-18 14:18:30 -06:00
|
|
|
container := elements.NewVBox(elements.SpaceBoth)
|
2023-01-17 18:16:03 -07:00
|
|
|
window.Adopt(container)
|
|
|
|
|
2023-04-18 14:18:30 -06:00
|
|
|
container.AdoptExpand(elements.NewLabel("Rapidly approaching your location..."))
|
2023-03-30 21:19:04 -06:00
|
|
|
bar := elements.NewProgressBar(0)
|
2023-04-18 14:18:30 -06:00
|
|
|
container.Adopt(bar)
|
2023-03-30 21:19:04 -06:00
|
|
|
button := elements.NewButton("Stop")
|
2023-01-17 18:16:03 -07:00
|
|
|
button.SetEnabled(false)
|
2023-04-18 14:18:30 -06:00
|
|
|
container.Adopt(button)
|
2023-01-17 18:16:03 -07:00
|
|
|
|
|
|
|
window.OnClose(tomo.Stop)
|
|
|
|
window.Show()
|
2023-03-30 21:19:04 -06:00
|
|
|
go fill(window, bar)
|
2023-01-17 18:16:03 -07:00
|
|
|
}
|
|
|
|
|
2023-03-30 21:19:04 -06:00
|
|
|
func fill (window tomo.Window, bar *elements.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,
|
2023-03-30 21:19:04 -06:00
|
|
|
window,
|
2023-01-17 18:30:58 -07:00
|
|
|
"I am here",
|
|
|
|
"Don't look outside your window.")
|
|
|
|
})
|
2023-01-17 18:16:03 -07:00
|
|
|
}
|