-
Notifications
You must be signed in to change notification settings - Fork 0
/
buttons.go
42 lines (35 loc) · 1.22 KB
/
buttons.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Everythin related to buttons
package tui
import (
"fmt"
"github.com/rivo/tview"
)
// initializeButtons initializes the tui commands buttons
func initializeButtons() {
helpButton = tview.NewButton("").
SetLabel("Help [::b][F1[]").
SetBackgroundColorActivated(buttonFocusColor).
SetSelectedFunc(func(){pages.ShowPage("help page")})
aboutButton = tview.NewButton("").
SetLabel("About [::b][F2[]").
SetBackgroundColorActivated(buttonFocusColor).
SetSelectedFunc(func(){pages.ShowPage("about page")})
quitButton = tview.NewButton("").
SetLabel("Quit [::b][CTRL+C[]").
SetBackgroundColorActivated(buttonFocusColor).
SetSelectedFunc(func(){app.Stop()})
updateButton = tview.NewButton("").
SetLabel("Update Dbase [::b][CTRL+U[]").
SetBackgroundColorActivated(buttonFocusColor).
SetSelectedFunc(func(){
pages.ShowPage("update page")
go func () {
err := UpdateDbase()
if err != nil {
updateWidget.SetText(fmt.Sprintf("%s", err))
} else {
updateWidget.SetText(updateDoneMsg)
}
} ()
})
}