diffpy.pdfgui.gui package
Subpackages
Submodules
diffpy.pdfgui.gui.phaseresultspanel module
diffpy.pdfgui.gui.tooltips module
Tooltips for pdfgui panels.
diffpy.pdfgui.gui.bondlengthdialog module
diffpy.pdfgui.gui.datasetresultspanel module
diffpy.pdfgui.gui.phaseconfigurepanel module
- class diffpy.pdfgui.gui.phaseconfigurepanel.PhaseConfigurePanel(*args, **kwds)[source]
Bases:
Panel
,PDFPanel
Panel for configuring a phase.
- Data members:
structure – reference to PDFStructure _focusedText – value of a cell or textctrl before it changes lConstraintsMap – map of TextCtrl name to parameter name _row – row, where rightclick occurred _col – column, where rightclick occurred
- applyCellChange(i, j, value)[source]
Update an atom according to a change in a cell.
i – cell position j – cell position value – new value
- applyTextCtrlChange(id, value)[source]
Update a structure according to a change in a TextCtrl.
id – textctrl id value – new value
- fillCells(value)[source]
Fill cells with a given value.
value – string value to place into cells
This uses the member variable _selectedCells, a list of (i,j) tuples for the selected cells.
- onTextCtrlKey(event)
Process a textCtrl key event as if the textCtrl was a grid cell.
This catches ESC and ENTER events in textCtrls and processes them as if the textCtrl were a grid cell. This method can be bound to the wx.EVT_KEY_DOWN event of any textCtrl. See phaseconfigurepanel.py in diffpy.pdfgui.gui for an example.
- ESC – Cancel the edit and highlight the text. This requires that
panel has a _focusedText attribute that stores the previous value.
- ENTER – Confirm the edit and move to the next cell (the default TAB
behavior).
diffpy.pdfgui.gui.supercelldialog module
diffpy.pdfgui.gui.sgstructuredialog module
diffpy.pdfgui.gui.sgconstraindialog module
diffpy.pdfgui.gui.bondangledialog module
diffpy.pdfgui.gui.adddatapanel module
- class diffpy.pdfgui.gui.adddatapanel.AddDataPanel(*args, **kwds)[source]
Bases:
Panel
,PDFPanel
Panel for adding or changing data.
Data members: Several items must be known to this panel so it knows where to try to insert the dataset. entrypoint – The FitTree item id from which we entered this panel. entryfit – The parent of the new dataset. entryset – The dataset below which to place the new set. This can be
None, which means the new dataset is appended to the end of the entryfit.
- readConfiguration()[source]
Read the ‘DATASET’ configuration.
In the ‘DATASET’ section of the project ConfigurationParser the following is set by this panel.
- ‘last’ – The last dataset file added to the project. This is
stored in the class variable fullpath.
diffpy.pdfgui.gui.phaseconstraintspanel module
- class diffpy.pdfgui.gui.phaseconstraintspanel.PhaseConstraintsPanel(*args, **kwds)[source]
Bases:
Panel
,PDFPanel
- applyCellChange(i, j, value)[source]
Update an atom according to a change in a cell.
i – cell position j – cell position value – new value
returns the new value stored in the data object, or None if value is somehow invalid.
- applyTextCtrlChange(id, value)[source]
Update a structure according to a change in a TextCtrl.
id – textctrl id value – new value
- fillCells(value)[source]
Fill cells with a given value.
value – string value to place into cells
This uses the member variable _selectedCells, a list of (i,j) tuples for the selected cells.
- onTextCtrlKey(event)
Process a textCtrl key event as if the textCtrl was a grid cell.
This catches ESC and ENTER events in textCtrls and processes them as if the textCtrl were a grid cell. This method can be bound to the wx.EVT_KEY_DOWN event of any textCtrl. See phaseconfigurepanel.py in diffpy.pdfgui.gui for an example.
- ESC – Cancel the edit and highlight the text. This requires that
panel has a _focusedText attribute that stores the previous value.
- ENTER – Confirm the edit and move to the next cell (the default TAB
behavior).
diffpy.pdfgui.gui.temperatureseriespanel module
diffpy.pdfgui.gui.datasetconstraintpanel module
- class diffpy.pdfgui.gui.datasetconstraintpanel.DataSetConstraintPanel(*args, **kwds)[source]
Bases:
Panel
,PDFPanel
- onTextCtrlKey(event)
Process a textCtrl key event as if the textCtrl was a grid cell.
This catches ESC and ENTER events in textCtrls and processes them as if the textCtrl were a grid cell. This method can be bound to the wx.EVT_KEY_DOWN event of any textCtrl. See phaseconfigurepanel.py in diffpy.pdfgui.gui for an example.
- ESC – Cancel the edit and highlight the text. This requires that
panel has a _focusedText attribute that stores the previous value.
- ENTER – Confirm the edit and move to the next cell (the default TAB
behavior).
diffpy.pdfgui.gui.journalpanel module
diffpy.pdfgui.gui.debugoptions module
DebugOptions class for storing guess three time what.
There should be exactly one instance of DebugOptions in pdfguiglobals module.
- class diffpy.pdfgui.gui.debugoptions.DebugOptions[source]
Bases:
object
DebugOptions is a place to store various debugging options. There should be just one instance defined in pdfguiglobals module. It would be nice to have a simple way of setting them on command line.
- Options in short and long forms:
- noed, noerrordialog – [False], disable exceptions catching and
display in ErrorReportDialog
- nocf, noconfirm – boolean (default False), exit without asking to
save modified project file
- pdb, pythondebugger – use python debugger to handle error exceptions
instead of ErrorReportDialog
- alldebugoptions = (('noed', 'noerrordialog'), ('nocf', 'noconfirm'), ('pdb', 'pythondebugger'))
- short2long = {'nocf': 'noconfirm', 'noed': 'noerrordialog', 'pdb': 'pythondebugger'}
diffpy.pdfgui.gui.fittree module
This module contains the FitTree object designed for use in PDFgui.
- Classes:
FitTree – A tree specific to orgainizing data for pdffit
- Exceptions:
FitTreeError – Exception for errors with FitTree operations.
- class diffpy.pdfgui.gui.fittree.FitTree(parent, id=-1, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=2081, validator=<wx._core.Validator object>, name='FitTree')[source]
Bases:
TreeCtrl
TreeCtrl designed to organize pdffit fits.
The root of the tree is hidden. Below that there are several levels which are diagrammed below.
_ fit (*) | |____ phase (5) |____ dataset (*) |____ calculation (*)
Fits are at the top level. Under fits there are phases, datasets, and calculations (in that order).
It is required that the data for each node is a dictionary. In the ‘type’ entry of this dictionary is the node type (fit, phase, dataset, calculation). Fit items also have a ‘cdata’ entry in their tree item dictionary. This is the control center data associated with this node’s branch.
Data members: control – The pdfguicontrol object that interfaces between the tree
and the pdffit2 engine. The tree is a mirror of the internal structure of the control.
- AddCalc(node, label, insertafter=None, makedata=True, cdata=None)[source]
Add a new DataSet to the tree as a child of fit.
node – The parent node of the calculation. Must be ‘fit’ type. label – The label of the new node. insertafter – The node after which to insert the new calculation. If
insertafter is None (default) the new calculation is appended to the end of the calculation in the subtree of the parent node.
- makedata – Tells whether the control needs to make data for the
node (default True). If True, cdata is ignored.
- cdata – Control data for the node. If False cdata is None
(default), then it is assumed that the node already has data in the control. See ExtendProjectTree and __InsertBranch for examples of how this is used.
Calculations are always placed after datasets.
- Raises:
FitTreeError if node is not a "fit" node. –
FitTreeError if insertafter is not a "calculation" node. –
Returns the id of the new node.
- AddDataSet(node, label, insertafter=None, filename=None, makedata=True, cdata=None)[source]
Add a new DataSet to the tree as a child of fit.
node – The parent node of the dataset. Must be ‘fit’ type. label – The label of the new node. insertafter – The node after which to insert the new dataset. If
insertafter is None (default) the new dataset is appended to the end of the datasets in the subtree of the parent node.
filename – The name of the file from which to load the data. makedata – Tells whether the control needs to make data for the
node (default True). If True, cdata is ignored.
- cdata – Control data for the node. If False cdata is None
(default), then it is assumed that the node already has data in the control. See ExtendProjectTree and __InsertBranch for examples of how this is used.
DataSets are always placed after Phases.
- Raises:
FitTreeError if node is not a "fit" node. –
FitTreeError if insertafter is not a "dataset" node. –
Returns the id of the new node.
- AddFit(fitname='Fit 1', cdata=None, paste=False)[source]
Append a new fit tree to the end of the current fits.
- fitname – The name of the fit. This is incremented if it already
exists.
- cdata – Control data for the node. If cdata is None (default),
then the control is asked to create new data.
- paste – Whether or not the cdata is being pasted from another
node (default False).
Returns the id of the new node.
- AddPhase(node, label, insertafter=None, filename=None, makedata=True, cdata=None)[source]
Add a new blank Phase to the tree as a child of node.
node – The parent ‘fit’ node. label – The name of the new node. insertafter – The node after which to insert the new phase. If
insertafter is None (default) the new phase is appended to the end of the phases in the subtree of the parent node.
- filename – The file from which to load the structure. If this is
None (default), a new structure is created.
- makedata – Tells whether the control needs to make data for the
node (default True).
- cdata – Control data for the node. If cdata is None (default),
then it is assumed that the node already has data in the control. See ExtendProjectTree and __InsertBranch for examples of how this is used.
Phases are always placed before DataSets.
- Raises:
FitTreeError if node is not a "fit" node. –
FitTreeError if insertafter is not a "phase" node. –
Returns the id of the new node.
- CopyBranch(startnode)[source]
Make a copy of a tree branch.
The branch is held in the system clipboard so it can be used in another instance of the fittree.
- ExtendProjectTree(treelist, clear=True, paste=False)[source]
Extend the project tree from the treelist.
- treelist – A list of control data returned by
Oraganizer.organization()
clear – Clear the tree before adding new nodes (default True) paste – Whether or not the cdata is being pasted from another
node (default False).
The treelist here is of the type returned from pdfguicontrol.load. It is a list of fit lists with the following format. node[0] – fit object node[1] – list of (name, dataset) tuples node[2] – list of (name, phase) tuples node[3] – list of (name, calculation) tuples
Note that node[1] should be empty if the node is a calculation.
Returns the last inserted fit or calculation node
- GetCalculations(node)[source]
Get a list of calculations in branch.
node is either the fit-root or a node in the fit-branch of interest.
- GetClipboard()[source]
Get the clipboard data.
Returns the controldata in the clipboard, or None if the clipboard is empty or contains the wrong type of data.
- GetControlData(node)[source]
Get the control center data associated with a node.
NOTE: The fit-root of a node holds this data. This method makes it convenient to retrieve it.
- GetDataSets(node)[source]
Get a list of datasets in branch.
node is either the fit-root or a node in the fit-branch of interest.
- GetLastDataSet(node)[source]
Get the last dataset child of the fit node.
If there is no last dataset node, this may return the last phase node. The purpose of getting this node is to know where to place another node, so the actual node type is not important.
- GetLastPhase(node)[source]
Get the last phase child of the parent node.
This method is helpful in placing datasets and phases into the fit tree. This method depends on the fact that phases are placed before datasets in the fit tree.
- GetNodeType(node)[source]
Get the node type.
This is the “type” entry in the data dictionary of the node.
- GetNumDataSets(node)[source]
Get the number of datasets in a branch.
node – A node in the branch, or the root of the branch.
- GetNumPhases(node)[source]
Get the number of phases in a branch.
node – A node in the branch, or the root of the branch.
- GetPhases(node)[source]
Get a list of phase in branch.
node is either the fit-root or a node in the fit-branch of interest.
- GetPositionInSubtree(node)[source]
Get the index if the node in its subtree.
For fits the position is absolute within the tree. For phases, datasets, and calculations, the location is taken to be in reference to the other nodes of its type. This is designed to be compatible with the control center.
- PasteBranch(entrypoint=None)[source]
Paste the branch from the clipboard into tree at the given node.
A certain type of branch can only be copied to specific places.
- fit - A fit can be pasted to anywhere. This does not overwrite
an existing node, but simply inserts the fit into the last available slot.
- phase - A phase can be pasted from anywhere. If pasted from a
fit, it is placed at the end of the phase section of that node. If inserted from a dataset or a calculation, it is placed at the end of the phase section.
- dataset - A dataset can be pasted from anywhere. If pasted from a
fit, the dataset is appended at the end of the other datasets. If pasted from a dataset, the pasted set is inserted right after that one. If pasted from a phase, it is placed at the beginning of the dataset section. If pasted from a calculation, it is placed at the end of the dataset section.
- calculation - A calculation can be pasted to anywhere, but it appears
at the end of the calculation section of the tree. If pasted from a calculation node, it is inserted after that node.
- Raises:
FitTreeError if the entrypoint and branch type are incompatible. –
- SelectAllType(node=None)[source]
Select all nodes of same type as passed node.
- node – Node whose type to select. If node is None (default), then
all fit nodes will be selected.
- SetControlData(node, data)[source]
Set the control center data associated with the node.
This need only be called for ‘fit’ nodes. This is the “cdata” entry in the data dictionary of the node. It holds the object with which the right panel interfaces. For example, for a ‘phase’ node, it contains a Structure object.
- exception diffpy.pdfgui.gui.fittree.FitTreeError(*args)[source]
Bases:
ControlError
diffpy.pdfgui.gui.extendedplotframe module
The module contains extensions for GUI plot frame.
- class diffpy.pdfgui.gui.extendedplotframe.ExtendedPlotFrame(parent=None, *args, **kwargs)[source]
Bases:
Frame
An extended plotting frame with a save and close button.
The class has a matplotlib.figure.Figure data member named ‘figure’. It also has a matplotlib.axes.Axes data member named ‘axes’. The normal matplotlib plot manipulations can be performed with these two data members. See the matplotlib API at: http://matplotlib.sourceforge.net/classdocs.html
- changeStyle(curveRef, style)[source]
Change curve style.
curveRef – internal reference to curves style – style dictionary
- close_keys = {'cmd+w', 'ctrl+w', 'q'}
- insertCurve(xData, yData, style)[source]
Insert a new curve to the plot.
xData, yData – x, y data to used for the curve style – the way curve should be plotted return: internal reference to the newly added curve
- class diffpy.pdfgui.gui.extendedplotframe.ExtendedToolbar(canvas)[source]
Bases:
NavigationToolbar2Wx
An extended plotting toolbar with a save and close button.
- toolitems = (('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous view', 'back', 'back'), ('Forward', 'Forward to next view', 'forward', 'forward'), (None, None, None, None), ('Pan', 'Left button pans, Right button zooms\nx/y fixes axis, CTRL fixes aspect', 'move', 'pan'), ('Zoom', 'Zoom to rectangle\nx/y fixes axis', 'zoom_to_rect', 'zoom'), (None, None, None, None), ('Save', 'Save the figure', 'filesave', 'save_figure'))
diffpy.pdfgui.gui.preferencespanel module
diffpy.pdfgui.gui.addphasepanel module
- class diffpy.pdfgui.gui.addphasepanel.AddPhasePanel(*args, **kwds)[source]
Bases:
Panel
,PDFPanel
Panel for adding a phase.
Several items must know to this panel so it knows where to try to insert the phase. entrypoint – The FitTree item id from which we entered this panel.
dataset or a calculation item.
entryfit – The parent of the new dataset. entryphase – The phase below which to place the new phase. This can be
None, which means the new phase is appended to the end of the phase section of the entryfit.
- onOpen(event)[source]
Add a the new phase to the tree.
The phase is added as a child of entryfit, right after the entryphase, if it exists. If entryphase is None, the new phase is appended to the end of the children of entryfit.
diffpy.pdfgui.gui.rseriespanel module
diffpy.pdfgui.gui.fitnotebookpanel module
diffpy.pdfgui.gui.aboutdialog module
diffpy.pdfgui.gui.paneltest module
diffpy.pdfgui.gui.dopingseriespanel module
- class diffpy.pdfgui.gui.dopingseriespanel.DopingSeriesPanel(*args, **kwds)[source]
Bases:
Panel
,PDFPanel
- checkConfiguration()[source]
Verify that the dopant and base are elements.
More detailed checking is done in the control method.
diffpy.pdfgui.gui.blankpanel module
This module contains the BlankPanel class.
diffpy.pdfgui.gui.datasetconfigurepanel module
- class diffpy.pdfgui.gui.datasetconfigurepanel.DataSetConfigurePanel(*args, **kwds)[source]
Bases:
Panel
,PDFPanel
- onSampling(event)[source]
Record how the data is to be sampled during the fit.
This does not use the event argument, so feel free to call this method programmatically.
- onTextCtrlKey(event)
Process a textCtrl key event as if the textCtrl was a grid cell.
This catches ESC and ENTER events in textCtrls and processes them as if the textCtrl were a grid cell. This method can be bound to the wx.EVT_KEY_DOWN event of any textCtrl. See phaseconfigurepanel.py in diffpy.pdfgui.gui for an example.
- ESC – Cancel the edit and highlight the text. This requires that
panel has a _focusedText attribute that stores the previous value.
- ENTER – Confirm the edit and move to the next cell (the default TAB
behavior).
diffpy.pdfgui.gui.errorreportdialog_control_fix module
diffpy.pdfgui.gui.plotpanel module
diffpy.pdfgui.gui.welcomepanel module
diffpy.pdfgui.gui.pdfpanel module
- class diffpy.pdfgui.gui.pdfpanel.PDFPanel(*args, **kwds)[source]
Bases:
object
Mix-in class for all PDF gui panels.
This method is meant to be a secondary parent class for classed derived from wx.Panel. It defines methods and member variables necessary to all panels in the PDFgui.
diffpy.pdfgui.gui.resultspanel module
diffpy.pdfgui.gui.outputpanel module
diffpy.pdfgui.gui.insertrowsdialog module
diffpy.pdfgui.gui.errorreportdialog module
diffpy.pdfgui.gui.parameterspanel module
- class diffpy.pdfgui.gui.parameterspanel.ParametersPanel(*args, **kwds)[source]
Bases:
Panel
,PDFPanel
GUI Panel, parameters viewer/editor.
- Data members:
parameters – parameters dictionary _focusedText – value of a cell before it changes
- applyCellChange(row, col, value)[source]
Update parameters dictionary according to a change in a cell.
This also updates the cell, if possible, but not the grid. Changes to the cell that may affect the grid, such as inserting text that is wider than the column width, must be handled elsewhere.
row – row col – column value – new value
- fillCells(indices, value)[source]
Fill cells with a given value.
indices – list of (i,j) tuples representing cell coordinates value – string value to place into cells
- onGridRangeSelect(event)[source]
Handle range selections.
This is needed to properly handle simple left-clicking of fix/free cells. It serves no other purpose.
diffpy.pdfgui.gui.datasetpanel module
diffpy.pdfgui.gui.main module
- class diffpy.pdfgui.gui.main.PDFGuiApp(redirect=False, filename=None, useBestVisual=False, clearSigInt=True)[source]
Bases:
App
- diffpy.pdfgui.gui.main.main()[source]
Kick starter for the PDFgui graphical user interface.
This function is normally called from a light-weight console starter diffpy.pdfgui.applications.pdfgui. Command line options and arguments can be passed via cmdopts and cmdargs variables of the pdfguiglobals module.
diffpy.pdfgui.gui.pdfguiglobals module
This module contains global parameters needed by PDFgui.
diffpy.pdfgui.gui.phasepanelutils module
Common methods used in the phase panels.
- diffpy.pdfgui.gui.phasepanelutils.canCopySelectedCells(panel)[source]
Check to see if we can copy selected cells.
To be copyable, the cells must exist in a single block or there must be a single cell selected. Note that a block that is selected by individual cells is considered a collection of individual atoms, not a block. This is default wxPython behavior.
- diffpy.pdfgui.gui.phasepanelutils.canPasteIntoCells(panel)[source]
Check if clipboard contents are formatted for grid insertion.
This also checks to see if the cell selection is appropriate for pasting.
- diffpy.pdfgui.gui.phasepanelutils.copySelectedCells(panel)[source]
Copy block of selected cells or individual cell into clipboard.
This stores the cells as a plain text grid so that it can be copied to and from other applications. Columns are delimited by tabs ‘ ‘. Rows are delimited by newlines ‘
‘.
- diffpy.pdfgui.gui.phasepanelutils.pasteIntoCells(panel)[source]
Paste clipboard contents into cells.
canPasteIntoCells must be called before this method in order to format clipboard text for pasting.
- diffpy.pdfgui.gui.phasepanelutils.refreshGrid(panel)[source]
Refreshes grid on the panel.
This is used by phaseconfigurepanel and phaseresultspanel.
This method fills the grid with the contents of the structure member variable of the panel. It is expected that the grid is named ‘gridAtoms’.
- diffpy.pdfgui.gui.phasepanelutils.refreshTextCtrls(panel)[source]
Refreshes the TextCtrls on the panel.
This is used by phaseconfigurepanel and phaseresultspanel.
This method updates the following TextCtrls with with contents of the structure member variable of the panel. textCtrlA textCtrlB textCtrlC textCtrlAlpha textCtrlBeta textCtrlGamma textCtrlScaleFactor textCtrlDelta1 textCtrlDelta2 textCtrlSratio textCtrlRcut textCtrlStepcut textCtrlSpdiameter
diffpy.pdfgui.gui.phasenotebookpanel module
diffpy.pdfgui.gui.errorwrapper module
This module contains a function wrapper and an object wrapper that catch control errors and shows them in an error report dialog.
This is used by PDFPanel and MainFrame.
- diffpy.pdfgui.gui.errorwrapper.catchFunctionErrors(obj, funcName)[source]
Wrap a function so its errors get transferred to a dialog.
- obj – Object containing the function. It is assumed that the
object has an attribute named ‘mainFrame’, which is a reference to the MainFrame instance, which contains information about how and when to display errors.
funcName – Name of a function to wrap.
Returns the wrapped function
- diffpy.pdfgui.gui.errorwrapper.catchObjectErrors(obj, exclude=None)[source]
Wrap all functions of an object so that the exceptions are caught.
- obj – Object containing the function. It is assumed that the object has an
attribute named ‘mainFrame’, which is a reference to the MainFrame instance, which contains information about how and when to display errors.
- exclude – An iterable of additional function names to exclude. These are
excluded in addition to names in _EXCLUDED_METHODS defined above.
All functions starting with ‘_’ are excluded.
diffpy.pdfgui.gui.windowperspective module
This contains the default perspective for the gui window.
diffpy.pdfgui.gui.calculationpanel module
- class diffpy.pdfgui.gui.calculationpanel.CalculationPanel(*args, **kwds)[source]
Bases:
Panel
,PDFPanel
- onTextCtrlKey(event)
Process a textCtrl key event as if the textCtrl was a grid cell.
This catches ESC and ENTER events in textCtrls and processes them as if the textCtrl were a grid cell. This method can be bound to the wx.EVT_KEY_DOWN event of any textCtrl. See phaseconfigurepanel.py in diffpy.pdfgui.gui for an example.
- ESC – Cancel the edit and highlight the text. This requires that
panel has a _focusedText attribute that stores the previous value.
- ENTER – Confirm the edit and move to the next cell (the default TAB
behavior).
diffpy.pdfgui.gui.mainframe module
This module contains the main window of PDFgui.
- class diffpy.pdfgui.gui.mainframe.MainFrame(*args, **kwds)[source]
Bases:
Frame
The left pane is a FitTree (from fittree.py), the right is a dynamic panel, accessed via the data member rightPanel, which can hold one of any number of panels. The panels that can appear in the right pane must be derived from PDFPanel (in pdfpanel.py) and are defined in the dynamicPanels dictionary, which is defined in __customProperties. A panel is placed in the right pane by passing its dynamicPanels dictionary key to the switchRightPanel method. This method takes care of displaying the panel, giving the data it needs, and calling its refresh() method.
** NODE TYPES ** The FitTree is essential to the functionality of the Gui. The tree contains one of five types of items: “fit” – This represents a fit that is to be run by pdffit. “dataset” – This represents a data for a fit. “phase” – This represents the theoretical phases needed for a
dataset or a calculation.
- “calculation” – This represents a calculation which is to be made from
using a configured fit.
Depending upon what type of item is selected in the tree, the right pane will display the properties and configuration of that item (if in “fitting mode”, see below.) More on these item types is given in the documentation for the FitTree in fittree.py. See r
** MODES ** The program has various modes of operation. “fitting” – In this mode the right pane changes depending upon what
type of item is selected in the FitTree. When the fitting button is pressed, the program is in “fitting” mode.
“addingdata” – This mode is for adding data. “addingphase” – This mode is for adding the phase “config” – This mode is used for preferences and structure viewer
configuration.
“rseries” – The mode used when configuring an r-series macro. “tseries” – The mode used when configuring a temperature series
macro.
“dseries” – The mode used when configuring a doping series macro.
The mode determines how the tree and other widgets react to user interaction. The mode of the program is changed with the method setMode. This method outright enables or disables certain widgets that should not be used when in certain modes.
** DATA MEMBERS ** dynamicPanels – The dictionary of right panels. This is used to change the
right panel in the method switchRightPanel. The panels held by the dynamicPanels dictionary are listed below by their dictionary keys:
Miscellaneous panels:
“blank” – A blank panel “rseries” – The r-series macro panel “tseries” – The temperature series macro panel “dseries” – The doping series macro panel “welcome” – A welcome panel
‘fitting’ mode panels
“fit” – The panel for ‘fit’ nodes “phase” – The panel for ‘phase’ nodes “dataset” – The panel for ‘dataset’ nodes “calculation” – The panel for ‘calculation’ nodes
Panels specific to other program modes
“adddata” – The panel used in ‘addingdata’ mode “addphase” – The panel used in ‘addingphase’ mode
Panels for future implementation
“configuration” – Another ‘config’ mode panel
rightPanel – The current right panel. fullpath – The full path to the most recently accessed project file. workpath – The full path to the working directory. This is modified
whenever something is loaded or saved to file. It is preserved in the current session and across new projects.
- cP – A python SafeConfigurationParser object. This is in charge
of storing configuration information about the most recently used files list. It is also used by addphasepanel and adddatapanel to store their respective fullpath variables. The code that handles the MRU files interacts directly with cP.
- mode – The current mode of the program. This is modified using the
setMode method. See the MODES section above.
name – The name of the program as defined in pdfguiglobals. control – The pdfguicontrol object needed for interfacing with the
engine pdffit2 code.
- isAltered – A Boolean flag that indicates when the program has been
altered. This should be changed with the method needsSave so that the save menu item and toolbar button can be updated accordingly.
- runningDict – A dictionary of running fits and calculations indexed by
name. This dictionary is used to change the status colors of running fits and to keep the user from editing a running fit.
- quitting – A boolean that is set when the program is quitting. This
flag tells the error handlers to ignore any errors that take place during shutdown.
- checkForSave()[source]
Pop up a dialog if the project needs to be saved.
returns: wx.ID_YES if the user chose to save the project. wx.ID_NO if the user chose not to save the project. wx.ID_CANCEL if they changed their mind about their action.
Disable some menu items based upon what is selected in the tree.
menu – The menu which to apply the changes.
Note that this method is meant to disable only the shared menu items, that is, those that use the same menu item Ids. These are defined in the top part of __defineLocalIds(). Putting this logic into a single method makes it easier to make changes with the menus. If a specific menu needs additional logic, put that in a separate method.
- loadConfiguration()[source]
Load the configuration from file.
The MRU list is handled by the local member fileHistory, which is a wxFileHistory object.
- makeTreeSelection(node)[source]
Manually select a node of the tree and update according to selection.
This makes sure that the node is visible after selection.
If node is None, this does nothing.
- needsSave(altered=True)[source]
Tell the gui that the program needs to be saved.
This changes the state of the save menu and tool bar items.
altered – Whether or not the program needs saving (default True).
- onBeginLabelEdit(event)[source]
Veto editing of some items and in some modes.
The following editing attempts are Veto()’d * Editing any item in “addingdata”, “addingphase”, or “config” mode.
- onEndLabelEdit(event)[source]
Allow only certain types of renaming.
The following rename attempts are Veto()’d * Giving a node the same name as a sibling. Cousins can share names. * Giving a node the name ‘’. Everything needs a name.
- onInsCalc(event)[source]
Insert a new calculation item.
A calculation is given the name “Calculation n”, where n is the smallest positive integer such that the name is not already taken.
- onInsData(event)[source]
Insert a new dataset item.
This opens up the new data set panel from adddatapanel.py. That panel is in charge of inserting a new phase. See the module for details.
- onInsPhase(event)[source]
Insert a new phase item.
This opens up the new phase panel from addphasepanel.py. That panel is in charge of inserting a new phase. See the module for details.
- onNewFit(event)[source]
Start a new fit tree.
A fit is given the name “Fit n”, where n is the smallest positive integer such that the name is not already taken.
- onPasteLink(event)[source]
Paste a copied fit and link it to the original.
This should only be called on a ‘fit’ node, and only if the original ‘fit’ node, or at least one with the same name as the original still exists in the tree.
- onPreferences(event)[source]
Switch the right panel to the ‘preferences’ panel.
The ‘preferences’ panel uses the ‘config’ mode.
- onRightClick(event)[source]
Bring up the right-click menu.
This menu can give a different menu depending upon which mode the program is in. It can even give a different menu depending upon what part of the tree is selected.
“fitting” mode The menu appears for right-clicks both on and off of tree items. The menu has the following items: “New Fit” – Append a new fit from anywhere on the tree. “Copy” – Copy a fit, phase, dataset, or calc branch “Paste” – Paste a copied branch into the tree. Branches
of a given type can only be pasted in certain places.
“Delete” – Delete a branch from the tree. “Insert Phase” – Insert a phase in the phase section of a fit or
calculation branch.
- “Insert Data Set” – Insert a dataset in the dataset section of a fit
branch.
- “Insert Calculation”– Insert a calculation in the calculation section
of a fit.
The menu appears for right-clicks both on and off of tree items. The menu has the following items: “Select All” – The tree automatically selects all items of the
type the user clicked on.
- onRun(event)[source]
Run the selected fits/calculations and disable their tree entries.
This also runs calculations that are children of a running fit.
- onStop(event)[source]
Stop all fits.
This removes all items from the runningDict and changes the status colors back to wxWHITE.
- onTreeSelChanging(event)[source]
Set the click behavior for each mode.
Note that this doesn’t work on Windows. Be sure to build in redundancy so that the program behaves as if this does not even get called. If the Windows bug does not get fixed, this method will probably be eliminated.
- “addingdata” mode:
can select nothing
- “addingphase” mode:
can select nothing
- “config” mode:
can select nothing
- “rseries” mode:
can only select fit items
- “tseries” mode:
can only select fit items
- “dseries” mode:
can only select fit items
- postEvent(type, info)[source]
This method is called by the control.
Whenever the control needs to communicate directly with the gui it can call this method. The event is processed by onCustom and then handled by the gui on its own terms.
- setMode(mode)[source]
Set the mode of the program.
This method takes care of any widget properties that must change when the mode is changed. If the mode is changing due to the change in the right panel, always call setMode before switchRightPanel.
- “fitting” mode:
treeCtrlMain is enabled
plotPanel panel is enabled
toolBar is enabled
menuBar is enabled
“addingdata” mode: “addingphase” mode: “config” mode:
treeCtrlMain is disabled
plotPanel panel is disabled
toolBar is disabled
menuBar is disabled
“rseries” mode: “tseries” mode: “dseries” mode:
treeCtrlMain is enabled
plotPanel panel is disabled
toolBar is disabled
menuBar is disabled
- setPanelSpecificData(paneltype)[source]
This method sets the panel specific data for the right panel.
This method gets panel-specific data and sends it to the rightPanel. The different types of data assignment are listed below.
“fit” type: * Give the fit object to the panel
“phase” type: * initialize constraints dictionary and configuration and results * Structure objects.
“dataset” type: * initialize configuration, constraints, and results objects
“calculation” type: * Give the calculation object to the panel
“rseries” type: * Give the fit object to the panel
“tseries” type: * Give the fit object to the panel
“dseries” type: * Give the fit object to the panel
- showMessage(info, title='PDF Control Error')[source]
ShowMessage(self, info) –> tell user about an exception and so on.
title – window title info – message
- switchRightPanel(paneltype)[source]
Switch the panel which is visible in the right hand side.
This sets any panel-specific data and calls the refresh() method of the new rightPanel. All right panels must be derived from wxPanel and PDFPanel (in pdfpanel module).
Inputs: paneltype – The code used in self.dynamicPanels that indicates the
panel to be displayed. If paneltype is None, the blank panel is displayed.
- treeSelectionUpdate(node)[source]
Update the widgets based on a tree selection.
“fitting” mode: * Right panel changes depending upon the type of item selected from the tree.
“rseries”, “tseries”, “dseries” mode: * The behavior is defined in the associated panel
- updateConfiguration()[source]
Update the configuration information.
This updates the ‘MRU’ section of the configuration.
- updateFittingStatus(job)[source]
Update the fitting status.
This will alter the local member runningDict so that the running items cannot be altered. The following status ids are defined in the fitting module. Some are given a color which gives the user an indication of the fit status. job is actually a fitting or a calculation object.
Fit status INITIALIZED – ‘LIGHT GRAY’ CONNECTED – ‘GREEN’ CONFIGURED – ‘GREEN’ DONE – ‘WHITE’
JOB Status VOID QUEUED RUNNING PAUSED