Common functions used for the psyplot gui

Classes:

DockMixin()

A mixin class to define psyplot_gui plugins

ListValidator(valid[, sep])

A validator class to validate that a string consists of strings in a list of strings

LoadFromConsoleButton([instances])

A toolbutton to load an object from the console

PyErrorMessage

Widget designed to display python errors via the showTraceback() method

StreamToLogger(logger[, log_level])

Fake file-like stream object that redirects writes to a logger instance.

Functions:

get_icon(name)

Get the path to an icon in the icons directory

get_module_path(modname)

Return module modname base path

is_running_tests()

Check if there are any GUI tests running

class psyplot_gui.common.DockMixin[source]

Bases: object

A mixin class to define psyplot_gui plugins

Notes

Each external plugin should set the dock_position and the title attribute!

Attributes:

config_page

The config page for this widget.

dock

The instance of QDockWidget of this plugin

dock_position

The position of the plugin

hidden

Boolean that is True if the dock widget should be hidden automatically after startup

is_shown

Boolean that is True, if the dock widget is shown

title

The title of the plugin

Methods:

create_central_widget_action(main)

Setup the action to make this plugin the central widget

create_view_action(main[, docktype])

hide_plugin()

Hide the plugin widget

position_dock(main, *args, **kwargs)

Set the position of the dock widget

remove_plugin()

Remove this plugin and close it

show_plugin()

Show the plugin widget

show_status_message(msg)

Show a status message

to_dock(main[, title, position, docktype])

Classes:

dock_cls

The class to use for the DockWidget

config_page = None

The config page for this widget. Should inherit the psyplot_gui.preferences.ConfigPage widget

create_central_widget_action(main)[source]

Setup the action to make this plugin the central widget

create_view_action(main, docktype='pane')[source]
dock = None

The instance of QDockWidget of this plugin

dock_cls

The class to use for the DockWidget

alias of QDockWidget Attributes:

AllDockWidgetFeatures

DockWidgetClosable

DockWidgetFloatable

DockWidgetMovable

DockWidgetVerticalTitleBar

NoDockWidgetFeatures

allowedAreasChanged(*args, **kwargs)

Union[Qt.DockWidgetAreas, Qt.DockWidgetArea]) [signal]

dockLocationChanged(*args, **kwargs)

Qt.DockWidgetArea) [signal]

featuresChanged(*args, **kwargs)

Union[QDockWidget.DockWidgetFeatures, QDockWidget.DockWidgetFeature]) [signal]

topLevelChanged(*args, **kwargs)

bool) [signal]

visibilityChanged(*args, **kwargs)

bool) [signal]

Classes:

DockWidgetFeature

DockWidgetFeatures()

Methods:

allowedAreas(self)

changeEvent(self, event)

closeEvent(self, event)

event(self, event)

features(self)

initStyleOption(self, option)

isAreaAllowed(self, area)

isFloating(self)

paintEvent(self, event)

setAllowedAreas(self, areas)

setFeatures(self, features)

setFloating(self, floating)

setTitleBarWidget(self, widget)

setWidget(self, widget)

titleBarWidget(self)

toggleViewAction(self)

widget(self)

dock_position = None

The position of the plugin

hidden = False

Boolean that is True if the dock widget should be hidden automatically after startup

hide_plugin()[source]

Hide the plugin widget

property is_shown

Boolean that is True, if the dock widget is shown

position_dock(main, *args, **kwargs)[source]

Set the position of the dock widget

This method places the plugin widget at the desired dock position (by default, indicated with the dock_position attribute)

Parameters:

main (psyplot_gui.main.Mainwindow) – The main window where the dock is added

remove_plugin()[source]

Remove this plugin and close it

show_plugin()[source]

Show the plugin widget

show_status_message(msg)[source]

Show a status message

title = None

The title of the plugin

to_dock(main, title=None, position=None, docktype='pane', *args, **kwargs)[source]
class psyplot_gui.common.ListValidator(valid, sep=',', *args, **kwargs)[source]

Bases: QRegExpValidator

A validator class to validate that a string consists of strings in a list of strings

class psyplot_gui.common.LoadFromConsoleButton(instances=None, *args, **kwargs)[source]

Bases: QToolButton

A toolbutton to load an object from the console

Methods:

check(obj)

get_from_shell([oname])

Open an input dialog, receive an object and emit the object_loaded signal

get_obj(oname)

Load an object from the current shell

Attributes:

instances2check_str

object_loaded(*args, **kwargs)

The signal that is emitted when an object has been loaded.

potential_object_names

check(obj)[source]
get_from_shell(oname=None)[source]

Open an input dialog, receive an object and emit the object_loaded signal

get_obj(oname)[source]

Load an object from the current shell

property instances2check_str
object_loaded(*args, **kwargs)

The signal that is emitted when an object has been loaded. The first argument is the object name, the second the object itself

property potential_object_names
class psyplot_gui.common.PyErrorMessage[source]

Bases: QErrorMessage

Widget designed to display python errors via the showTraceback() method

Methods:

excepthook(type, value, traceback)

showTraceback([header])

excepthook(type, value, traceback)[source]
showTraceback(header=None)[source]
class psyplot_gui.common.StreamToLogger(logger, log_level=20)[source]

Bases: object

Fake file-like stream object that redirects writes to a logger instance.

Methods:

flush()

write(buf)

flush()[source]
write(buf)[source]
psyplot_gui.common.get_icon(name)[source]

Get the path to an icon in the icons directory

psyplot_gui.common.get_module_path(modname)[source]

Return module modname base path

psyplot_gui.common.is_running_tests()[source]

Check if there are any GUI tests running

This function returns the psyplot_gui.UNIT_TESTING variable