diff --git a/pym/calculate/lib/utils/text.py b/pym/calculate/lib/utils/text.py index 8da3751..7baac7b 100644 --- a/pym/calculate/lib/utils/text.py +++ b/pym/calculate/lib/utils/text.py @@ -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