Make EvTable.add_row forward row-options correctly. Resolve #2389.
This commit is contained in:
parent
819097fdde
commit
a4cabd9306
1 changed files with 7 additions and 3 deletions
|
|
@ -308,7 +308,7 @@ def fill(text, width=_DEFAULT_WIDTH, **kwargs):
|
||||||
# EvCell class (see further down for the EvTable itself)
|
# EvCell class (see further down for the EvTable itself)
|
||||||
|
|
||||||
|
|
||||||
class EvCell(object):
|
class EvCell:
|
||||||
"""
|
"""
|
||||||
Holds a single data cell for the table. A cell has a certain width
|
Holds a single data cell for the table. A cell has a certain width
|
||||||
and height and contains one or more lines of data. It can shrink
|
and height and contains one or more lines of data. It can shrink
|
||||||
|
|
@ -976,14 +976,17 @@ class EvColumn(object):
|
||||||
Available keywods as per `EvCell.__init__`.
|
Available keywods as per `EvCell.__init__`.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
# column-level options override those in kwargs
|
||||||
|
options = {**kwargs, **self.options}
|
||||||
|
|
||||||
ypos = kwargs.get("ypos", None)
|
ypos = kwargs.get("ypos", None)
|
||||||
if ypos is None or ypos > len(self.column):
|
if ypos is None or ypos > len(self.column):
|
||||||
# add to the end
|
# add to the end
|
||||||
self.column.extend([EvCell(data, **self.options) for data in args])
|
self.column.extend([EvCell(data, **options) for data in args])
|
||||||
else:
|
else:
|
||||||
# insert cells before given index
|
# insert cells before given index
|
||||||
ypos = min(len(self.column) - 1, max(0, int(ypos)))
|
ypos = min(len(self.column) - 1, max(0, int(ypos)))
|
||||||
new_cells = [EvCell(data, **self.options) for data in args]
|
new_cells = [EvCell(data, **options) for data in args]
|
||||||
self.column = self.column[:ypos] + new_cells + self.column[ypos:]
|
self.column = self.column[:ypos] + new_cells + self.column[ypos:]
|
||||||
# self._balance(**kwargs)
|
# self._balance(**kwargs)
|
||||||
|
|
||||||
|
|
@ -1010,6 +1013,7 @@ class EvColumn(object):
|
||||||
Keywords as per `EvCell.__init__`.
|
Keywords as per `EvCell.__init__`.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
# column-level options take precedence here
|
||||||
kwargs.update(self.options)
|
kwargs.update(self.options)
|
||||||
self.column[index].reformat(**kwargs)
|
self.column[index].reformat(**kwargs)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue