DictModelRow

Methods

qconcurrency.models.DictModelRow.__init__(…)
param parent:Another QStandardItem that has already
qconcurrency.models.DictModelRow.add_child(key) Adds a new row to this DictModel, at a new level of nesting henceforth referred to by the key key.
qconcurrency.models.DictModelRow.add_row(key) Adds a new row to this DictModel, at the same level of nesting henceforth referred to by the key key.
qconcurrency.models.DictModelRow.columnitem(name) Returns the sibling-widget representing one of the columnvals
qconcurrency.models.DictModelRow.columnval(name) Retrieve a single column-value only.
qconcurrency.models.DictModelRow.columnvals() Returns a dictionary of this item’s columnvals from the Model.
qconcurrency.models.DictModelRow.delete() Removes this row from the model.
qconcurrency.models.DictModelRow.id() Returns the key this row represents.
qconcurrency.models.DictModelRow.keys() Returns list containig keys for every
qconcurrency.models.DictModelRow.level() Returns either a label (if qconcurrency.models.DictModel.__init__() was passed a hierarchy argument), or an integer representing the nesting-depth.
qconcurrency.models.DictModelRow.set_columnvals(…) Set columnvals on a key of this qconcurrency.models.DictModel

Documentation

class qconcurrency.models.DictModelRow(parent, key, columnvals=None)[source]

Bases: PySide.QtGui.QStandardItem

A DictModelRow is a QtGui.QStandardItem that holds an item’s key (usually database-Id) within a qconcurrency.models.DictModel. It is always added to a qconcurrency.models.DictModel at the column-index 0. When setting columnvals, they are added to the same parent qconcurrency.models.DictModel or qconcurrency.models.DictModelRow, but at different column-indexes.

Example

                ===== ========|
DictModelRow     _id  | class |  # level: 'jedi_class'
     |          ===== ========|
     +---------> 101  | sith  |
     |            |============================================|
     |            |  _id | firstname  | lastname   | username  | # level: 'user'
     |            |============================================|
     +-------------> 56  | Darth      | Vader      | anakins   |
     +-------------> 57  | Darth      | Maul       | darthm    |
                  |============================================|
                            /\           /\            /\
                            |            |             |
   QtGui.QStandardItem  ----+------------+-------------+
__init__(parent, key, columnvals=None)[source]
Parameters:
  • parent (QtGui.QStandardItem, QtGui.QStandardItemModel) –

    Another QStandardItem that has already been added to the model, or a model itself.

    It will be used to access the model’s info, and this widget will be added to it.

  • key (obj) – A hashable python object that will be used to represent this object’s databaseId.
  • columnvals (dict, optional) – A dictionary of columns, and assignments to store in the view.
add_child(key, columnvals=None)[source]

Adds a new row to this DictModel, at a new level of nesting henceforth referred to by the key key.

Example

|==============|
| _id | column |
|==============|
| 100 | 'A'    |     # add_child( 102, {'column':'A1'} )
|   |==============|
|   | _id | column | # added child:  model[100][102]
|   |==============|
|   | 102 | 'A1'   |
|   |==============|
|              |
| 101 | 'B'    |
|==============|
Parameters:
  • key (obj) – Key is the id you will use to refer to this object. Generally it will be a databaseId. This object must be hashable.
  • columnvals (dict, optional) – Optionally, you may provide a dictionary of column-val assignments (appropriate to this item’s table-level) as determined by the columns argument to qconcurrency.models.DictModel.__init__()
Returns:

qconcurrency.models.DictModelRow

add_row(key, columnvals=None)[source]

Adds a new row to this DictModel, at the same level of nesting henceforth referred to by the key key.

Example

|==============|
| _id | column |
|==============|
| 100 | 'A'    | # add_row( 102, {'column':'C'} )
| 101 | 'B'    |
| 102 | 'C'    | # added row: model[102]
|==============|
Parameters:
  • key (obj) – Key is the id you will use to refer to this object. Generally it will be a databaseId. This object must be hashable.
  • columnvals (dict, optional) – Optionally, you may provide a dictionary of column-val assignments (appropriate to this item’s table-level) as determined by the columns argument to qconcurrency.models.DictModel.__init__()
Returns:

qconcurrency.models.DictModelRow

columnitem(name)[source]

Returns the sibling-widget representing one of the columnvals

columnval(name)[source]

Retrieve a single column-value only.

columnvals()[source]

Returns a dictionary of this item’s columnvals from the Model. A column _id will be added to the list of columns, which will be the key value of this row.

delete()[source]

Removes this row from the model.

id()[source]

Returns the key this row represents. (It’s value depends on the value passed to qconcurrency.models.DictModelRow.add_row() or qconcurrency.models.DictModelRow.add_child() ).

keys()[source]

Returns list containig keys for every child-row that has been added to this qconcurrency.models.DictModelRow

level()[source]

Returns either a label (if qconcurrency.models.DictModel.__init__() was passed a hierarchy argument), or an integer representing the nesting-depth. Either way, level is used to indicate the level-of-nesting of the table that this item is in.

set_columnvals(columnvals)[source]

Set columnvals on a key of this qconcurrency.models.DictModel