urclib.ui_qt.view_models

Various models to drive table, list, and tree views.

Module Contents

Classes

TaskListMdl

Model for Task List view.

ResultTreeModel

Model for Result Tree heirarchy view.

class urclib.ui_qt.view_models.TaskListMdl(parent)

Bases: PyQt5.QtCore.QAbstractListModel

Model for Task List view.

taskToggled
flags(index)

This is an overload of a QAbstractListModel method. See Qt documentation for details.

Parameters:

index (PyQt5.QtCore.QModelIndex) – Cell being queried for flags.

Returns:

Bitflags signalling behaviors for the specified cell

Return type:

int

See also

[Official Qt Documentation](https://doc.qt.io/qt-5/qabstractlistmodel.html#flags)

rowCount(parent=QModelIndex())

This is an overload of a QAbstractListModel method. See Qt documentation for details.

Parameters:

parent (PyQt5.QtCore.QModelIndex,optional) – Parent cell, if any.

Returns:

The number of existing rows.

Return type:

int

See also

[Official Qt Documentation](https://doc.qt.io/qt-5/qabstractitemmodel.html#rowCount)

data(index, role=Qt.DisplayRole)

This is an overload of a QAbstractListModel method. See Qt documentation for details.

Parameters:
  • index (PyQt5.QtCore.QModelIndex) – Cell being queried for data.

  • role (int,optional) – Flag indicating the type of data being requested.

Returns:

The requeseted data.

Return type:

PyQt5.QtCore.QVariant

See also

[Official Qt Documentation](https://doc.qt.io/qt-5/qabstractitemmodel.html#data)

setData(index, value, role=Qt.EditRole)

This is an overload of a QAbstractListModel method. See Qt documentation for details.

Parameters:
  • index (PyQt5.QtCore.QModelIndex) – Cell being assigned a value.

  • value (PyQt5.QtCore.QVariant) – The value to assign.

  • role (int,optional) – Flag indicating the type of data being assigned.

Returns:

True if the data was assigned; False otherwise.

Return type:

bool

See also

[Official Qt Documentation](https://doc.qt.io/qt-5/qabstractitemmodel.html#setData)

state_for_row(r)

Retrieve the checked state for a given model.

Parameters:

r (int) – The row/record to query.

Returns:

Return the active state for the entry.

Return type:

bool

set_state_for_row(r, state)

Set the active state for a given row.

Parameters:
  • r (int) – The row/record to modify.

  • state (bool) – The active state for the role.

any_enabled()

Test to see if any entries are enabled.

Returns:

True if one or more entries are enabled; False otherwise.

Return type:

bool

emit_all_states()

Emit the state for each row in the list.

class urclib.ui_qt.view_models.ResultTreeModel(parent=None)

Bases: PyQt5.QtCore.QAbstractItemModel

Model for Result Tree heirarchy view.

Parameters:

parent (PyQt5.QtWidgets.QWidget,optional) – The parent widget, if any.

class _BaseNode(name, parent=None)

Bases: object

Common Attributes for a tree node.

Parameters:
  • name (str) – The name of the node.

  • parent (_BaseNode or None,optional) – The parent node, if any. Defaults to None.

name

The name of the node.

Type:

str

parent

The parent node, if any.

Type:

_BaseNode or None

property index

index of this node in the parent node’s list, or -1 if there is no parent node.

Type:

int

is_root()

Test to see if a node is at the root of the tree.

Returns:

True if node is at the root of the tree; False otherwise.

Return type:

bool

class GroupNode(name='', parent=None)

Bases: ResultTreeModel._BaseNode

Node containing subnodes.

Parameters:
  • name (str) – The name of the node.

  • parent (_BaseNode or None,optional) – The parent node, if any. Defaults to None.

property node_count

The total number of child nodes.

Type:

int

add_group(name)

Add a new group node as a subnode.

Parameters:

name (str) – The name of the new group node.

Returns:

The newly created node.

Return type:

GroupNode

add_node(path)

Add a leaf node.

Parameters:

path (str) – The path represented by the leaf.

Returns:

The newly created leaf node.

Return type:

EntryNode

__len__()
__getitem__(item)
__iter__()
class EntryNode(path, parent)

Bases: ResultTreeModel._BaseNode

Leaf node representing a file entry.

Parameters:
  • path (str) – Path to representative file.

  • parent (_BaseNode or None,optional) – The parent node, if any. Defaults to None.

id

Space for the visualizer to assign an id for the visual representation.

Type:

int or None

path

The path to the represented file.

Type:

str

gradRec

Gradient to be applied to data on visualization.

Type:

.visualizer.GradientRecord

new_top_group(name)

Add a new group node to the root node.

Parameters:

name (str) – The name of the new node.

Returns:

The newly created node.

Return type:

GroupNode

add_subnode(parent, path)

Add new leaf node.

Parameters:
  • parent (GroupNode) – The node to add a new child node to.

  • path (str) – Path to the represented file.

Returns:

The newly created node.

Return type:

EntryNode

index(row, column, parent=QModelIndex())

This is an overload of a QAbstractItemModel method. See Qt documentation for details.

Parameters:
  • row (int) – The row of the index to retrieve.

  • column (int) – The column of the index to retrieve.

  • parent (PyQt5.QtCore.QModelIndex,optional) – The index object of the parent cell, if any.

Returns:

The index object representing the requested entry.

Return type:

PyQt5.QtCore.QModelIndex

See also

[Official Qt Documentation](https://doc.qt.io/qt-5/qabstractitemmodel.html#index)

parent(index)

This is an overload of a QAbstractItemModel method. See Qt documentation for details.

Parameters:

index (PyQt5.QtCore.QModelIndex) – The index for which to retrieve the parent index object.

Returns:

The parent index object, if any.

Return type:

PyQt5.QtCore.QModelIndex

See also

[Official Qt Documentation](https://doc.qt.io/qt-5/qabstractitemmodel.html#parent)

rowCount(parent=QModelIndex())

This is an overload of a QAbstractListModel method. See Qt documentation for details.

Parameters:

parent (PyQt5.QtCore.QModelIndex,optional) – Parent cell, if any.

Returns:

The number of existing rows.

Return type:

int

See also

[Official Qt Documentation](https://doc.qt.io/qt-5/qabstractitemmodel.html#rowCount)

columnCount(parent=QModelIndex())

This is an overload of a QAbstractListModel method. See Qt documentation for details.

Parameters:

parent (PyQt5.QtCore.QModelIndex,optional) – Parent cell, if any.

Returns:

The number of existing columns.

Return type:

int

See also

[Official Qt Documentation](https://doc.qt.io/qt-5/qabstractitemmodel.html#columnCount)

data(index, role=Qt.DisplayRole)

This is an overload of a QAbstractListModel method. See Qt documentation for details.

Parameters:
  • index (PyQt5.QtCore.QModelIndex) – Cell being queried for data.

  • role (int,optional) – Flag indicating the type of data being requested.

Returns:

The requeseted data.

Return type:

PyQt5.QtCore.QVariant

See also

[Official Qt Documentation](https://doc.qt.io/qt-5/qabstractitemmodel.html#data)

flags(index)

This is an overload of a QAbstractListModel method. See Qt documentation for details.

Parameters:

index (PyQt5.QtCore.QModelIndex) – Cell being queried for flags.

Returns:

Bitflags signalling behaviors for the specified cell

Return type:

int

See also

[Official Qt Documentation](https://doc.qt.io/qt-5/qabstractlistmodel.html#flags)

__iter__()