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.aui.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_delete(evnt)

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

on_element_select(evnt)

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

set_control_panels(control_panels)

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

main Module

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

class avoplot.gui.main.AvoPlotSession(name)

Bases: avoplot.core.AvoPlotElementBase

A session is the “root” element for an AvoPlot program instance. It doesn’t really do anything by itself, but provides a parent to any figures that get created.

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()

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.

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.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_tree_select_el(evnt)

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

plots_panel Module

class avoplot.gui.plots_panel.PlotsPanel(parent)

Bases: wx.aui.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.

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.

widgets Module

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

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.SettingBase(parent, label)

Bases: wx._core.BoxSizer

Base class for settings controls.

class avoplot.gui.widgets.TextSetting(parent, label, default_text, callback)

Bases: avoplot.gui.widgets.SettingBase

A text label next to a wx text entry control.