The expt_editor module

A general frame for creating and editing experiments.

Classes

SequenceFrame

class src.gui.main.expt_editor.SequenceFrame(parent, experiment, sourceDefault=True, title='Experiment Editor', experimentPath=None)[source]

A frame for creating general experiments.

Parameters :

parent : Transport

The main Transport program frame (or anything which implements the same interface).

experiment : Experiment

The Experiment object which this frame edits.

sourceDefault : bool

Whether the sequence should be populated with the default items.

title : str

The title of the experiment.

experimentPath : str

The path to the experiment, if it was opened from a file. The default is None.

Methods

createSetupFrames()[source]

Create frames for managing constants, instruments, and graphs.

edited

Return whether the experiment has been edited.

Returns :

bool :

Whether the experiment has been edited.

extendMenus()[source]

Extend the menu bar with experiment editor-specific items.

extendToolbar()[source]

Extend the toolbar with experiment editor-specific items.

flagEdit()[source]

Indicate that the experiment has been edited.

This is a simple shorthand for self.edited = True.

getEdited()[source]

Return whether the experiment has been edited.

Returns :

bool :

Whether the experiment has been edited.

onRun(event=None)[source]

Run the experiment.

onSetupConstants(event)[source]

Open the constants configuration tool.

onSetupGraphs(event)[source]

Open the graphs configuration tool.

onSetupInstruments(event)[source]

Open the instrument configuration tool.

setClipboardButtonStatus(cut=None, copy=None, paste=None)[source]

Set the enabled state of the clipboard-related buttons.

Parameters :

cut : bool

Whether the ‘cut’ button should be enabled.

copy : bool

Whether the ‘copy’ button should be enabled.

paste : bool

Whether the ‘paste’ button should be enabled.

setEdited(newValue)[source]

Set whether the experiment has been edited.

Parameters :

newValue : bool

Whether the experiment has been edited.

updateActionDisplay(event=None)[source]

Update the list of actions for changes in selected instrument.

updateExperimentDisplay(event=None)[source]

Refresh the sequence tree.

updateInstrumentDisplay(event=None)[source]

Update the list of instruments.

updateName(newName=None)[source]

Update the name of the experiment.

DropData

class src.gui.main.expt_editor.DropData[source]

An object for storing data for drag-and-drop creation of actions.

Methods

getObject()[source]

Get the information necessary to construct the correct action.

Returns :

obj : tuple of int

A tuple consisting of the two integers: the index of the correct instrument in experiment’s list and the index of the correct action in the instrument’s list.

setObject(obj)[source]

Set the information necessary to choose the correct action.

Parameters :

obj : tuple of int

A tuple consisting of the two integers: the index of the correct instrument in experiment’s list and the index of the correct action in the instrument’s list.

MyDropTarget

class src.gui.main.expt_editor.MyDropTarget(tree, acts)[source]

A class to handle drop actions on the tree.

Parameters :

tree : ActionTree

The tree into which actions may be dropped.

acts : ListBox

The list box of actions from which actions will be dragged.

Methods

OnData(x, y, defResult)[source]

Tell the tree to make the action.

This method is called when self.OnDrop returns True. It tells the ActionTree to create the object based on the stored data tuple.

OnDragOver(x, y, defResult)[source]

When data is dragged over a tree item, select that item.

OnDrop(x, y)[source]

Reselect the previously selected items after data is dropped.

OnEnter(x, y, defResult)[source]

Handle the situation with the user drags something over the tree.

When the user drags the right data type over the tree, unselect all tree items and save them to a list.

OnLeave()[source]

Handle the situation when the user drags something off the tree.

When the user drags the data from the action list outside of the tree window, restore the items that were selected before the tree window was entered.

ActionTree

class src.gui.main.expt_editor.ActionTree(parent, experiment, idnum=-1, style=10244, parentFrame=None)[source]

A tree control for displaying experiment sequences.

This subclass of wxTreeCtrl implements a number of features, including drag-and-drop and copy-and-paste while ensuring that the underlying experiment sequence remains in sync.

Parameters :

parent : wxWindow

The panel or frame which contains this control.

experiment : Experiment

The experiment which manages the action sequence represented in this control.

wxId : int

The wxPython internal ID of this control.

style : int

The style for the control in terms of wx constants.

parentFrame : ExperimentFrame

The ExperimentFrame (or a derived class thereof) which contains this control.

Methods

addAction(action)[source]

Add an action to the end of the tree.

Parameters :

action : Action

The action to add to the end of the tree (at the highest level).

buildDefaultTree()[source]

Fill a tree with default values.

Currently, the values are for testing purposes only and are not really useful. For the final, working version, everything except the set filename action will be removed.

clearClipboard()[source]

Clear the clipboard, trashing its contents.

copyAction(item)[source]

Copy an item from the tree to the clipboard.

Parameters :

item : wxTreeItemId

The item to copy from the tree.

cutAction(item)[source]

Cut an item from the tree to the clipboard.

Parameters :

item : wxTreeItemId

The item to cut from the tree.

deleteAction(item)[source]

Delete the action contained within a given tree item.

Parameters :

item : wxTreeItemId

The tree item which should be deleted, along with its associated action and all of their children.

editAction(item)[source]

Edit the selected action.

Parameters :

item : wxTreeItemId

The item whose action the user wants to edit.

enableTree(top, enable)[source]

Change the color of a tree of actions based on the top.

flagEdit()[source]

Indicate that the sequence has been edited.

getItemAtPosition(parentItem, index)[source]

Get the item at a position under a specified parent.

Parameters :

parentItem : wxTreeItemId

The parent under which the desired item is located.

index : int

The position of the item to get.

Returns :

wxTreeItemId :

The item at the specified position, or None if the position is out of range.

getItemPosition(parentItem, item)[source]

Get the position of an item within its list of siblings.

Parameters :

parentItem : wxTreeItemId

The parent of the item in question.

item : wxTreeItemId

The item whose position is sought.

Returns :

int :

The position of item in the list of children of parentItem. If item is not a child of parentItem, then None is returned.

insertAction(actionTuple, targetItem)[source]

Insert an action above the specified item.

Parameters :

actionTuple : tuple of int

A tuple consisting of two integers. The first should be the index of the instrument in the experiment’s list. The second should be the index of the action within the instrument’s list.

targetItem : wxTreeItemId

The tree item above which the new action should be added.

moveAction(sourceItem, targetItem)[source]

Move the item and its action from one place to another.

Essentially, this is just a cut and paste operation rolled into one, allowing for drag-and-drop move operations without messing with the clipboard.

Parameters :

sourceItem : wxTreeItemId

The item which is to be moved.

targetItem : wxTreeItemId

The item before which sourceItem should be placed.

onCopy(event)[source]

Copy the selected item (pass the work to the tree).

onCut(event)[source]

Cut the item from the tree (pass the work to the tree).

onEnable(event)[source]

Enable or disable the selected item.

onPaste(event)[source]

Paste an item into the tree (pass the work to the tree).

pasteAction(item)[source]

Paste an item from the clipboard onto the tree.

Parameters :

item : wx.TreeItemId

The tree item before which to paste the clipboard’s contents.

Notes

At the end of this operation, the clipboard’s operation flag is always ‘copy’, and its action is always a clone of whatever action was originally put there. That way, the user can continue to do paste operations even if the clipboard was filled using a cut (and clones do not need to be trashed, since they were never instantiated in the first place).

refresh()[source]

Fill in the entire tree from the experiment’s action sequence.

InstrumentFrame

class src.gui.main.expt_editor.InstrumentFrame(parent, experiment, successAction=None)[source]

A frame for configuring the instruments in an experiment.

Parameters :

parent : wx.Window

The panel or frame which contains this instrument frame.

experiment : Experiment

The experiment whose instruments should be modified by this frame.

successAction : Command or list of Command

The action or actions to perform when the instruments are updated.

Methods

executeSuccessActions()[source]

Execute any success actions.

onAdd(event)[source]

Add a new instrument.

onClose(event)[source]

Hide the frame.

onEdit(event)[source]

Edit the selected instrument.

onRemove(event)[source]

Remove the selected instrument.

onSelection(event)[source]

Change the buttons to reflect selections.

populate()[source]

Fill the available and included instruments boxes.

updateButtonEnabled()[source]

Enable and disable buttons based on selections.

GraphFrame

class src.gui.main.expt_editor.GraphFrame(parent, experiment, successAction=None)[source]

A frame for setting the graphs which the owning experiment will create.

Parameters :

parent : wx.Window

The panel or frame which contains this graph frame.

experiment : Experiment

The experiment whose graphs should be modified by this frame.

successAction : list of Command

The action or actions to perform when the graphs are updated.

Methods

checkAbility()[source]

Return whether there are enough columns to create a graph.

executeSuccessActions()[source]

Execute any success actions.

onAdd(event)[source]

Add a new graph.

onClose(event)[source]

Hide the frame.

onEdit(event)[source]

Edit an existing graph.

onRemove(event)[source]

Delete an existing graph.

onSelection(event)[source]

Change the buttons to reflect selections.

populate()[source]

Fill the list of graphs.

updateButtonEnabled()[source]

Enable or disable buttons based on current selection.

ConstantFrame

class src.gui.main.expt_editor.ConstantFrame(parent, experiment, successAction=None)[source]

A frame for setting the constants which the owning experiment can use.

Parameters :

parent : wx.Window

The panel or frame which contains this constant frame.

experiment : Experiment

The experiment whose constants should be modified by this frame.

successAction : Command or list of Command

The action or actions to perform when the constants are updated.

Methods

checkValue()[source]

Make sure the entered value is legitimate.

deselectAll()[source]

Deselect all items in the list.

executeSuccessActions()[source]

Execute any success actions which have been defined.

onAdd(event)[source]

Add a new constant with the entered name and value.

onClear(event)[source]

Clear the name and value controls.

onClose(event)[source]

Hide the frame.

onEdit(event)[source]

Update buttons based on the contents of the controls.

onRemove(event)[source]

Remove the selected constant.

onSave(event)[source]

Save the value if it is legitimate.

onSelection(event)[source]

Update buttons and values as the list selection changes.

populate()[source]

Read the constants (names and values) from the experiment.

Table Of Contents

Previous topic

The premade_loader module

Next topic

The base_experiment module

This Page