summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaleb Bassi <calebjbassi@gmail.com>2019-02-03 20:11:35 -0800
committerCaleb Bassi <calebjbassi@gmail.com>2019-02-03 21:04:57 -0800
commitd9607af03443f6e409ea75026653a0d85b193e4f (patch)
treefeebae12766ca6499d64a94f266ffbc93df86f4c
parentdbf25cdd857e3b71a26d9fc7bbd29354068da791 (diff)
Refactor
-rw-r--r--src/widgets/proc.go5
-rw-r--r--src/widgets/temp.go6
-rw-r--r--src/widgets/temp_other.go3
-rw-r--r--src/widgets/temp_windows.go3
4 files changed, 9 insertions, 8 deletions
diff --git a/src/widgets/proc.go b/src/widgets/proc.go
index 13aaa38..d0dbce9 100644
--- a/src/widgets/proc.go
+++ b/src/widgets/proc.go
@@ -9,10 +9,11 @@ import (
"sync"
"time"
- ui "github.com/cjbassi/gotop/src/termui"
- "github.com/cjbassi/gotop/src/utils"
"github.com/gizak/termui"
psCPU "github.com/shirou/gopsutil/cpu"
+
+ ui "github.com/cjbassi/gotop/src/termui"
+ "github.com/cjbassi/gotop/src/utils"
)
const (
diff --git a/src/widgets/temp.go b/src/widgets/temp.go
index 78c1b3d..9b90069 100644
--- a/src/widgets/temp.go
+++ b/src/widgets/temp.go
@@ -1,8 +1,5 @@
package widgets
-// Temp is too customized to inherit from a generic widget so we create a customized one here.
-// Temp defines its own Buffer method directly.
-
import (
"fmt"
"image"
@@ -14,7 +11,7 @@ import (
)
type Temp struct {
- *ui.Block
+ *ui.Block // inherits from Block instead of a premade Widget
interval time.Duration
Data map[string]int
Threshold int
@@ -50,6 +47,7 @@ func NewTemp(renderLock *sync.RWMutex, fahrenheit bool) *Temp {
return self
}
+// We implement a custom Draw method instead of inheriting from a generic Widget.
func (self *Temp) Draw(buf *ui.Buffer) {
self.Block.Draw(buf)
diff --git a/src/widgets/temp_other.go b/src/widgets/temp_other.go
index db30de4..68995d2 100644
--- a/src/widgets/temp_other.go
+++ b/src/widgets/temp_other.go
@@ -6,8 +6,9 @@ import (
"log"
"strings"
- "github.com/cjbassi/gotop/src/utils"
psHost "github.com/shirou/gopsutil/host"
+
+ "github.com/cjbassi/gotop/src/utils"
)
func (self *Temp) update() {
diff --git a/src/widgets/temp_windows.go b/src/widgets/temp_windows.go
index 8fabb19..8ff5ef4 100644
--- a/src/widgets/temp_windows.go
+++ b/src/widgets/temp_windows.go
@@ -3,8 +3,9 @@ package widgets
import (
"log"
- "github.com/cjbassi/gotop/src/utils"
psHost "github.com/shirou/gopsutil/host"
+
+ "github.com/cjbassi/gotop/src/utils"
)
func (self *Temp) update() {