hyperspyui.mainwindowutillayer module

Created on Sat Feb 21 16:05:41 2015

@author: Vidar Tonaas Fauske

class hyperspyui.mainwindowutillayer.MainWindowActionRecorder(parent=None)

Bases: hyperspyui.mainwindowutillayer.MainWindowUtils

Adds recorder functionality.

_wire_action(ac, key, callback, selection_callback)
on_console_executing(source)

Override when inherited to perform actions before exectuing ‘source’.

record_action(key)
record_code(code)
class hyperspyui.mainwindowutillayer.MainWindowUtils(parent=None)

Bases: hyperspyui.mainwindowbase.MainWindowBase

Adds UI utility functions to the main window, including traitsui dialog capture.

_make_action(label, icon, shortcut, tip)
_wire_action(ac, key, callback, selection_callback)
add_action(key, label, callback, tip=None, icon=None, shortcut=None, selection_callback=None)

Create and add a QAction to self.actions[key]. ‘label’ is used as the short description of the action, and ‘tip’ as the long description. The tip is typically shown in the statusbar. The callback is called when the action is triggered(). The optional ‘icon’ should either be a QIcon, or a path to an icon file, and is used to depict the action on toolbar buttons and in menus.

If selection_callback is supplied, it is called whenever the currently selected signal/figure changes. This allows the callback to enable/disable the action to reflect whether the selected figure/signal is supported for the action.

add_menuitem(category, action, label=None)

Add the supplied ‘action’ as a menu entry. If the menu defined by ‘cateogry’ does not exist, it will be created in self.menus[category].

If the label argument is not supplied, category will be used.

add_tool(tool, selection_callback=None)
add_toolbar_button(category, action)

Add the supplied ‘action’ as a toolbar button. If the toolbar defined by ‘cateogry’ does not exist, it will be created in self.toolbars[category].

add_widget(widget, floating=None)

Add the passed ‘widget’ to the main window. If the widget is not a QDockWidget, it will be wrapped into one. The QDockWidget is returned. The widget is also added to the window menu self.windowmenu, so that it’s visibility can be toggled.

The parameter ‘floating’ specifies whether the widget should be made floating. If None, the value of the setting ‘default_widget_floating’ is used.

capture_traits_dialog(callback)
get_figure_filepath_suggestion(figure, deault_ext=None)

Get a suggestion for a file path for saving figure.

make_icon(icon)

Create an icon that coheres to the internal standard for icons.

Parameters

icon ({string | QIcon}) – If icon is a path, it loads the file. If the path does not correspond to a valid file, it is checked if it is a valid path relative to the ‘images’ folder of the package. After loading, SVG files will be run through SmartColorSVGIconEngine to adapt suitable icons to the current palette. If a QIcon is passed directly, it is also sent through SmartColorSVGIconEngine.

on_traits_destroyed(dialog)
on_traits_dialog(dialog, ui, parent)
prompt_files(extension_filter=None, path=None, exists=True, title=None, def_filter=None)
remove_tool(tool)
remove_toolbar_button(category, action)
save_figure(figure=None)

Save the matplotlib figure. If a figure is not passed, it tries to save whichever is active (using activeSubWindow() of the MDI area).

set_status(msg)

Display ‘msg’ in window’s statusbar.

show_okcancel_dialog(title, widget, modal=True)

Show a dialog with the passed widget and OK and cancel buttons.