sas.guiframe package

Subpackages

Submodules

sas.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.guiframe.CategoryInstaller.CategoryInstaller[source]

Class for making sure all category stuff is installed

Note - class is entirely static!

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

the main method of this class makes sure serialized_cat.json exists and if not compile it and install :param homefile: Override the default home directory :param model_list: List of model names except customized models

static get_default_file()[source]

returns the path of the default file e.g. blahblah/default_categories.json

static get_user_file()[source]

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

sas.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.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.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.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.guiframe.CategoryManager.IS_MAC = True

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.guiframe.aboutbox module

class sas.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.guiframe.aboutbox.MyApp(redirect=False, filename=None, useBestVisual=False, clearSigInt=True)[source]

Bases: wx._core.App

OnInit()[source]
sas.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.guiframe.config module

Application settings

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

sas.guiframe.custom_pstats module

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

Bases: pstats.Stats

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

sas.guiframe.customdir module

class sas.guiframe.customdir.SetupCustom[source]

Bases: object

implement custom config dir

find_dir()[source]
setup_dir(path)[source]

sas.guiframe.dataFitting module

Adapters for fitting module

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

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

copy_from_datainfo(data1d)[source]

copy values of Data1D of type DataLaoder.Data_info

class sas.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.plottools.plottables.Data2D, sas.dataloader.data_info.Data2D

copy_from_datainfo(data2d)[source]

copy value of Data2D of type DataLoader.data_info

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

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

copy_from_datainfo(data1d)[source]

copy values of Data1D of type DataLaoder.Data_info

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

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

sas.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.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.guiframe.data_panel module

This module provides Graphic interface for the data_manager module.

class sas.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.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.guiframe.data_panel.DataPanel(parent, list=None, size=(255, 750), id=-1, list_of_perspective=None, manager=None, *args, **kwds)[source]

Bases: wx.lib.scrolledpanel.ScrolledPanel, sas.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_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)[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.guiframe.data_panel.DataTreeCtrl(parent, *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.guiframe.data_panel.State[source]

DataPanel State

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

Set data state

sas.guiframe.data_processor module

Implement grid used to store data

class sas.guiframe.data_processor.BatchCell[source]

Object describing a cell in the grid.

class sas.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.guiframe.data_processor.GridFrame(parent=None, data_inputs=None, data_outputs=None, id=-1, title='Grid Window', size=(800, 500))[source]

Bases: wx._windows.Frame

GetLabelText(id)[source]

Get Label Text

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

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

On Copy

on_menu_open(event)[source]

On menu open

on_open(event)[source]

Open file containg batch result

on_paste(event)[source]

On Paste

on_remove_column(event)[source]

On remove column

on_save_page(event)[source]
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.guiframe.data_processor.GridPage(parent, panel=None)[source]

Bases: wx.lib.sheet.CSheet

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]
insert_col_menu(menu, label, window)[source]
insert_column(col, col_name)[source]
onContextMenu(event)[source]

Default context menu

on_clear(event)[source]

Clear the cells selected

on_copy(event)[source]

On copy event from the contextmenu

on_edit_cell(event)[source]
on_insert_after_column(event)[source]

Insert the given column after the highlighted column

on_insert_column(event)[source]
on_left_click(event)[source]

Catch the left click on label mouse event

on_paste(event)[source]

On paste event from the contextmenu

on_remove_column(event=None)[source]
on_right_click(event)[source]

Catch the right click mouse

on_selected_cell(event)[source]

Handler catching cell selection

on_set_x_axis(event)[source]
on_set_y_axis(event)[source]
remove_column(col, numCols=1)[source]

Remove column to the current grid

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

Add data to the grid :param data_inputs: data to use from the context menu of the grid :param data_ouputs: default columns deplayed

set_grid_values()[source]

Set the values in grids

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

Bases: sas.guiframe.data_processor.SPanel

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

Receive a list of cells and create a string presenting the selected cells. :param 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

layout_plotting_area()[source]

Draw area containing options to plot

on_edit_axis(event)[source]

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

on_plot(event)[source]

Evaluate the contains of textcrtl and plot result

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

Get object represented buy the given cell and plot them.

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

Bases: wx.aui.AuiNotebook, sas.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. :param cell_list: list of tuple

enable_close_button()[source]

display the close button on tab for more than 1 tabs else remove the close button

get_column_labels()[source]

return dictionary of columns labels of the current page

get_highlighted_row(is_number=True)[source]

Add highlight rows

get_odered_results(inputs, outputs=None)[source]

Get ordered the results

on_close_page(event)[source]

close the page

on_edit_axis()[source]

Return the select cell of a given selected column. Check 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.guiframe.data_processor.SPanel(parent, *args, **kwds)[source]

Bases: wx.lib.scrolledpanel.ScrolledPanel

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

Return a dictionary of column label and index or row selected :param sentence: String to parse :param list: list of columns label

sas.guiframe.data_state module

class sas.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.guiframe.documentation_window module

class sas.guiframe.documentation_window.DocumentationWindow(parent, id, path, title='Help', size=(850, 540))[source]

Bases: wx._windows.Frame

sas.guiframe.dummyapp module

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

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

Bases: sas.guiframe.gui_manager.ViewApp

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

Bases: sas.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.guiframe.events module

sas.guiframe.gui_manager module

Gui manager: manages the widgets making up an application

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

Bases: wx._windows.Panel, sas.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.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]
class sas.guiframe.gui_manager.ViewApp(redirect=False, filename=None, useBestVisual=False, clearSigInt=True)[source]

Bases: wx._core.App

Toy application to test this Frame

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='/Users/andrewjackson/Devel/sasview/build/lib.macosx-10.5-x86_64-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.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]

FIXME: No message is passed. What is this supposed to do?

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]
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

: return: 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

Return size: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 else the application is default mode(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]
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: dictionary of string and list of items

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_default_perspective()[source]

Choose among the plugin the first plug-in that has “set_default_perspective” method and its return value is True will be as a default perspective when the welcome page is closed

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.guiframe.gui_manager.get_app_dir()[source]

The application directory is the one where the default custom_config.py file resides.

sas.guiframe.gui_manager.get_user_directory()[source]

Returns the user’s home directory

sas.guiframe.gui_statusbar module

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

Bases: wx._windows.Frame

Close(event)[source]
set_message(status, event=None)[source]
set_multiple_messages(messages=[])[source]
class sas.guiframe.gui_statusbar.ConsolePanel(parent, *args, **kwargs)[source]

Bases: wx._windows.Panel

set_message(status='', event=None)[source]
class sas.guiframe.gui_statusbar.SPageStatusbar(parent, timeout=None, *args, **kwds)[source]

Bases: wx._windows.StatusBar

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

Bases: wx._windows.StatusBar

Application status bar

OnIdle(event)[source]
OnSize(evt)[source]
PopStatusText(*args, **kwds)[source]

Override status bar

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

Hide the gauge

enable_clear_gauge()[source]

clear the progress bar

get_msg_position()[source]
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.guiframe.gui_style module

Provide the style for guiframe

class sas.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.guiframe.gui_style.GUIFRAME_ICON[source]
BOOKMARK_ICON = <wx._core.Image; proxy of <Swig Object of type 'wxImage *' at 0x1006e1210> >
BOOKMARK_ICON_PATH = '/Users/andrewjackson/Devel/sasview/build/lib.macosx-10.5-x86_64-2.7/sas/guiframe/images/bookmark.png'
COPY_ICON = <wx._core.Image; proxy of <Swig Object of type 'wxImage *' at 0x10a214c00> >
COPY_ICON_PATH = '/Users/andrewjackson/Devel/sasview/build/lib.macosx-10.5-x86_64-2.7/sas/guiframe/images/copy.png'
DRAG_ICON = <wx._core.Image; proxy of <Swig Object of type 'wxImage *' at 0x100721050> >
DRAG_ID_PATH = '/Users/andrewjackson/Devel/sasview/build/lib.macosx-10.5-x86_64-2.7/sas/guiframe/images/drag_hand.png'
FRAME_ICON_PATH = '/Users/andrewjackson/Devel/sasview/build/lib.macosx-10.5-x86_64-2.7/sas/guiframe/images/ball.ico'
HIDE_ICON = <wx._core.Image; proxy of <Swig Object of type 'wxImage *' at 0x10a4f6cf0> >
HIDE_ID_PATH = '/Users/andrewjackson/Devel/sasview/build/lib.macosx-10.5-x86_64-2.7/sas/guiframe/images/hide.png'
PASTE_ICON = <wx._core.Image; proxy of <Swig Object of type 'wxImage *' at 0x1006becb0> >
PASTE_ICON_PATH = '/Users/andrewjackson/Devel/sasview/build/lib.macosx-10.5-x86_64-2.7/sas/guiframe/images/paste.png'
PATH = '/Users/andrewjackson/Devel/sasview/build/lib.macosx-10.5-x86_64-2.7/sas/guiframe/images'
PREVIEW_ICON = <wx._core.Image; proxy of <Swig Object of type 'wxImage *' at 0x10a4d0430> >
PREVIEW_ID_PATH = '/Users/andrewjackson/Devel/sasview/build/lib.macosx-10.5-x86_64-2.7/sas/guiframe/images/report.png'
PRINT_ICON = <wx._core.Image; proxy of <Swig Object of type 'wxImage *' at 0x104b324a0> >
PRINT_ID_PATH = '/Users/andrewjackson/Devel/sasview/build/lib.macosx-10.5-x86_64-2.7/sas/guiframe/images/printer.png'
REDO_ICON = <wx._core.Image; proxy of <Swig Object of type 'wxImage *' at 0x104b91fa0> >
REDO_ICON_PATH = '/Users/andrewjackson/Devel/sasview/build/lib.macosx-10.5-x86_64-2.7/sas/guiframe/images/redo.png'
REPORT_ICON = <wx._core.Image; proxy of <Swig Object of type 'wxImage *' at 0x10a424a10> >
RESET_ICON = <wx._core.Image; proxy of <Swig Object of type 'wxImage *' at 0x10a46fef0> >
RESET_ID_PATH = '/Users/andrewjackson/Devel/sasview/build/lib.macosx-10.5-x86_64-2.7/sas/guiframe/images/reset.png'
SAVE_ICON = <wx._core.Image; proxy of <Swig Object of type 'wxImage *' at 0x10a221a80> >
SAVE_ICON_PATH = '/Users/andrewjackson/Devel/sasview/build/lib.macosx-10.5-x86_64-2.7/sas/guiframe/images/save.png'
UNDO_ICON = <wx._core.Image; proxy of <Swig Object of type 'wxImage *' at 0x108d88e10> >
UNDO_ICON_PATH = '/Users/andrewjackson/Devel/sasview/build/lib.macosx-10.5-x86_64-2.7/sas/guiframe/images/undo.png'
ZOOM_ICON = <wx._core.Image; proxy of <Swig Object of type 'wxImage *' at 0x10a2c0e30> >
ZOOM_ID_PATH = '/Users/andrewjackson/Devel/sasview/build/lib.macosx-10.5-x86_64-2.7/sas/guiframe/images/search_pan.png'
ZOOM_IN_ICON = <wx._core.Image; proxy of <Swig Object of type 'wxImage *' at 0x10a4e8a70> >
ZOOM_IN_ID_PATH = '/Users/andrewjackson/Devel/sasview/build/lib.macosx-10.5-x86_64-2.7/sas/guiframe/images/zoom_in.png'
ZOOM_OUT_ICON = <wx._core.Image; proxy of <Swig Object of type 'wxImage *' at 0x10931d840> >
ZOOM_OUT_ID_PATH = '/Users/andrewjackson/Devel/sasview/build/lib.macosx-10.5-x86_64-2.7/sas/guiframe/images/zoom_out.png'
class sas.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.guiframe.gui_toolbar module

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

Bases: wx._controls.ToolBar

Implement toolbar for guiframe

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.guiframe.gui_toolbar.clear_image(image)[source]

sas.guiframe.panel_base module

class sas.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 else the application is default mode(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.guiframe.pdfview module

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

Bases: wx._windows.Frame

Frame for PDF panel

class sas.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.guiframe.pdfview.TextFrame(parent, id, title, text)[source]

Bases: wx._windows.Frame

Frame for PDF panel

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

Bases: wx.lib.scrolledpanel.ScrolledPanel

Panel that contains the text

OnClose(event)[source]

Close panel

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

Bases: wx._core.App

OnInit()[source]

sas.guiframe.plugin_base module

class sas.guiframe.plugin_base.PluginBase(name='Test_plugin', standalone=True)[source]

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 laod 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_default_perspective()[source]

Call back method that True to notify the parent that the current plug-in can be set as default perspective. when returning False, the plug-in is not candidate for an automatic default perspective setting

set_is_active(active=False)[source]
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.guiframe.startup_configuration module

sas.guiframe.startup_configuration.PANEL_HEIGHT = 215

Dialog to set Appication startup configuration

class sas.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

write_string(fname, strings)[source]

Write and Save file

sas.guiframe.utils module

Contains common classes and functions

class sas.guiframe.utils.PanelMenu(self, String title=EmptyString, long style=0)[source]

Bases: wx._core.Menu

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

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

sas.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.guiframe.utils.parse_name(name, expression)[source]

remove “_” in front of a name

sas.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.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.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.guiframe.get_data_path(media)[source]
sas.guiframe.get_media_path(media)[source]