Table Of Contents

Previous topic

avoplot Package

Next topic

plugins Package

This Page

gui Package

gui Package

As the name suggests, the gui module contains a collection of modules that make up the AvoPlot GUI.

analysis_tools Module

This module is still under construction! Eventually, it will contain a set of data analysis tools for working with data.

artwork Module

class avoplot.gui.artwork.AvoplotArtProvider

Bases: wx._misc.ArtProvider

Customised art provider class for serving the AvoPlot specific icons.

CreateBitmap(artid, client, size)

Overrides CreateBitmap from wx.ArtProvider. This method looks in the AvoPlot icons directory (as returned by avoplot.get_avoplot_icons_dir()) for the icon specified by artid. The icons are split up into subfolders by size (for example “16x16”) and this method will only look in the relevant size subfolder for the requested icon.

control_panel Module

class avoplot.gui.control_panel.ControlPanel(parent)

Bases: wx.lib.agw.aui.auibook.AuiNotebook

Notebook control which holds all the controls for the currently selected element. Each set of controls (as returned by element.get_control_panels()) is added as a new tab in the notebook.

on_element_add(evnt)

Event handler for element add events. Passes the event through to all pages currently in the control panel

on_element_delete(evnt)

Event handler for element delete events. Removes any control panels associated with the deleted element from the notebook.

If the element is not the currently selected element, then the event gets passed through to all pages currently in the control panel

on_element_select(evnt)

Event handler for element select events. Adds any relevant control panels for the newly selected element to the notebook.

on_page_changed(evnt)

Event handler for page changed events. Calls the on_control_panel_active() method on the control panel that has been newly selected.

on_page_changing(evnt)

Event handler for page changing events. Calls the on_control_panel_inactive() method on the control panel that is being de-selected.

set_control_panels(element)

Sets the control panels shown in the notebook. ‘control_panels’ should be a list of AvoPlotControlPanelBase objects.

dialog Module

class avoplot.gui.dialog.AvoPlotDialog(parent, title)

Bases: wx._windows.Dialog

Base class for all Dialogs used in the GUI.

gridlines Module

class avoplot.gui.gridlines.GridPropertiesEditor(parent, subplot, mpl_axis)

Bases: avoplot.gui.dialog.AvoPlotDialog

on_close(evnt)

Event handler for close events. Destroys the dialog box.

linestyle_editor Module

class avoplot.gui.linestyle_editor.LineStyleEditorPanel(parent, mpl_lines, update_command, linestyles=[LineType(name='', mpl_symbol='None', has_width=False), LineType(name='____', mpl_symbol='-', has_width=True), LineType(name='------', mpl_symbol='--', has_width=True), LineType(name='.-.-.-', mpl_symbol='-.', has_width=True), LineType(name='.......', mpl_symbol=':', has_width=True)])

Bases: wx._windows.Panel

on_line_colour_change(evnt)

Event handler for line colour change events.

on_linestyle(evnt)

Event handler for line style change events.

on_linewidth(evnt)

Event handler for line thickness change events.

update_line_controls(current_line)

If val==True then disables the line properties controls, else enables them.

class avoplot.gui.linestyle_editor.LineType

Bases: tuple

LineType(name, mpl_symbol, has_width)

has_width

itemgetter(item, ...) –> itemgetter object

Return a callable object that fetches the given item(s) from its operand. After, f=itemgetter(2), the call f(r) returns r[2]. After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])

mpl_symbol

itemgetter(item, ...) –> itemgetter object

Return a callable object that fetches the given item(s) from its operand. After, f=itemgetter(2), the call f(r) returns r[2]. After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])

name

itemgetter(item, ...) –> itemgetter object

Return a callable object that fetches the given item(s) from its operand. After, f=itemgetter(2), the call f(r) returns r[2]. After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])

class avoplot.gui.linestyle_editor.MarkerStyleEditorPanel(parent, mpl_lines, update_command, markers=[MarkerType(bitmap='avoplot_nullbitmap', mpl_symbol='None', has_size=False, has_fill=False, has_edge=False), MarkerType(bitmap='avoplot_marker_point', mpl_symbol='.', has_size=True, has_fill=True, has_edge=True), MarkerType(bitmap='avoplot_marker_plus', mpl_symbol='+', has_size=True, has_fill=False, has_edge=True), MarkerType(bitmap='avoplot_marker_circle', mpl_symbol='o', has_size=True, has_fill=True, has_edge=True), MarkerType(bitmap='avoplot_marker_cross', mpl_symbol='x', has_size=True, has_fill=False, has_edge=True), MarkerType(bitmap='avoplot_marker_uptriangle', mpl_symbol='^', has_size=True, has_fill=True, has_edge=True), MarkerType(bitmap='avoplot_marker_downtriangle', mpl_symbol='v', has_size=True, has_fill=True, has_edge=True), MarkerType(bitmap='avoplot_marker_lefttriangle', mpl_symbol='<', has_size=True, has_fill=True, has_edge=True), MarkerType(bitmap='avoplot_marker_righttriangle', mpl_symbol='>', has_size=True, has_fill=True, has_edge=True), MarkerType(bitmap='avoplot_marker_square', mpl_symbol='s', has_size=True, has_fill=True, has_edge=True), MarkerType(bitmap='avoplot_marker_diamond', mpl_symbol='D', has_size=True, has_fill=True, has_edge=True), MarkerType(bitmap='avoplot_marker_thindiamond', mpl_symbol='d', has_size=True, has_fill=True, has_edge=True), MarkerType(bitmap='avoplot_marker_pentagon', mpl_symbol='p', has_size=True, has_fill=True, has_edge=True), MarkerType(bitmap='avoplot_marker_hexagon', mpl_symbol='h', has_size=True, has_fill=True, has_edge=True), MarkerType(bitmap='avoplot_marker_star', mpl_symbol='*', has_size=True, has_fill=True, has_edge=True), MarkerType(bitmap='avoplot_marker_hline', mpl_symbol='_', has_size=True, has_fill=False, has_edge=True), MarkerType(bitmap='avoplot_marker_vline', mpl_symbol='|', has_size=True, has_fill=False, has_edge=True)])

Bases: wx._windows.Panel

on_marker(evnt)

Event handler for marker style change events.

on_marker_edgecolour(evnt)

Event handler for marker fill colour change events

on_marker_edgewidth(evnt)

Event handler for line thickness change events.

on_marker_fillcolour(evnt)

Event handler for marker fill colour change events

on_markersize(evnt)

Event handler for marker size change events

update_marker_controls(current_marker)

Shows or hides marker property controls depending on which are relevant for the currently selected marker type. current_marker should be a MarkerType named tuple.

class avoplot.gui.linestyle_editor.MarkerType

Bases: tuple

MarkerType(bitmap, mpl_symbol, has_size, has_fill, has_edge)

bitmap

itemgetter(item, ...) –> itemgetter object

Return a callable object that fetches the given item(s) from its operand. After, f=itemgetter(2), the call f(r) returns r[2]. After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])

has_edge

itemgetter(item, ...) –> itemgetter object

Return a callable object that fetches the given item(s) from its operand. After, f=itemgetter(2), the call f(r) returns r[2]. After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])

has_fill

itemgetter(item, ...) –> itemgetter object

Return a callable object that fetches the given item(s) from its operand. After, f=itemgetter(2), the call f(r) returns r[2]. After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])

has_size

itemgetter(item, ...) –> itemgetter object

Return a callable object that fetches the given item(s) from its operand. After, f=itemgetter(2), the call f(r) returns r[2]. After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])

mpl_symbol

itemgetter(item, ...) –> itemgetter object

Return a callable object that fetches the given item(s) from its operand. After, f=itemgetter(2), the call f(r) returns r[2]. After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])

main Module

The main module contains the code for the main frame of the AvoPlot GUI.

class avoplot.gui.main.AvoPlotApp(options, args, start_hidden=False)

Bases: wx._core.App

wx app for the AvoPlot program. Overrides the OnInit method to do some startup tasks.

MainLoop()
OnInit()
on_idle(evnt)
class avoplot.gui.main.MainFrame

Bases: wx._windows.Frame

Main frame of the GUI. This is set as the top level window when the AvoPlot App is created in the AvoPlot.py script.

add_figure(figure)

Adds a figure element (an avoplot.figure.AvoPlotFigureBase instance) to the current session.

launch(start_hidden=False)

Create all the GUI elements and show the main window. Note that this needs to be separate from the __init__ method, since we need set the top level window for wx before calling launch().

on_avoplot_event(evnt)

All AvoPlot events (see the ‘core’ module) are posted to the MainFrame where they are handled by this method. All it does is to repost the event to all the GUI components so that they can react as needed.

on_close(*args)

Handler called when the MainFrame is closed. This performs all the tidy up operations such as saving program state. Note that all elements that can be reached through the AvoPlotSession - i.e. all those that have a parent that isn’t None, will have their delete() method called before the program exits.

on_pane_close(evnt)

Event handler for pane close events (where the panes are those managed by the AUI manager of the MainFrame object - currently just the control pane and the navigation pane).

on_show_ctrl_panel(evnt)

Event handler for the “unhiding” of the control pane.

on_show_nav_panel(evnt)

Event handler for the “unhiding” of the navigation pane.

avoplot.gui.main.display_warning(message, category, filename, *args)

Displays a warning message in a wx.MessageBox. This is designed to override the warnings module’s show_warning function.

menu Module

class avoplot.gui.menu.CallbackWrapper(func, *args, **kwargs)

Thin wrapper class to allow callables along with a set of arguments for them to be set as callback handlers.

class avoplot.gui.menu.MainMenu(parent)

Bases: wx._core.MenuBar

The main program menu.

create_file_menu()

Creates the file menu for the main menubar.

create_help_menu()

Creates the help menu for the main menubar

create_view_menu()

Creates the view menu for the main menubar

onAbout(evnt)

Event handler for Help->About menu events. Creates a standard “About” dialog.

on_ctrl_panel_change_state(evnt)

Event handler for AvoPlotCtrlPanelChangeState events. Updates the toggle state of the View->Control Panel menu entry.

on_element_add(evnt)

Event handler for AvoPlotElementAdd events. Enables menu entries when there are a sufficient number of figures open for it to make sense to do so. For example - you can’t split the display if you only have one figure open.

on_element_delete(evnt)

Event handler for AvoPlotElementDelete events. Disables menu entries when there are an insufficient number of figures open for them to make sense. For example - you can’t save a figure if there are none open.

on_element_select(evnt)

Event handler for AvoPlotElementSelect events. Just keeps track of which element is currently selected.

on_nav_panel_change_state(evnt)

Event handler for AvoPlotNavPanelChangeState events. Updates the toggle state of the View->Navigation Panel menu entry.

on_save_plot(evnt)

Event handler for File->Save menu events. Opens a dialog to allow the user to save the currently selected figure as an image.

on_show_ctrl_panel(evnt)

Event handler for View->Control Panel menu events. Sends a AvoPlotCtrlPanelChangeState event to the main window and lets that sort out hiding/restoring the pane.

on_show_nav_panel(evnt)

Event handler for View->Navigation Panel menu events. Sends a AvoPlotNavPanelChangeState event to the main window and lets that sort out hiding/restoring the pane.

class avoplot.gui.menu.TabRightClickMenu(plots_frame)

Bases: wx._core.Menu

The menu displayed when a tab in the plots panel (which is an AuiNotebook) is right clicked on.

close_all(evnt)

Event handler for “Close All” menu events. Closes all figures.

close_current(evnt)

Event handler for “Close” menu events. Closes the currently selected figure.

close_others(evnt)

Event handler for “Close Others” menu events. Closes all figures except the currently selected one.

avoplot.gui.menu.create_the_New_menu(parent)

Creates and returns a new wxMenu object which contains the “File->New” entries. These are read from the plugins that are currently registered.

The relevant event handlers for the menu entries are also registered by this function.

avoplot.gui.menu.get_subplot_right_click_menu(subplot)

Returns a wx.Menu object which is relevant for the subplot which was passed as an arg. This ensures that only menu entries provided by plugins which are compatible with the subplot are included. For example, there is no point in the menu for a 2D subplot to have a “New 3D data series” option.

nav_panel Module

class avoplot.gui.nav_panel.NavigationPanel(parent, session)

Bases: wx._windows.ScrolledWindow

Navigation panel for selecting plot elements in a tree ctrl.

on_element_add(evnt)

Event handler for AvoPlotElementAdd events. Adds a tree item for the element which has been added and all its children (recursively).

on_element_delete(evnt)

Event handler for AvoPlotElementDelete events. Removes the tree item corresponding to the element which has been deleted.

on_element_rename(evnt)

Event handler for AvoPlotElementRename events. Renames the tree item for the element which has been renamed.

on_element_select(evnt)

Event handler for AvoPlotElementSelect events. Selects the tree item corresponding to the element which has been selected.

on_rclick_menu_delete(evnt)

Event handler for the delete option in the right click menu.

on_rclick_menu_export(evnt)

Event handler for the export option in the right click menu.

on_rclick_menu_rename(evnt)

Event handler for the rename option in the right click menu.

Opens a dialog box for the user to enter the new element name.

on_tree_el_menu(evnt)

Event handler for right click events on elements in the navigation panel - opens a popup menu for the element clicked.

on_tree_select_el(evnt)

Event handler for tree item select. Selects the corresponding AvoPlot element (which generates an AvoPlotElementSelect)

class avoplot.gui.nav_panel.RightClickMenu(nav_panel)

Bases: wx._core.Menu

Popup menu displayed when elements in the navigation panel are right clicked.

plots_panel Module

class avoplot.gui.plots_panel.PlotsPanel(parent)

Bases: wx.lib.agw.aui.auibook.AuiNotebook

AuiNotebook for displaying figures in. Multiple figures may be viewed simultaneously by splitting the notebook.

on_delete_element(evnt)

Event handler for AvoPlotElementDelete events. If the element is a figure then the notebook page associated with the figure is deleted - note that this destroys the window, and so future attempts to access the figure object will cause an exception.

on_new_element(evnt)

Event handler for AvoPlotElementAdd events. Adds a page to the notebook for newly created figure objects.

on_rename_element(evnt)

Event handler for AvoPlotElementRename events. If the element is a figure then the relevant notebook page is renamed accordingly.

on_select_element(evnt)

Event handler for AvoPlotElementSelect events. Changes the currently selected notebook page to that containing the newly selected element.

If the selected element is not a figure, then the figure which contains the element is selected.

on_tab_change(evnt)

Event handler for tab change events. Calls on set_selected() on the figure associated with the newly selected tab.

on_tab_close(evnt)

Event handler for tab close events. This vetos the event to prevent the notebook from destroying the window and then calls delete() on the figure object associated with the tab that has just been closed, relying on the event handlers for the AvoPlotElementDelete event to actually destroy the window when it is finished with (this is done by on_delete_element() in this class)

on_tab_right_click(evnt)

Event handler for right click events on the notebook tabs. Creates a popup menu allowing the user to close the tab, split the tab and rename the tab.

rename_current_figure(evnt)

Event handler for rename events (from the tab right click menu) for notebook pages. Opens a rename dialog and then sets the name of the relevant figure object. Note that this generates an AvoPlotElementRename event and the actual renaming of the notebook tab is left up to the event handler for this event - on_rename_element()

split_figure_horiz(*args)

Splits the selected pane horizontally.

split_figure_vert(*args)

Splits the selected pane vertically.

unsplit_panes(*args)

Unsplits all the panes.

text Module

The text module contains classes and functions for editing matplotlib Text objects

class avoplot.gui.text.AnimatedText(text_objects)
redraw_text()

Restores the whole background region from the cache and then draws the animated text objects over the top. You should call this every time you change the text and want the changes to be drawn to the screen.

start_text_animation()

Start the animation of the text. This must be called before you call redraw_text. This creates a cache of the figure background and registers a callback to update the cache if the background gets changed.

stop_text_animation()

Deletes the background cache and removes the update callback. Should be called whenever you are finished animating the text

class avoplot.gui.text.FontPropertiesPanel(parent, text_objects)

Bases: wx._windows.Panel

Panel to hold the text property editing controls within the TextPropertiesEditor dialog. The Text object to be edited should be passed to the constructor.

Note that this panel does not use blitting methods to get fast text animation because that causes layout problems for certain text objects - e.g. the layout of axis labels and tick-labels are related to each other, and this is not honoured properly if blitting methods are used.

get_font_colour()

Returns the currently selected font colour (as a HTML string).

get_font_name()

Returns the name of the currently selected font.

get_font_size()

Returns the currently selected font size (integer number of points)

get_font_stretch()

Returns the stretch of the font currently selected

get_font_style()

Returns the style (‘normal’, ‘italic’ etc.) of the font currently selected

get_font_weight()

Returns the weight of the font currently selected

on_font_colour(evnt)

Event handler for font colour change events.

on_font_selection(evnt)

Event handler for font selection events.

on_font_size(evnt)

Event handler for font size change events.

on_font_stretch(evnt)

Event handler for font stretch (e.g. compressed) change events.

on_font_style(evnt)

Event handler for font style (e.g. italic) change events.

on_font_weight(evnt)

Event handler for font weight (e.g. bold) change events.

redraw_text()

Redraws the text - does not use blitting for fast animation because that causes layout problems in some cases.

class avoplot.gui.text.TextPropertiesEditor(parent, text_objects)

Bases: avoplot.gui.dialog.AvoPlotDialog

Dialog which allows the user to edit the text properties (colour, font etc.) of a set of matplotlib.text.Text object. The Text objects to be edited should be passed to the dialog constructor - which will accept either a single Text object or an iterable of Text objects

apply_to(text_obj)

Applies the selected properties to text_obj which must be a matplotlib.text.Text object

on_apply(evnt)

Event handler for Apply button clicks

on_close(evnt)

Event handler for frame close events

on_ok(evnt)

Event handler for Ok button clicks.

toolbar Module

class avoplot.gui.toolbar.MainToolbar(parent)

Bases: wx._controls.ToolBar

Main program toolbar

enable_plot_tools(state)

Enables the plot tools if state=True or disables them if state=False

on_element_add(evnt)

Event handler for new element events. If the element is not a figure then nothing gets done. For figures, their zoom and pan settings are updated depending on the toggle state of the zoom/pan tools.

This method also enables the plot navigation tools if they were previously disabled.

on_element_delete(evnt)

Event handler for element delete events.If the element is not a figure then nothing gets done. If the element being deleted was the last figure in the session, then this disables the plot navigation tools.

on_element_select(evnt)

Event handler for element select events. Just keeps track of what the curretly selected element is.

on_home(evnt)

Event handler for “home zoom level” events. Resets all subplots in the current figure to their default zoom levels.

on_new(evnt)

Handle ‘new’ button pressed. Creates a popup menu over the tool button containing the same entries as the File->New menu.

on_pan(evnt)

Event handler for pan tool toggle events. Enables or disables panning in all figures accordingly.

on_save_plot(*args)

Event handler for save tool events. Opens a file save dialog for saving the currently selected figure as an image file.

on_zoom(evnt)

Event handler for zoom tool toggle events. Enables or disables zooming in all figures accordingly.

set_pan_state(state)

Enables (state = True) or disables (state = False) the pan tool for all figures. The zoom tool will be disabled if needed.

set_zoom_state(state)

Enables (state = True) or disables (state = False) the zoom tool for all figures. The pan tool will be disabled if needed.

widgets Module

The widgets module contains a set of convenience widgets for building control panels for elements.

class avoplot.gui.widgets.BitmapChoice(parent, id=-1, value=u'', pos=wx.Point(-1, -1), size=wx.Size(-1, -1), choices=[], style=0, validator=<wx._core.Validator; proxy of <Swig Object of type 'wxValidator *' at 0x2aaf7948e5e0> >, name=u'comboBox', bitmaps=[])

Bases: wx.combo.OwnerDrawnComboBox

OnDrawItem(dc, rect, item, flags)
OnMeasureItem(item)
OnMeasureItemWidth(item)
class avoplot.gui.widgets.ChoiceSetting(parent, label, current_selection, selections, callback)

Bases: avoplot.gui.widgets.SettingBase

A text label next to a wx choice control.

class avoplot.gui.widgets.ColourSetting(parent, label, default_colour, callback)

Bases: avoplot.gui.widgets.SettingBase

A text label next to a wx colour picker control.

class avoplot.gui.widgets.EditableCheckBox(parent, label, edit_label='edit')

Bases: wx._core.BoxSizer

on_checkbox(evnt)

Event handler for checkbox events. This should be overridden in the subclass.

Event handler for clicks on the hyperlink. This should be overridden in the subclass.

set_checked(value)

Sets the checkbox to be either checked (value = True), or unchecked (value = False).

class avoplot.gui.widgets.SettingBase(parent, label)

Bases: wx._core.BoxSizer

Base class for settings controls.

class avoplot.gui.widgets.TextSetting(parent, label, text_obj)

Bases: avoplot.gui.widgets.SettingBase, avoplot.gui.text.AnimatedText

A text label next to a wx text entry control. The matplotlib Text object associated with the control is automatically animated to provide fast redraws when the text is changed.

A font properties button is displayed next to the text control (if the text entry box is not empty) which opens a font properties dialog.

on_focus(evnt)

Event handler for when the control gets focus. Starts the text animation (i.e. caches the background).

on_text_change(evnt)

Event handler for text change events. Updates the text on the figure and redraws it.

on_text_prop_button(evnt)

Event handler for clicks on the “font properties” button. Opens a font properties dialog.

on_unfocus(evnt)

Event handler for when the control loses focus. Stops the text animation