spinetoolbox.widgets.custom_qwidgets

Custom QWidgets for Filtering and Zooming.

author
  1. Vennström (VTT)

date

4.12.2018

Module Contents

Classes

FilterWidgetBase

Filter widget class.

SimpleFilterWidget

Filter widget class.

CustomWidgetAction

A QWidgetAction with custom hovering.

ToolBarWidgetAction

An action with a tool bar.

ToolBarWidgetBase

A toolbar on the right, with enough space to print a text beneath.

ToolBarWidget

A toolbar on the right, with enough space to print a text beneath.

MenuItemToolBarWidget

A menu item with a toolbar on the right.

_MenuToolBar

A custom tool bar for MenuItemToolBarWidget.

TitleWidgetAction

A titled separator.

WrapLabel

A QLabel that always wraps text.

HyperTextLabel

A QLabel that supports hyperlinks.

QWizardProcessPage

A QWizards page with a log. Useful for pages that need to capture the output of a process.

LabelWithCopyButton

A read only QLabel with a QToolButton that copies the text to clipboard.

class spinetoolbox.widgets.custom_qwidgets.FilterWidgetBase(parent)[source]

Bases: PySide2.QtWidgets.QWidget

Filter widget class.

Init class.

Parameters

parent (QWidget) –

okPressed[source]
cancelPressed[source]
connect_signals(self)[source]
save_state(self)[source]

Saves the state of the FilterCheckboxListModel.

reset_state(self)[source]

Sets the state of the FilterCheckboxListModel to saved state.

clear_filter(self)[source]

Selects all items in FilterCheckBoxListModel.

has_filter(self)[source]

Returns true if any item is filtered in FilterCheckboxListModel false otherwise.

set_filter_list(self, data)[source]

Sets the list of items to filter.

_apply_filter(self)[source]

Apply current filter and save state.

_cancel_filter(self)[source]

Cancel current edit of filter and set the state to the stored state.

_filter_list(self)[source]

Filter list with current text.

_text_edited(self, new_text)[source]

Callback for edit text, starts/restarts timer. Start timer after text is edited, restart timer if text is edited before last time out.

class spinetoolbox.widgets.custom_qwidgets.SimpleFilterWidget(parent, show_empty=True)[source]

Bases: FilterWidgetBase

Filter widget class.

Init class.

Parameters

parent (QWidget) –

class spinetoolbox.widgets.custom_qwidgets.CustomWidgetAction(parent=None)[source]

Bases: PySide2.QtWidgets.QWidgetAction

A QWidgetAction with custom hovering.

Class constructor.

Parameters

parent (QMenu) – the widget’s parent

_handle_hovered(self)[source]

Hides other menus that might be shown in the parent widget and repaints it. This is to emulate the behavior of QAction.

class spinetoolbox.widgets.custom_qwidgets.ToolBarWidgetAction(text, parent=None, compact=False)[source]

Bases: CustomWidgetAction

An action with a tool bar.

tool_bar
Type

QToolBar

Class constructor.

Parameters

parent (QMenu) – the widget’s parent

_parent_key_press_event[source]
eventFilter(self, obj, ev)[source]
_handle_hovered(self)[source]

Hides other menus that might be shown in the parent widget and repaints it. This is to emulate the behavior of QAction.

class spinetoolbox.widgets.custom_qwidgets.ToolBarWidgetBase(text, parent=None)[source]

Bases: PySide2.QtWidgets.QWidget

A toolbar on the right, with enough space to print a text beneath.

tool_bar
Type

QToolBar

Class constructor.

Parameters
  • text (str) –

  • parent (QWidget) – the widget’s parent

class spinetoolbox.widgets.custom_qwidgets.ToolBarWidget(text, parent=None)[source]

Bases: ToolBarWidgetBase

A toolbar on the right, with enough space to print a text beneath.

tool_bar
Type

QToolBar

Class constructor.

Parameters
  • text (str) –

  • parent (QWidget) – the widget’s parent

class spinetoolbox.widgets.custom_qwidgets.MenuItemToolBarWidget(text, parent=None, compact=False)[source]

Bases: ToolBarWidgetBase

A menu item with a toolbar on the right.

tool_bar
Type

QToolBar

Class constructor.

Parameters
  • text (str) –

  • parent (QWidget) – the widget’s parent

  • compact (bool) – if True, the widget uses the minimal space

paintEvent(self, event)[source]

Draws the menu item, then calls the super() method to draw the tool bar.

class spinetoolbox.widgets.custom_qwidgets._MenuToolBar[source]

Bases: PySide2.QtWidgets.QToolBar

A custom tool bar for MenuItemToolBarWidget.

enabled_changed[source]
_enabled = True[source]
_focus_widget[source]
is_enabled(self)[source]
addActions(self, actions)[source]

Overriden method to customize tool buttons.

addAction(self, *args, **kwargs)[source]

Overriden method to customize the tool button.

_setup_action_button(self, action)[source]
Customizes the QToolButton associated with given action:
  1. Makes sure that the text honors the action’s mnemonics.

  2. Installs this as event filter on the button (see self.eventFilter()).

Must be called everytime an action is added to the tool bar.

Parameters

QAction

actionEvent(self, ev)[source]

Updates self._enabled: True if at least one non-separator action is enabled, False otherwise. Emits self.enabled_changed accordingly.

eventFilter(self, obj, ev)[source]

Installed on each action’s QToolButton. Ignores Up and Down key press events, so they are handled by the toolbar for custom navigation.

keyPressEvent(self, ev)[source]

Navigates over the tool bar buttons.

hideEvent(self, ev)[source]
class spinetoolbox.widgets.custom_qwidgets.TitleWidgetAction(title, parent=None)[source]

Bases: CustomWidgetAction

A titled separator.

Class constructor.

Parameters

parent (QMenu) – the widget’s parent

H_MARGIN = 5[source]
V_MARGIN = 2[source]
static _add_line(widget, layout)[source]
isSeparator(self)[source]
class spinetoolbox.widgets.custom_qwidgets.WrapLabel(text='', parent=None)[source]

Bases: PySide2.QtWidgets.QLabel

A QLabel that always wraps text.

class spinetoolbox.widgets.custom_qwidgets.HyperTextLabel(text='', parent=None)[source]

Bases: WrapLabel

A QLabel that supports hyperlinks.

class spinetoolbox.widgets.custom_qwidgets.QWizardProcessPage(parent)[source]

Bases: PySide2.QtWidgets.QWizardPage

A QWizards page with a log. Useful for pages that need to capture the output of a process.

class _ExecutionManager[source]

A descriptor that stores a QProcessExecutionManager. When execution_finished is emitted, it shows the button to copy the process log.

public_name[source]
private_name[source]
__set_name__(self, owner, name)[source]
__get__(self, obj, objtype=None)[source]
__set__(self, obj, value)[source]
msg[source]
msg_warning[source]
msg_error[source]
msg_success[source]
msg_proc[source]
msg_proc_error[source]
_exec_mngr[source]
_connect_signals(self)[source]
_handle_copy_clicked(self, _=False)[source]
_add_msg(self, msg)[source]
_add_msg_warning(self, msg)[source]
_add_msg_error(self, msg)[source]
_add_msg_succes(self, msg)[source]
isComplete(self)[source]
cleanupPage(self)[source]
class spinetoolbox.widgets.custom_qwidgets.LabelWithCopyButton(text='', parent=None)[source]

Bases: PySide2.QtWidgets.QWidget

A read only QLabel with a QToolButton that copies the text to clipboard.