hyperspyui.widgets.dataviewwidget module

Created on Tue Nov 04 16:32:55 2014

@author: Vidar Tonaas Fauske

class hyperspyui.widgets.dataviewwidget.ComponentEditorHandler

Bases: traitsui.handler.Handler

setattr(info, object, name, value)

Handles the user setting a specified object trait’s value.

This method is called when an editor attempts to set a new value for a specified object trait attribute. Use this method to control what happens when a trait editor tries to set an attribute value. For example, you can use this method to record a history of changes, in order to implement an “undo” mechanism. No result is returned. The default implementation simply calls the built-in setattr() function. If you override this method, make sure that it actually sets the attribute, either by calling the parent method or by setting the attribute directly

  • info (UIInfo instance) – The UIInfo for the current UI

  • object (object) – The object whose attribute is being set

  • name (string) – The name of the attribute being set

  • value – The value to which the attribute is being set

class hyperspyui.widgets.dataviewwidget.DataViewWidget(main_window, parent=None)

Bases: PyQt5.QtWidgets.QWidget

A custom QTreeWidget, that handles the Signal-Model-Component hierarchy. The relationships are displayed in a tree structure, and helps keep track of the relationships between them. Also makes handeling several Models per Signal easier.

ComponentType = 1002
ModelType = 1001
SignalType = 1000
_add(item, itemtype, parent=None)

Make a QTreeWidgetItem for data item, and insert it below parent. The parent can be either a data item, or a QTreeWidgetItem.

add(object, type, parent=None)
add_component(component, model)
add_model(model, signal=None)
currentItemChanged(current, previous)
edit_traits(comp, buttons=True)

Returns the first selected Model. Any selected Signals/Components will select their Model child/parent.


Returns the first selected Signal. Any selected Models or Components will select their Signal parent.


Returns a list of all selected signals. Any selected Models or Components will select their Signal parent.

itemDoubleClicked(item, column)
keyPressEvent(self, QKeyEvent)

Displays the context menu for whatever is under the supplied point.


Can be connected to an MdiArea’s subWindowActivated signal to sync the selected signal.

class hyperspyui.widgets.dataviewwidget.HyperspyItem(parent, itemtype, hspy_item)

Bases: PyQt5.QtWidgets.QTreeWidgetItem

HyperspyItem.data(self, int, int) -> Any
HyperspyItem.setData(self, int, int, Any)
class hyperspyui.widgets.dataviewwidget.VisbilityDelegate(parent=None, icons=None)

Bases: PyQt5.QtWidgets.QStyledItemDelegate

iconPos(icon, option)
paint(self, QPainter, QStyleOptionViewItem, QModelIndex)
sizeHint(self, QStyleOptionViewItem, QModelIndex) QSize