From a85578e24235fbc5cab7b345f3f9ea07c8d96b2a Mon Sep 17 00:00:00 2001 From: Valentin Samir Date: Sun, 23 Nov 2014 17:12:40 +0100 Subject: [PATCH] =?UTF-8?q?[affichage]=20D=C3=A9tails=20pour=20dialogue-is?= =?UTF-8?q?ation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gestion/affichage.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gestion/affichage.py b/gestion/affichage.py index d02e64c1..0042186f 100755 --- a/gestion/affichage.py +++ b/gestion/affichage.py @@ -222,7 +222,7 @@ def nostyle(dialog=False): return "\033[1;0m" @static_var([("styles", {})]) -def style(texte, what=[], dialog=False): +def style(texte, what=None, dialog=False): """ Pretty text is pretty On peut appliquer plusieurs styles d'affilée, ils seront alors traités @@ -244,6 +244,9 @@ def style(texte, what=[], dialog=False): UPPER, parce que c'est inutile, donc kewl. """ + if what is None: + what = [] + if dialog: return dialogStyle(texte, what) @@ -397,7 +400,7 @@ def format_data(data, format): return "%.2f %s" % (data/oct_sizes[i], oct_names[i]) return "%.0f o" % (data) -def tableau(data, titre=None, largeur=None, alignement=None, format=None, dialog=False, width=None, styles=None, swap=[]): +def tableau(data, titre=None, largeur=None, alignement=None, format=None, dialog=False, width=None, styles=None, swap=None): """ Retourne une chaine formatée repésentant un tableau. @@ -425,6 +428,9 @@ def tableau(data, titre=None, largeur=None, alignement=None, format=None, dialog swap : Met styles à None et alterne une ligne sur deux niveau couleurs. """ + if swap is None: + swap = [] + if data and isinstance(data, list): nb_cols = len(data[0]) else: