[whos] Reformatage de la fonction d'affichage de l'historique
This commit is contained in:
parent
45dc21acd7
commit
a01ba77a8e
1 changed files with 25 additions and 25 deletions
|
@ -930,33 +930,33 @@ def _info(clas) :
|
|||
f += u'\n'
|
||||
return f
|
||||
|
||||
def _hist(clas) :
|
||||
def _hist(clas):
|
||||
""" Formatage de l'historique de la classe fournie """
|
||||
if limit_aff_historique==0 : return ''
|
||||
f=u''
|
||||
if limit_aff_historique == 0:
|
||||
return u''
|
||||
f = u''
|
||||
h = clas.historique()
|
||||
h.reverse()
|
||||
if h :
|
||||
f += coul(u'Historique : ','gras')
|
||||
for i in xrange(0,limit_aff_historique) :
|
||||
try :
|
||||
a = h[i] # Produit une erreur si i trop grand
|
||||
if i !=0 : f += ' '
|
||||
try:
|
||||
# on force l'encodage ici sinon il est fait au moment de l'impression a
|
||||
# l'ecran et il empeche l'affichage de toutes les infos
|
||||
f += u'%s\n' % a
|
||||
except Exception, e:
|
||||
if debug:
|
||||
f += coul(u'*** non affichable [%s] ***\n' % str(e), 'rouge')
|
||||
else:
|
||||
f += coul(u'*** non affichable ***\n', 'rouge')
|
||||
except :
|
||||
break
|
||||
try :
|
||||
if h[i+1] : f += ' [...]\n'
|
||||
except :
|
||||
None
|
||||
if h:
|
||||
f += coul(u'Historique : ', 'gras')
|
||||
notfirst = False
|
||||
lim = - (limit_aff_historique + 1)
|
||||
for a in h[:lim:-1]: # les `limit_aff_historique` (au plus) derniers éléments, en partant du dernier
|
||||
if notfirst:
|
||||
f += u' '
|
||||
else:
|
||||
notfirst = True
|
||||
try:
|
||||
# TODO: clarifier ça, a priori `a` c'est déjà un unicode
|
||||
# on force l'encodage ici sinon il est fait au moment de l'impression a
|
||||
# l'ecran et il empeche l'affichage de toutes les infos
|
||||
f += u'%s\n' % a
|
||||
except Exception, e:
|
||||
if debug:
|
||||
f += coul(u'*** non affichable [%s] ***\n' % str(e), 'rouge')
|
||||
else:
|
||||
f += coul(u'*** non affichable ***\n', 'rouge')
|
||||
if len(h) > limit_aff_historique:
|
||||
f += u' [...]\n'
|
||||
|
||||
return f
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue