Do further cleanups in evmenu color handling; relates to #1117.

This commit is contained in:
Griatch 2016-11-15 01:07:16 +01:00
parent 682060daaf
commit 596bfff35a
2 changed files with 7 additions and 6 deletions

View file

@ -314,10 +314,10 @@ def evtable_options_formatter(optionlist, caller=None):
raw_key = strip_ansi(key)
if raw_key != key:
# already decorations in key definition
table.append(ANSIString(" |lc%s|lt%s|le: %s" % (raw_key, key, desc)))
table.append(" |lc%s|lt%s|le: %s" % (raw_key, key, desc))
else:
# add a default white color to key
table.append(ANSIString(" |lc%s|lt|w%s|n|le: %s" % (raw_key, raw_key, desc)))
table.append(" |lc%s|lt|w%s|n|le: %s" % (raw_key, raw_key, desc))
ncols = (_MAX_TEXT_WIDTH // table_width_max) + 1 # number of ncols
nlastcol = nlist % ncols # number of elements left in last row
@ -356,7 +356,7 @@ def underline_node_formatter(nodetext, optionstext, caller=None):
total_width = max(options_width_max, nodetext_width_max)
separator1 = "_" * total_width + "\n\n" if nodetext_width_max else ""
separator2 = "\n" + "_" * total_width + "\n\n" if total_width else ""
return separator1 + nodetext + separator2 + optionstext
return separator1 + "|n" + nodetext + "|n" + separator2 + "|n" + optionstext
def null_node_formatter(nodetext, optionstext, caller=None):

View file

@ -475,7 +475,8 @@ class EvCell(object):
Apply all EvCells' formatting operations.
"""
return self._border(self._pad(self._valign(self._align(self._fit_width(self.data)))))
data = self._border(self._pad(self._valign(self._align(self._fit_width(self.data)))))
return data
def _split_lines(self, text):
"""
@ -812,7 +813,7 @@ class EvCell(object):
def __repr__(self):
self.formatted = self._reformat()
return unicode(ANSIString("EvCel<%s>" % self.formatted))
return unicode(ANSIString("<EvCel %s>" % self.formatted))
def __str__(self):
"returns cell contents on string form"
@ -926,7 +927,7 @@ class EvColumn(object):
self.column[index].reformat(**kwargs)
def __repr__(self):
return "EvColumn<%i cels>" % len(self.column)
return "<EvColumn\n %s>" % ("\n ".join([repr(cell) for cell in self.column]))
def __len__(self):
return len(self.column)
def __iter__(self):