Changeset 97

Show
Ignore:
Timestamp:
09/12/08 01:36:35 (4 years ago)
Author:
lgs
Message:

Add str methods to make debugging easier. Inspired in a patch by Nicolas

Location:
trunk/src
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/bar.py

    r95 r97  
    159159        self.xval, self.yval = xval, yval 
    160160        self.name = name 
     161 
     162    def __str__(self): 
     163        return "<pycha.bar.Rect@(%.2f, %.2f) %.2fx%.2f>" % (self.x, self.y, 
     164                                                            self.w, self.h) 
  • trunk/src/line.py

    r96 r97  
    112112        self.xval, self.yval = xval, yval 
    113113        self.name = name 
     114 
     115    def __str__(self): 
     116        return "<pycha.line.Point@(%.2f, %.2f)>" % (self.x, self.y) 
  • trunk/src/pie.py

    r96 r97  
    176176        self.endAngle = 2 * (angle + fraction) * math.pi 
    177177 
     178    def __str__(self): 
     179        return ("<pycha.pie.Slice from %.2f to %.2f (%.2f%%)>" % 
     180                (self.startAngle, self.endAngle, self.fraction) 
     181 
    178182    def isBigEnough(self): 
    179183        return abs(self.startAngle - self.endAngle) > 0.001