Исправлена вывод таблицы для консоли

master-3.5
Mike Hiretsky 8 years ago
parent eb9ef3be04
commit 83b7bdfc05

@ -192,17 +192,17 @@ class tableReport(object):
columnsWidth.append(0)
# Вычисляем ширину столбцов
for e in self.dataList:
i = 0
for s in e:
for i, s in enumerate(e):
lenS = len(_u(s))+1
if columnsWidth[i] < lenS:
columnsWidth[i] = lenS
i += 1
return columnsWidth
def createFormatStr(self, listStr):
def createFormatStr(self, listStr, offset=0):
"""Создает список (текст, ширина ...)"""
return chain(*izip_longest(listStr, self.columnsWidth, fillvalue=""))
return chain(*izip_longest(listStr,
map(lambda x:x-offset, self.columnsWidth),
fillvalue=""))
def printFunc(self, s):
"""
@ -246,7 +246,7 @@ class tableReport(object):
columnMatrix(*self.createFormatStr(listStrSep))]]
for s in self.dataList:
printData.append([self.vertChar, self.body_printer,
columnMatrix(*self.createFormatStr(s))])
columnMatrix(*self.createFormatStr(s, 1))])
printData.append([self.crossChar, self.line_printer,
columnMatrix(*self.createFormatStr(listStrSep))])
last_col = len(self.headerList) - 1

Loading…
Cancel
Save