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 for making sure all category stuff is installed
Note - class is entirely static!
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
returns the path of the default file e.g. blahblah/default_categories.json
returns the user data file, eg .sasview/serialized_cat.json
This software was developed by Institut Laue-Langevin as part of Distributed Data Analysis of Neutron Scattering Experiments (DANSE).
Copyright 2012 Institut Laue-Langevin
Bases: wx._windows.Frame
A class for managing categories
modify_dialog onclose
Bases: wx._windows.Dialog
dialog for changing the categories of a model
Returns a list of categories applying to this model
Callback for new category added
Callback for existing category selected
Callback for new category added
On OK pressed (MAC only)
Callback for a category removed
Bases: wx._controls.ListCtrl, wx.lib.mixins.listctrl.CheckListCtrlMixin, wx.lib.mixins.listctrl.ListCtrlAutoWidthMixin
Taken from http://zetcode.com/wxpython/advanced/
When the user checks the item we need to save that state
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)
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
Bases: wx._core.App
Launches browser and opens specified url
In some cases may require BROWSER environment variable to be set up.
Parameters: | url – URL to open |
---|
Bases: pstats.Stats
Adapters for fitting module
Bases: sas.plottools.plottables.Data1D, sas.dataloader.data_info.Data1D
copy values of Data1D of type DataLaoder.Data_info
Bases: sas.plottools.plottables.Data2D, sas.dataloader.data_info.Data2D
copy value of Data2D of type DataLoader.data_info
Bases: sas.plottools.plottables.Theory1D, sas.dataloader.data_info.Data1D
copy values of Data1D of type DataLaoder.Data_info
Return True is data is valid enough to compute chisqr, else False
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.
Bases: object
Manage a list of data
receive a list of
Receive data from loader and create a data to use for guiframe
save data and path
save data and path
return list of all available data
return a list of data given a list of data names
Send list of selected data
return message
rename data
This module provides Graphic interface for the data_manager module.
Bases: wx._windows.Dialog
Allow file selection at loading time
return the selected data
Bases: wx._windows.Frame
Data Frame
Fill the list inside its panel
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 object under data from a state of id = state_id replace that theory if already displayed
Append theory helper
Check_theory_to_freeze
Define the skeleton of the panel
Disable app combo box
Create the panel layout
enable or disable append button
enable or disable the freeze button
enable or disable send button
enable or disable plot button
enable or disable remove button
enable remove plot button if there is a plot panel on focus
enable or disable combobo box selection
fill the combobox with analysis name
Set up batch mode options
Layout widgets related to buttons
Add a listcrtl in the panel
Create selection option combo box
add need data with its theory under the tree
Pop up an error message.
Parameters: | error – details error message to be displayed |
---|
Retrieve the state selected state
append plot to plot panel on focus
Change to batch mode :param event: UI event
On check item
On close event
On close
clseo the panel on focus
Data Info panel
Pop Up Data Editor
On freeze to make a theory to a data set
Get all select data and set them to the current active perspetive
Send a list of data names to plot
Frozen image of 3D
Frozen plot
Get a list of item checked and remove them from the treectrl Ask the parent to remove reference to this item
Allow Editing Data
On click theory data
Save data as a file
Change to single mode :param event: UI event
Remove_dat by id
set the active perspective
Set data helper
set the plot panel on focus
Unfocus plot
Send full draw to guimanager
show load data and remove data button if dataloader on else hide them
Bases: wx.lib.agw.customtreectrl.CustomTreeCtrl
Check list control to be used for Data Panel
Overrides OnCompareItems in wx.TreeCtrl. Used by the SortChildren method.
DataPanel State
Set data state
Implement grid used to store data
Object describing a cell in the grid.
Bases: wx._windows.Frame
Allow to select where the result of batch will be displayed or stored
Get the user selection and display output to the selected application
close the Window
Receive event and display data into third party application or save data to file.
Bases: wx._windows.Frame
Get Label Text
Add a new table
Append a new column to the grid
On Clear
On Copy
On menu open
Open file containg batch result
On Paste
On remove column
open excel and display batch result in Excel
Set data
Bases: wx.lib.sheet.CSheet
Return value contained in the grid
Return number of total rows
Default context menu
Clear the cells selected
On copy event from the contextmenu
Insert the given column after the highlighted column
Catch the left click on label mouse event
On paste event from the contextmenu
Catch the right click mouse
Handler catching cell selection
Remove column to the current grid
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 the values in grids
Bases: sas.guiframe.data_processor.SPanel
Receive a list of cells and create a string presenting the selected cells. :param cell_list: list of tuple
get controls to modify
Get sentence from dict
Draw the area related to the grid
Draw area containing options to plot
Get the selected column on the visible grid and set values for axis
Evaluate the contains of textcrtl and plot result
Get object represented buy the given cell and plot them.
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
Append a new column to the grid
Receive a list of cells and create a string presenting the selected cells. :param cell_list: list of tuple
display the close button on tab for more than 1 tabs else remove the close button
return dictionary of columns labels of the current page
Add highlight rows
Get ordered the results
close the page
Return the select cell of a given selected column. Check that all cells are from the same column
Remove the selected column from the grid
Bases: wx.lib.scrolledpanel.ScrolledPanel
Return a dictionary of column label and index or row selected :param sentence: String to parse :param list: list of columns label
Bases: object
Store information about data
return message
return the path of the loaded data
Set the path of the loaded data
Bases: wx._windows.Frame
Dummy application. Allows the user to set an external data manager
Bases: sas.guiframe.plugin_base.PluginBase
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 |
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 |
Returns a set of menu entries for tools
Create and return the list of application menu items for the plug-in. :param parent: parent window
Returns: | plug-in menu |
---|
Gui manager: manages the widgets making up an application
Bases: wx._windows.Panel, sas.guiframe.panel_base.PanelBase
Defines the API for a panels to work with the GUI manager
Bases: wx._windows.MDIChildFrame
Frame for panels
On Close event
Bases: wx._core.App
Toy application to test this Frame
When initialised
Manually add a perspective to the application GUI
Build the GUI
Delete plugin models in app folder
Parameters: | path – path of the plugin_models folder in app |
---|
Displays the splash screen. It will exactly cover the main frame.
Maximize the window after the frame shown
When the splash screen is closed.
open a state file at the start of the application
Sets a reference to the application manager of the GUI manager (Frame)
Set the welcome panel
Parameters: | panel_class – class of the welcome panel to be instantiated |
---|
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.
Bases: wx._windows.MDIParentFrame
Main application frame
Quit the application
FIXME: No message is passed. What is this supposed to do?
Quit the application from x icon
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
get list of child and attempt to add the default icon
Add a perspective if it doesn’t already exist.
Bookmark available information of the panel on focus
Build the GUI by setting up the toolbar, menu and layout.
Check the perspective have batch mode capablitity
Delete the data.
delete panel given uid
Disables all menus in the menubar
Enable append data on a plot panel
Bookmark
enable copy related control
drag
enable menu item under edit menu depending on the panel on focus
enable paste
preview
enable redo
reset the current panel
save
enable undo related control
zoom
zoom in
zoom out
Draw the panels with axes in the schedule to full dwar list
return client size tuple
Get the context menu items made available by the different plug-ins. This function is used by the plotting module
Get the context menu items made available by the current plug-in. This function is used by the plotting module
return the current perspective
return the data manager.
Get pane Caption from window_name
Parameters: | name – window_name in AuiPaneInfo |
---|
: return: AuiPaneInfo of the name
return the _default_save_location
Get schedule
Return the gui style
return the toolbar.
Get window size
Return size: | tuple |
---|
load data from command line
Load entire folder
load data from cmd or application
load data from command line or application
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)
bookmark panel
On cat panel
Change the panel caption
Parameters: |
|
---|
Close the welcome panel
Parameters: | event – contains parameters for id and color |
---|
copy the last panel on focus if possible
drag apply to the panel on focus
received an event to trigger load from data plugin
Gets called when the close event for a panel runs. This will check which panel has been closed and delete it.
paste clipboard to the last panel on focus
preview information on the panel on focus
print available information on the last panel on focus
Open a file dialog , extract the file to read and display values into a grid
redo the last cancel action done on the last panel on focus
reset the current panel
Save state into a file
save possible information on the current panel
Display data into a grid in batch mode and show the grid
Set focus on a plot panel
undo previous action of the last panel on focus if possible
A panel was selected to be shown. If it’s not already shown, display it.
Parameters: | evt – menu event |
---|
zoom in of the panel on focus
zoom out on the panel on focus
zoom on the current panel if possible
Display data in the another application , by default Excel
Display value of data into the application grid :param data: dictionary of string and list of items
send a list of data to plot
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] |
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 on the tap of a panel
Pop up message to make sure the user wants to quit the application
Extract value from file name and Display them into a grid
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 list
: param panel: a control panel or tap where the bookmark is
Save data dialog
Save data2d dialog
Send focusing on ID to data explorer
set the current active perspective
Set default starting perspective
set data to current perspective
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
Parameters: | input_file – file to read |
---|
Sets the application manager for this frame
Parameters: | manager – frame manager |
---|
Store reference to the last panel on focus update the toolbar if available update edit menu if available
Helper for panel on focus with data_panel
Sets the perspective of the GUI. Opens all the panels in the list, and closes all the others.
Parameters: | panels – list of panels |
---|
Un focus all plot panels
Set schedule
Add/subtract the schedule full draw list with the panel given
Parameters: |
|
---|
Set up custom configuration if exists
show the grid of result
Show data dialog
Show data dialog
show the data panel
Display the welcome panel
Update the data.
Update the theory
Helper to write result from batch into cvs file
The application directory is the one where the default custom_config.py file resides.
Returns the user’s home directory
Bases: wx._windows.Frame
Bases: wx._windows.Panel
Bases: wx._windows.StatusBar
Bases: wx._windows.StatusBar
Application status bar
Override status bar
Hide the gauge
clear the progress bar
Place the various fields in their proper position
Display dialogbox
change the state of the gauge according the state of the current job
Display icons related to the type of message sent to the statusbar when available. No icon is displayed if the message is empty
display received message on the statusbar
Update the status bar .
Parameters: |
|
---|
Provide the style for guiframe
Bases: wx._controls.ToolBar
Implement toolbar for guiframe
Add default items in bookmark menu
receive item to append on the toolbar button bookmark
Append a item in bookmark
Get bookmark menu items
Bind the buttons
add book mark
Remove a bookmark item
Defines the API for a panels to work with the ViewerFrame toolbar and menu bar
Get the bookmark flag to update appropriately the tool bar
Get the copy flag to update appropriately the tool bar
return list of current data
Get the drag flag to update appropriately the tool bar
Get the copy flag to update appropriately the tool bar
Get the preview flag to update appropriately the tool bar
Get the print flag to update appropriately the tool bar
Get the redo flag to update appropriately the tool bar
Get the reset flag to update appropriately the tool bar
Get the save flag to update appropriately the tool bar
return the current state
Get the undo flag to update appropriately the tool bar
Get the zoom flag to update appropriately the tool bar
Get the zoom in flag to update appropriately the tool bar
Get the zoom out flag to update appropriately the tool bar
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)
The derivative class is on bookmark mode if implemented
Close event. Hide the whole window.
The copy action if possible
The derivative class allows dragging motion if implemented
The derivative class is on unfocus if implemented
The paste action if possible
Display a printable version of the class derivative
The previous action is restored if possible
The derivative class state is restored
The state of the derivative class is restored
The derivative class is on focus if implemented
Update menu on clicking the panel tap
The current action is canceled
The derivative class is on zoom mode (using pane) if zoom mode is implemented
The derivative class is on zoom in mode if implemented
The derivative class is on zoom out mode if implemented
Bases: wx._windows.Frame
Frame for PDF panel
Bases: wx._windows.Panel
Panel that contains the pdf reader
Close panel
Load a pdf file
: Param path: full path to the file
Goes to Next page
Open file button
Goes to Previous page
Bases: wx._windows.Frame
Frame for PDF panel
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:
perspectives/Foo/__init__.py contains two lines:
PLUGIN_ID = "Foo plug-in 1.0"
from Foo import *
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.
Adds color to a plugin
if return True, then call handler to laod data
clear all related panels
Delete all references of data which id are in data_list.
Check if the plugin has a batch capability
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 |
return state reader and its extensions
Returns MDIChildFrame
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 the list of panel names for this perspective
Returns a set of menu entries for tools
return True is this plugin is always active and it is local to guiframe even if the user is switching between perspectives
data_name = ‘None’ in_use = False example [(data_name, self.sub_menu)]
Load data
Load entire folder
need to be overwritten by the derivated class
Call back function for the perspective menu item. We notify the parent window that the perspective has changed.
Parameters: | event – menu event |
---|
update state
Append menu item under file menu item of the frame
Create and return the list of application menu items for the plug-in.
Parameters: | parent – parent window |
---|---|
Returns: | plug-in menu |
Post initialization call back to close the loose ends
the plugin to its batch state if flag is True
receive a list of data and use it in the current perspective
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
update state
Parameters: | theory_list – list of information related to available theory state |
---|
return True if these plugin use data
Dialog to set Appication startup configuration
Bases: wx._windows.Dialog
Dialog for Startup Configuration
Set to curent setup
Set to default
Write custom configuration
Write and Save file
Contains common classes and functions
Bases: wx._core.Menu
Parameters: | item – txtcrtl containing a value |
---|
Return a float in a standardized, human-readable formatted string
this method remove the begin and end tags given by the user from the string .
Parameters: |
|
---|---|
Returns: | begin_flag==True if begin was found, end_flag==if end was found else return false, false |
remove “_” in front of a name
returns a list of string without white space of separator
Parameters: | separator – the string to remove |
---|
return a list of string without white space of separator
Parameters: | separator – the string to remove |
---|
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.