Utilities¶
-
cplcom.utils.
pretty_time
(seconds)¶ 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'
-
cplcom.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'
-
cplcom.utils.
byteify
(val, py2_only=True)¶ Returns a copy of the input with all string in the input converted to bytes.
Parameters: - val: object
The object to convert.
- py2_only: bool
If the conversion should happen in Python 2.x only. If False, it’s always converted. If True, the default, it’s only converted to bytes when running in Python 2.
For example in python 2:
>>> obj = {u'cheese': u'crackers', 4: [u'four', u'apple', 5, 'cheeses']} >>> obj {u'cheese': u'crackers', 4: [u'four', u'apple', 5, 'cheeses']} >>> byteify(obj) {'cheese': 'crackers', 4: ['four', 'apple', 5, 'cheeses']}
-
class
cplcom.utils.
ColorTheme
¶ Bases:
kivy._event.EventDispatcher
Default values from https://www.materialpalette.com/amber/indigo
-
primary_text
¶ This is different.
-