sas.sasgui.guiframe package

Subpackages

Submodules

sas.sasgui.guiframe.CategoryInstaller module

Class for making sure all category stuff is installed and works fine.

Copyright (c) Institut Laue-Langevin 2012

@author kieranrcampbell@gmail.com @modified by NIST/MD sasview team

class sas.sasgui.guiframe.CategoryInstaller.CategoryInstaller[source]

Bases: object

Class for making sure all category stuff is installed

Note - class is entirely static!

static check_install(homedir=None, model_list=None)[source]

Makes sure categories.json exists and if not compile it and install.

This is the main method of this class.

Parameters:
  • homefile – Override the default home directory
  • model_list – List of model names except those in Plugin Models which are user supplied.
static get_default_file()[source]
static get_user_file()[source]

returns the user data file, eg .sasview/categories.json.json

sas.sasgui.guiframe.CategoryManager module

This software was developed by Institut Laue-Langevin as part of Distributed Data Analysis of Neutron Scattering Experiments (DANSE).

Copyright 2012 Institut Laue-Langevin

class sas.sasgui.guiframe.CategoryManager.CategoryManager(parent, win_id, title)[source]

Bases: wx._windows.Frame

A class for managing categories

dial_ok(dialog=None, model=None)[source]

modify_dialog onclose

class sas.sasgui.guiframe.CategoryManager.ChangeCat(parent, title, cat_list, current_cats)[source]

Bases: wx._windows.Dialog

dialog for changing the categories of a model

get_category()[source]

Returns a list of categories applying to this model

on_add(event)[source]

Callback for new category added

on_existing(event)[source]

Callback for existing category selected

on_newcat(event)[source]

Callback for new category added

on_ok_mac(event)[source]

On OK pressed (MAC only)

on_remove(event)[source]

Callback for a category removed

class sas.sasgui.guiframe.CategoryManager.CheckListCtrl(parent, callback_func)[source]

Bases: wx._controls.ListCtrl, wx.lib.mixins.listctrl.CheckListCtrlMixin, wx.lib.mixins.listctrl.ListCtrlAutoWidthMixin

Taken from http://zetcode.com/wxpython/advanced/

OnCheckItem(index, flag)[source]

When the user checks the item we need to save that state

sas.sasgui.guiframe.CategoryManager.logger = <logging.Logger object at 0x000000000E8EFCC0>

Notes The category manager mechanism works from 3 data structures used: - self.master_category_dict: keys are the names of categories, the values are lists of tuples, the first being the model names (the models belonging to that category), the second a boolean of whether or not the model is enabled - self.by_model_dict: keys are model names, values are a list of categories belonging to that model - self.model_enabled_dict: keys are model names, values are bools of whether the model is enabled use self._regenerate_model_dict() to create the latter two structures from the former use self._regenerate_master_dict() to create the first structure from the latter two

The need for so many data structures comes from the fact sometimes we need fast access to all the models in a category (eg user selection from the gui) and sometimes we need access to all the categories corresponding to a model (eg user modification of model categories)

sas.sasgui.guiframe.aboutbox module

class sas.sasgui.guiframe.aboutbox.DialogAbout(*args, **kwds)[source]

Bases: wx._windows.Dialog

“About” Dialog

Shows product name, current version, authors, and link to the product page. Current version is taken from version.py

class sas.sasgui.guiframe.aboutbox.MyApp(redirect=False, filename=None, useBestVisual=False, clearSigInt=True)[source]

Bases: wx._core.App

OnInit()[source]
sas.sasgui.guiframe.aboutbox.launchBrowser(url)[source]

Launches browser and opens specified url

In some cases may require BROWSER environment variable to be set up.

Parameters:url – URL to open

sas.sasgui.guiframe.acknowledgebox module

Created on Feb 18, 2015

@author: jkrzywon

class sas.sasgui.guiframe.acknowledgebox.DialogAcknowledge(*args, **kwds)[source]

Bases: wx._windows.Dialog

“Acknowledgement” Dialog Box

Shows the current method for acknowledging SasView in scholarly publications.

class sas.sasgui.guiframe.acknowledgebox.MyApp(redirect=False, filename=None, useBestVisual=False, clearSigInt=True)[source]

Bases: wx._core.App

Class for running module as stand alone for testing

OnInit()[source]

Defines an init when running as standalone

sas.sasgui.guiframe.config module

Application settings

sas.sasgui.guiframe.config.printEVT(message)[source]

sas.sasgui.guiframe.custom_pstats module

class sas.sasgui.guiframe.custom_pstats.CustomPstats(*args, **kwds)[source]

Bases: pstats.Stats

write_stats(*amount)[source]
sas.sasgui.guiframe.custom_pstats.f8(x)[source]
sas.sasgui.guiframe.custom_pstats.func_std_string(func_name)[source]
sas.sasgui.guiframe.custom_pstats.profile(fn, name='profile.txt', *args, **kw)[source]

sas.sasgui.guiframe.dataFitting module

Adapters for fitting module

class sas.sasgui.guiframe.dataFitting.Data1D(x=None, y=None, dx=None, dy=None, lam=None, dlam=None, isSesans=False)[source]

Bases: sas.sasgui.plottools.plottables.Data1D, sas.sascalc.dataloader.data_info.Data1D

copy_from_datainfo(data1d)[source]

copy values of Data1D of type DataLaoder.Data_info

class sas.sasgui.guiframe.dataFitting.Data2D(image=None, err_image=None, qx_data=None, qy_data=None, q_data=None, mask=None, dqx_data=None, dqy_data=None, xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None)[source]

Bases: sas.sasgui.plottools.plottables.Data2D, sas.sascalc.dataloader.data_info.Data2D

copy_from_datainfo(data2d)[source]

copy value of Data2D of type DataLoader.data_info

class sas.sasgui.guiframe.dataFitting.Theory1D(x=None, y=None, dy=None)[source]

Bases: sas.sasgui.plottools.plottables.Theory1D, sas.sascalc.dataloader.data_info.Data1D

copy_from_datainfo(data1d)[source]

copy values of Data1D of type DataLaoder.Data_info

sas.sasgui.guiframe.dataFitting.check_data_validity(data)[source]

Return True is data is valid enough to compute chisqr, else False

sas.sasgui.guiframe.data_manager module

This module manages all data loaded into the application. Data_manager makes available all data loaded for the current perspective.

All modules “creating Data” posts their data to data_manager . Data_manager make these new data available for all other perspectives.

class sas.sasgui.guiframe.data_manager.DataManager[source]

Bases: object

Manage a list of data

add_data(data_list)[source]

receive a list of

create_gui_data(data, path=None)[source]

Receive data from loader and create a data to use for guiframe

delete_by_id(id_list=None)[source]

save data and path

delete_by_name(name_list=None)[source]

save data and path

delete_data(data_id, theory_id=None, delete_all=False)[source]
delete_theory(data_id, theory_id)[source]
freeze(theory_id)[source]
freeze_theory(data_id, theory_id)[source]
get_all_data()[source]

return list of all available data

get_by_id(id_list=None)[source]
get_by_name(name_list=None)[source]

return a list of data given a list of data names

get_data_state(data_id)[source]

Send list of selected data

get_message()[source]

return message

rename(name)[source]

rename data

update_data(prev_data, new_data)[source]
update_theory(theory, data_id=None, state=None)[source]

sas.sasgui.guiframe.data_panel module

This module provides Graphic interface for the data_manager module.

class sas.sasgui.guiframe.data_panel.DataDialog(data_list, parent=None, text='', *args, **kwds)[source]

Bases: wx._windows.Dialog

Allow file selection at loading time

get_data()[source]

return the selected data

class sas.sasgui.guiframe.data_panel.DataFrame(parent=None, owner=None, manager=None, size=(300, 800), list_of_perspective=[], list=[], *args, **kwds)[source]

Bases: wx._windows.Frame

Data Frame

ALWAYS_ON = True
load_data_list(list=[])[source]

Fill the list inside its panel

window_caption = 'Data Panel'
window_name = 'Data Panel'
class sas.sasgui.guiframe.data_panel.DataPanel(parent, list=None, size=(235, 700), id=-1, list_of_perspective=None, manager=None, *args, **kwds)[source]

Bases: wx.lib.scrolledpanel.ScrolledPanel, sas.sasgui.guiframe.panel_base.PanelBase

This panel displays data available in the application and widgets to interact with data.

append_theory(state_id, theory_list)[source]

append theory object under data from a state of id = state_id replace that theory if already displayed

append_theory_helper(tree, root, state_id, theory_list)[source]

Append theory helper

check_theory_to_freeze()[source]

Check_theory_to_freeze

define_panel_structure()[source]

Define the skeleton of the panel

disable_app_combo(enable)[source]

Disable app combo box

do_layout()[source]

Create the panel layout

enable_append()[source]

enable or disable append button

enable_freeze()[source]

enable or disable the freeze button

enable_import()[source]

enable or disable send button

enable_plot()[source]

enable or disable plot button

enable_remove()[source]

enable or disable remove button

enable_remove_plot()[source]

enable remove plot button if there is a plot panel on focus

enable_selection()[source]

enable or disable combobo box selection

fill_cbox_analysis(plugin)[source]

fill the combobox with analysis name

get_frame()[source]
layout_batch()[source]

Set up batch mode options

layout_button()[source]

Layout widgets related to buttons

layout_data_list()[source]

Add a listcrtl in the panel

layout_selection()[source]

Create selection option combo box

load_data_list(list)[source]

add need data with its theory under the tree

load_error(error=None)[source]

Pop up an error message.

Parameters:error – details error message to be displayed
onContextMenu(event)[source]

Retrieve the state selected state

on_append_plot(event=None)[source]

append plot to plot panel on focus

on_batch_mode(event)[source]

Change to batch mode :param event: UI event

on_check_item(event)[source]

On check item

on_close(event)[source]

On close event

on_close_page(event=None)[source]

On close

on_close_plot(event)[source]

clseo the panel on focus

on_data_info(event)[source]

Data Info panel

on_edit_data(event)[source]

Pop Up Data Editor

on_freeze(event)[source]

On freeze to make a theory to a data set

on_help(event)[source]

Bring up the data manager Documentation whenever the HELP button is clicked.

Calls DocumentationWindow with the path of the location within the documentation tree (after /doc/ ....”. Note that when using old versions of Wx (before 2.9) and thus not the release version of installers, the help comes up at the top level of the file as webbrowser does not pass anything past the # to the browser when it is running “file:///....”

Parameters:event – Triggers on clicking the help button
on_import(event=None)[source]

Get all select data and set them to the current active perspetive

on_plot(event=None)[source]

Send a list of data names to plot

on_plot_3d(event)[source]

Frozen image of 3D

on_quick_plot(event)[source]

Frozen plot

on_remove(event, prompt=True)[source]

Get a list of item checked and remove them from the treectrl Ask the parent to remove reference to this item

on_right_click_data(event)[source]

Allow Editing Data

on_right_click_theory(event)[source]

On click theory data

on_save_as(event)[source]

Save data as a file

on_single_mode(event)[source]

Change to single mode :param event: UI event

remove_by_id(id)[source]

Remove_dat by id

set_active_perspective(name)[source]

set the active perspective

set_data_helper()[source]

Set data helper

set_frame(frame)[source]
set_panel_on_focus(name=None)[source]

set the plot panel on focus

set_plot_unfocus()[source]

Unfocus plot

set_schedule_full_draw(panel=None, func='del')[source]

Send full draw to guimanager

show_data_button()[source]

show load data and remove data button if dataloader on else hide them

window_caption = 'Data Explorer'
window_name = 'Data Panel'
window_type = 'Data Panel'
class sas.sasgui.guiframe.data_panel.DataTreeCtrl(parent, root, *args, **kwds)[source]

Bases: wx.lib.agw.customtreectrl.CustomTreeCtrl

Check list control to be used for Data Panel

OnCompareItems(item1, item2)[source]

Overrides OnCompareItems in wx.TreeCtrl. Used by the SortChildren method.

class sas.sasgui.guiframe.data_panel.State[source]

DataPanel State

sas.sasgui.guiframe.data_panel.set_data_state(data=None, path=None, theory=None, state=None)[source]

Set data state

sas.sasgui.guiframe.data_processor module

Implement grid used to store results of a batch fit.

This is in Guiframe rather than fitting which is probably where it should be. Actually could be a generic framework implemented in fit gui module. At this point however there this grid behaves independently of the fitting panel and only knows about information sent to it but not about the fits or fit panel and thus cannot feed back to the fitting panel. This could change in the future.

The organization of the classes goes as:

Note

Path to this is: /sasview/src/sas/sasgui/guiframe/data_processor.py

Note

Path to image is: /sasview/src/sas/sasgui/guiframe/media/BatchGridClassLayout.png

../../_images/BatchGridClassLayout.png
class sas.sasgui.guiframe.data_processor.BatchCell[source]

Bases: object

Object describing a cell in the grid.

class sas.sasgui.guiframe.data_processor.BatchOutputFrame(parent, data_inputs, data_outputs, file_name='', details='', *args, **kwds)[source]

Bases: wx._windows.Frame

Allow to select where the result of batch will be displayed or stored

on_apply(event)[source]

Get the user selection and display output to the selected application

on_close(event)[source]

close the Window

onselect(event=None)[source]

Receive event and display data into third party application or save data to file.

class sas.sasgui.guiframe.data_processor.GridCellEditor(grid)[source]

Bases: wx.lib.sheet.CCellEditor

Custom cell editor

This subclasses the sheet.CCellEditor (itself a subclass of grid.GridCellEditor) in order to override two of its methods: PaintBackrgound and EndEdit.

This is necessary as the sheet module is broken in wx 3.0.2 and improperly subclasses grid.GridCellEditor

EndEdit(row, col, grid, previous)[source]

Commit editing the current cell. Returns True if the value has changed.

Parameters:previous – previous value in the cell
PaintBackground(dc, rect, attr)[source]

Overrides wx.sheet.CCellEditor.PaintBackground which incorrectly calls the base class method.

In wx3.0 all paint objects must explicitly have a wxPaintDC (Device Context) object. Thus the paint event which generates a call to this method provides such a DC object and the base class in grid expects to receive that object. sheet was apparently not updated to reflect this and hence fails. This could thus become obsolete in a future bug fix of wxPython.

Apart from adding a dc variable in the list of arguments in the def and in the call to the base class the rest of this method is copied as is from sheet.CCellEditor.PaintBackground

From original GridCellEditor docs:

Draws the part of the cell not occupied by the edit control. The base class version just fills it with background colour from the attribute.

Note

There is no need to override this if you don’t need to do something out of the ordinary.

Parameters:dc – the wxDC object for the paint
class sas.sasgui.guiframe.data_processor.GridFrame(parent=None, data_inputs=None, data_outputs=None, id=-1, title='Batch Fitting Results Panel', size=(800, 500))[source]

Bases: wx._windows.Frame

The main wx.Frame for the batch results grid

GetLabelText(id)[source]

Get Label Text

add_edit_menu(menubar)[source]

populates the edit menu on the menubar. Not activated as of SasView 3.1.0

add_table(event)[source]

Add a new table

on_append_column(event)[source]

Append a new column to the grid

on_clear(event)[source]

On Clear from the Edit menu item on the menubar

on_close(event)[source]
on_copy(event)[source]

On Copy from the Edit menu item on the menubar

on_menu_open(event)[source]

On menu open

on_open(event)[source]

Open file containing batch result

on_paste(event)[source]

On Paste from the Edit menu item on the menubar

on_remove_column(event)[source]

On remove column from the Edit menu Item on the menubar

on_save_page(event)[source]

Saves data in grid to a csv file.

At this time only the columns displayed get saved. Thus any error bars not inserted before saving will not be saved in the file

open_with_excel(event)[source]

open excel and display batch result in Excel

set_data(data_inputs, data_outputs, details='', file_name=None)[source]

Set data

class sas.sasgui.guiframe.data_processor.GridPage(parent, panel=None)[source]

Bases: wx.lib.sheet.CSheet

Class that receives the results of a batch fit.

GridPage displays the received results in a wx.grid using sheet. This is then used by GridPanel and GridFrame to present the full GUI.

OnCellChange(event)[source]

Overrides sheet.CSheet.OnCellChange.

Processes when a cell has been edited by a cell editor. Checks for the edited row being outside the max row to use attribute and if so updates the last row. Then calls the base handler using skip.

OnLeftClick(event)[source]

Overrides sheet.CSheet.OnLefClick.

Processes when a cell is selected by left clicking on that cell. First process the base Sheet method then the current class specific method

get_grid_view()[source]

Return value contained in the grid

get_nofrows()[source]

Return number of total rows

insert_after_col_menu(menu, label, window)[source]

Method called to populate the ‘insert column after current column’ submenu

insert_col_menu(menu, label, window)[source]

method called to populate the ‘insert column before current column’ submenu.

insert_column(col, col_name)[source]

Insert column at position col with data[col_name] into the current grid.

onContextMenu(event)[source]

Method to handle cell right click context menu.

THIS METHOD IS NOT CURRENTLY USED. It is designed to provide a cell pop up context by right clicking on a cell and gives the option to cut, paste, and clear. This will probably be removed in future versions and is being superseded by more traditional cut and paste options.

on_clear(event)[source]

Called when clear cell is chosen from cell right click context menu

THIS METHOD IS NOT CURRENTLY USED. it is part of right click cell context menu which is being removed. This will probably be removed in future versions and is being superseded by more traditional cut and paste options

on_copy(event)[source]

Called when copy is chosen from cell right click context menu

THIS METHOD IS NOT CURRENTLY USED. it is part of right click cell context menu which is being removed. This will probably be removed in future versions and is being superseded by more traditional cut and paste options

on_insert_after_column(event)[source]

Called when user chooses insert ‘column after’ submenu of the column context menu obtained when right clicking on a given column header.

Sets up to insert column into the current grid after the current highlighted column location and sets up what to populate that column with. Then calls insert_column method to actually do the insertion.

on_insert_column(event)[source]

Called when user chooses insert ‘column before’ submenu of the column context menu obtained when right clicking on a given column header.

Sets up to insert column into the current grid before the current highlighted column location and sets up what to populate that column with. Then calls insert_column method to actually do the insertion.

on_left_click(event)[source]

Is triggered when the left mouse button is clicked while the mouse is hovering over the column ‘label.’

This processes the information on the selected column: the column name (in row 0 of column) and the range of cells with a valid value to be used by the GridPanel set_axis methods.

on_paste(event)[source]

Called when paste is chosen from cell right click context menu

THIS METHOD IS NOT CURRENTLY USED. it is part of right click cell context menu which is being removed. This will probably be removed in future versions and is being superseded by more traditional cut and paste options

on_remove_column(event=None)[source]

Called when user chooses remove from the column right click menu Checks the columnn exists then calls the remove_column method

on_right_click(event)[source]

Is triggered when the right mouse button is clicked while the mouse is hovering over the column ‘label.’

This brings up a context menu that allows the deletion of the column, or the insertion of a new column either to the right or left of the current column. If inserting a new column can insert a blank column or choose a number of hidden columns. By default all the error parameters are in hidden columns so as to save space on the grid. Also any other intrinsic variables stored with the data such as Temperature, pressure, time etc can be used to populate this menu.

on_selected_cell(event)[source]

Handler catching cell selection.

Called after calling base ‘on left click’ method.

on_set_x_axis(event)[source]

Just calls the panel version of the method

on_set_y_axis(event)[source]

Just calls the panel version of the method

remove_column(col, numCols=1)[source]

Remove the col column from the current grid

set_data(data_inputs, data_outputs, details, file_name)[source]

Add data to the grid

Parameters:
  • data_inputs – data to use from the context menu of the grid
  • data_ouputs – default columns displayed
set_grid_values()[source]

Set the values in grids

class sas.sasgui.guiframe.data_processor.GridPanel(parent, data_inputs=None, data_outputs=None, *args, **kwds)[source]

Bases: sas.sasgui.guiframe.data_processor.SPanel

A ScrolledPanel class that contains the grid sheet as well as a number of widgets to create interesting plots and buttons for help etc.

add_column()[source]
create_axis_label(cell_list)[source]

Receive a list of cells and create a string presenting the selected cells.

Parameters:cell_list – list of tuple
edit_axis_helper(tcrtl_label, tcrtl_title, label, title)[source]

get controls to modify

get_plot_axis(col, list)[source]
get_sentence(dict, sentence, column_names)[source]

Get sentence from dict

layout_grid()[source]

Draw the area related to the grid by adding it as the first element in the panel’s grid_sizer

layout_plotting_area()[source]

Add the area containing all the plot options, buttons etc to a plotting area sizer to later be added to the top level grid_sizer

on_edit_axis(event)[source]

Get the selected column on the visible grid and set values for axis

on_help(event)[source]

Bring up the Batch Grid Panel Usage Documentation whenever the HELP button is clicked.

Calls DocumentationWindow with the path of the location within the documentation tree (after /doc/ ....”. Note that when using old versions of Wx (before 2.9) and thus not the release version of installers, the help comes up at the top level of the file as webbrowser does not pass anything past the # to the browser when it is running “file:///....”

Parameters:evt – Triggers on clicking the help button
on_plot(event)[source]

Evaluate the contains of textcrtl and plot result

on_remove_column()[source]
on_view(event)[source]

Get object represented by the given cells and plot them. Basically plot the column in y vs the column in x.

set_dyaxis(label='', dy=None)[source]
set_xaxis(label='', x=None)[source]
set_yaxis(label='', y=None)[source]
class sas.sasgui.guiframe.data_processor.Notebook(parent, manager=None, data=None, *args, **kwargs)[source]

Bases: wx.aui.AuiNotebook, sas.sasgui.guiframe.panel_base.PanelBase

## Internal name for the AUI manager window_name = “Fit panel” ## Title to appear on top of the window

add_column()[source]

Append a new column to the grid

add_empty_page()[source]
create_axis_label(cell_list)[source]

Receive a list of cells and create a string presenting the selected cells that can be used as data for one axis of a plot.

Parameters:cell_list – list of tuple
enable_close_button()[source]

display the close button on the tab if more than 1 tab exits. Otherwise remove the close button

get_column_labels()[source]

return dictionary of columns labels on the current page

get_highlighted_row(is_number=True)[source]

Add highlight rows

get_odered_results(inputs, outputs=None)[source]

Order a list of ‘inputs.’ Used to sort rows and columns to present in batch results grid.

on_close_page(event)[source]

close the page

on_edit_axis()[source]

Return the select cell range from a given selected column. Checks that all cells are from the same column

on_remove_column()[source]

Remove the selected column from the grid

set_data(data_inputs, data_outputs, details='', file_name=None)[source]
window_caption = 'Notebook '
class sas.sasgui.guiframe.data_processor.SPanel(parent, *args, **kwds)[source]

Bases: wx.lib.scrolledpanel.ScrolledPanel

ensure proper scrolling of GridPanel

Adds a SetupScrolling call to the normal ScrolledPanel init. GridPanel then subclasses this class

sas.sasgui.guiframe.data_processor.parse_string(sentence, list)[source]

Return a dictionary of column label and index or row selected

Parameters:
  • sentence – String to parse
  • list – list of columns label
Returns:

col_dict

sas.sasgui.guiframe.data_state module

class sas.sasgui.guiframe.data_state.DataState(data=None, parent=None)[source]

Bases: object

Store information about data

clone()[source]
get_data()[source]
get_message()[source]

return message

get_name()[source]
get_path()[source]

return the path of the loaded data

get_theory()[source]
set_data(data)[source]
set_name(name)[source]
set_path(path)[source]

Set the path of the loaded data

set_theory(theory_data, theory_state=None)[source]

sas.sasgui.guiframe.documentation_window module

documentation module provides a simple means to add help throughout the application. It checks for the existence of html2 package needed to support fully html panel which supports css. The class defined here takes a title for the particular help panel, a pointer to the html documentation file of interest within the documentation tree along with a ‘command’ string such as a page anchor or a query string etc. The path to the doc directory is retrieved automatically by the class itself. Thus with these three pieces of information the class generates a panel with the appropriate title bar and help file formatted according the style sheets called in the html file. Finally, if an old version of Python is running and the html2 package is not available the class brings up the default browser and passes the file:/// string to it. In this case however the instruction portion is usually not passed for security reasons.

class sas.sasgui.guiframe.documentation_window.DocumentationWindow(parent, dummy_id, path, url_instruction, title, size=(850, 540))[source]

Bases: wx._windows.Frame

DocumentationWindow inherits from wx.Frame and provides a centralized coherent framework for all help documentation. Help files must be html files stored in an properly organized tree below the top ‘doc’ folder. In order to display the appropriate help file from anywhere in the gui, the code simply needs to know the location below the top level where the help file resides along with the name of the help file. called (self, parent, dummy_id, path, url_instruction, title, size=(850, 540))

Parameters:
  • path – path to html file beginning AFTER /doc/ and ending in the file.html.
  • url_instructions – anchor string or other query e.g. ‘#MyAnchor’
  • title – text to place in the title bar of the help panel
OnError(evt)[source]
sas.sasgui.guiframe.documentation_window.main()[source]

main loop function if running alone for testing.

sas.sasgui.guiframe.documentation_window.start_documentation_server(doc_root, port)[source]

sas.sasgui.guiframe.dummyapp module

Dummy application. Allows the user to set an external data manager

class sas.sasgui.guiframe.dummyapp.DummyView(redirect=False, filename=None, useBestVisual=False, clearSigInt=True)[source]

Bases: sas.sasgui.guiframe.gui_manager.SasViewApp

class sas.sasgui.guiframe.dummyapp.SasView[source]
class sas.sasgui.guiframe.dummyapp.TestPlugin(name='Test_plugin')[source]

Bases: sas.sasgui.guiframe.plugin_base.PluginBase

get_context_menu(graph=None)[source]

This method is optional.

When the context menu of a plot is rendered, the get_context_menu method will be called to give you a chance to add a menu item to the context menu.

A ref to a Graph object is passed so that you can investigate the plot content and decide whether you need to add items to the context menu.

This method returns a list of menu items. Each item is itself a list defining the text to appear in the menu, a tool-tip help text, and a call-back method.

Parameters:graph – the Graph object to which we attach the context menu
Returns:a list of menu items with call-back function
get_panels(parent)[source]

Create and return the list of wx.Panels for your plug-in. Define the plug-in perspective.

Panels should inherit from DefaultPanel defined below, or should present the same interface. They must define “window_caption” and “window_name”.

Parameters:parent – parent window
Returns:list of panels
get_tools()[source]

Returns a set of menu entries for tools

populate_menu(parent)[source]

Create and return the list of application menu items for the plug-in. :param parent: parent window

Returns:plug-in menu

sas.sasgui.guiframe.events module

sas.sasgui.guiframe.gui_manager module

Gui manager: manages the widgets making up an application

class sas.sasgui.guiframe.gui_manager.DefaultPanel(parent, *args, **kwds)[source]

Bases: wx._windows.Panel, sas.sasgui.guiframe.panel_base.PanelBase

Defines the API for a panels to work with the GUI manager

CENTER_PANE = True
window_caption = 'Welcome panel'
window_name = 'default'
class sas.sasgui.guiframe.gui_manager.MDIFrame(parent, panel, title='Untitled', size=(300, 200))[source]

Bases: wx._windows.MDIChildFrame

Frame for panels

OnClose(event)[source]

On Close event

set_panel(panel)[source]
set_panel_focus(event)[source]
show_data_panel(action)[source]

Turns on the data panel

The the data panel is optional. Most of its functions can be performed from the menu bar and from the plots.

class sas.sasgui.guiframe.gui_manager.SasViewApp(redirect=False, filename=None, useBestVisual=False, clearSigInt=True)[source]

Bases: wx._core.App

SasView application

OnInit()[source]

When initialised

add_perspective(perspective)[source]

Manually add a perspective to the application GUI

build_gui()[source]

Build the GUI

clean_plugin_models(path)[source]

Delete plugin models in app folder

Parameters:path – path of the plugin_models folder in app
display_splash_screen(parent, path='C:\\jenkins\\workspace\\SasView_Win7_Release\\sasview\\build\\lib.win-amd64-2.7\\sas\\sasview\\images\\SVwelcome_mini.png')[source]

Displays the splash screen. It will exactly cover the main frame.

maximize_win()[source]

Maximize the window after the frame shown

on_close_splash_screen(event)[source]

When the splash screen is closed.

open_file()[source]

open a state file at the start of the application

set_manager(manager)[source]

Sets a reference to the application manager of the GUI manager (Frame)

set_welcome_panel(panel_class)[source]

Set the welcome panel

Parameters:panel_class – class of the welcome panel to be instantiated
window_placement(size)[source]

Determines the position and size of the application frame such that it fits on the user’s screen without obstructing (or being obstructed by) the Windows task bar. The maximum initial size in pixels is bounded by WIDTH x HEIGHT. For most monitors, the application will be centered on the screen; for very large monitors it will be placed on the left side of the screen.

class sas.sasgui.guiframe.gui_manager.ViewerFrame(parent, title, size=(-1, -1), gui_style=381, style=541072960, pos=wx.Point(-1, -1))[source]

Bases: wx._windows.MDIParentFrame

Main application frame

Close(event=None)[source]

Quit the application

PopStatusText(*args, **kwds)[source]
PushStatusText(*args, **kwds)[source]
SetStatusText(*args, **kwds)[source]
WindowClose(event=None)[source]

Quit the application from x icon

add_data(data_list)[source]

receive a dictionary of data from loader store them its data manager if possible send to data the current active perspective if the data panel is not active. :param data_list: dictionary of data’s ID and value Data

add_data_helper(data_list)[source]
add_icon()[source]

get list of child and attempt to add the default icon

add_perspective(plugin)[source]

Add a perspective if it doesn’t already exist.

append_bookmark(event=None)[source]

Bookmark available information of the panel on focus

build_gui()[source]

Build the GUI by setting up the toolbar, menu and layout.

check_multimode(perspective=None)[source]

Check the perspective have batch mode capablitity

create_gui_data(data, path=None)[source]
delete_data(data)[source]

Delete the data.

delete_panel(uid)[source]

delete panel given uid

disable_app_menu(p_panel=None)[source]

Disables all menus in the menubar

enable_add_data(new_plot)[source]

Enable append data on a plot panel

enable_bookmark()[source]

Bookmark

enable_copy()[source]

enable copy related control

enable_drag(event=None)[source]

drag

enable_edit_menu()[source]

enable menu item under edit menu depending on the panel on focus

enable_paste()[source]

enable paste

enable_preview()[source]

preview

enable_print()[source]

print

enable_redo()[source]

enable redo

enable_reset()[source]

reset the current panel

enable_save()[source]

save

enable_undo()[source]

enable undo related control

enable_zoom()[source]

zoom

enable_zoom_in()[source]

zoom in

enable_zoom_out()[source]

zoom out

freeze(data_id, theory_id)[source]

Saves theory/model and passes to data loader.

..warning:: This seems to be the exact same code as the next function called simply freeze. This probably needs fixing

full_draw()[source]

Draw the panels with axes in the schedule to full dwar list

get_client_size()[source]

return client size tuple

get_context_menu(plotpanel=None)[source]

Get the context menu items made available by the different plug-ins. This function is used by the plotting module

get_current_context_menu(plotpanel=None)[source]

Get the context menu items made available by the current plug-in. This function is used by the plotting module

get_current_perspective()[source]

return the current perspective

get_data(path)[source]
get_data_manager()[source]

return the data manager.

get_paneinfo(name)[source]

Get pane Caption from window_name

Parameters:name – window_name in AuiPaneInfo
Returns:AuiPaneInfo of the name
get_save_location()[source]

return the _default_save_location

get_schedule()[source]

Get schedule

get_style()[source]

Return the gui style

get_toolbar()[source]

return the toolbar.

get_toolbar_height()[source]
get_window_size()[source]

Get window size

Returns:size
Return type:tuple
load_data(path)[source]

load data from command line

load_folder(path)[source]

Load entire folder

load_from_cmd(path)[source]

load data from cmd or application

load_state(path, is_project=False)[source]

load data from command line or application

on_batch_selection(event=None)[source]
Parameters:event – contains parameter enable. When enable is set to True the application is in Batch mode otherwise the application is in Single mode.
on_bookmark_panel(event=None)[source]

bookmark panel

on_category_panel(event)[source]

On cat panel

on_change_caption(name, old_caption, new_caption)[source]

Change the panel caption

Parameters:
  • name – window_name of the pane
  • old_caption – current caption [string]
  • new_caption – new caption [string]
on_change_categories(evt)[source]
on_close_welcome_panel()[source]

Close the welcome panel

on_color_selection(event)[source]
Parameters:event – contains parameters for id and color
on_copy_panel(event=None)[source]

copy the last panel on focus if possible

on_drag_panel(event=None)[source]

drag apply to the panel on focus

on_load_data(event)[source]

received an event to trigger load from data plugin

on_panel_close(event)[source]

Gets called when the close event for a panel runs. This will check which panel has been closed and delete it.

on_paste_panel(event=None)[source]

paste clipboard to the last panel on focus

on_preview_panel(event=None)[source]

preview information on the panel on focus

on_print_panel(event=None)[source]

print available information on the last panel on focus

on_read_batch_tofile(base)[source]

Open a file dialog , extract the file to read and display values into a grid

on_redo_panel(event=None)[source]

redo the last cancel action done on the last panel on focus

on_reset_panel(event=None)[source]

reset the current panel

on_save_helper(doc, reader, panel, path)[source]

Save state into a file

on_save_panel(event=None)[source]

save possible information on the current panel

on_set_batch_result(data_outputs, data_inputs=None, plugin_name='')[source]

Display data into a grid in batch mode and show the grid

on_set_plot_focus(panel)[source]

Set focus on a plot panel

on_undo_panel(event=None)[source]

undo previous action of the last panel on focus if possible

on_view(evt)[source]

A panel was selected to be shown. If it’s not already shown, display it.

Parameters:evt – menu event
on_zoom_in_panel(event=None)[source]

zoom in of the panel on focus

on_zoom_out_panel(event=None)[source]

zoom out on the panel on focus

on_zoom_panel(event=None)[source]

zoom on the current panel if possible

onfreeze(theory_id)[source]

Saves theory/model and passes to data loader.

..warning:: This seems to be the exact same code as the next function called simply freeze. This probably needs fixing

open_with_externalapp(data, file_name, details='')[source]

Display data in the another application , by default Excel

open_with_localapp(data_inputs=None, details='', file_name=None, data_outputs=None)[source]

Display value of data into the application grid :param data_inputs: dictionary of string and list of items :param details: descriptive string :param file_name: file name :param data_outputs: Data outputs

plot_data(state_id, data_id=None, theory_id=None, append=False)[source]

send a list of data to plot

popup_panel(p)[source]

Add a panel object to the AUI manager

Parameters:p – panel object to add to the AUI manager
Returns:ID of the event associated with the new panel [int]
post_init()[source]

This initialization method is called after the GUI has been created and all plug-ins loaded. It calls the post_init() method of each plug-in (if it exists) so that final initialization can be done.

put_icon(frame)[source]

Put icon on the tap of a panel

quit_guiframe()[source]

Pop up message to make sure the user wants to quit the application

read_batch_tofile(file_name)[source]

Extract value from file name and Display them into a grid

remove_data(data_id, theory_id=None)[source]

Delete data state if data_id is provide delete theory created with data of id data_id if theory_id is provide if delete all true: delete the all state else delete theory

reset_bookmark_menu(panel)[source]

Reset Bookmark menu list

: param panel: a control panel or tap where the bookmark is

save_data1d(data, fname)[source]

Save data dialog

save_data2d(data, fname)[source]

Save data2d dialog

send_focus_to_datapanel(name)[source]

Send focusing on ID to data explorer

set_current_perspective(perspective)[source]

set the current active perspective

set_custom_default_perspective()[source]

Set default starting perspective

set_data(data_id, theory_id=None)[source]

set data to current perspective

set_input_file(input_file)[source]
Parameters:input_file – file to read
set_manager(manager)[source]

Sets the application manager for this frame

Parameters:manager – frame manager
set_panel_on_focus(event)[source]

Store reference to the last panel on focus update the toolbar if available update edit menu if available

set_panel_on_focus_helper()[source]

Helper for panel on focus with data_panel

set_perspective(panels)[source]

Sets the perspective of the GUI. Opens all the panels in the list, and closes all the others.

Parameters:panels – list of panels
set_plot_unfocus()[source]

Un focus all plot panels

set_schedule(schedule=False)[source]

Set schedule

set_schedule_full_draw(panel=None, func='del')[source]

Add/subtract the schedule full draw list with the panel given

Parameters:
  • panel – plot panel
  • func – append or del [string]
set_theory(state_id, theory_id=None)[source]
setup_custom_conf()[source]

Set up custom configuration if exists

show_batch_frame(event=None)[source]

show the grid of result

show_data1d(data, name)[source]

Show data dialog

show_data2d(data, name)[source]

Show data dialog

show_data_panel(event=None, action=True)[source]

show the data panel

show_welcome_panel(event)[source]

Display the welcome panel

update_data(prev_data, new_data)[source]

Update the data.

update_theory(data_id, theory, state=None)[source]

Update the theory

write_batch_tofile(data, file_name, details='')[source]

Helper to write result from batch into cvs file

sas.sasgui.guiframe.gui_manager.custom_value(name, default=None)[source]

Fetch a config value from custom_config. Fallback to config, and then to default if it doesn’t exist in config.

sas.sasgui.guiframe.gui_statusbar module

Defines and draws the status bar that should appear along the bottom of the main SasView window.

class sas.sasgui.guiframe.gui_statusbar.Console(parent=None, status='', *args, **kwds)[source]

Bases: wx._windows.Frame

The main class defining the Console window.

Close(event)[source]

Calling close on the panel will hide the panel.

Parameters:event – A wx event.
set_message(status, event=None)[source]

Exposing the base ConsolePanel set_message

Parameters:
  • status – A status message to be sent to the console log.
  • event – A wx event.
set_multiple_messages(messages=[])[source]

Method to send an arbitrary number of messages to the console log

Parameters:messages – A list of strings to be sent to the console log.
class sas.sasgui.guiframe.gui_statusbar.ConsolePanel(parent, *args, **kwargs)[source]

Bases: wx._windows.Panel

Interaction class for adding messages to the Console log.

set_message(status='', event=None)[source]

Adds a message to the console log as well as the main sasview.log

Parameters:
  • status – A status message to be sent to the console log.
  • event – A wx event.
class sas.sasgui.guiframe.gui_statusbar.SPageStatusbar(parent, timeout=None, *args, **kwds)[source]

Bases: wx._windows.StatusBar

class sas.sasgui.guiframe.gui_statusbar.StatusBar(parent, id)[source]

Bases: wx._windows.StatusBar

Application status bar

PopStatusText(*args, **kwds)[source]

Override status bar

PushStatusText(*args, **kwds)[source]
SetStatusText(text='', number=1, event=None)[source]

Set the text that will be displayed in the status bar.

clear_gauge(msg='')[source]

Hide the gauge

enable_clear_gauge()[source]

clear the progress bar

get_msg_position()[source]

Get the last known message that was displayed on the console window.

on_idle(event)[source]

When the window is idle, check if the window has been resized

on_size(evt)[source]

If the window is resized, redraw the window.

reposition()[source]

Place the various fields in their proper position

set_dialog(event)[source]

Display dialogbox

set_gauge(event)[source]

change the state of the gauge according the state of the current job

set_icon(event)[source]

Display icons related to the type of message sent to the statusbar when available. No icon is displayed if the message is empty

set_message(event)[source]

display received message on the statusbar

set_status(event)[source]

Update the status bar .

Parameters:
  • type – type of message send. type must be in [“start”,”progress”,”update”,”stop”]
  • msg – the message itself as string
  • thread – if updatting using a thread status

sas.sasgui.guiframe.gui_style module

Provide the style for guiframe

class sas.sasgui.guiframe.gui_style.GUIFRAME[source]
CALCULATOR_ON = 256
DATALOADER_ON = 16
DEFAULT_STYLE = 92
FIXED_PANEL = 4
FLOATING_PANEL = 2
MANAGER_ON = 1
MULTIPLE_APPLICATIONS = 92
PLOTTING_ON = 8
SINGLE_APPLICATION = 64
TOOLBAR_ON = 32
WELCOME_PANEL_ON = 128
class sas.sasgui.guiframe.gui_style.GUIFRAME_ICON[source]
BOOKMARK_ICON = <wx._core.Image; proxy of <Swig Object of type 'wxImage *' at 0x116a0630> >
BOOKMARK_ICON_PATH = 'C:\\jenkins\\workspace\\SasView_Win7_Release\\sasview\\build\\lib.win-amd64-2.7\\sas\\sasgui\\guiframe\\images\\bookmark.png'
COPY_ICON = <wx._core.Image; proxy of <Swig Object of type 'wxImage *' at 0x116a05b0> >
COPY_ICON_PATH = 'C:\\jenkins\\workspace\\SasView_Win7_Release\\sasview\\build\\lib.win-amd64-2.7\\sas\\sasgui\\guiframe\\images\\copy.png'
DRAG_ICON = <wx._core.Image; proxy of <Swig Object of type 'wxImage *' at 0x116a05f0> >
DRAG_ID_PATH = 'C:\\jenkins\\workspace\\SasView_Win7_Release\\sasview\\build\\lib.win-amd64-2.7\\sas\\sasgui\\guiframe\\images\\drag_hand.png'
FRAME_ICON_PATH = 'C:\\jenkins\\workspace\\SasView_Win7_Release\\sasview\\build\\lib.win-amd64-2.7\\sas\\sasgui\\guiframe\\images\\ball.ico'
HIDE_ICON = <wx._core.Image; proxy of <Swig Object of type 'wxImage *' at 0x116a0770> >
HIDE_ID_PATH = 'C:\\jenkins\\workspace\\SasView_Win7_Release\\sasview\\build\\lib.win-amd64-2.7\\sas\\sasgui\\guiframe\\images\\hide.png'
PASTE_ICON = <wx._core.Image; proxy of <Swig Object of type 'wxImage *' at 0x116a05d0> >
PASTE_ICON_PATH = 'C:\\jenkins\\workspace\\SasView_Win7_Release\\sasview\\build\\lib.win-amd64-2.7\\sas\\sasgui\\guiframe\\images\\paste.png'
PATH = 'C:\\jenkins\\workspace\\SasView_Win7_Release\\sasview\\build\\lib.win-amd64-2.7\\sas\\sasgui\\guiframe\\images'
PREVIEW_ICON = <wx._core.Image; proxy of <Swig Object of type 'wxImage *' at 0x116a06b0> >
PREVIEW_ID_PATH = 'C:\\jenkins\\workspace\\SasView_Win7_Release\\sasview\\build\\lib.win-amd64-2.7\\sas\\sasgui\\guiframe\\images\\report.png'
PRINT_ICON = <wx._core.Image; proxy of <Swig Object of type 'wxImage *' at 0x116a0710> >
PRINT_ID_PATH = 'C:\\jenkins\\workspace\\SasView_Win7_Release\\sasview\\build\\lib.win-amd64-2.7\\sas\\sasgui\\guiframe\\images\\printer.png'
REDO_ICON = <wx._core.Image; proxy of <Swig Object of type 'wxImage *' at 0x116a0590> >
REDO_ICON_PATH = 'C:\\jenkins\\workspace\\SasView_Win7_Release\\sasview\\build\\lib.win-amd64-2.7\\sas\\sasgui\\guiframe\\images\\redo.png'
REPORT_ICON = <wx._core.Image; proxy of <Swig Object of type 'wxImage *' at 0x116a06f0> >
RESET_ICON = <wx._core.Image; proxy of <Swig Object of type 'wxImage *' at 0x116a0690> >
RESET_ID_PATH = 'C:\\jenkins\\workspace\\SasView_Win7_Release\\sasview\\build\\lib.win-amd64-2.7\\sas\\sasgui\\guiframe\\images\\reset.png'
SAVE_ICON = <wx._core.Image; proxy of <Swig Object of type 'wxImage *' at 0x116a0550> >
SAVE_ICON_PATH = 'C:\\jenkins\\workspace\\SasView_Win7_Release\\sasview\\build\\lib.win-amd64-2.7\\sas\\sasgui\\guiframe\\images\\save.png'
UNDO_ICON = <wx._core.Image; proxy of <Swig Object of type 'wxImage *' at 0x116a0570> >
UNDO_ICON_PATH = 'C:\\jenkins\\workspace\\SasView_Win7_Release\\sasview\\build\\lib.win-amd64-2.7\\sas\\sasgui\\guiframe\\images\\undo.png'
ZOOM_ICON = <wx._core.Image; proxy of <Swig Object of type 'wxImage *' at 0x116a0670> >
ZOOM_ID_PATH = 'C:\\jenkins\\workspace\\SasView_Win7_Release\\sasview\\build\\lib.win-amd64-2.7\\sas\\sasgui\\guiframe\\images\\search_pan.png'
ZOOM_IN_ICON = <wx._core.Image; proxy of <Swig Object of type 'wxImage *' at 0x116a0610> >
ZOOM_IN_ID_PATH = 'C:\\jenkins\\workspace\\SasView_Win7_Release\\sasview\\build\\lib.win-amd64-2.7\\sas\\sasgui\\guiframe\\images\\zoom_in.png'
ZOOM_OUT_ICON = <wx._core.Image; proxy of <Swig Object of type 'wxImage *' at 0x116a0650> >
ZOOM_OUT_ID_PATH = 'C:\\jenkins\\workspace\\SasView_Win7_Release\\sasview\\build\\lib.win-amd64-2.7\\sas\\sasgui\\guiframe\\images\\zoom_out.png'
class sas.sasgui.guiframe.gui_style.GUIFRAME_ID[source]
BOOKMARK_ID = 104
COPYAS_ID = 116
COPYEX_ID = 114
COPYLAT_ID = 115
COPY_ID = 102
CURRENT_APPLICATION = 113
CURVE_SYMBOL_NUM = 13
DRAG_ID = 109
PASTE_ID = 103
PREVIEW_ID = 111
PRINT_ID = 112
REDO_ID = 101
RESET_ID = 110
SAVE_ID = 105
UNDO_ID = 100
ZOOM_ID = 108
ZOOM_IN_ID = 106
ZOOM_OUT_ID = 107

sas.sasgui.guiframe.gui_toolbar module

class sas.sasgui.guiframe.gui_toolbar.GUIToolBar(parent, *args, **kwds)[source]

Bases: wx._controls.ToolBar

Implement toolbar for guiframe

ID_BOOKMARK = 138
add_bookmark_default()[source]

Add default items in bookmark menu

append_bookmark(event)[source]

receive item to append on the toolbar button bookmark

append_bookmark_item(id, label)[source]

Append a item in bookmark

do_layout()[source]
enable_bookmark(panel)[source]
enable_copy(panel)[source]
enable_paste(panel)[source]
enable_preview(panel)[source]
enable_print(panel)[source]
enable_redo(panel)[source]
enable_reset(panel)[source]
enable_save(panel)[source]
enable_undo(panel)[source]
enable_zoom(panel)[source]
enable_zoom_in(panel)[source]
enable_zoom_out(panel)[source]
get_bookmark_items()[source]

Get bookmark menu items

on_bind_button()[source]

Bind the buttons

on_bookmark(event)[source]

add book mark

remove_bookmark_item(item)[source]

Remove a bookmark item

update_button(application_name='', panel_name='')[source]
update_toolbar(panel=None)[source]
sas.sasgui.guiframe.gui_toolbar.clear_image(image)[source]

sas.sasgui.guiframe.panel_base module

class sas.sasgui.guiframe.panel_base.PanelBase(parent=None)[source]

Defines the API for a panels to work with the ViewerFrame toolbar and menu bar

get_bookmark_flag()[source]

Get the bookmark flag to update appropriately the tool bar

get_copy_flag()[source]

Get the copy flag to update appropriately the tool bar

get_data()[source]

return list of current data

get_drag_flag()[source]

Get the drag flag to update appropriately the tool bar

get_frame()[source]
get_manager()[source]
get_paste_flag()[source]

Get the copy flag to update appropriately the tool bar

get_preview_flag()[source]

Get the preview flag to update appropriately the tool bar

get_print_flag()[source]

Get the print flag to update appropriately the tool bar

get_redo_flag()[source]

Get the redo flag to update appropriately the tool bar

get_reset_flag()[source]

Get the reset flag to update appropriately the tool bar

get_save_flag()[source]

Get the save flag to update appropriately the tool bar

get_state()[source]

return the current state

get_undo_flag()[source]

Get the undo flag to update appropriately the tool bar

get_zoom_flag()[source]

Get the zoom flag to update appropriately the tool bar

get_zoom_in_flag()[source]

Get the zoom in flag to update appropriately the tool bar

get_zoom_out_flag()[source]

Get the zoom out flag to update appropriately the tool bar

group_id = None
has_changed()[source]
on_batch_selection(event)[source]
Parameters:event – contains parameter enable. When enable is set to True the application is in Batch mode otherwise the application is in Single mode.
on_bookmark(event)[source]

The derivative class is on bookmark mode if implemented

on_close(event)[source]

Close event. Hide the whole window.

on_copy(event)[source]

The copy action if possible

on_drag(event)[source]

The derivative class allows dragging motion if implemented

on_kill_focus(event=None)[source]

The derivative class is on unfocus if implemented

on_paste(event)[source]

The paste action if possible

on_preview(event)[source]

Display a printable version of the class derivative

on_redo(event)[source]

The previous action is restored if possible

on_reset(event)[source]

The derivative class state is restored

on_save(event)[source]

The state of the derivative class is restored

on_set_focus(event=None)[source]

The derivative class is on focus if implemented

on_tap_focus()[source]

Update menu on clicking the panel tap

on_undo(event)[source]

The current action is canceled

on_zoom(event)[source]

The derivative class is on zoom mode (using pane) if zoom mode is implemented

on_zoom_in(event)[source]

The derivative class is on zoom in mode if implemented

on_zoom_out(event)[source]

The derivative class is on zoom out mode if implemented

save_project(doc=None)[source]

return an xml node containing state of the panel that guiframe can write to file

set_manager(manager)[source]
uid = None

sas.sasgui.guiframe.pdfview module

class sas.sasgui.guiframe.pdfview.PDFFrame(parent, id, title, path)[source]

Bases: wx._windows.Frame

Frame for PDF panel

class sas.sasgui.guiframe.pdfview.PDFPanel(parent, path=None)[source]

Bases: wx._windows.Panel

Panel that contains the pdf reader

OnClose(event)[source]

Close panel

OnLoad(event=None, path=None)[source]

Load a pdf file

: Param path: full path to the file

OnNextPageButton(event)[source]

Goes to Next page

OnOpenButton(event)[source]

Open file button

OnPrevPageButton(event)[source]

Goes to Previous page

class sas.sasgui.guiframe.pdfview.TextFrame(parent, id, title, text)[source]

Bases: wx._windows.Frame

Frame for PDF panel

class sas.sasgui.guiframe.pdfview.TextPanel(parent, text=None)[source]

Bases: wx.lib.scrolledpanel.ScrolledPanel

Panel that contains the text

OnClose(event)[source]

Close panel

class sas.sasgui.guiframe.pdfview.ViewApp(redirect=False, filename=None, useBestVisual=False, clearSigInt=True)[source]

Bases: wx._core.App

OnInit()[source]

sas.sasgui.guiframe.plugin_base module

Defines the interface for a Plugin class that can be used by the gui_manager.

class sas.sasgui.guiframe.plugin_base.PluginBase(name='Test_plugin')[source]

Bases: object

This class defines the interface for a Plugin class that can be used by the gui_manager.

Plug-ins should be placed in a sub-directory called “perspectives”. For example, a plug-in called Foo should be place in “perspectives/Foo”. That directory contains at least two files:

  1. perspectives/Foo/__init__.py contains two lines:

    PLUGIN_ID = "Foo plug-in 1.0"
    from Foo import *
    
  2. perspectives/Foo/Foo.py contains the definition of the Plugin class for the Foo plug-in. The interface of that Plugin class should follow the interface of the class you are looking at.

See dummyapp.py for a plugin example.

add_color(color, id)[source]

Adds color to a plugin

can_load_data()[source]

if return True, then call handler to load data

clear_panel()[source]

clear all related panels

delete_data(data_id)[source]

Delete all references of data which id are in data_list.

get_batch_capable()[source]

Check if the plugin has a batch capability

get_context_menu(plotpanel=None)[source]

This method is optional.

When the context menu of a plot is rendered, the get_context_menu method will be called to give you a chance to add a menu item to the context menu.

A ref to a plotpanel object is passed so that you can investigate the plot content and decide whether you need to add items to the context menu.

This method returns a list of menu items. Each item is itself a list defining the text to appear in the menu, a tool-tip help text, and a call-back method.

Parameters:graph – the Graph object to which we attach the context menu
Returns:a list of menu items with call-back function
get_extensions()[source]

return state reader and its extensions

get_frame()[source]

Returns MDIChildFrame

get_panels(parent)[source]

Create and return the list of wx.Panels for your plug-in. Define the plug-in perspective.

Panels should inherit from DefaultPanel defined below, or should present the same interface. They must define “window_caption” and “window_name”.

Parameters:parent – parent window
Returns:list of panels
get_perspective()[source]

Get the list of panel names for this perspective

get_tools()[source]

Returns a set of menu entries for tools

is_always_active()[source]

return True is this plugin is always active and it is local to guiframe even if the user is switching between perspectives

is_in_use(data_id)[source]
get a data id a list of data name if data data is
currently used by the plugin and the name of the plugin

data_name = ‘None’ in_use = False example [(data_name, self.sub_menu)]

load_data(event)[source]

Load data

load_folder(event)[source]

Load entire folder

on_batch_selection(flag)[source]

need to be overwritten by the derivated class

on_perspective(event=None)[source]

Call back function for the perspective menu item. We notify the parent window that the perspective has changed.

Parameters:event – menu event
on_set_state_helper(event)[source]

update state

populate_file_menu()[source]

Append menu item under file menu item of the frame

populate_menu(parent)[source]

Create and return the list of application menu items for the plug-in.

Parameters:parent – parent window
Returns:plug-in menu
post_init()[source]

Post initialization call back to close the loose ends

set_batch_selection(flag)[source]

the plugin to its batch state if flag is True

set_data(data_list=None)[source]

receive a list of data and use it in the current perspective

set_is_active(active=False)[source]

Set if the perspective is always active

set_state(state=None, datainfo=None)[source]

update state

set_theory(theory_list=None)[source]
Parameters:theory_list – list of information related to available theory state
use_data()[source]

return True if these plugin use data

sas.sasgui.guiframe.proxy module

class sas.sasgui.guiframe.proxy.Connection(url, timeout)[source]

Bases: object

connect()[source]

Performs the request and gets a response from self.url @return: response object from urllib2.urlopen

sas.sasgui.guiframe.proxy.logger = <logging.Logger object at 0x00000000158EF5C0>

HTTP Proxy parser and Connection

connect() function:
  • auto detects proxy in windows, osx
  • in ux systems, the http_proxy environment variable must be set
  • if it fails, try to find the proxy.pac address. - parses the file, and looks up for all possible proxies

sas.sasgui.guiframe.report_dialog module

Base class for reports. Child classes will need to implement the onSave() method.

class sas.sasgui.guiframe.report_dialog.BaseReportDialog(report_list, imgRAM, fig_urls, *args, **kwds)[source]

Bases: wx._windows.Dialog

HTML2PDF(data, filename)[source]

Create a PDF file from html source string. Returns True is the file creation was successful. : data: html string : filename: name of file to be saved

onClose(event=None)[source]

Close the Dialog : event: Close button event

onPreview(event=None)[source]

Preview : event: Preview button event

onPrint(event=None)[source]

Print : event: Print button event

sas.sasgui.guiframe.report_image_handler module

class sas.sasgui.guiframe.report_image_handler.ReportImageHandler[source]
static check_for_empty_instance()[source]
instance = None
static remove_figure(fig_url)[source]
static set_figs(figs, bitmaps, perspective)[source]

sas.sasgui.guiframe.startup_configuration module

sas.sasgui.guiframe.startup_configuration.PANEL_HEIGHT = 215

Dialog to set Appication startup configuration

class sas.sasgui.guiframe.startup_configuration.StartupConfiguration(parent, gui, id=-1, title='Startup Setting')[source]

Bases: wx._windows.Dialog

Dialog for Startup Configuration

OnCurrent(event=None)[source]

Set to curent setup

OnDefault(event=None)[source]

Set to default

write_custom_config()[source]

Write custom configuration

sas.sasgui.guiframe.utils module

Contains common classes and functions

class sas.sasgui.guiframe.utils.IdList[source]

Create a list of wx ids that can be reused.

Ids for items need to be unique within their context. In a dynamic application where the number of ids needed different each time the form is created, depending for example, on the number of items that need to be shown in the context menu, you cannot preallocate the ids that you are going to use for the form. Instead, you can use an IdList, which will reuse ids from context to context, adding new ones if the new context requires more than a previous context.

IdList is set up as an iterator, which returns new ids forever or until it runs out. This makes it pretty useful for defining menus:

class Form(wx.Dialog):
    _form_id_pool = IdList()
    def __init__(self):
        ...
        menu = wx.Menu()
        for item, wx_id in zip(menu_items, self._form_id_pool):
            name, description, callback = item
            menu.Append(wx_id, name, description)
            wx.EVT_MENU(self, wx_id, callback)
        ...

It is a little unusual to use an iterator outside of a loop, but it is supported. For example, when defining a form, your class definition might look something like:

class Form(wx.Dialog):
    _form_id_pool = IdList()
    def __init__(self, pairs, ...):
        ids = iter(_form_id_pool)
        ...
        wx.StaticText(self, ids.next(), "Some key-value pairs")
        for name, value in pairs:
            label = wx.StaticText(self, ids.next(), name)
            input = wx.TextCtrl(self, ids.next(), value=str(value))
            ...
        ...

If the dialog is really dynamic, and not defined all in one place, then save the id list iterator as self._ids = iter(_form_id_pool) in the constructor.

The wx documentation is not clear on whether ids need to be unique. Clearly different dialogs can use the same ids, as this is done for the standard button ids such as wx.ID_HELP. Presumably each widget on the form needs its own id, but whether these ids can match the ids of menu items is not indicated, or whether different submenus need their own ids. Using different id lists for menu items and widgets is safest, but probably not necessary. And what about notebook tabs. Do the ids need to be unique across all tabs?

class sas.sasgui.guiframe.utils.PanelMenu(*args, **kwargs)[source]

Bases: wx._core.Menu

graph = None
plots = None
set_graph(graph)[source]
set_plots(plots)[source]
sas.sasgui.guiframe.utils.check_float(item)[source]
Parameters:item – txtcrtl containing a value
sas.sasgui.guiframe.utils.check_int(item)[source]
Parameters:item – txtcrtl containing a value
sas.sasgui.guiframe.utils.format_number(value, high=False)[source]

Return a float in a standardized, human-readable formatted string

sas.sasgui.guiframe.utils.look_for_tag(string1, begin, end=None)[source]

this method remove the begin and end tags given by the user from the string .

Parameters:
  • begin – the initial tag
  • end – the final tag
  • string – the string to check
Returns:

begin_flag==True if begin was found, end_flag==if end was found else return false, false

sas.sasgui.guiframe.utils.parse_name(name, expression)[source]

remove “_” in front of a name

sas.sasgui.guiframe.utils.split_list(separator, mylist, n=0)[source]

returns a list of string without white space of separator

Parameters:separator – the string to remove
sas.sasgui.guiframe.utils.split_text(separator, string1, n=0)[source]

return a list of string without white space of separator

Parameters:separator – the string to remove

Module contents

sas.sasgui.guiframe.data_files()[source]

Return the data files associated with guiframe images .

The format is a list of (directory, [files...]) pairs which can be used directly in setup(...,data_files=...) for setup.py.

sas.sasgui.guiframe.get_data_path(media)[source]
sas.sasgui.guiframe.get_media_path(media)[source]