diff options
| author | İbrahim Serdar Açıkgöz <serdaracikgoz86@gmail.com> | 2018-11-28 18:50:14 +0300 |
|---|---|---|
| committer | İbrahim Serdar Açıkgöz <serdaracikgoz86@gmail.com> | 2018-11-28 18:50:14 +0300 |
| commit | fbd81c57b850e698ab11494b4b90b5ddffb11d4d (patch) | |
| tree | b5aeba3264420e78faf68890cf7d4bcb10655bdc | |
| parent | visual improvements (diff) | |
| download | gitbatch-fbd81c57b850e698ab11494b4b90b5ddffb11d4d.tar.gz | |
minor ui tweaks
| -rw-r--r-- | pkg/gui/gui.go | 1 | ||||
| -rw-r--r-- | pkg/gui/keybindings.go | 28 | ||||
| -rw-r--r-- | pkg/gui/mainview.go | 60 | ||||
| -rw-r--r-- | pkg/gui/queuehandler.go | 12 |
4 files changed, 71 insertions, 30 deletions
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index 8d90975..cf35a17 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -118,6 +118,7 @@ func (gui *Gui) layout(g *gocui.Gui) error { } v.Title = mainViewFeature.Title v.Highlight = true + // v.SelBgColor = gocui.ColorWhite v.SelFgColor = gocui.ColorGreen v.Overwrite = true } diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index 61db55f..599d471 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -185,19 +185,31 @@ func (gui *Gui) updateKeyBindingsView(g *gocui.Gui, viewName string) error { v.BgColor = gocui.ColorWhite v.FgColor = gocui.ColorBlack v.Frame = false - for _, k := range gui.KeyBindings { - if k.View == viewName && k.Vital { - binding := " " + k.Display + ": " + k.Description + " ░" - fmt.Fprint(v, binding) - } - } switch mode := gui.State.Mode.ModeID; mode { case FetchMode: - writeRightHandSide(v, " ⭠ Fetch", 0, 0) + v.BgColor = gocui.ColorBlue + v.FgColor = gocui.ColorWhite + fmt.Fprint(v, " ↓ Fetch Mode █▓▒") case PullMode: - writeRightHandSide(v, " ⭠ Pull", 0, 0) + v.BgColor = gocui.ColorMagenta + v.FgColor = gocui.ColorWhite + fmt.Fprint(v, " ↓↳ Pull Mode █▓▒") default: writeRightHandSide(v, "No-Mode", 0, 0) } + for _, k := range gui.KeyBindings { + if k.View == viewName && k.Vital { + binding := "░ " + k.Display + ": " + k.Description + " " + fmt.Fprint(v, binding) + } + } + // switch mode := gui.State.Mode.ModeID; mode { + // case FetchMode: + // writeRightHandSide(v, " ⭠ Fetch", 0, 0) + // case PullMode: + // writeRightHandSide(v, " ⭠ Pull", 0, 0) + // default: + // writeRightHandSide(v, "No-Mode", 0, 0) + // } return nil } diff --git a/pkg/gui/mainview.go b/pkg/gui/mainview.go index 6d511d1..aca5daf 100644 --- a/pkg/gui/mainview.go +++ b/pkg/gui/mainview.go @@ -106,12 +106,12 @@ func (gui *Gui) markRepository(g *gocui.Gui, v *gocui.View) error { if err != nil { return err } - if !r.Branch.Clean { - if err = gui.openErrorView(g, "Stage your changes before pull", "You should manually resolve this issue"); err != nil { - return err - } - return nil - } + // if !r.Branch.Clean { + // if err = gui.openErrorView(g, "Stage your changes before pull", "You should manually resolve this issue"); err != nil { + // return err + // } + // return nil + // } if r.State == git.Available || r.State == git.Success { var jt job.JobType switch mode := gui.State.Mode.ModeID; mode { @@ -158,14 +158,24 @@ func (gui *Gui) refreshMain(g *gocui.Gui) error { } func displayString(entity *git.RepoEntity) string { + prefix := "" if entity.Branch.Pushables != "?" { - prefix = prefix + string(blue.Sprint("↑")) + "" + entity.Branch.Pushables + " " + - string(blue.Sprint("↓")) + "" + entity.Branch.Pullables + string(magenta.Sprint(" → ")) + prefix = prefix + string(blue.Sprint("↖")) + " " + entity.Branch.Pushables + " " + + string(blue.Sprint("↘")) + " " + entity.Branch.Pullables + string(magenta.Sprint(" → ")) } else { - prefix = prefix + magenta.Sprint("?") + string(yellow.Sprint(" → ")) + prefix = prefix + " " + magenta.Sprint("?") + string(yellow.Sprint(" → ")) + } + branch := "" + entity.Branch.Name + if len(branch) > 16 { + branch = branch[:13] + "..." + } + prefix = prefix + string(cyan.Sprint(branch)) + if !entity.Branch.Clean { + prefix = prefix + string(yellow.Sprint("✗") + " ") + } else { + prefix = prefix + " " } - prefix = prefix + string(cyan.Sprint(entity.Branch.Name)) + " " if entity.State == git.Queued { return prefix + entity.Name + " " + string(green.Sprint("•") + " ") } else if entity.State == git.Working { @@ -174,9 +184,35 @@ func displayString(entity *git.RepoEntity) string { return prefix + entity.Name + " " + string(green.Sprint("✔") + " ") } else if entity.State == git.Fail { return prefix + entity.Name + " " + string(red.Sprint("✗") + " ") - } else if !entity.Branch.Clean { - return prefix + entity.Name + " " + string(yellow.Sprint("✗") + " ") } else { return prefix + entity.Name } } + +// func displayString(entity *git.RepoEntity) string { + +// prefix := "" +// if entity.Branch.Pushables != "?" { +// prefix = prefix + string(blue.Sprint("↑")) + " " + entity.Branch.Pushables + " " + +// string(blue.Sprint("↓")) + " " + entity.Branch.Pullables + " " +// } else { +// prefix = prefix + " " + magenta.Sprint("?") +// } +// if !entity.Branch.Clean { +// prefix = prefix + " " + string(yellow.Sprint("✗") + " ") +// } else { +// prefix = prefix + " " + string(magenta.Sprint(" ")) +// } +// prefix = prefix + " " + string(cyan.Sprint(entity.Branch.Name)) + " " +// if entity.State == git.Queued { +// return prefix + entity.Name + " " + string(blue.Sprint("•") + " ") +// } else if entity.State == git.Working { +// return prefix + entity.Name + " " + string(blue.Sprint("•") + " ") +// } else if entity.State == git.Success { +// return prefix + entity.Name + " " + string(green.Sprint("✔") + " ") +// } else if entity.State == git.Fail { +// return prefix + entity.Name + " " + string(red.Sprint("✗") + " ") +// } else { +// return prefix + entity.Name +// } +// } diff --git a/pkg/gui/queuehandler.go b/pkg/gui/queuehandler.go index 1810cf5..adb9ddc 100644 --- a/pkg/gui/queuehandler.go +++ b/pkg/gui/queuehandler.go @@ -13,7 +13,7 @@ func (gui *Gui) startQueue(g *gocui.Gui, v *gocui.View) error { gui_go.refreshMain(gu) return nil }) - defer indicateQueueFinished(g_go) + defer gui.updateKeyBindingsView(g, mainViewFeature.Name) if err != nil { return } @@ -36,14 +36,6 @@ func indicateQueueStarted(g *gocui.Gui) error { return err } v.BgColor = gocui.ColorGreen - return nil -} - -func indicateQueueFinished(g *gocui.Gui) error { - v, err := g.View(keybindingsViewFeature.Name) - if err != nil { - return err - } - v.BgColor = gocui.ColorWhite + v.FgColor = gocui.ColorBlack return nil } |
