Logo Search packages:      
Sourcecode: wavesurfer version File versions  Download package

def WsurfPlugin::TkObject::convert (   self,
  obj 
)
Convert object.

As in the Tkinter module, dictionaries are converted into -key value
strings - used for configuration.
Other sequence types are expanded and themselves converted.
TkObject instances are replaced by their names,
functions (callable objects) are registered, and all other objects
are replaced by their string representation.

Definition at line 108 of file WsurfPlugin.py.

                          :
        """Convert object.

        As in the Tkinter module, dictionaries are converted into -key value
        strings - used for configuration.
        Other sequence types are expanded and themselves converted.
        TkObject instances are replaced by their names,
        functions (callable objects) are registered, and all other objects
        are replaced by their string representation.
        """
        if type(obj) == types.DictType:
            d = {}
            for key in obj.keys():
                d.update({key: self.convert(obj[key])})
            res = d
        elif type(obj) in (types.ListType, types.TupleType):
            c = ()
            for item in obj:
                if type(item) == types.DictType:
                    c += self.master._options(self.convert(item))
                elif type(item) in (types.ListType, types.TupleType):
                    c += self.convert(item)
                else:
                    c += (self.convert(item),)
            res = c
        elif isinstance(obj, TkObject):
            res = obj.name
        elif callable(obj):
            res = self.master._register(obj)
        else:
            res = str(obj)
        return res
    


Generated by  Doxygen 1.6.0   Back to index