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

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

### 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.
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.
toDict | Public method to collect data to be persisted.

### Static Methods

None

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

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

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

#### PackageItem.setModel

setModel(model)

Public method to set the package model.

model (PackageModel)
  package model containing the package data

#### PackageItem.toDict

toDict()

Public method to collect data to be persisted.

Return:
  dictionary containing data to be persisted

Return Type:
  dict

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 (str)
  package name
moduleslist (list of str)
  list of module names

#### PackageModel.addModule

addModule(modulename)

Public method to add a module to the package model.

modulename (str)
  module name to be added

#### PackageModel.getModules

getModules()

Public method to retrieve the modules of the package.

Return:
  list of module names

Return Type:
  list of str

Up