[POS-commit] r3869 - stoqlib/trunk/stoqlib/reporting/base

Henrique Romano henrique at async.com.br
Fri Jul 7 10:02:57 BRT 2006


Author: henrique
Date: Fri Jul  7 10:02:56 2006
New Revision: 3869

Modified:
   stoqlib/trunk/stoqlib/reporting/base/tables.py

Log:
Removing unneeded code.




Modified: stoqlib/trunk/stoqlib/reporting/base/tables.py
==============================================================================
--- stoqlib/trunk/stoqlib/reporting/base/tables.py	(original)
+++ stoqlib/trunk/stoqlib/reporting/base/tables.py	Fri Jul  7 10:02:56 2006
@@ -24,7 +24,6 @@
 ##
 """ Stoqlib Reporting tables implementation.  """
 
-from reportlab.pdfbase.pdfmetrics import stringWidth
 from reportlab.platypus import TableStyle, Table as RTable
 
 from stoqlib.reporting.base.flowables import (LEFT, CENTER, RIGHT,
@@ -37,8 +36,6 @@
                                                   TABLE_LINE,
                                                   COL_PADDING,
                                                   SOFT_LINE_COLOR,
-                                                  DEFAULT_FONTNAME,
-                                                  DEFAULT_FONTSIZE,
                                                   STYLE_SHEET)
 
 # Highlight rules:
@@ -619,23 +616,6 @@
         self.expand = expand
         self.virtual = virtual
 
-    def truncate_string(self, data):
-        if not isinstance(data, basestring):
-            data = str(data)
-        if not self.truncate or not len(data):
-            return data
-        if self.truncate and not self.width:
-            msg = '%s can\'t truncate without a fixed width.' % self
-            raise AssertionError, msg
-        # XXX This piece of code is *ugly*, but works pretty well with
-        # default font and padding.
-        string_width = stringWidth(data, DEFAULT_FONTNAME,
-                                   DEFAULT_FONTSIZE) or self.width
-        # We remove four extra chars to keep the cell padding
-        max = int(len(data) / (string_width / self.width)) - 4
-        data = '\n'.join([l[:max] for l in data.split('\n')])
-        return data
-
     def get_string_data(self, value):
         """  Returns the column value. The value can be returned through
         accessors defined by the user. """


More information about the POS-commit mailing list