Skip to content
Permalink
Browse files

Upgrade gizak/termui@v3-wip

  • Loading branch information...
cjbassi committed Jan 15, 2019
1 parent c1d7aad commit c34782d45f3aae11829f2e430df9925f91519315
Showing with 14 additions and 12 deletions.
  1. +1 −1 go.mod
  2. +2 −0 go.sum
  3. +2 −2 src/termui/sparkline.go
  4. +3 −3 src/termui/table.go
  5. +3 −3 src/widgets/statusbar.go
  6. +3 −3 src/widgets/temp.go
2 go.mod
@@ -7,7 +7,7 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/distatus/battery v0.0.0-20170521010419-916919eb43bd
github.com/docopt/docopt.go v0.0.0-20180111231733-ee0de3bc6815
github.com/gizak/termui v0.0.0-20190106180445-e0cfd08b56af
github.com/gizak/termui v0.0.0-20190114080300-043950fed066
github.com/go-ole/go-ole v1.2.1 // indirect
github.com/maruel/panicparse v1.1.1 // indirect
github.com/mattn/go-runewidth v0.0.4 // indirect
2 go.sum
@@ -14,6 +14,8 @@ github.com/gizak/termui v0.0.0-20181228210747-b136f68f55f1 h1:TCe+sQ3zOPa8KNePfj
github.com/gizak/termui v0.0.0-20181228210747-b136f68f55f1/go.mod h1:W48Llfv3G9PIK3TQjqynxzC9mP4HUcAn/6vlDWekq9k=
github.com/gizak/termui v0.0.0-20190106180445-e0cfd08b56af h1:1UzQCUneHMAfAfSkah0chOL36sJZrIYInbwhUNE8S7o=
github.com/gizak/termui v0.0.0-20190106180445-e0cfd08b56af/go.mod h1:S3xz8JHXNDPSNFsvXCdG7bHlEGrwvUG3a0joR/xYZ5M=
github.com/gizak/termui v0.0.0-20190114080300-043950fed066 h1:bvCoawfbeVriOaMCsYfEi159KmLKSiKhwWQiJx44c4A=
github.com/gizak/termui v0.0.0-20190114080300-043950fed066/go.mod h1:S3xz8JHXNDPSNFsvXCdG7bHlEGrwvUG3a0joR/xYZ5M=
github.com/gizak/termui v2.1.2-0.20161117194350-ac02ff0e7ca6+incompatible h1:S5a8Iu1VRy0aWpHO8SVSahQ6eTbWD58gY9hD1/aRRMI=
github.com/gizak/termui v2.1.2-0.20161117194350-ac02ff0e7ca6+incompatible/go.mod h1:PkJoWUt/zacQKysNfQtcw1RW+eK2SxkieVBtl+4ovLA=
github.com/gizak/termui v2.3.0+incompatible h1:S8wJoNumYfc/rR5UezUM4HsPEo3RJh0LKdiuDWQpjqw=
@@ -57,15 +57,15 @@ func (self *Sparklines) Draw(buf *Buffer) {
if self.Inner.Dy() > 5 {
buf.SetString(
title1,
image.Pt(self.Inner.Min.X, title1Y),
AttrPair{line.TitleColor | AttrBold, -1},
image.Pt(self.Inner.Min.X, title1Y),
)
}
if self.Inner.Dy() > 6 {
buf.SetString(
title2,
image.Pt(self.Inner.Min.X, title2Y),
AttrPair{line.TitleColor | AttrBold, -1},
image.Pt(self.Inner.Min.X, title2Y),
)
}

@@ -78,8 +78,8 @@ func (self *Table) Draw(buf *Buffer) {
}
buf.SetString(
h,
image.Pt(self.Inner.Min.X+self.CellXPos[i]-1, self.Inner.Min.Y),
AttrPair{Theme.Default.Fg | AttrBold, -1},
image.Pt(self.Inner.Min.X+self.CellXPos[i]-1, self.Inner.Min.Y),
)
}

@@ -102,8 +102,8 @@ func (self *Table) Draw(buf *Buffer) {
}
buf.SetString(
strings.Repeat(" ", self.Inner.Dx()),
image.Pt(self.Inner.Min.X, self.Inner.Min.Y+y-1),
AttrPair{fg, -1},
image.Pt(self.Inner.Min.X, self.Inner.Min.Y+y-1),
)
}
self.SelectedItem = row[self.UniqueCol]
@@ -123,8 +123,8 @@ func (self *Table) Draw(buf *Buffer) {
r := TrimString(row[i], width)
buf.SetString(
r,
image.Pt(self.Inner.Min.X+self.CellXPos[i]-1, self.Inner.Min.Y+y-1),
AttrPair{fg, -1},
image.Pt(self.Inner.Min.X+self.CellXPos[i]-1, self.Inner.Min.Y+y-1),
)
}
}
@@ -24,27 +24,27 @@ func (self *StatusBar) Draw(buf *ui.Buffer) {
hostname, _ := os.Hostname()
buf.SetString(
hostname,
image.Pt(self.Inner.Min.X, self.Inner.Min.Y+(self.Inner.Dy()/2)),
ui.AttrPair{ui.Attribute(7), -1},
image.Pt(self.Inner.Min.X, self.Inner.Min.Y+(self.Inner.Dy()/2)),
)

t := time.Now()
_time := t.Format("15:04:05")
buf.SetString(
_time,
ui.AttrPair{7, -1},
image.Pt(
self.Inner.Min.X+(self.Inner.Dx()/2)-len(_time)/2,
self.Inner.Min.Y+(self.Inner.Dy()/2),
),
ui.AttrPair{7, -1},
)

buf.SetString(
"gotop",
ui.AttrPair{7, -1},
image.Pt(
self.Inner.Max.X-6,
self.Inner.Min.Y+(self.Inner.Dy()/2),
),
ui.AttrPair{7, -1},
)
}
@@ -69,20 +69,20 @@ func (self *Temp) Draw(buf *ui.Buffer) {

s := ui.TrimString(key, (self.Inner.Dx() - 4))
buf.SetString(s,
image.Pt(self.Inner.Min.X, self.Inner.Min.Y+y),
ui.Theme.Default,
image.Pt(self.Inner.Min.X, self.Inner.Min.Y+y),
)
if self.Fahrenheit {
buf.SetString(
fmt.Sprintf("%3dF", self.Data[key]),
image.Pt(self.Inner.Dx()-3, y+1),
ui.AttrPair{fg, -1},
image.Pt(self.Inner.Dx()-3, y+1),
)
} else {
buf.SetString(
fmt.Sprintf("%3dC", self.Data[key]),
image.Pt(self.Inner.Max.X-4, self.Inner.Min.Y+y),
ui.AttrPair{fg, -1},
image.Pt(self.Inner.Max.X-4, self.Inner.Min.Y+y),
)
}
}

0 comments on commit c34782d

Please sign in to comment.
You can’t perform that action at this time.