Refactor
This commit is contained in:
parent
dbf25cdd85
commit
d9607af034
@ -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 (
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user