Abridge levels description, add example instead (#683)

fixes issue #681
This commit is contained in:
Егор 2018-12-08 18:36:46 +03:00 committed by enkore
parent 8120d807eb
commit 90460d94ce

View File

@ -162,7 +162,7 @@ class BatteryChecker(IntervalModule):
format='{battery_ident}: [{status} ]{percentage_design:.2f}%', format='{battery_ident}: [{status} ]{percentage_design:.2f}%',
alert=True, alert=True,
alert_percentage=15, alert_percentage=15,
status = { status={
'DPL': 'DPL', 'DPL': 'DPL',
'CHR': 'CHR', 'CHR': 'CHR',
'DIS': 'DIS', 'DIS': 'DIS',
@ -170,6 +170,16 @@ class BatteryChecker(IntervalModule):
} }
) )
# status.register(
# 'battery',
# format='{status} {percentage:.0f}%',
# levels={
# 25: "<=25",
# 50: "<=50",
# 75: "<=75",
# },
# )
status.run() status.run()
""" """
@ -189,15 +199,7 @@ class BatteryChecker(IntervalModule):
("base_path", "Override the default base path for searching for batteries"), ("base_path", "Override the default base path for searching for batteries"),
("battery_prefix", "Override the default battery prefix"), ("battery_prefix", "Override the default battery prefix"),
("status", "A dictionary mapping ('DPL', 'DIS', 'CHR', 'FULL') to alternative names"), ("status", "A dictionary mapping ('DPL', 'DIS', 'CHR', 'FULL') to alternative names"),
("levels", ("levels", "A dictionary mapping percentages of charge levels to corresponding names."),
"A dictionary mapping of charge levels to corresponding names. Let the keys be a < b < c < d. "
"Then the following intervals correspond to each value:\n"
" 0 -> status['DPL']\n"
" |0 < x <= a| -> levels[a]\n"
" |a < x <= b| -> levels[b]\n"
" |b < x <= c| -> levels[c]\n"
" |c < x <= d| -> levels[d]\n"
" |d < x <= 100| -> status['FULL']"),
("color", "The text color"), ("color", "The text color"),
("full_color", "The full color"), ("full_color", "The full color"),
("charging_color", "The charging color"), ("charging_color", "The charging color"),