Skip to content

Commit

Permalink
cubestat: fix space cell
Browse files Browse the repository at this point in the history
  • Loading branch information
okuvshynov committed Aug 20, 2024
1 parent c087384 commit d562525
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
5 changes: 3 additions & 2 deletions cubestat/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ def prepare_cells():
colorpair = 1
for name, colors in colors_ansi256.items():
cells[name] = []
for fg, bg in zip(colors[1:], colors[:-1]):
for i, (fg, bg) in enumerate(zip(colors[1:], colors[:-1])):
curses.init_pair(colorpair, fg, bg)
cells[name].extend((chr, colorpair) for chr in chrs)
j = 0 if i == 0 else 1
cells[name].extend((chr, colorpair) for chr in chrs[j:])
colorpair += 1
return cells

Expand Down
1 change: 0 additions & 1 deletion cubestat/cubestat.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from cubestat.screen import Screen

from cubestat.platforms.factory import get_platform

from cubestat.metrics_registry import get_metrics, metrics_configure_argparse


Expand Down
31 changes: 31 additions & 0 deletions cubestat/metrics/mock.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from cubestat.metrics.base_metric import base_metric
from cubestat.metrics.registry import cubestat_metric

@cubestat_metric('darwin')
class mock_metric(base_metric):
def read(self, context):
res = {'mock': self.v}
self.v += 1.0
return res

def pre(self, title):
return False, ''

def format(self, title, values, idxs):
return 100.0, [f'{values[i]:3.0f}%' for i in idxs]

@classmethod
def key(cls):
return 'mock'

def hotkey(self):
return 'w'

@classmethod
def configure_argparse(cls, parser):
pass

def configure(self, conf):
self.v = 0.0
return self

0 comments on commit d562525

Please sign in to comment.