better instructions
This commit is contained in:
parent
3d58bc1c32
commit
ba514f7827
|
@ -5,11 +5,13 @@ package main
|
|||
*/
|
||||
|
||||
import (
|
||||
"go.wit.com/gui"
|
||||
"go.wit.com/lib/debugger"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
func init() {
|
||||
gui.InitArg()
|
||||
if debugger.ArgDebug() {
|
||||
log.Info("cmd line --debugger == true")
|
||||
go func() {
|
||||
|
|
30
doGui.go
30
doGui.go
|
@ -8,8 +8,6 @@ package main
|
|||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"go.wit.com/gui"
|
||||
|
@ -90,8 +88,6 @@ func doGui() {
|
|||
}
|
||||
|
||||
func drawWindow(win *gadgets.BasicWindow) {
|
||||
var reposWin *repoWindow // this is the handle to the repo window
|
||||
|
||||
box := win.Box()
|
||||
|
||||
vbox := box.NewVerticalBox("BOX2")
|
||||
|
@ -102,19 +98,17 @@ func drawWindow(win *gadgets.BasicWindow) {
|
|||
// me.autoWorkingPwd = gadgets.NewOneLiner(grid, "working directory (pwd)")
|
||||
me.goSrcPwd = gadgets.NewOneLiner(grid, "repo src home")
|
||||
grid.NewLabel("")
|
||||
me.demoB = grid.NewButton("Demo", func() {
|
||||
log.Info("todo: put instructions here")
|
||||
var howtoWin *genericWindow
|
||||
me.demoB = grid.NewButton("Howto", func() {
|
||||
if howtoWin != nil {
|
||||
howtoWin.Toggle()
|
||||
return
|
||||
}
|
||||
howtoWin = makeHowtoWin()
|
||||
})
|
||||
grid.NextRow()
|
||||
|
||||
usr, _ := user.Current()
|
||||
homeDir, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
log.Warn("Error getting home directory:", err)
|
||||
homeDir = "/home/autotypist"
|
||||
}
|
||||
srcDir := filepath.Join(homeDir, "go/src")
|
||||
me.goSrcPwd.SetText(srcDir)
|
||||
me.goSrcPwd.SetText(me.forge.GetGoSrc())
|
||||
|
||||
// use ENV GIT_AUTHOR
|
||||
me.gitAuthor = gadgets.NewOneLiner(grid, "Git Author")
|
||||
|
@ -135,10 +129,6 @@ func drawWindow(win *gadgets.BasicWindow) {
|
|||
me.setBranchB = grid.NewButton("git checkout", func() {
|
||||
win.Disable()
|
||||
defer win.Enable()
|
||||
if reposWin != nil {
|
||||
log.Info("reposWin == nil")
|
||||
reposWin.Hide()
|
||||
}
|
||||
|
||||
if me.autoCreateBranches.Checked() {
|
||||
argv.Force = true
|
||||
|
@ -170,8 +160,8 @@ func drawWindow(win *gadgets.BasicWindow) {
|
|||
me.newBranch = grid.NewDropdown()
|
||||
me.newBranch.AddText("master")
|
||||
me.newBranch.AddText("devel")
|
||||
me.newBranch.AddText(usr.Username)
|
||||
me.newBranch.SetText(usr.Username)
|
||||
me.newBranch.AddText(me.forge.Config.GetUsername())
|
||||
me.newBranch.SetText(me.forge.Config.GetUsername())
|
||||
me.argvCheckoutUser = true
|
||||
me.newBranch.Custom = func() {
|
||||
// toggle global values shared by the command line and the gui for doCheckout()
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
|
||||
// Use of this source code is governed by the GPL 3.0
|
||||
|
||||
package main
|
||||
|
||||
// An app to submit patches for the 30 GO GUI repos
|
||||
|
||||
import (
|
||||
"go.wit.com/lib/fhelp"
|
||||
"go.wit.com/lib/gui/shell"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
func makeHowtoWin() *genericWindow {
|
||||
howtoWin := initGenericWindow("Howto", "forge -- a GUI tool for git repostories")
|
||||
tmp := `A good way to see how forge works is to download forge
|
||||
|
||||
This will 'git clone' a few things (~50 repos):
|
||||
`
|
||||
howtoWin.group.NewLabel(tmp)
|
||||
grid := howtoWin.group.RawGrid()
|
||||
grid.NewLabel("forge")
|
||||
grid.NewLabel("the sources for forge")
|
||||
grid.NextRow()
|
||||
|
||||
grid.NewLabel("autogenpb")
|
||||
grid.NewLabel("generates needed code for working with the protobuf files")
|
||||
grid.NextRow()
|
||||
|
||||
grid.NewLabel("go-clone")
|
||||
grid.NewLabel("recursively 'git clone' dependencies based on go.mod")
|
||||
grid.NextRow()
|
||||
|
||||
grid.NewLabel("the GUI")
|
||||
grid.NewLabel("GO plugins for libcurses and GTK")
|
||||
grid.NextRow()
|
||||
|
||||
grid.NewLabel("") // a stupid way to add padding
|
||||
grid.NextRow()
|
||||
|
||||
howtoWin.group.NewLabel("Working dir: " + me.forge.GetGoSrc())
|
||||
grid = howtoWin.group.RawGrid()
|
||||
grid.NewButton("Download", func() {
|
||||
howtoWin.Disable()
|
||||
defer howtoWin.Enable()
|
||||
log.Info("download here")
|
||||
if path, err := fhelp.CheckCmd("go-clone"); err != nil {
|
||||
log.Info("go-clone missing", path, err)
|
||||
cmd := []string{"go", "install", "go.wit.com/apps/go-clone@latest"}
|
||||
shell.RunRealtime(cmd)
|
||||
}
|
||||
if path, err := fhelp.CheckCmd("go-clone2"); err != nil {
|
||||
log.Info("go-clone2 missing", path, err)
|
||||
}
|
||||
if path, err := fhelp.CheckCmd("go-clone"); err != nil {
|
||||
log.Info("can't prep build. you probably need ~/go/bin in your PATH", path, err)
|
||||
return
|
||||
}
|
||||
var cmd []string
|
||||
if me.forge.IsGoWork() {
|
||||
cmd = []string{"go-clone", "--work", "--recursive"}
|
||||
} else {
|
||||
cmd = []string{"go-clone", "--recursive"}
|
||||
}
|
||||
log.Info("Running:", cmd)
|
||||
shell.RunRealtime(cmd)
|
||||
|
||||
cmd = []string{"go-clone", "--recursive", "go.wit.com/apps/go-mod-clean"}
|
||||
log.Info("Running:", cmd)
|
||||
shell.RunRealtime(cmd)
|
||||
|
||||
cmd = []string{"go-clone", "--recursive", "go.wit.com/apps/forge"}
|
||||
log.Info("Running:", cmd)
|
||||
shell.RunRealtime(cmd)
|
||||
|
||||
cmd = []string{"go-clone", "--recursive", "go.wit.com/toolkits/gocui"}
|
||||
log.Info("Running:", cmd)
|
||||
shell.RunRealtime(cmd)
|
||||
|
||||
cmd = []string{"go-clone", "--recursive", "go.wit.com/toolkits/andlabs"}
|
||||
log.Info("Running:", cmd)
|
||||
shell.RunRealtime(cmd)
|
||||
})
|
||||
return howtoWin
|
||||
}
|
|
@ -32,7 +32,6 @@ type mainType struct {
|
|||
urlbase string // base URL
|
||||
|
||||
// our view of the repositories
|
||||
// repos *repoWindow
|
||||
// patchWin *patchesWindow
|
||||
|
||||
mainWindow *gadgets.BasicWindow
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
|
||||
// Use of this source code is governed by the GPL 3.0
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"go.wit.com/lib/gadgets"
|
||||
"go.wit.com/log"
|
||||
|
||||
"go.wit.com/gui"
|
||||
)
|
||||
|
||||
type genericWindow struct {
|
||||
win *gadgets.BasicWindow // the window widget itself
|
||||
box *gui.Node // the top box of the repolist window
|
||||
group *gui.Node // the default group
|
||||
}
|
||||
|
||||
func (r *genericWindow) Hidden() bool {
|
||||
if r == nil {
|
||||
return true
|
||||
}
|
||||
if r.win == nil {
|
||||
return true
|
||||
}
|
||||
return r.win.Hidden()
|
||||
}
|
||||
|
||||
func (r *genericWindow) Toggle() {
|
||||
if r.Hidden() {
|
||||
r.Show()
|
||||
} else {
|
||||
r.Hide()
|
||||
}
|
||||
}
|
||||
|
||||
func (r *genericWindow) Show() {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
if r.win == nil {
|
||||
return
|
||||
}
|
||||
r.win.Show()
|
||||
}
|
||||
|
||||
func (r *genericWindow) Hide() {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
if r.win == nil {
|
||||
return
|
||||
}
|
||||
r.win.Hide()
|
||||
}
|
||||
|
||||
func (r *genericWindow) Disable() {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
if r.box == nil {
|
||||
return
|
||||
}
|
||||
r.box.Disable()
|
||||
}
|
||||
|
||||
func (r *genericWindow) Enable() {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
if r.box == nil {
|
||||
return
|
||||
}
|
||||
r.box.Enable()
|
||||
}
|
||||
|
||||
func initGenericWindow(title string, grouptxt string) *genericWindow {
|
||||
gw := new(genericWindow)
|
||||
gw.win = gadgets.RawBasicWindow(title)
|
||||
gw.win.Make()
|
||||
|
||||
gw.box = gw.win.Box().Vertical() // a vertical box (like a stack of books)
|
||||
gw.win.Custom = func() {
|
||||
log.Warn("Found Window close. setting hidden=true")
|
||||
// sets the hidden flag to false so Toggle() works
|
||||
gw.win.Hide()
|
||||
}
|
||||
gw.group = gw.box.NewGroup(grouptxt)
|
||||
gw.Show()
|
||||
|
||||
return gw
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
|
||||
// Use of this source code is governed by the GPL 3.0
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"go.wit.com/lib/gadgets"
|
||||
|
||||
"go.wit.com/gui"
|
||||
)
|
||||
|
||||
type repoWindow struct {
|
||||
win *gadgets.BasicWindow // the window widget itself
|
||||
box *gui.Node // notsure
|
||||
topbox *gui.Node // the top box of the repolist window
|
||||
}
|
||||
|
||||
func (r *repoWindow) Hidden() bool {
|
||||
if r == nil {
|
||||
return true
|
||||
}
|
||||
if r.win == nil {
|
||||
return true
|
||||
}
|
||||
return r.win.Hidden()
|
||||
}
|
||||
|
||||
func (r *repoWindow) Show() {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
if r.win == nil {
|
||||
return
|
||||
}
|
||||
r.win.Show()
|
||||
}
|
||||
|
||||
func (r *repoWindow) Hide() {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
if r.win == nil {
|
||||
return
|
||||
}
|
||||
r.win.Hide()
|
||||
}
|
||||
|
||||
func (r *repoWindow) Disable() {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
if r.box == nil {
|
||||
return
|
||||
}
|
||||
r.box.Disable()
|
||||
}
|
||||
|
||||
func (r *repoWindow) Enable() {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
if r.box == nil {
|
||||
return
|
||||
}
|
||||
r.box.Enable()
|
||||
}
|
Loading…
Reference in New Issue