diffpy.pdfgui.gui package

Subpackages

Submodules

diffpy.pdfgui.gui.phaseresultspanel module

class diffpy.pdfgui.gui.phaseresultspanel.PhaseResultsPanel(*args, **kwds)[source]

Bases: Panel, PDFPanel

GUI Panel, holds phase (structure) related constraints.

refresh()[source]

Refreshes wigets on the panel.

diffpy.pdfgui.gui.tooltips module

Tooltips for pdfgui panels.

diffpy.pdfgui.gui.tooltips.isalias(s)[source]

diffpy.pdfgui.gui.bondlengthdialog module

class diffpy.pdfgui.gui.bondlengthdialog.BondLengthDialog(*args, **kwds)[source]

Bases: Dialog

getCtrlLetter(ctrl)[source]

Get the letter associated with the control.

onCancel(event)[source]
onComboKillFocus(event)[source]
onOk(event)[source]
onSpin(event)[source]
onTextKillFocus(event)[source]
setStructure(structure)[source]

Set the structure and update the widgets.

This must be called before the spin control boxes will be settable to anything other than 1.

diffpy.pdfgui.gui.datasetresultspanel module

class diffpy.pdfgui.gui.datasetresultspanel.DataSetResultsPanel(*args, **kwds)[source]

Bases: Panel, PDFPanel

onExport(event)[source]
refresh()[source]

Refresh the panel.

setResultsData()[source]

Set the values in the results panel.

The values are taken from the results member dictionary. dscale – float qdamp – float qbroad – float

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.

onCellChange(event)[source]

Update focused and selected text when a cell changes.

onCellRightClick(event)[source]

Bring up right-click menu.

onEditorShown(event)[source]

Capture the focused text when the grid editor is shown.

onKey(event)[source]

Catch key events in the panel.

onKillFocus(event)[source]

Check value of TextCtrl and update structure if necessary.

onLabelRightClick(event)[source]

Bring up right-click menu.

onPopupCopy(event)[source]

Copy selected cells.

onPopupDelete(event)[source]

Deletes the row under mouse pointer from the grid.

onPopupInsert(event)[source]

Adds rows to the grid.

onPopupPaste(event)[source]

Paste previously copied cells.

onPopupSelect(event)[source]

Limit cell selection to specified atom selection string.

onPopupSpaceGroup(event)[source]

Create a supercell with the supercell dialog.

onPopupSupercell(event)[source]

Create a supercell with the supercell dialog.

onSelectedPairs(event)[source]

Check to see if the value of the selected pairs is valid.

onSetFocus(event)[source]

Saves a TextCtrl value, to be compared in onKillFocus later.

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

popupMenu(window, x, y)[source]

Creates the popup menu.

window – window, where to popup a menu x – x coordinate y – y coordinate

refresh()[source]

Refreshes widgets on the panel.

restrictConstrainedParameters()[source]

Set ‘read-only’ boxes that correspond to constrained parameters.

diffpy.pdfgui.gui.supercelldialog module

class diffpy.pdfgui.gui.supercelldialog.SupercellDialog(*args, **kwds)[source]

Bases: Dialog

getMNO()[source]

Get the [m, n, o] expansion parameters from the dialog.

onCancel(event)[source]

Get out of here.

onOk(event)[source]

Accept the expansion.

diffpy.pdfgui.gui.sgstructuredialog module

class diffpy.pdfgui.gui.sgstructuredialog.SGStructureDialog(*args, **kwds)[source]

Bases: Dialog, PDFPanel

getOffset()[source]

Get the offset.

getSpaceGroup()[source]

Get the current space group.

onCancel(event)[source]
onKillFocus(event)[source]

Check value of widgets and update the dialog message.

onOXTextEnter(event)[source]
onOYTextEnter(event)[source]
onOZTextEnter(event)[source]
onOk(event)[source]
onSGSelect(event)[source]
onSGTextEnter(event)[source]
setStructure(structure)[source]

Set the structure and update the dialog.

updateSpaceGroupList()[source]

Update space group choices in combobox according to self.structure.getSpaceGroupList().

Requires that structure attribute is defined.

updateWidgets()[source]

Update the widgets.

diffpy.pdfgui.gui.sgconstraindialog module

class diffpy.pdfgui.gui.sgconstraindialog.SGConstrainDialog(*args, **kwds)[source]

Bases: Dialog, PDFPanel

getOffset()[source]

Get the offset.

getPosFlag()[source]

Get whether the positions should be constrained.

getSpaceGroup()[source]

Get the current space group.

getTempFlag()[source]

Get whether the positions should be constrained.

onCancel(event)[source]
onKillFocus(event)[source]

Check value of widgets and update the dialog message.

onOXTextEnter(event)[source]
onOYTextEnter(event)[source]
onOZTextEnter(event)[source]
onOk(event)[source]
onPosFlag(event)[source]
onSGSelect(event)[source]
onSGTextEnter(event)[source]
onTempFlag(event)[source]
setStructure(structure)[source]

Set the structure and update the widgets.

updateSpaceGroupList()[source]

Update space group choices in combobox according to self.structure.getSpaceGroupList().

Requires that structure attribute is defined.

updateWidgets()[source]

Update the widgets.

diffpy.pdfgui.gui.bondangledialog module

class diffpy.pdfgui.gui.bondangledialog.BondAngleDialog(*args, **kwds)[source]

Bases: Dialog, PDFPanel

getCtrlLetter(ctrl)[source]

Get the letter associated with the control.

onCancel(event)[source]
onOk(event)[source]
onSpin(event)[source]

Handle atom selection events.

This makes sure that no two controls can have the same value.

setStructure(structure)[source]

Set the structure and update the widgets.

This must be called before the spin control boxes will be settable to anything other than 1.

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.

onCancel(event)[source]

Cancel this addition.

Go back to the last panel.

onOpen(event)[source]

Add a dataset to the tree from a file.

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.

refresh()[source]

Check the necessary tree nodes and bold text the entry point.

Update the configuration

updateConfiguration()[source]

Update the configuration for the ‘DATASET’.

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.

onCellChange(event)[source]

Update focused and selected text when a cell changes.

onCellRightClick(event)[source]

Bring up right-click menu.

onEditorShown(event)[source]

Capture the focused text when the grid editor is shown.

onKey(event)[source]

Catch key events in the panel.

onKillFocus(event)[source]

Check value of TextCtrl and update structure if necessary.

onLabelRightClick(event)[source]

Bring up right-click menu.

onPopupCopy(event)[source]

Copy selected cells.

onPopupPaste(event)[source]

Paste previously copied cells.

onPopupSelect(event)[source]

Limit cell selection to specified atom selection string.

onPopupSpaceGroup(event)[source]

Create a supercell with the supercell dialog.

onSetFocus(event)[source]

Saves a TextCtrl value, to be compared in onKillFocuse later.

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

popupMenu(window, x, y)[source]

Creates the popup menu.

window – window, where to popup a menu x – x coordinate y – y coordinate

refresh()[source]

Refresh wigets on the panel.

refreshTextCtrls()[source]

Refreshes the TextCtrls.

diffpy.pdfgui.gui.temperatureseriespanel module

class diffpy.pdfgui.gui.temperatureseriespanel.TemperatureSeriesPanel(*args, **kwds)[source]

Bases: Panel, PDFPanel

fillList()[source]

Fill the list with the datasets.

onAdd(event)[source]

Append files to the list.

onCancel(event)[source]

Let’s go, but not actually do anything.

onColClick(event)[source]

Sort by temperature.

onDelete(event)[source]

Delete selected files from the list.

onDown(event)[source]

Move an item in the list down.

onEndLabelEdit(event)[source]

Update the temperature in the datasets.

onOK(event)[source]

Let’s go!

onUp(event)[source]

Move an item in the list up.

refresh()[source]

Block out OK button if there is no fit.

This also blocks OK if the fit has no datasets or structures.

treeSelectionUpdate(node)[source]

Set the current fit when the tree selection changes.

diffpy.pdfgui.gui.datasetconstraintpanel module

class diffpy.pdfgui.gui.datasetconstraintpanel.DataSetConstraintPanel(*args, **kwds)[source]

Bases: Panel, PDFPanel

onLoseFocus(event)[source]

Record the user’s selection for the text ctrl data.

onSetFocus(event)[source]

Saves a TextCtrl value, to be compared in onKillFocus later.

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

processFormula(value, parname)[source]

Process a formula that was entered into a textCtrl.

refresh()[source]

Refresh the panel.

setConstraintsData()[source]

Set the values in the constraints panel.

The values come from the constraints member dictionary. dscale qdamp qbroad

diffpy.pdfgui.gui.journalpanel module

class diffpy.pdfgui.gui.journalpanel.JournalPanel(*args, **kwds)[source]

Bases: Panel, PDFPanel

onClose(event)[source]
onExport(event)[source]

Export the journal to an external file.

onKey(event)[source]

Catch Ctrl+J to close the journal.

onText(event)[source]

Record anything that is written into the journal.

refresh()[source]

Fill the jounalTextCtrl with the journal.

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.

DeleteBranches(selections)[source]

Remove the subtree starting from the selected node(s).

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

GetAllType(node)[source]

Get the id of each item in the tree of the same type as node.

GetBranchName(node)[source]

Get the name of the branch in which node resides.

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.

GetChildren(node)[source]

Get the ids of the children of a given node.

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.

GetFitRoot(node)[source]

Return the id of the fit in which the passed node resides.

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.

GetSiblings(node)[source]

Get the ids of the siblings of a given node.

GetTreeItemDict(node)[source]

Get the data dictionary of the node.

InitializeTree()[source]

This initializes the tree by adding a root node.

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.

SelectAll()[source]

Select all nodes.

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.

SetNodeType(node, tp)[source]

Set the node type of a node.

exception diffpy.pdfgui.gui.fittree.FitTreeError(*args)[source]

Bases: ControlError

diffpy.pdfgui.gui.fittree.incrementName(name, namelist, start=1)[source]

Increment the name by assigning the lowest number to the end such that the name does not appear in the namelist.

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

OnPaint(event)[source]
UpdateStatusBar(event)[source]
changeStyle(curveRef, style)[source]

Change curve style.

curveRef – internal reference to curves style – style dictionary

clear()[source]

Erase all curves.

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

mplKeyPress(event)[source]

Process keyboard input in matplotlib plot window.

This implements a standard close-window shortcut key.

onClose(evt)[source]

Close the frame.

removeCurve(curveRef)[source]

Remove curve from plot.

curveRef – internal reference to curves

replot()[source]

Officially call function in matplotlib to do drawing.

savePlotData(evt)[source]

Save the data in the plot in columns.

setTitle(wt, gt)[source]

Set graph labels.

wt – window title gt – graph title

setXLabel(x)[source]

Set label for x axis.

x – x label

setYLabel(y)[source]

Set label for y axis.

y – y label

updateData(curveRef, xData, yData)[source]

Update data for a existing curve.

curveRef – internal reference to a curve xData, yData – x, y data to used for the 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.extendedplotframe.legendBoxProperties()[source]

Legend properties dictionary with keys consistent with MPL version.

The argument names have changed in matplotlib 0.98.5. Old arguments do not work with later versions of matplotlib.

Return dictionary of legend properties.

diffpy.pdfgui.gui.preferencespanel module

class diffpy.pdfgui.gui.preferencespanel.PreferencesPanel(*args, **kwds)[source]

Bases: Panel, PDFPanel

onBrowse(event)[source]
onCancel(event)[source]

Cancel the changes.

Go back to the last panel.

onOK(event)[source]

Record all of the preferences and return to fitting mode.

refresh()[source]

Refresh the panel.

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.

onCancel(event)[source]

Cancel this addition.

Go back to the last panel.

onNew(event)[source]

Add a new item to be created from scratch.

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.

readConfiguration()[source]

Read the ‘PHASE’ configuration.

In the ‘PHASE’ section of the project ConfigurationParser the following is set by this panel.

‘last’ – The last structure file added to the project. This is

stored in the class variable fullpath.

refresh()[source]

Bold text the entrypoint on the tree.

This also reads the configuration.

updateConfiguration()[source]

Update the configuration for the ‘DATASET’.

validateStructure(node)[source]

Make sure that the structure is valid.

diffpy.pdfgui.gui.rseriespanel module

class diffpy.pdfgui.gui.rseriespanel.RSeriesPanel(*args, **kwds)[source]

Bases: Panel, PDFPanel

onCancel(event)[source]

Return to the main panel.

onOK(event)[source]

Add make a temperature series and add it to the project.

refresh()[source]

Block out OK button if there is no fit.

This also blocks OK if the fit has no datasets or phases.

treeSelectionUpdate(node)[source]

Set the current fit when the tree selection changes.

diffpy.pdfgui.gui.fitnotebookpanel module

class diffpy.pdfgui.gui.fitnotebookpanel.FitNotebookPanel(*args, **kwds)[source]

Bases: Panel, PDFPanel

Enable(enable=True)[source]

Keep the notebook enabled, just not the panels.

outputPanel is immune from this, since it needs to be interacted with.

onPageChanged(event)[source]

Refresh the panel visible panel.

onPageChanging(event)[source]
refresh()[source]

Refresh the panels.

diffpy.pdfgui.gui.aboutdialog module

class diffpy.pdfgui.gui.aboutdialog.DialogAbout(*args, **kwds)[source]

Bases: Dialog

The “About” Dialog.

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

diffpy.pdfgui.gui.aboutdialog.launchBrowser(url)[source]

Launches browser and opens specified url.

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

@param url: URL to open

diffpy.pdfgui.gui.paneltest module

class diffpy.pdfgui.gui.paneltest.MyApp(redirect=False, filename=None, useBestVisual=False, clearSigInt=True)[source]

Bases: App

OnInit(self) bool[source]
class diffpy.pdfgui.gui.paneltest.MyFrame(*args, **kwds)[source]

Bases: Frame

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.

fillList()[source]

Fill the list with the datasets.

onAdd(event)[source]

Append files to the list.

onCancel(event)[source]

Let’s go, but not actually do anything.

onColClick(event)[source]

Sort by doping.

onDelete(event)[source]

Delete selected files from the list.

onDown(event)[source]

Move an item in the list down.

onEndLabelEdit(event)[source]

Update the doping in the datasets.

onOK(event)[source]

Let’s go!

onUp(event)[source]

Move an item in the list up.

refresh()[source]

Block out OK button if there is no fit.

This also blocks OK if the fit has no datasets or structures.

treeSelectionUpdate(node)[source]

Set the current fit when the tree selection changes.

diffpy.pdfgui.gui.blankpanel module

This module contains the BlankPanel class.

class diffpy.pdfgui.gui.blankpanel.BlankPanel(*args, **kwds)[source]

Bases: Panel, PDFPanel

A blank panel needed as a right panel in mainframe.py.

refresh()[source]

Refreshes wigets of the panel.

This method must be overloaded in the derived class or else a NotImplementedError will be raised when this method is called.

diffpy.pdfgui.gui.datasetconfigurepanel module

class diffpy.pdfgui.gui.datasetconfigurepanel.DataSetConfigurePanel(*args, **kwds)[source]

Bases: Panel, PDFPanel

onLoseFocus(event)[source]

Record the user’s selection for the text ctrl data.

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.

onSetFocus(event)[source]

Saves a TextCtrl value, to be used later.

onStype(event)[source]

Record the user’s selection for stype.

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

refresh()[source]

Refresh the panel.

restrictConstrainedParameters()[source]

Set ‘read-only’ boxes that correspond to constrained parameters.

setConfigurationData()[source]

Set the values in the configuration panel.

The values come from the configuration member dictionary. stype – ‘N’ or ‘X’ dscale – float qmax – float qdamp – float rmin – float rmax – float fitrmin – float fitrmax – float temperature – float doping – float

diffpy.pdfgui.gui.errorreportdialog_control_fix module

class diffpy.pdfgui.gui.errorreportdialog_control_fix.ErrorReportDialogControlFix(*args, **kwds)[source]

Bases: Dialog

ShowModal() int[source]

Shows an application-modal dialog.

class diffpy.pdfgui.gui.errorreportdialog_control_fix.MyApp(redirect=False, filename=None, useBestVisual=False, clearSigInt=True)[source]

Bases: App

OnInit(self) bool[source]
test()[source]

Testing code goes here.

diffpy.pdfgui.gui.plotpanel module

class diffpy.pdfgui.gui.plotpanel.PlotPanel(*args, **kwds)[source]

Bases: Panel, PDFPanel

enableWidgets(on=True)[source]

Enable or disable the widgets.

getSelectedYVals()[source]

Get the y-values selected in the y-value ListCtrl.

onEnter(event)[source]

Reset plot.

onPlot(event)[source]

Plot some stuff.

onReset(event)[source]

Reset everything.

refresh()[source]

Refresh this panel.

updateWidgets()[source]

Enable or disable certain widgets depending upon what is selected in the tree and in the plotting widgets.

diffpy.pdfgui.gui.welcomepanel module

class diffpy.pdfgui.gui.welcomepanel.WelcomePanel(*args, **kwds)[source]

Bases: Panel, PDFPanel

refresh()[source]

Refreshes wigets of the panel.

This method must be overloaded in the derived class or else a NotImplementedError will be raised when this method is called.

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.

refresh()[source]

Refreshes wigets of the panel.

This method must be overloaded in the derived class or else a NotImplementedError will be raised when this method is called.

setToolTips(toolTips)[source]

Sets tooltips for controls.

@param toolTips: dictionary of the form {‘controlname’ : ‘tooltip’}

diffpy.pdfgui.gui.resultspanel module

class diffpy.pdfgui.gui.resultspanel.ResultsPanel(*args, **kwds)[source]

Bases: Panel, PDFPanel

refresh()[source]

Fill in the resultsTextCtrl with the fit results if they exist.

diffpy.pdfgui.gui.outputpanel module

class diffpy.pdfgui.gui.outputpanel.OutputPanel(*args, **kwds)[source]

Bases: Panel, PDFPanel

clearText()[source]

Clear the text from the output control.

refresh()[source]

Refreshes wigets of the panel.

This method must be overloaded in the derived class or else a NotImplementedError will be raised when this method is called.

updateText(text)[source]

Update the text in the window.

diffpy.pdfgui.gui.insertrowsdialog module

class diffpy.pdfgui.gui.insertrowsdialog.InsertRowsDialog(*args, **kwds)[source]

Bases: Dialog

diffpy.pdfgui.gui.errorreportdialog module

class diffpy.pdfgui.gui.errorreportdialog.ErrorReportDialog(*args, **kwds)[source]

Bases: Dialog

ShowModal() int[source]

Shows an application-modal dialog.

onCopyErrorLog(event)[source]
onGoogle(event)[source]

Handle the “Google This Error” button.

Search for path-independent module and function names and for error message extracted from exception traceback.

onURL(event)[source]
class diffpy.pdfgui.gui.errorreportdialog.MyApp(redirect=False, filename=None, useBestVisual=False, clearSigInt=True)[source]

Bases: App

OnInit(self) bool[source]
test()[source]

Testing code goes here.

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

getSelectedParameters()[source]

Get list of row values of selected cells.

onApplyParameters(event)[source]
onCellChange(event)[source]
onCellLeftClick(event)[source]

Toggle a fix/free cell when clicked.

onCellRightClick(event)[source]
onEditorShown(event)[source]
onGridRangeSelect(event)[source]

Handle range selections.

This is needed to properly handle simple left-clicking of fix/free cells. It serves no other purpose.

onPopupCopyRefinedToInitial(event)[source]

Copy refined parameter to initial value.

onPopupFill(event)[source]

Fills cells selected in the grid with a new value.

onPopupFixFree(event)[source]

Fixes parameters with selected cells.

onPopupRenameParameters(event)[source]

Rename parameters.

popupMenu(window, x, y)[source]

Opens a popup menu.

window – window, where to popup a menu x – x coordinate y – y coordinate

refresh()[source]

Refreshes wigets on the panel.

diffpy.pdfgui.gui.datasetpanel module

class diffpy.pdfgui.gui.datasetpanel.DataSetPanel(*args, **kwds)[source]

Bases: Panel, PDFPanel

Enable(enable=True)[source]

Keep the notebook enabled, just not the panels.

onNotebookChanged(event)[source]

Refresh the selected panel.

refresh()[source]

Refreshes wigets of the panel.

This method must be overloaded in the derived class or else a NotImplementedError will be raised when this method is called.

refreshSelectedPage()[source]

Refresh the panel corresponding to the currently selected page.

diffpy.pdfgui.gui.main module

class diffpy.pdfgui.gui.main.PDFGuiApp(redirect=False, filename=None, useBestVisual=False, clearSigInt=True)[source]

Bases: App

OnInit(self) bool[source]
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.pdfguiglobals.iconpath(iconfilename)[source]

Full path to the icon file in pdfgui installation. This function should be used whenever GUI needs access to custom icons.

iconfilename – icon file name without any path

Return string.

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.float2str(x)[source]

Compact string representation of float.

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.phasepanelutils.showSelectAtomsDialog(panel)[source]

Extend or limit selection to a string atom selection.

panel – instance of PhaseConfigurePanel or PhaseConstraintsPanel

No return value.

diffpy.pdfgui.gui.phasenotebookpanel module

class diffpy.pdfgui.gui.phasenotebookpanel.PhaseNotebookPanel(*args, **kwds)[source]

Bases: Panel, PDFPanel

Enable(enable=True)[source]

Keep the notebook enabled, just not the panels.

onNotebookPageChanged(event)[source]

Called after the page selection is changed.

onNotebookPageChanging(event)[source]

Called during the page selection change.

refresh()[source]

Refreshes the currently shown panel.

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

onCalcRange(event)[source]
onExport(event)[source]
onKillFocus(event)[source]
onSetFocus(event)[source]

Saves a TextCtrl value, to be used later.

onStype(event)[source]
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).

refresh()[source]

Refresh the panel.

setConfigurationData()[source]

Set the data in the panel.

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.

disableMainMenuItems()[source]

Disable main menu items.

disableSharedMenuItems(menu)[source]

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.

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

onAbout(event)[source]
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.

onCommunity(event)[source]

Open the browser and go to the diffpy-users Google Group.

onCopy(event)[source]

Copy the subtree of the current selected item into the clipboard.

onCustom(event)[source]

This handles the custom events sent by the control.

onDSeries(event)[source]

Open up the doping series panel.

onDefaultLayout(event)[source]

Place the fit tree and plot panel in default locations.

onDelete(event)[source]

Remove the subtrees starting from the selected nodes.

onDocumentation(event)[source]

Show information about the documentation.

onDoubleClick(event)[source]

Select-all type on item double click.

onDoubleClick2(event)[source]

Select-all type on item double click.

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.

onExportNewStruct(event)[source]

Export a structure that was created from scratch.

onExportPDF(event)[source]

Export a fit PDF.

onExportRes(event)[source]

Export the results file for the selected calculation.

onExportStruct(event)[source]

Export a fit structure.

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.

onKey(event)[source]

Catch key events in the panel.

onMRUFile(event)[source]

Open a recently used file.

onMainMenu(event)[source]

Prepare the main menu whenever it is activated.

onMiddleClick(event)[source]

Quickplot on item middle click.

onNew(event)[source]

Create a new project.

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.

onOpen(event)[source]

Open a file dialog so an existing project can be opened.

onPaste(event)[source]

Paste the subtree from the clipboard into the tree.

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.

onPlotFStruct(event)[source]

Plots the phase structure.

Opens Atomeye and plots the structure.

onPlotIStruct(event)[source]

Plots the phase structure.

Opens Atomeye and plots the structure.

onPreferences(event)[source]

Switch the right panel to the ‘preferences’ panel.

The ‘preferences’ panel uses the ‘config’ mode.

onPrintBA(event)[source]

Print the bond angles of a selected structure to the output panel.

onPrintBL(event)[source]

Print the bond lengths of a selected structure to the output panel.

onQuickPlot(event)[source]

Quickly plot information for the selected node.

onQuit(event)[source]

Shut down gracefully.

onRSeries(event)[source]

Open up the r-series panel.

onRequest(event)[source]
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.

onSave(event)[source]

Save the project to a predetermined location.

onSaveAs(event)[source]

Open a save dialog so the current project can be saved.

onSaveCalc(event)[source]

Export a calculated PDF.

onShowFit(event)[source]

Make sure the fit tree is visible.

onShowJournal(event)[source]

Bring up or hide the journal window.

onShowOutput(event)[source]

Make sure the output panel is visible.

onShowPlot(event)[source]

Make sure the plot panel is visible.

onStop(event)[source]

Stop all fits.

This removes all items from the runningDict and changes the status colors back to wxWHITE.

onTSeries(event)[source]

Open up the temperature series panel.

onTreeSelChanged(event)[source]

Set the click behavior for each mode.

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

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

updateOutput()[source]

Update text in outputPanel with text in stdout.

updateTitle()[source]

Update the title according to the name of the current file.

updateToolbar()[source]

Update the toolbar based upon the status of the program.

writeConfiguration()[source]

Write the program configuration to file.