[entropy.output] _print_prio: use nice unicode header chars :-)

This commit is contained in:
Fabio Erculiani
2013-12-12 11:56:04 +01:00
parent 89b0c053ff
commit 36b634aea7

View File

@@ -497,6 +497,8 @@ def _std_write(msg, stderr = False):
else:
obj.write(msg)
_PRINT_PRIO_HEADER = const_convert_to_unicode("\u2560 ")
def _print_prio(msg, color_func, back = False, flush = True, end = '\n',
stderr = False):
if is_mute():
@@ -507,12 +509,14 @@ def _print_prio(msg, color_func, back = False, flush = True, end = '\n',
is_tty = is_stdout_a_tty()
if is_tty:
writechar("\r", stderr = stderr)
if back:
msg = color_func(">>") + " " + msg
else:
msg = color_func(">>") + " " + msg + end
header = color_func(_PRINT_PRIO_HEADER)
_std_write(header, stderr = stderr)
_std_write(msg, stderr = stderr)
if not back:
_std_write(end, stderr = stderr)
if back and (not is_tty):
# in this way files are properly written
writechar("\n", stderr = stderr)