// New creates a welcome widget with informations about the program. // func New(source cftype.Source, log cdtype.Logger, switcher *pageswitch.Switcher) cftype.Grouper { const group = "Dev" title := tran.Slate("hi") // all packages in the application gopath. pathGoTest := strings.Join(append(cdglobal.AppBuildPath, "..."), "/") pathTestConfCmd := cdglobal.AppBuildPathFull("test", "confcmd", "confcmd.go") pathTestConfGUI := cdglobal.AppBuildPathFull("test", "confgui", "confgui.go") pathTestConfCmd, _ = filepath.EvalSymlinks(pathTestConfCmd) pathTestConfGUI, _ = filepath.EvalSymlinks(pathTestConfGUI) printConfig := func(showAll bool) { path := source.MainConfigFile() def := source.MainConfigDefault() otherSw := pageswitch.New() defer otherSw.Destroy() build, e := cfbuild.NewFromFile(source, log, path, def, "") if !log.Err(e, "load current dock config file") { // build.BuildSingle("TaskBar") build.BuildAll(otherSw) println("conf", path, def) cfprint.Default(build, showAll) build.Destroy() } } buildInfo := cfbuild.TweakAddGroup(group, newkey.TextLabel(group, "txt_title", common.Bold(common.Big(title))), newkey.Separator(group, "sep_title"), newkey.TextLabel(group, "txt_dev_page", "Test page, with useful tools for the developer."), newkey.CustomButtonLabel(group, "printConfig", "Print configuration", "show mainconf edited", func() { printConfig(false) }), newkey.CustomButtonLabel(group, "printConfig", "Print configuration", "show mainconf all", func() { printConfig(true) }), newkey.Separator(group, "sep_go_area"), newkey.TextLabel(group, "txt_go_area", "<b>Those commands requires the application sources in their Go environment</b>."), newkey.Separator(group, "sep_tests_gui"), newkey.LaunchCommand(group, "testConfGUI", "Launch config GUI test", "go run "+pathTestConfGUI), newkey.Separator(group, "sep_tests_cmd"), newkey.LaunchCommand(group, "testConfGUI", "Launch config console test", "go run "+pathTestConfCmd), newkey.LaunchCommand(group, "testConfGUI", "Launch config console mainconf diff", "go run "+pathTestConfCmd+" "+source.MainConfigFile()), newkey.Separator(group, "sep_tests_go"), newkey.LaunchCommand(group, "gotest", "Launch go tests", "go test "+pathGoTest), newkey.LaunchCommand(group, "golint", "Launch go lint", "golint "+pathGoTest), newkey.LaunchCommand(group, "govet", "Launch go vet", "go vet "+pathGoTest), ) build := cfbuild.NewVirtual(source, log, "", "", "").BuildAll(switcher, buildInfo) build.ShowAll() return build }
func main() { gtk.Init(nil) win, e := gtk.WindowNew(gtk.WINDOW_TOPLEVEL) if e != nil { println(e.Error()) return } path, isTest := vdata.TestPathDefault() var saveCall func(cftype.Builder) if isTest { saveCall = cfprint.Updated } else { saveCall = func(build cftype.Builder) { cfprint.Default(build, true) } } source := vdata.New(log.NewLog(log.Logs), win, saveCall) build := vdata.TestInit(source, path) source.SetGrouper(build) glib.IdleAdd(packWindow(win, source, build)) gtk.Main() }
func main() { path, isTest := vdata.TestPathDefault() // path := cdglobal.ConfigDirDock("") + "/current_theme/cairo-dock.conf" // path := cdglobal.AppBuildPathFull(pathGoGmail...) gtk.Init(nil) source := vdata.New(log.NewLog(log.Logs), nil, nil) build := vdata.TestInit(source, path) if build == nil { return } build.BuildAll(pageswitch.New()) if isTest { cfprint.Updated(build) build.KeyWalk(vdata.TestValues) cfprint.Updated(build) } else { cfprint.Default(build, true) } }