eric7.Graphics.ImportsDiagramBuilder

Module implementing a dialog showing an imports diagram of a package.

Global Attributes

None

Classes

ImportsDiagramBuilder Class implementing a builder for imports diagrams of a package.

Functions

None


ImportsDiagramBuilder

Class implementing a builder for imports diagrams of a package.

Note: Only package internal imports are shown in order to maintain some readability.

Derived from

UMLDiagramBuilder

Class Attributes

None

Class Methods

None

Methods

ImportsDiagramBuilder Constructor
__addModule Private method to add a module to the diagram.
__arrangeNodes Private method to arrange the shapes on the canvas.
__buildModulesDict Private method to build a dictionary of modules contained in the package.
__createAssociations Private method to generate the associations between the module shapes.
buildDiagram Public method to build the modules shapes of the diagram.
fromDict Public method to populate the class with data persisted by 'toDict()'.
initialize Public method to initialize the object.
parsePersistenceData Public method to parse persisted data.
toDict Public method to collect data to be persisted.

Static Methods

None

ImportsDiagramBuilder (Constructor)

ImportsDiagramBuilder(dialog, view, project, package, showExternalImports=False)

Constructor

dialog (UMLDialog)
reference to the UML dialog
view (UMLGraphicsView)
reference to the view object
project (Project)
reference to the project object
package (str)
name of a python package to show the import relationships
showExternalImports (bool)
flag indicating to show exports from outside the package

ImportsDiagramBuilder.__addModule

__addModule(name, classes, x, y)

Private method to add a module to the diagram.

name (str)
module name to be shown
classes (list of str)
list of class names contained in the module
x (float)
x-coordinate
y (float)
y-coordinate
Return:
reference to the imports item
Return Type:
ModuleItem

ImportsDiagramBuilder.__arrangeNodes

__arrangeNodes(nodes, routes, whiteSpaceFactor=1.2)

Private method to arrange the shapes on the canvas.

The algorithm is borrowed from Boa Constructor.

nodes (list of str)
list of nodes to arrange
routes (list of tuple of (str, str))
list of routes
whiteSpaceFactor (float)
factor to increase whitespace between items

ImportsDiagramBuilder.__buildModulesDict

__buildModulesDict()

Private method to build a dictionary of modules contained in the package.

Return:
dictionary of modules contained in the package
Return Type:
dict

ImportsDiagramBuilder.__createAssociations

__createAssociations(routes)

Private method to generate the associations between the module shapes.

routes (list of tuple of (str, str))
list of associations

ImportsDiagramBuilder.buildDiagram

buildDiagram()

Public method to build the modules shapes of the diagram.

ImportsDiagramBuilder.fromDict

fromDict(_version, data)

Public method to populate the class with data persisted by 'toDict()'.

_version (str)
version of the data (unused)
data (dict)
dictionary containing the persisted data
Return:
tuple containing a flag indicating success and an info message in case the diagram belongs to a different project
Return Type:
tuple of (bool, str)

ImportsDiagramBuilder.initialize

initialize()

Public method to initialize the object.

ImportsDiagramBuilder.parsePersistenceData

parsePersistenceData(_version, data)

Public method to parse persisted data.

_version (str)
version of the data (unused)
data (str)
persisted data to be parsed
Return:
flag indicating success
Return Type:
bool

ImportsDiagramBuilder.toDict

toDict()

Public method to collect data to be persisted.

Return:
dictionary containing data to be persisted
Return Type:
dict
Up