eric7.Graphics.PackageDiagramBuilder

Module implementing a dialog showing an UML like class diagram of a package.

Global Attributes

None

Classes

PackageDiagramBuilder Class implementing a builder for UML like class diagrams of a package.

Functions

None


PackageDiagramBuilder

Class implementing a builder for UML like class diagrams of a package.

Derived from

UMLDiagramBuilder

Class Attributes

None

Class Methods

None

Methods

PackageDiagramBuilder Constructor
__addExternalClass Private method to add a class defined outside the module.
__addLocalClass Private method to add a class defined in the module.
__addPackage Private method to add a package to the diagram.
__arrangeClasses Private method to arrange the shapes on the canvas.
__buildModulesDict Private method to build a dictionary of modules contained in the package.
__buildSubpackagesDict Private method to build a dictionary of sub-packages contained in this package.
__createAssociations Private method to generate the associations between the class shapes.
__getCurrentShape Private method to get the named shape.
buildDiagram Public method to build the class shapes of the package 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

PackageDiagramBuilder (Constructor)

PackageDiagramBuilder(dialog, view, project, package, noAttrs=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 be shown
noAttrs (bool)
flag indicating, that no attributes should be shown

PackageDiagramBuilder.__addExternalClass

__addExternalClass(_class, x, y)

Private method to add a class defined outside the module.

If the canvas is too small to take the shape, it is enlarged.

_class (ModuleParser.Class)
class to be shown
x (float)
x-coordinate
y (float)
y-coordinate

PackageDiagramBuilder.__addLocalClass

__addLocalClass(className, _class, x, y, isRbModule=False)

Private method to add a class defined in the module.

className (str)
name of the class to be as a dictionary key
_class (ModuleParser.Class)
class to be shown
x (float)
x-coordinate
y (float)
y-coordinate
isRbModule (bool)
flag indicating a Ruby module

PackageDiagramBuilder.__addPackage

__addPackage(name, modules, x, y)

Private method to add a package to the diagram.

name (str)
package name to be shown
modules (list of str)
list of module names contained in the package
x (float)
x-coordinate
y (float)
y-coordinate

PackageDiagramBuilder.__arrangeClasses

__arrangeClasses(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

PackageDiagramBuilder.__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

PackageDiagramBuilder.__buildSubpackagesDict

__buildSubpackagesDict()

Private method to build a dictionary of sub-packages contained in this package.

Return:
dictionary of sub-packages contained in this package
Return Type:
dict

PackageDiagramBuilder.__createAssociations

__createAssociations(routes)

Private method to generate the associations between the class shapes.

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

PackageDiagramBuilder.__getCurrentShape

__getCurrentShape(name)

Private method to get the named shape.

name (str)
name of the shape
Return:
shape
Return Type:
QCanvasItem

PackageDiagramBuilder.buildDiagram

buildDiagram()

Public method to build the class shapes of the package diagram.

The algorithm is borrowed from Boa Constructor.

PackageDiagramBuilder.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)

PackageDiagramBuilder.initialize

initialize()

Public method to initialize the object.

PackageDiagramBuilder.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

PackageDiagramBuilder.toDict

toDict()

Public method to collect data to be persisted.

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