4.44. umbra.ui.models — Umbra 1.0.9 documentation

# 4.44. umbra.ui.models

models.py

Platform:
  Windows, Linux, Mac Os X.
Description:
  Defines the Application Models classes.

Others:

## 4.44.1. Module Attributes

`umbra.ui.models.` `LOGGER`

## 4.44.2. Classes

class `umbra.ui.models.` `GraphModel`(parent=None, rootNode=None, horizontalHeaders=None, verticalHeaders=None, defaultNode=None)

  Bases: `PyQt4.QtCore.QAbstractItemModel`

  Defines a QAbstractItemModel subclass providing a graph model.
  The Model provided by this object is very generic and abstract making it compatible with major Qt Views ( QListView, QTreeView, QTableView, QComboBox ).

  Initializes the class.

  Parameters: | parent (QObject) – Object parent. rootNode (AbstractCompositeNode or GraphModelNode) – Root node. horizontalHeaders (OrderedDict) – Headers. verticalHeaders (OrderedDict) – Headers. defaultNode (AbstractCompositeNode or GraphModelNode) – Default node.

  `rootNode`

    Property for self.__rootNode attribute.

    Returns: | self.__rootNode.
    Return type: | AbstractCompositeNode or GraphModelNode

  `horizontalHeaders`

    Property for self.__horizontalHeaders attribute.

    Returns: | self.__horizontalHeaders.
    Return type: | OrderedDict

  `verticalHeaders`

    Property for self.__verticalHeaders attribute.

    Returns: | self.__verticalHeaders.
    Return type: | OrderedDict

  `defaultNode`

    Property for self.__defaultNode attribute.

    Returns: | self.__defaultNode.
    Return type: | AbstractCompositeNode or GraphModelNode

  `rowCount`(parent=<PyQt4.QtCore.QModelIndex object at 0x1067c7848>)

    Reimplements the `QAbstractItemModel.rowCount()` method.

    Parameters: | parent (AbstractCompositeNode or GraphModelNode) – Parent node.
    Returns: | Row count.
    Return type: | int

  `columnCount`(parent=<PyQt4.QtCore.QModelIndex object at 0x1067c7938>)

    Reimplements the `QAbstractItemModel.columnCount()` method.

    Parameters: | parent (AbstractCompositeNode or GraphModelNode) – Parent node.
    Returns: | Column count.
    Return type: | int

  `data`(index, role=0)

    Reimplements the `QAbstractItemModel.data()` method.

    Parameters: | index (QModelIndex) – Index. role (int) – Role.
    Returns: | Data.
    Return type: | QVariant

  `setData`(index, value, role=2)

    Reimplements the `QAbstractItemModel.setData()` method.

    Parameters: | index (QModelIndex) – Index. value (QVariant) – Value. role (int) – Role.
    Returns: | Method success.
    Return type: | bool

  `headerData`(section, orientation, role=0)

    Reimplements the `QAbstractItemModel.headerData()` method.

    Parameters: | section (int) – Section. orientation – Orientation. ( Qt.Orientation ) role (int) – Role.
    Returns: | Header data.
    Return type: | QVariant

  `flags`(index)

    Reimplements the `QAbstractItemModel.flags()` method.

    Parameters: | index (QModelIndex) – Index.
    Returns: | Flags. ( Qt.ItemFlags )

  `parent`(index)

    Reimplements the `QAbstractItemModel.parent()` method.

    Parameters: | index (QModelIndex) – Index.
    Returns: | Parent.
    Return type: | QModelIndex

  `index`(row, column=0, parent=<PyQt4.QtCore.QModelIndex object at 0x1067c7c80>)

    Reimplements the `QAbstractItemModel.index()` method.

    Parameters: | row (int) – Row. column (int) – Column. parent (QModelIndex) – Parent.
    Returns: | Index.
    Return type: | QModelIndex

  `sort`(column, order=0)

    Reimplements the `QAbstractItemModel.sort()` method.

    Parameters: | column (int) – Column. order – Order. ( Qt.SortOrder )

  `insertRows`(row, count, parent=<PyQt4.QtCore.QModelIndex object at 0x1067c7de8>)

    Reimplements the `QAbstractItemModel.insertRows()` method.

    Parameters: | row (int) – Row. count (int) – Count. parent (QModelIndex) – Parent.
    Returns: | Method success.
    Return type: | bool

  `removeRows`(row, count, parent=<PyQt4.QtCore.QModelIndex object at 0x1067c7ed8>)

    Reimplements the `QAbstractItemModel.removeRows()` method.

    Parameters: | row (int) – Row. count (int) – Count. parent (QModelIndex) – Parent.
    Returns: | Method success.
    Return type: | bool

  `movesRows`(fromParent, fromFirstRow, fromLastRow, toParent, toRow)

    Moves given rows from parent to parent row.

  `mimeTypes`()

    Reimplements the `QAbstractItemModel.mimeTypes()` method.

    Returns: | Mime types.
    Return type: | QStringList

  `mimeData`(indexes)

    Reimplements the `QAbstractItemModel.mimeData()` method.

    Parameters: | indexes (QModelIndexList) – Indexes.
    Returns: | MimeData.
    Return type: | QMimeData

  `clear`()

    Clears the Model.

    Returns: | Method success.
    Return type: | bool

  `hasNodes`()

    Returns if Model has nodes.

    Returns: | Has children.
    Return type: | bool

  `getNode`(index)

    Returns the Node at given index.

    Parameters: | index (QModelIndex) – Index.
    Returns: | Node.
    Return type: | AbstractCompositeNode or GraphModelNode

  `getAttribute`(node, column)

    Returns the given Node attribute associated to the given column.

    Parameters: | node (AbstractCompositeNode or GraphModelNode) – Node. column (int) – Column.
    Returns: | Attribute.
    Return type: | Attribute

  `getNodeIndex`(node)

    Returns given Node index.

    Parameters: | node (AbstractCompositeNode or GraphModelNode) – Node.
    Returns: | Index.
    Return type: | QModelIndex

  `getAttributeIndex`(node, column)

    Returns given Node attribute index at given column.

    Parameters: | node (AbstractCompositeNode or GraphModelNode) – Node. column (int) – Attribute column.
    Returns: | Index.
    Return type: | QModelIndex

  `findChildren`(pattern=u'.*', flags=0)

    Finds the children matching the given patten.

    Parameters: | pattern (unicode) – Matching pattern. flags (int) – Matching regex flags.
    Returns: | Matching children.
    Return type: | list

  `findFamily`(pattern=u'.*', flags=0, node=None)

    Returns the Nodes from given family.

    Parameters: | pattern (unicode) – Matching pattern. flags (int) – Matching regex flags. node (AbstractNode or AbstractCompositeNode or GraphModelNode) – Node to start walking from.
    Returns: | Family nodes.
    Return type: | list

  `findNode`(attribute)

    Returns the Node with given attribute.

    Parameters: | attribute (GraphModelAttribute) – Attribute.
    Returns: | Node.
    Return type: | GraphModelNode

  `findModel`(object)

    Returns the model(s) associated with given object.

    Parameters: | object (GraphModelNode or GraphModelAttribute) – Node / Attribute.
    Returns: | Model(s).
    Return type: | list

  `enableModelTriggers`(state)

    Enables Model Nodes and attributes triggers.

    Parameters: | state (bool) – Inform model state.
    Returns: | Method success.
    Return type: | bool

  `nodeChanged`(node)

    Calls `QAbstractItemModel.dataChanged()` with given Node index.

    Parameters: | node (AbstractCompositeNode or GraphModelNode) – Node.
    Returns: | Method success.
    Return type: | bool

  `attributeChanged`(node, column)

    Calls `QAbstractItemModel.dataChanged()` with given Node attribute index.

    Parameters: | node (AbstractCompositeNode or GraphModelNode) – Node. column (int) – Attribute column.
    Returns: | Method success.
    Return type: | bool