summaryrefslogtreecommitdiff
path: root/testGui
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-12-05 12:30:18 -0600
committerJeff Carr <[email protected]>2024-12-05 12:30:18 -0600
commit87f53b432fb9bb097c21bd3e01957d0e0b97de33 (patch)
treeae651220b9e198c3067373dae7cfdfb14c762c1d /testGui
parent2f33fc86488202b4df04e94da9fff29bbf079103 (diff)
remove guiv0.0.8
Diffstat (limited to 'testGui')
-rw-r--r--testGui/Makefile3
-rw-r--r--testGui/dpkg.go51
-rw-r--r--testGui/main.go99
-rw-r--r--testGui/structs.go74
4 files changed, 18 insertions, 209 deletions
diff --git a/testGui/Makefile b/testGui/Makefile
index 9f03282..dbbe743 100644
--- a/testGui/Makefile
+++ b/testGui/Makefile
@@ -2,11 +2,12 @@ VERSION = $(shell git describe --tags)
GUIVERSION = $(shell git describe --tags)
BUILDTIME = $(shell date +%Y.%m.%d)
-all: build
+all: goimports build
build:
GO111MODULE=off go build \
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
+ ./testGui
vet:
GO111MODULE=off go vet
diff --git a/testGui/dpkg.go b/testGui/dpkg.go
deleted file mode 100644
index 1d26c13..0000000
--- a/testGui/dpkg.go
+++ /dev/null
@@ -1,51 +0,0 @@
-package main
-
-import (
- "bufio"
- "bytes"
- "os/exec"
- "strings"
-)
-
-func listInstalledPackages() ([]string, error) {
- // Execute dpkg -l command
- cmd := exec.Command("dpkg", "-l")
- var out bytes.Buffer
- cmd.Stdout = &out
-
- if err := cmd.Run(); err != nil {
- return nil, err
- }
-
- // Initialize slice to hold package names
- var packages []string
- scanner := bufio.NewScanner(&out)
-
- // Skip the first five lines as they are headers in dpkg -l output
- for i := 0; i < 5 && scanner.Scan(); i++ {
- // Ignore header lines
- }
-
- // Process each remaining line
- for scanner.Scan() {
- line := scanner.Text()
- fields := strings.Fields(line)
-
- // Ensure the line has enough fields for parsing
- if len(fields) >= 2 {
- status := fields[0]
- packageName := fields[1]
-
- // Only add packages with "ii" status (installed)
- if status == "ii" {
- packages = append(packages, packageName)
- }
- }
- }
-
- if err := scanner.Err(); err != nil {
- return nil, err
- }
-
- return packages, nil
-}
diff --git a/testGui/main.go b/testGui/main.go
index ddfa433..7bef94c 100644
--- a/testGui/main.go
+++ b/testGui/main.go
@@ -1,14 +1,11 @@
package main
import (
- "fmt"
"os"
-
- "go.wit.com/log"
+ "time"
"go.wit.com/gui"
- "go.wit.com/lib/gui/repolist"
- "go.wit.com/lib/protobuf/forgepb"
+ "go.wit.com/log"
)
// sent via -ldflags
@@ -17,87 +14,23 @@ var BUILDTIME string
func main() {
me = new(autoType)
-
- // load the ~/.config/forge/ config
- me.forge = forgepb.Init()
- me.forge.ConfigPrintTable()
-
// setup the GUI
me.myGui = gui.New()
- me.myGui.Default()
-
- me.repoList = repolist.Init(me.forge, me.myGui)
- me.repoList.Enable()
-
- failed := make(map[*repolist.RepoRow]string)
- versions := make(map[*repolist.RepoRow]string)
-
- rloop := me.repoList.ReposSortByName()
- for rloop.Scan() {
- repo := rloop.Repo()
- repotype := repo.RepoType()
- if repotype != "binary" {
- // we only want to process golang binaries where package == 'main'
- // log.Info("skipping repo", repo.GoPath(), repotype)
- continue
- }
- // var cmd []string
- var start string
- var end string
- var alreadyBuilt bool
- ver := repo.Status.DebianReleaseVersion()
- name := me.forge.DebName(repo.GoPath())
- if me.forge.Machine.IsInstalled(name) {
- end += "(installed) "
- }
- if actualp := me.forge.Machine.FindVersion(name, ver); actualp != nil {
- end += " (version match) " + actualp.Version + " " + ver + " "
- alreadyBuilt = true
- } else {
- end += " (need to build) " + ver + " "
- }
-
- if alreadyBuilt {
- start = fmt.Sprintf("already built %-30s %-8s %-50s", name, ver, repo.GoPath())
- } else {
- start = fmt.Sprintf("need to build %-30s %-8s %-50s", name, ver, repo.GoPath())
- }
- log.Info(start, "("+versions[repo]+")", end)
- if name == "" {
- // err := fmt.Sprintf("name is blank error %+v", repo)
- log.Warn("name is blank error", repo.GoPath())
- }
-
- if argv.DryRun {
- continue
- }
-
- // skip if already built. (unless --force)
- if alreadyBuilt {
- // don't rebuild things
- if argv.Force {
- // well, okay, force me to rebuild them then
- } else {
- continue
- }
- }
-
- if repo.Status.IsPrivate() {
- // cmd = []string{"go-deb", "--auto", "--repo", repo.GoPath()}
- } else {
+ testLoad("nocui")
+ testLoad("pixelgl")
+ testLoad("gocui")
+ testLoad("andlabs")
+ testLoad("fyne")
+ //testLoad("fail")
+}
- }
- }
- log.Info("")
- log.Info("something failed on:")
- var fail bool = true
- for repo, cmd := range failed {
- log.Info("failed cmd :", cmd, repo.Status.Path())
- fail = false
- }
- if fail {
- os.Exit(0)
+func testLoad(name string) {
+ if _, err := me.myGui.LoadToolkit(name); err == nil {
+ } else {
+ log.Warn("LoadToolkit() failed to load", name, "error:", err)
+ os.Exit(-1)
}
- os.Exit(-1)
+ time.Sleep(3 * time.Second)
+ me.myGui.CloseToolkit(name)
}
diff --git a/testGui/structs.go b/testGui/structs.go
index a836504..b475f72 100644
--- a/testGui/structs.go
+++ b/testGui/structs.go
@@ -2,9 +2,6 @@ package main
import (
"go.wit.com/gui"
- "go.wit.com/lib/gadgets"
- "go.wit.com/lib/gui/repolist"
- "go.wit.com/lib/protobuf/forgepb"
)
var me *autoType
@@ -13,75 +10,4 @@ var me *autoType
type autoType struct {
// allrepos map[string]*repo
myGui *gui.Node
-
- mainWindow *gui.Node
-
- // the main box. enable/disable this
- mainbox *gui.Node
-
- // the window from the /lib/gui/gowit package
- lw *gadgets.BasicWindow
-
- // our view of the repositories
- // repos *repoWindow
- repoList *repolist.RepoList
-
- // your customized repo preferences and settings
- forge *forgepb.Forge
-
- // where your ~/go/src is
- goSrcPath string
-
- // use zookeeper to get the list of installed packages
- // machine zoopb.Machine
-
- // #### autotypist Global Display Options
- autoHidePerfect *gui.Node
- autoHideReadOnly *gui.Node
-
- // #### autotypist Global Build Options
- // what to change all the branches to
- // so, as a developer, you can move all the repos
- // to the 'devel' branch and then test a devel branch build
- // then switch back to your 'username' branch and do a build there
- toMoveToBranch string
-
- // this button will regenerate everyones go.mod & go.sum
- rerunGoMod *gui.Node
-
- // if checked, will stop trying to os.Exec() things after failure
- stopOnErrors *gui.Node
-
- // button to attempt to autorebuild
- autoRebuildButton *gui.Node
-
- // checkbox for --dry-run
- autoDryRun *gui.Node
-
- // checkbox to enable intermittent scanning
- // if checked, it will check all your repos for changes
- autoScanReposCB *gui.Node
-
- // what is being used as your home dir
- userHomePwd *gadgets.OneLiner
-
- // what is being used as ~/go/src
- goSrcPwd *gadgets.OneLiner
-
- downloadEverythingButton *gui.Node
-
- // delete ~/go/src & ~/go/pkg buttons
- deleteGoSrcPkgB *gui.Node
-
- // displays a summary of all the repos
- // has total dirty, total read-only
- // total patches, etc
- // summary *patchSummary
-
- // when switch to user or devel branches, autocreate them
- autoCreateBranches *gui.Node
-
- // make a concept called a 'mode' that means which branches
- // are you working from: "master"? "devel"? <username>?
- newMode *gui.Node
}