gdesk.dicttree.widgets module¶
- class gdesk.dicttree.widgets.DictionaryTreeDialog(d)¶
Bases:
PySide2.QtWidgets.QDialog
guidata motivated dialog for editin dictionaries
- closeCancel()¶
- closeEvent(self, arg__1: PySide2.QtGui.QCloseEvent) → None¶
- edit()¶
- staticMetaObject = <PySide2.QtCore.QMetaObject object>¶
- to_dict()¶
- class gdesk.dicttree.widgets.DictionaryTreeModel(root, parent=None)¶
Bases:
PySide2.QtCore.QAbstractItemModel
Data model providing a tree of an arbitrary dictionary
- columnCount(parent)¶
Number of columns is always 2 since dictionaries consist of key-value pairs
- data(index, role)¶
returns the data requested by the view
- flags(index)¶
everything is editable
- getNode(index)¶
returns a Node() from given index
- headerData(section, orientation, role)¶
returns the name of the requested column
- index(row, column, parent)¶
returns an index from given row, column and parent
- insertRows(position, rows, parent=<PySide2.QtCore.QModelIndex(-1, -1, 0x0, QObject(0x0))>)¶
insert rows from starting position and number given by rows
- parent(index)¶
returns the parent from given index
- removeRows(position, rows, parent=<PySide2.QtCore.QModelIndex(-1, -1, 0x0, QObject(0x0))>)¶
remove the rows from position to position+rows
- rowCount(parent)¶
the number of rows is the number of children
- setData(index, value, role=PySide2.QtCore.Qt.ItemDataRole.EditRole)¶
this method gets called when the user changes data
- staticMetaObject = <PySide2.QtCore.QMetaObject object>¶
- to_dict()¶
- class gdesk.dicttree.widgets.DictionaryTreeWidget(d)¶
Bases:
PySide2.QtWidgets.QTreeView
returns an object containing the tree of the given dictionary d. example:
tree = DictionaryTree(d) tree.edit() d_edited = tree.dict()
d_edited contains the dictionary with the edited data. this has to be refactored…
- load_dictionary(d)¶
load a dictionary into my tree applicatoin
- staticMetaObject = <PySide2.QtCore.QMetaObject object>¶
- to_dict()¶
returns a dictionary from the tree-data
- gdesk.dicttree.widgets.node_structure_from_dict(datadict, parent=None, root_node=None)¶
returns a hierarchical node stucture required by the TreeModel