main.go raw
1 package cfg
2
3 import (
4 "github.com/p9c/p9/pkg/qu"
5
6 "github.com/p9c/p9/pkg/gel"
7 )
8
9 func New(w *gel.Window, killAll qu.C) *Config {
10 cfg := &Config{
11 Window: w,
12 // cx: cx,
13 quit: killAll,
14 }
15 // cfg.Theme = cx.App
16 return cfg.Init()
17 }
18
19 type Config struct {
20 // cx *state.State
21 *gel.Window
22 Bools map[string]*gel.Bool
23 lists map[string]*gel.List
24 enums map[string]*gel.Enum
25 checkables map[string]*gel.Checkable
26 clickables map[string]*gel.Clickable
27 editors map[string]*gel.Editor
28 inputs map[string]*gel.Input
29 multis map[string]*gel.Multi
30 configs GroupsMap
31 passwords map[string]*gel.Password
32 quit qu.C
33 }
34
35 func (c *Config) Init() *Config {
36 c.Theme.SetDarkTheme(c.Theme.Dark.True())
37 c.enums = map[string]*gel.Enum{
38 // "runmode": ng.th.Enum().SetValue(ng.runMode),
39 }
40 c.Bools = map[string]*gel.Bool{
41 // "runstate": ng.th.Bool(false).SetOnChange(func(b bool) {
42 // D.Ln("run state is now", b)
43 // }),
44 }
45 c.lists = map[string]*gel.List{
46 // "overview": ng.th.List(),
47 "settings": c.List(),
48 }
49 c.clickables = map[string]*gel.Clickable{
50 // "quit": ng.th.Clickable(),
51 }
52 c.checkables = map[string]*gel.Checkable{
53 // "runmodenode": ng.th.Checkable(),
54 // "runmodewallet": ng.th.Checkable(),
55 // "runmodeshell": ng.th.Checkable(),
56 }
57 c.editors = make(map[string]*gel.Editor)
58 c.inputs = make(map[string]*gel.Input)
59 c.multis = make(map[string]*gel.Multi)
60 c.passwords = make(map[string]*gel.Password)
61 return c
62 }
63