Updated get_formatted_status()
This commit is contained in:
parent
6cdc4015e7
commit
30b703e025
1 changed files with 21 additions and 5 deletions
|
|
@ -72,7 +72,9 @@ class BlockPair():
|
||||||
if map_data['full recovery']:
|
if map_data['full recovery']:
|
||||||
self.pass_done = [True, True, True]
|
self.pass_done = [True, True, True]
|
||||||
self.rescued = self.total_size
|
self.rescued = self.total_size
|
||||||
self.status[pass_num] = get_formatted_status(100)
|
self.status[pass_num] = get_formatted_status(
|
||||||
|
label='Pass {}'.format(pass_num),
|
||||||
|
data=100)
|
||||||
# Mark future passes as Skipped
|
# Mark future passes as Skipped
|
||||||
pass_num += 1
|
pass_num += 1
|
||||||
while pass_num <= 2:
|
while pass_num <= 2:
|
||||||
|
|
@ -474,9 +476,23 @@ def get_size_in_bytes(s):
|
||||||
|
|
||||||
|
|
||||||
def get_formatted_status(label, data):
|
def get_formatted_status(label, data):
|
||||||
"""TODO"""
|
"""Build status string using provided info, returns str."""
|
||||||
# TODO
|
data_width = SIDE_PANE_WIDTH - len(label)
|
||||||
pass
|
try:
|
||||||
|
data_str = '{data:>{data_width}.2f} %'.format(
|
||||||
|
data=data,
|
||||||
|
data_width=data_width-2)
|
||||||
|
except ValueError:
|
||||||
|
# Assuming non-numeric data
|
||||||
|
data_str = '{data:>{data_width}}'.format(
|
||||||
|
data=data,
|
||||||
|
data_width=data_width)
|
||||||
|
status = '{label}{s_color}{data_str}{CLEAR}'.format(
|
||||||
|
label=label,
|
||||||
|
s_color=get_status_color(data),
|
||||||
|
data_str=data_str,
|
||||||
|
**COLORS)
|
||||||
|
return status
|
||||||
|
|
||||||
|
|
||||||
def get_status_color(s, t_success=99, t_warn=90):
|
def get_status_color(s, t_success=99, t_warn=90):
|
||||||
|
|
@ -489,7 +505,7 @@ def get_status_color(s, t_success=99, t_warn=90):
|
||||||
# Status is either in lists below or will default to red
|
# Status is either in lists below or will default to red
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if s in ('Pending',):
|
if s in ('Pending',) or str(s)[-2:] in (' b', 'Kb', 'Mb', 'Gb', 'Tb'):
|
||||||
color = COLORS['CLEAR']
|
color = COLORS['CLEAR']
|
||||||
elif s in ('Skipped', 'Unknown', 'Working'):
|
elif s in ('Skipped', 'Unknown', 'Working'):
|
||||||
color = COLORS['YELLOW']
|
color = COLORS['YELLOW']
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue