PYME.Acquire.ExecTools module

Defines a few neat things to allow scripts to be executed in background during initialisation & to allow a user script directory

class PYME.Acquire.ExecTools.BGInitTask(name, codeObj)

Bases: object

NOT_PRESENT = 3
TASK_DONE = 1
TASK_FAILED = 2
TASK_RUNNING = 0
get_status_msg()
join(timeout=None)
class PYME.Acquire.ExecTools.GUIInitTask(name, codeObj)

Bases: object

run(parent, scope)
Parameters
parentPYME.Acquire.acquiremainframe.PYMEMainFrame, wx.Frame
scopePYME.Acquire.microscope.microscope
exception PYME.Acquire.ExecTools.HWNotPresent

Bases: Exception

An exception which, if thrown during initialisation, will result in a more informative error message than just failure

PYME.Acquire.ExecTools.InitBG(name, codeObj)

Runs a portion of the initialisation code in a background thread

Parameters
namestring

A descriptive name for the code block - e.g. ‘Camera’

codeObjstring, compiled code object

The code that will be executed - something that exec understands

Returns
tthread

The thread in which the code is executing (can be used with threading.join later)

PYME.Acquire.ExecTools.InitGUI(code='', name='')

Add a piece of code to a list of items to be executed once the GUI is up and running. Used to defer the initialisation of GUI components ascociated with hardware items until they can be displayed.

Parameters
codeObjstring, compiled code object

The code that will be executed - something that exec understands

PYME.Acquire.ExecTools.execBG(codeObj, localVars={}, globalVars={})

Executes a code object in a background thread, using the given namespace.

Returns
tthread

The thread in which the code is executing (can be used with threading.join later)

PYME.Acquire.ExecTools.execFile(filename, localVars={}, globalVars={}, then=None)
PYME.Acquire.ExecTools.execFileBG(filename, localVars={}, globalVars={}, then=None)
PYME.Acquire.ExecTools.init_gui(name)
PYME.Acquire.ExecTools.init_hardware(name)
PYME.Acquire.ExecTools.joinBGInit()

Wait for all the initialisation tasks that bave been launched as background threads to complete.

PYME.Acquire.ExecTools.setDefaultNamespace(locals, globals)

Populate the namespace in which the initialisation script will run.

Parameters
localsdict
globalsdict