Commits

Antoni Aloy committed d32fe11

new package distribution

Comments (0)

Files changed (5)

 *~
 *.geany
 *.py.orig
+xlswtreporter.egg-info
+.~lock.*
 syntax: regexp
 

__init__.py

Empty file removed.

engine.py

-#!/usr/bin/env python
-#-*- coding: UTF-8 -*-
-
-import xlwt
-fmt = xlwt.easyxf
-
-
-class InitMarkerNotFound(Exception):
-    pass
-
-class Marker(object):
-    def __init__(self, start=None, end=None):
-        self.start = start
-        self.end = end
-
-    def get_cell_range(self):
-        inici = xlwt.Utils.rowcol_to_cell(*self.start)
-        final = xlwt.Utils.rowcol_to_cell(*self.end)
-        return "%s:%s" % (inici, final)
-
-class Reporter(object):
-    def __init__(self, sheet_name):
-        self.wbk = xlwt.Workbook(encoding='utf-8')
-        self.sheet = self.wbk.add_sheet(sheet_name)
-        self._col = 0
-        self._row = 0
-        self._makers = {}
-
-    def start_maker(self, name='default'):
-        m = Marker(start = (self._row, self._col))
-        self._markers[name] = m
-
-    def end_maker(self, name='default'):
-        if not self._markers.has_key(name):
-            raise InitMarkerNotFound()
-        self._markers[name].end = (self._row, self._col)
-
-    def CRLF(self):
-        self._col = 0
-        self._row += 1
-
-    def CR(self):
-        self._row += 1
-
-    def move(self, row, col):
-        self._col = col
-        self._row = row
-
-    def left(self, x = 1):
-        self._col += abs(x)
-
-    def right(self, x = 1):
-        self._col -= abs(x)
-        if self._col <0: self._col = 0
-
-    def up(self, y = 1):
-        self._row -= abs(y)
-        if self._row < 0: self._row = 0
-
-    def down(self, y=1):
-        self._row += y
-
-    def write(self, value, fmt=None):
-        if fmt:
-            self.sheet.write(self._row, self._col, value, fmt)
-        else:
-            self.sheet.write(self._row, self._col, value)
-
-    def writeln(self, value, fmt=None):
-            self.write(value, fmt)
-            self._col += 1
-
-    def writecol(self, value, fmt=None):
-        self.write(value, fmt)
-        self._row += 1
-
-    def writeln_list(self, value_list, fmt=None):
-        for value in value_list:
-            self.writeln(value, fmt)
-
-    def writelns(self, value_list, fmt=None):
-        actual_col = self._col
-        for lista in value_list:
-            self.wrteln_list(lista)
-            self._row = +1
-            self._row = actual_col
-
-    def writecol_list(self, value_list, fmt=None):
-        for value in value_list:
-            self.writecol(value, fmt)
-
-    def get_actual_cell(self):
-        return xlwt.Utils.rowcol_to_cell(self._row, self._col)
-
-    def get_upper_cell(self):
-        return xlwt.Utils.rowcol_to_cell(self._row-1, self._col)
-
-    def get_left_cell(self):
-        return xlwt.Utils.rowcol_to_cell(self._row, self._col-1)
-
-    def writecols(self, value_list, fmt=None, formula=None):
-        actual_row = self._row
-        for lista in value_list:
-            origin = self.get_actual_cell()
-            self.writecol_list(lista, fmt)
-            if formula:
-                destination = self.get_upper_cell()
-                self.writecol(xlwt.Formula('%s(%s:%s)' % (formula, origin, destination)), fmt)
-            self._col +=1
-            self._row = actual_row
-
-    def set_col_sytle(self, col, style):
-        self.sheet.col(col).set_style(style)
-
-    def set_row_style(self, row, style):
-        self.sheet.row(row).set_style(style)
-
-    def save(self, name='default.xls'):
-        self.wbk.save(name)

xlwtreport/__init__.py

Empty file added.

xlwtreport/engine.py

+#!/usr/bin/env python
+#-*- coding: UTF-8 -*-
+
+import xlwt
+fmt = xlwt.easyxf
+
+
+class InitMarkerNotFound(Exception):
+    pass
+
+class Marker(object):
+    def __init__(self, start=None, end=None):
+        self.start = start
+        self.end = end
+
+    def get_cell_range(self):
+        inici = xlwt.Utils.rowcol_to_cell(*self.start)
+        final = xlwt.Utils.rowcol_to_cell(*self.end)
+        return "%s:%s" % (inici, final)
+
+class Reporter(object):
+    def __init__(self, sheet_name):
+        self.wbk = xlwt.Workbook(encoding='utf-8')
+        self.sheet = self.wbk.add_sheet(sheet_name)
+        self._col = 0
+        self._row = 0
+        self._makers = {}
+
+    def start_maker(self, name='default'):
+        m = Marker(start = (self._row, self._col))
+        self._markers[name] = m
+
+    def end_maker(self, name='default'):
+        if not self._markers.has_key(name):
+            raise InitMarkerNotFound()
+        self._markers[name].end = (self._row, self._col)
+
+    def CRLF(self):
+        self._col = 0
+        self._row += 1
+
+    def CR(self):
+        self._row += 1
+
+    def move(self, row, col):
+        self._col = col
+        self._row = row
+
+    def left(self, x = 1):
+        self._col += abs(x)
+
+    def right(self, x = 1):
+        self._col -= abs(x)
+        if self._col <0: self._col = 0
+
+    def up(self, y = 1):
+        self._row -= abs(y)
+        if self._row < 0: self._row = 0
+
+    def down(self, y=1):
+        self._row += y
+
+    def write(self, value, fmt=None):
+        if fmt:
+            self.sheet.write(self._row, self._col, value, fmt)
+        else:
+            self.sheet.write(self._row, self._col, value)
+
+    def writeln(self, value, fmt=None):
+            self.write(value, fmt)
+            self._col += 1
+
+    def writecol(self, value, fmt=None):
+        self.write(value, fmt)
+        self._row += 1
+
+    def writeln_list(self, value_list, fmt=None):
+        for value in value_list:
+            self.writeln(value, fmt)
+
+    def writelns(self, value_list, fmt=None):
+        actual_col = self._col
+        for lista in value_list:
+            self.wrteln_list(lista)
+            self._row = +1
+            self._row = actual_col
+
+    def writecol_list(self, value_list, fmt=None):
+        for value in value_list:
+            self.writecol(value, fmt)
+
+    def get_actual_cell(self):
+        return xlwt.Utils.rowcol_to_cell(self._row, self._col)
+
+    def get_upper_cell(self):
+        return xlwt.Utils.rowcol_to_cell(self._row-1, self._col)
+
+    def get_left_cell(self):
+        return xlwt.Utils.rowcol_to_cell(self._row, self._col-1)
+
+    def writecols(self, value_list, fmt=None, formula=None):
+        actual_row = self._row
+        for lista in value_list:
+            origin = self.get_actual_cell()
+            self.writecol_list(lista, fmt)
+            if formula:
+                destination = self.get_upper_cell()
+                self.writecol(xlwt.Formula('%s(%s:%s)' % (formula, origin, destination)), fmt)
+            self._col +=1
+            self._row = actual_row
+
+    def set_col_sytle(self, col, style):
+        self.sheet.col(col).set_style(style)
+
+    def set_row_style(self, row, style):
+        self.sheet.row(row).set_style(style)
+
+    def save(self, name='default.xls'):
+        self.wbk.save(name)