Update of /cvsroot/jtoolkit/jToolkit/widgets
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8970
Modified Files:
table.py
Log Message:
added checks for empty tables
Index: table.py
===================================================================
RCS file: /cvsroot/jtoolkit/jToolkit/widgets/table.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** table.py 9 Feb 2004 13:55:54 -0000 1.4
--- table.py 9 Feb 2004 14:05:41 -0000 1.5
***************
*** 83,95 ****
--- 83,99 ----
def maxrowspan(self, row):
+ if len(row) == 0: return 0
return max([cell.attribs['rowspan'] for cell in row.itervalues()])
def rowmaxcolnum(self, row):
+ if len(row) == 0: return 0
return max([col + cell.attribs['colspan']-1 for col, cell in row.iteritems()])
def minrownum(self):
+ if len(self.rowsdict) == 0: return 0
return min(self.rowsdict.iterkeys())
def maxrownum(self):
+ if len(self.rowsdict) == 0: return 0
return max([rownum + self.maxrowspan(row)-1 for rownum, row in self.rowsdict.iteritems()])
***************
*** 98,104 ****
--- 102,110 ----
def mincolnum(self):
+ if len(self.rowsdict) == 0: return 0
return min([min(row.iterkeys()) for row in self.rowsdict.itervalues()])
def maxcolnum(self):
+ if len(self.rowsdict) == 0: return 0
return max([self.rowmaxcolnum(row) for row in self.rowsdict.itervalues()])
***************
*** 187,190 ****
--- 193,197 ----
def shrinkrange(self):
"""removes all the empty rows and columns, reducing the range..."""
+ if len(self.rowsdict) == 0: return
# detect which rows are empty
emptyrows = []
|