Exemple #1
0
    def files_with_definitions_dependencies(self, path):
        file_names = FilesDependencies.find_files_in_directory(self, path)
        names = []
        sizes = []
        graph = Digraph('filesMethodsDefinitionsGraph', strict=True, format='pdf', filename='filesMethodsDefinitionsGraph',
                        node_attr={'color': 'khaki', 'style': 'filled', 'shape': 'doublecircle'})
        graph.attr(size='50', labelloc='b', label='Version: \n' + HashCommit.get_commit_hash(path))
        color = Color()
        for i in file_names:
            tmp = i.split(" ")
            names.append(tmp[0])
            sizes.append(tmp[1])

        for file, size in zip(names, sizes):
            same_function_dependencies = FilesWithDefinitionsDependencies.methods_in_file(self, path, file)
            graph.node(file, **{'width': str(float(size) / 15000), 'height': str(float(size) / 15000),
                                'color': color.__str__()})
            for i in same_function_dependencies[file]:
                graph.edge(i, file)
            color.h += 0.05
        try:
            graph.view(tempfile.mktemp('.filesMethodsDefinitionsGraph'))
        except Exception:
            from gui.Window import Window
            Window.show_error(Window)
Exemple #2
0
class ColorNode:
    ''' Creates a new color node from a color object.
    Constructor arguments:
    :param color: information about a color read in from a JSON file.
    '''
    def __init__(self, color):

        # The color, indicated by RGB values.
        self.color = Color(\
                           color['rgb']['r'], \
                           color['rgb']['g'], \
                           color['rgb']['b'] \
                           )

        # The color's name.
        self.name = color['name']

        # The color's brand.
        self.brand = color['brand']

        # The identifying code used by the color's brand.
        self.code = color['code']

        # The node's left and right children.
        self.left = None
        self.right = None

    ''' Formats node for printing.
    '''

    def __str__(self):
        return self.name + " " + self.color.__str__()
Exemple #3
0
 def __str__(self):
     string_f = Figura.__str__(self)
     string_c = Color.__str__(self)
     return (string_f + '\n' + string_c + '\n' + "<----x---->")
 def __str__(self):
     
     return FiguraGeometrica.__str__(self) + ", el area del Rectangulo es: " + str(
         self.area()) + " y es de " + Color.__str__(self)
Exemple #5
0
 def __str__(self):
     # Cuando llame un metoodo de la misma clase se necesita primero pner self.nombre_del_metodo()
     # Cuando se llama un metodo de otra clase el se ira dentro de los parentesis.
     return FiguraGeometrica.__str__(
         self) + ", el area del cuadrado es: " + str(
             self.area()) + " y es de " + Color.__str__(self)
Exemple #6
0
 def __str__(self):
     a = self.area()
     return FiguraGeometrica.__str__(self) + ", " + Color.__str__(
         self) + ", Area: " + str(a)