Utilities
- class base_kivy_app.utils.ColorTheme
Bases:
EventDispatcher
Default values from https://www.materialpalette.com/amber/indigo
- primary_text
This is different.
- base_kivy_app.utils.pretty_space(space, is_rate=False)
Returns a nice string representation of a number representing either size, e.g. 10 MB, or rate, e.g. 10 MB/s.
- Parameters:
- space: float, int
The number to convert.
- is_rate: bool
Whether the number represents size or rate. Defaults to False.
- Returns:
String representation of the space.
For example:
>>> pretty_space(10003045065) '9.32 GB' >>> tools.pretty_space(10003045065, is_rate=True) '9.32 GB/s'
- base_kivy_app.utils.pretty_time(seconds, pad=False)
Returns a nice representation of a time value.
- Parameters:
- seconds: float, int
The number, in seconds, to convert to a string.
- Returns:
String representation of the time.
For example:
>>> pretty_time(36574) '10:9:34.0'
- base_kivy_app.utils.yaml_dumps(value: ~typing.Any, *, get_yaml_obj: ~typing.Callable[[], ~ruamel.yaml.main.YAML] = <function get_yaml>) str
Converts the object to yaml.
- Parameters:
value – the object to convert.
get_yaml_obj – A function such as
get_yaml()
that will be called to get a yaml object. Defaults toget_yaml()
.
- Returns:
a string yaml representation.