hyperspyui.widgets.dataviewwidget module

Created on Tue Nov 04 16:32:55 2014

@author: Vidar Tonaas Fauske

class hyperspyui.widgets.dataviewwidget.ComponentEditorHandler

Bases: 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

Parameters:
  • 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: 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.

_remove(key)
add(object, type, parent=None)
add_component(component, model)
add_model(model, signal=None)
add_signal(signal)
clear_editor()
currentItemChanged(current, previous)
edit_traits(comp, buttons=True)
get_selected_component()
get_selected_model()

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

get_selected_wrapper()

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

get_selected_wrappers()

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

itemDoubleClicked(item, column)
keyPressEvent(self, a0: QKeyEvent | None)
onCustomContextMenu(point)

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

on_mdiwin_activated(mdi_figure)

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

remove(object)
set_traits_editor(traits_dialog)
class hyperspyui.widgets.dataviewwidget.HyperspyItem(parent, itemtype, hspy_item)

Bases: QTreeWidgetItem

_on_toggle_visibility()
data(self, column: int, role: int) Any
setData(self, column: int, role: int, value: Any)
class hyperspyui.widgets.dataviewwidget.VisbilityDelegate(parent=None, icons=None)

Bases: QStyledItemDelegate

iconPos(icon, option)
paint(self, painter: QPainter | None, option: QStyleOptionViewItem, index: QModelIndex)
sizeHint(self, option: QStyleOptionViewItem, index: QModelIndex) QSize
hyperspyui.widgets.dataviewwidget.tr(text)