# eric7.Graphics.ModuleItem

Module implementing a module item.

### Global Attributes

None

### Classes

ModuleItem | Class implementing a module item.
ModuleModel | Class implementing the module model.

### Functions

None

## ModuleItem

Class implementing a module item.

### Derived from

UMLItem

### Class Attributes

ItemType

### Class Methods

fromDict | Class method to create a class item from persisted data.

### Methods

ModuleItem | Constructor
__calculateSize | Private method to calculate the size of the module item.
__createTexts | Private method to create the text items of the module item.
paint | Public method to paint the item in local coordinates.
parseItemDataString | Public method to parse the given persistence data.
setModel | Public method to set the module model.
toDict | Public method to collect data to be persisted.

### Static Methods

None

#### ModuleItem.fromDict (class method)

fromDict(data, colors=None)

Class method to create a class item from persisted data.

data (dict)
  dictionary containing the persisted data as generated by toDict()
colors (tuple of (QColor, QColor))
  tuple containing the foreground and background colors

Return:
  created class item

Return Type:
  ClassItem

#### ModuleItem (Constructor)

ModuleItem(model=None, x=0, y=0, rounded=False, colors=None, parent=None, scene=None)

Constructor

model (ModuleModel)
  module model containing the module data
x (int)
  x-coordinate
y (int)
  y-coordinate
rounded (bool)
  flag indicating a rounded corner
colors (tuple of (QColor, QColor))
  tuple containing the foreground and background colors
parent (QGraphicsItem)
  reference to the parent object
scene (QGraphicsScene)
  reference to the scene object

#### ModuleItem.__calculateSize

__calculateSize()

Private method to calculate the size of the module item.

#### ModuleItem.__createTexts

__createTexts()

Private method to create the text items of the module item.

#### ModuleItem.paint

paint(painter, option, widget=None)

Public method to paint the item in local coordinates.

painter (QPainter)
  reference to the painter object
option (QStyleOptionGraphicsItem)
  style options
widget (QWidget)
  optional reference to the widget painted on

#### ModuleItem.parseItemDataString

parseItemDataString(version, data)

Public method to parse the given persistence data.

version (str)
  version of the data
data (str)
  persisted data to be parsed

Return:
  flag indicating success

Return Type:
  bool

#### ModuleItem.setModel

setModel(model)

Public method to set the module model.

model (ModuleModel)
  module model containing the module data

#### ModuleItem.toDict

toDict()

Public method to collect data to be persisted.

Return:
  dictionary containing data to be persisted

Return Type:
  dict

Up

## ModuleModel

Class implementing the module model.

### Derived from

UMLModel

### Class Attributes

None

### Class Methods

None

### Methods

ModuleModel | Constructor
addClass | Public method to add a class to the module model.
getClasses | Public method to retrieve the classes of the module.

### Static Methods

None

#### ModuleModel (Constructor)

ModuleModel(name, classlist=None)

Constructor

name (str)
  the module name
classlist (list of str)
  list of class names

#### ModuleModel.addClass

addClass(classname)

Public method to add a class to the module model.

classname (str)
  class name to be added

#### ModuleModel.getClasses

getClasses()

Public method to retrieve the classes of the module.

Return:
  list of class names

Return Type:
  list of str

Up