Changeset 2914

Show
Ignore:
Timestamp:
03/14/07 17:05:53 (2 years ago)
Author:
ed
Message:

Updated the repr() method to include angle brackets and also simplify the displayed class names.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/dabo/dObject.py

    r2912 r2914  
    7676        strval = "%s" % bc 
    7777        classname = strval.split("'")[1] 
    78         try: 
    79             ret = "%s (%s)" % (self.Name, classname) 
    80         except: 
    81             ret = classname 
    82         return ret 
     78        classparts = classname.split(".") 
     79        if ".ui.ui" in classname: 
     80            # Simplify the different UI toolkits 
     81            pos = classparts.index("ui") 
     82            classparts.pop(pos+1) 
     83        # Remove the duplicate class name that happens 
     84        # when the class name is the same as the file. 
     85        while classparts[-1] == classparts[-2]: 
     86            classparts.pop() 
     87        classname = ".".join(classparts) 
     88        spc = " " 
     89        try: 
     90            nm = self.Name 
     91        except AttributeError: 
     92            nm = "" 
     93        if (not nm) or (nm == "?"): 
     94            # No name 
     95            nm = spc = "" 
     96        return "<%(nm)s%(spc)s(class %(classname)s)>" % locals() 
     97         
    8398 
    8499