Exemplo n.º 1
0
    def prettystr(self):
        project, graph = Globals().getProjectAndGraph()
        s =  self.kind + ' ' + self.symbol + ' ' + self.version + ' (' + self._b_language + ')'
        
        if len(self._b_provides) > 0:
            s+=  '\n\tprovides ports:\n'
            for i in self._b_provides: 
                s +=  '\t  ' + i.prettystr() + '\n'
        
        if len(self._b_uses) > 0:
            s+=  '\n\tuses ports:\n'
            for i in self._b_uses: 
                s +=  '\t  ' + i.prettystr() + '\n'
                        
        if len(self._b_implements) > 0:
            s+=  '\n\timplements interfaces:\n'
            for i in self._b_implements.keys(): 
                s +=  '\t  ' + i 
                if self._b_implements[i] != '%local%': s += ', location = ' + project.getDefaultValue(i,'External')
                else: s += ', local'
                s += ' ' + '\n'

        if len(self._b_extends) > 0:
            s += '\n\textends class: ' + self._b_extends.keys()[0]                 
            if self._b_extends.values()[0] != '%local%': s += ', location = ' + project.getDefaultValue(self._b_extends.keys()[0],'External')
            else: s += ', local'
            s += ' ' + '\n'

        otherdeps = self.getAttr('requires')
        if otherdeps:
            s += '\n\tdepends on these symbols:\n\t  ' + ', '.join(otherdeps)  + '\n'    

        mysidldir, sidlfiles = project.getLocationManager().getSIDLLoc(self)
        s += '\n\tSIDL definition: ' + os.path.join(mysidldir,sidlfiles[0])
        
        myimpldir, impls = project.getLocationManager().getImplLoc(self)
        if not impls[0] or impls[0] == 'None': 
            s += '\n\timplementation:\t' + str(os.path.join(myimpldir, impls[1])) + '\n'
        else:
            files =[]
            for i in impls: files.append(os.path.join(myimpldir,i))
            s +=  '\n\timplementation:\n\t\t' + '\n\t\t'.join(files) + '\n'
            
        # Temporary for testing
        #s += "Extends hierarchy: " + str([v.symbol for v in self.walk(edgefilter=['extends'])]) + '\n'
        #s += "Implements hierarchy: " + str([v.symbol for v in self.walk(edgefilter=['implements'])]) + '\n'
 
        return s