4.45. umbra.ui.models — Umbra 1.0.4 documentation

### Navigation

- index
- modules |
- next |
- previous |
- Umbra 1.0.4 documentation »
- 4. Api »

# 4.45. umbra.ui.models

models.py

Platform:
  Windows, Linux, Mac Os X.
Description:
  This module defines the Application Models classes.

Others:

## 4.45.1. Module Attributes

`umbra.ui.models.` `LOGGER`

## 4.45.2. Classes

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

  Bases: `PyQt4.QtCore.QAbstractItemModel`

  This class is 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 ).

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

  `rootNode`

    This method is the property for self.__rootNode attribute.

    Returns: | self.__rootNode. ( AbstractCompositeNode / GraphModelNode )

  `horizontalHeaders`

    This method is the property for self.__horizontalHeaders attribute.

    Returns: | self.__horizontalHeaders. ( OrderedDict )

  `verticalHeaders`

    This method is the property for self.__verticalHeaders attribute.

    Returns: | self.__verticalHeaders. ( OrderedDict )

  `defaultNode`

    This method is the property for self.__defaultNode attribute.

    Returns: | self.__defaultNode. ( AbstractCompositeNode / GraphModelNode )

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

    This method reimplements the `QAbstractItemModel.rowCount()` method.

    Parameters: | parent – Parent node. ( AbstractCompositeNode / GraphModelNode )
    Returns: | Row count. ( Integer )

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

    This method reimplements the `QAbstractItemModel.columnCount()` method.

    Parameters: | parent – Parent node. ( AbstractCompositeNode / GraphModelNode )
    Returns: | Column count. ( Integer )

  `data`(index, role=0)

    This method reimplements the `QAbstractItemModel.data()` method.

    Parameters: | index – Index. ( QModelIndex ) role – Role. ( Integer )
    Returns: | Data. ( QVariant )

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

    This method reimplements the `QAbstractItemModel.setData()` method.

    Parameters: | index – Index. ( QModelIndex ) value – Value. ( QVariant ) role – Role. ( Integer )
    Returns: | Method success. ( Boolean )

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

    This method reimplements the `QAbstractItemModel.headerData()` method.

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

  `flags`(index)

    This method reimplements the `QAbstractItemModel.flags()` method.

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

  `parent`(index)

    This method reimplements the `QAbstractItemModel.parent()` method.

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

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

    This method reimplements the `QAbstractItemModel.index()` method.

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

  `sort`(column, order=0)

    This method reimplements the `QAbstractItemModel.sort()` method.

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

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

    This method reimplements the `QAbstractItemModel.insertRows()` method.

    Parameters: | row – Row. ( Integer ) count – Count. ( Integer ) parent – Parent. ( QModelIndex )
    Returns: | Method success. ( Boolean )

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

    This method reimplements the `QAbstractItemModel.removeRows()` method.

    Parameters: | row – Row. ( Integer ) count – Count. ( Integer ) parent – Parent. ( QModelIndex )
    Returns: | Method success. ( Boolean )

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

    This method moves given rows from parent to parent row.

  `mimeTypes`()

    This method reimplements the `QAbstractItemModel.mimeTypes()` method.

    Returns: | Mime types. ( QStringList )

  `mimeData`(indexes)

    This method reimplements the `QAbstractItemModel.mimeData()` method.

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

  `clear`()

    This method clears the Model.

    Returns: | Method success. ( Boolean )

  `hasNodes`()

    This method returns if Model has nodes.

    Returns: | Has children. ( Boolean )

  `getNode`(index)

    This method returns the Node at given index.

    Parameters: | index – Index. ( QModelIndex )
    Returns: | Node. ( AbstractCompositeNode / GraphModelNode )

  `getAttribute`(node, column)

    This method returns the given Node attribute associated to the given column.

    Parameters: | node – Node. ( AbstractCompositeNode / GraphModelNode ) column – Column. ( Integer )
    Returns: | Attribute. ( Attribute )

  `getNodeIndex`(node)

    This method returns given Node index.

    Parameters: | node – Node. ( AbstractCompositeNode / GraphModelNode )
    Returns: | Index. ( QModelIndex )

  `getAttributeIndex`(node, column)

    This method returns given Node attribute index at given column.

    Parameters: | node – Node. ( AbstractCompositeNode / GraphModelNode ) column – Attribute column. ( Integer )
    Returns: | Index. ( QModelIndex )

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

    This method finds the children matching the given patten.

    Parameters: | pattern – Matching pattern. ( String ) flags – Matching regex flags. ( Integer )
    Returns: | Matching children. ( List )

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

    This method returns the Nodes from given family.

    Parameters: | pattern – Matching pattern. ( String ) flags – Matching regex flags. ( Integer ) node – Node to start walking from. ( AbstractNode / AbstractCompositeNode / GraphModelNode )
    Returns: | Family nodes. ( List )

  `findNode`(attribute)

    This method returns the Node with given attribute.

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

  static `findModel`(object)

    This method returns the model(s) associated with given object.

    Parameters: | object – Node / Attribute. ( GraphModelNode / GraphModelAttribute )
    Returns: | Model(s). ( List )

  `enableModelTriggers`(state)

    This method enables Model Nodes and attributes triggers.

    Parameters: | state – Inform model state. ( Boolean )
    Returns: | Method success. ( Boolean )

  `nodeChanged`(node)

    This method calls `QAbstractItemModel.dataChanged()` with given Node index.

    Parameters: | node – Node. ( AbstractCompositeNode / GraphModelNode )
    Returns: | Method success. ( Boolean )

  `attributeChanged`(node, column)

    This method calls `QAbstractItemModel.dataChanged()` with given Node attribute index.

    Parameters: | node – Node. ( AbstractCompositeNode / GraphModelNode ) column – Attribute column. ( Integer )
    Returns: | Method success. ( Boolean )

### Navigation

- index
- modules |
- next |
- previous |
- Umbra 1.0.4 documentation »
- 4. Api »