loadingscreen.go raw

   1  package gui
   2  
   3  import (
   4  	"golang.org/x/exp/shiny/materialdesign/icons"
   5  
   6  	l "github.com/p9c/p9/pkg/gel/gio/layout"
   7  
   8  	"github.com/p9c/p9/pkg/gel"
   9  	"github.com/p9c/p9/pkg/p9icons"
  10  )
  11  
  12  func (wg *WalletGUI) getLoadingPage() (a *gel.App) {
  13  	a = wg.App(wg.Window.Width, wg.State.activePage, Break1).
  14  		SetMainDirection(l.Center + 1).
  15  		SetLogo(&p9icons.ParallelCoin).
  16  		SetAppTitleText("Parallelcoin Wallet")
  17  	a.Pages(
  18  		map[string]l.Widget{
  19  			"loading": wg.Page(
  20  				"loading", gel.Widgets{
  21  					gel.WidgetSize{
  22  						Widget:
  23  						func(gtx l.Context) l.Dimensions {
  24  							return a.Flex().Flexed(1, a.Direction().Center().Embed(a.H1("loading").Fn).Fn).Fn(gtx)
  25  						},
  26  					},
  27  				},
  28  			),
  29  			"unlocking": wg.Page(
  30  				"unlocking", gel.Widgets{
  31  					gel.WidgetSize{
  32  						Widget:
  33  						func(gtx l.Context) l.Dimensions {
  34  							return a.Flex().Flexed(1, a.Direction().Center().Embed(a.H1("unlocking").Fn).Fn).Fn(gtx)
  35  						},
  36  					},
  37  				},
  38  			),
  39  		},
  40  	)
  41  	a.ButtonBar(
  42  		[]l.Widget{
  43  			wg.PageTopBarButton(
  44  				"home", 4, &icons.ActionLock, func(name string) {
  45  					wg.unlockPage.ActivePage(name)
  46  				}, wg.unlockPage, "Danger",
  47  			),
  48  			// wg.Flex().Rigid(wg.Inset(0.5, gel.EmptySpace(0, 0)).Fn).Fn,
  49  		},
  50  	)
  51  	a.StatusBar(
  52  		[]l.Widget{
  53  			wg.RunStatusPanel,
  54  		},
  55  		[]l.Widget{
  56  			wg.StatusBarButton(
  57  				"console", 2, &p9icons.Terminal, func(name string) {
  58  					wg.MainApp.ActivePage(name)
  59  				}, a,
  60  			),
  61  			wg.StatusBarButton(
  62  				"log", 4, &icons.ActionList, func(name string) {
  63  					D.Ln("click on button", name)
  64  					wg.unlockPage.ActivePage(name)
  65  				}, wg.unlockPage,
  66  			),
  67  			wg.StatusBarButton(
  68  				"settings", 5, &icons.ActionSettings, func(name string) {
  69  					wg.unlockPage.ActivePage(name)
  70  				}, wg.unlockPage,
  71  			),
  72  			// wg.Inset(0.5, gel.EmptySpace(0, 0)).Fn,
  73  		},
  74  	)
  75  	// a.PushOverlay(wg.toasts.DrawToasts())
  76  	// a.PushOverlay(wg.dialog.DrawDialog())
  77  	return
  78  }
  79