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

Methods

get_status_msg()
join([timeout])
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

Methods

run(parent, scope)
run(parent, scope)
exception PYME.Acquire.ExecTools.HWNotPresent

Bases: exceptions.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:

name : string

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

codeObj : string, compiled code object

The code that will be executed - something that exec understands

Returns:

t : thread

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:

codeObj : string, 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:

t : thread

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

PYME.Acquire.ExecTools.execFile(filename, localVars={}, globalVars={})
PYME.Acquire.ExecTools.execFileBG(filename, localVars={}, globalVars={})
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:

locals : dict

globals : dict