Skip to content
This repository has been archived by the owner on Aug 29, 2020. It is now read-only.

Commit

Permalink
Upgrade gizak/termui@v3-wip
Browse files Browse the repository at this point in the history
  • Loading branch information
cjbassi committed Jan 15, 2019
1 parent c1d7aad commit c34782d
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
4 changes: 2 additions & 2 deletions src/termui/sparkline.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
}

Expand Down
6 changes: 3 additions & 3 deletions src/termui/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
}

Expand All @@ -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]
Expand All @@ -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),
)
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/widgets/statusbar.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
)
}
6 changes: 3 additions & 3 deletions src/widgets/temp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
}
}
Expand Down

0 comments on commit c34782d

Please sign in to comment.