# eric6.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

None

### 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.
buildItemDataString | Public method to build a string to persist the specific item data.
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.

### Static Methods

None

#### 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.buildItemDataString

buildItemDataString()

Public method to build a string to persist the specific item data.

This string must start with ", " and should be built like "attribute=value" with pairs separated by ", ". value must not contain ", " or newlines.

Returns:
  persistence data (string)

#### ModuleItem.paint

paint(painter, option, widget=None)

Public method to paint the item in local coordinates.

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

#### ModuleItem.parseItemDataString

parseItemDataString(version, data)

Public method to parse the given persistence data.

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

Returns:
  flag indicating success (boolean)

#### ModuleItem.setModel

setModel(model)

Public method to set the module model.

model
  module model containing the module data (ModuleModel)

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
  the module name (string)
classlist
  list of class names (list of strings)

#### ModuleModel.addClass

addClass(classname)

Public method to add a class to the module model.

classname
  class name to be added (string)

#### ModuleModel.getClasses

getClasses()

Public method to retrieve the classes of the module.

Returns:
  list of class names (list of strings)

Up