forked from marcetin/parallelcoin
/
loadingscreen.go
88 lines (85 loc) · 2.08 KB
/
loadingscreen.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package gui
import (
l "gioui.org/layout"
"github.com/p9c/pod/pkg/podcfg"
"golang.org/x/exp/shiny/materialdesign/icons"
"github.com/p9c/pod/pkg/gui"
p9icons "github.com/p9c/pod/pkg/icons/svg"
)
func (wg *WalletGUI) getLoadingPage() (a *gui.App) {
a = wg.App(&wg.Window.Width, wg.State.activePage, wg.invalidate, Break1).SetMainDirection(l.Center + 1)
a.SetThemeHook(
func() {
D.Ln("theme hook")
// D.Ln(wg.bools)
*wg.cx.Config.DarkTheme = *wg.Dark
a := wg.configs["config"]["DarkTheme"].Slot.(*bool)
*a = *wg.Dark
if wgb, ok := wg.config.Bools["DarkTheme"]; ok {
wgb.Value(*wg.Dark)
}
podcfg.Save(wg.cx.Config)
},
)
a.Pages(
map[string]l.Widget{
"loading": wg.Page(
"loading", gui.Widgets{
gui.WidgetSize{
Widget:
func(gtx l.Context) l.Dimensions {
return a.Flex().Flexed(1, a.Direction().Center().Embed(a.H1("loading").Fn).Fn).Fn(gtx)
},
},
},
),
"unlocking": wg.Page(
"unlocking", gui.Widgets{
gui.WidgetSize{
Widget:
func(gtx l.Context) l.Dimensions {
return a.Flex().Flexed(1, a.Direction().Center().Embed(a.H1("unlocking").Fn).Fn).Fn(gtx)
},
},
},
),
},
)
a.ButtonBar(
[]l.Widget{
wg.PageTopBarButton(
"home", 4, &icons.ActionLock, func(name string) {
wg.unlockPage.ActivePage(name)
}, wg.unlockPage, "Danger",
),
// wg.Flex().Rigid(wg.Inset(0.5, gui.EmptySpace(0, 0)).Fn).Fn,
},
)
a.StatusBar(
[]l.Widget{
wg.RunStatusPanel,
},
[]l.Widget{
wg.StatusBarButton(
"console", 2, &p9icons.Terminal, func(name string) {
wg.MainApp.ActivePage(name)
}, a,
),
wg.StatusBarButton(
"log", 4, &icons.ActionList, func(name string) {
D.Ln("click on button", name)
wg.unlockPage.ActivePage(name)
}, wg.unlockPage,
),
wg.StatusBarButton(
"settings", 5, &icons.ActionSettings, func(name string) {
wg.unlockPage.ActivePage(name)
}, wg.unlockPage,
),
// wg.Inset(0.5, gui.EmptySpace(0, 0)).Fn,
},
)
// a.PushOverlay(wg.toasts.DrawToasts())
// a.PushOverlay(wg.dialog.DrawDialog())
return
}