# eric6.Graphics.PackageItem

Module implementing a package item.

### Global Attributes

None

### Classes

PackageItem | Class implementing a package item.
PackageModel | Class implementing the package model.

### Functions

None

## PackageItem

Class implementing a package item.

### Derived from

UMLItem

### Class Attributes

ItemType

### Class Methods

None

### Methods

PackageItem | Constructor
__calculateSize | Private method to calculate the size of the package widget.
__createTexts | Private method to create the text items of the class 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 package model.

### Static Methods

None

#### PackageItem (Constructor)

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

Constructor

model (PackageModel)
  package model containing the package data
x (int)
  x-coordinate
y (int)
  y-coordinate
rounded (bool)
  flag indicating a rounded corner
noModules (bool)
  flag indicating, that no module names should be shown
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

#### PackageItem.__calculateSize

__calculateSize()

Private method to calculate the size of the package widget.

#### PackageItem.__createTexts

__createTexts()

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

#### PackageItem.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)

#### PackageItem.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)

#### PackageItem.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)

#### PackageItem.setModel

setModel(model)

Public method to set the package model.

model
  package model containing the package data (PackageModel)

Up

## PackageModel

Class implementing the package model.

### Derived from

UMLModel

### Class Attributes

None

### Class Methods

None

### Methods

PackageModel | Constructor
addModule | Public method to add a module to the package model.
getModules | Public method to retrieve the modules of the package.

### Static Methods

None

#### PackageModel (Constructor)

PackageModel(name, moduleslist=None)

Constructor

name
  package name (string)
moduleslist
  list of module names (list of strings)

#### PackageModel.addModule

addModule(modulename)

Public method to add a module to the package model.

modulename
  module name to be added (string)

#### PackageModel.getModules

getModules()

Public method to retrieve the modules of the package.

Returns:
  list of module names (list of strings)

Up