The main model for the GUI.
At its core, the model is a list of
WorkflowItem instances. A
wraps an operation, its completion status, the result of applying it to
WorkflowItem’s result, and
IView’s on that result. The Workflow
also maintains a “current” or selected WorkflowItem.
The left panel of the GUI is a View on this object (viewing the list of WorkflowItem instances), and the right panel of the GUI is a View of the selected WorkflowItem’s current view.
So far, so simple. However, in a single-threaded GUI application, the UI
freezes when something processor-intensive is happening. Adding another thread
doesn’t help matters because of the CPython global interpreter lock; while
Python is otherwise computing, the GUI doesn’t update. To solve this, the
Workflow maintains a copy of itself in a separate process. The
is the one that is viewed by the GUI; the
RemoteWorkflow is the one that
actually loads the data and does the processing. Thus the GUI remains
responsive. Changed attributes in either Workflow are noticed by a set of
Traits handlers, which send those changes to the other process.
This process is also where the plotting happens. For an explanation of how
the plots are ferried back to the GUI, see the module docstring for
- class cytoflowgui.workflow.workflow.Msg¶
Messages passed between the local and remote workflows
- NEW_WORKFLOW = 'NEW_WORKFLOW'¶
- ADD_ITEMS = 'ADD_ITEMS'¶
- REMOVE_ITEMS = 'REMOVE_ITEMS'¶
- SELECT = 'SELECT'¶
- UPDATE_OP = 'UPDATE_OP'¶
- UPDATE_VIEW = 'UPDATE_VIEW'¶
- CHANGE_CURRENT_VIEW = 'CHANGE_CURRENT_VIEW'¶
- CHANGE_CURRENT_PLOT = 'CHANGE_CURRENT_PLOT'¶
- UPDATE_WI = 'UPDATE_WI'¶
- ESTIMATE = 'ESTIMATE'¶
- APPLY_CALLED = 'APPLY_CALLED'¶
- PLOT_CALLED = 'PLOT_CALLED'¶
- EVAL = 'EVAL'¶
- EXEC = 'EXEC'¶
- RUN_ALL = 'RUN_ALL'¶
- SHUTDOWN = 'SHUTDOWN'¶
- class cytoflowgui.workflow.workflow.UniquePriorityQueue(maxsize=0)¶
A PriorityQueue that only allows one copy of each item. http://stackoverflow.com/questions/5997189/how-can-i-make-a-unique-value-priority-queue-in-python
Recursively filter unpicklable items from lists and dictionaries
- class cytoflowgui.workflow.workflow.LocalWorkflow(remote_workflow_connection, **kwargs)¶
The workflow that is maintained in the “local” process – ie, the same one that showing a GUI.
Has this workflow been modified since it was loaded?
The method that runs in
recv_threadto receive messages from the remote process.
Send the RUN_ALL message to the remote process
Evaluate an expression in the remote process and return the result
Execute an expression in the remote process and wait until it completes
- wi_sync(wi, variable, value, timeout=30)¶
WorkflowItem.statuson the remote workflow, then wait for it to propogate here.
- wi_waitfor(wi, variable, value, timeout=30)¶
Waits a configurable amount of time for wi’s status to change to status
Shut down the remote process
- class cytoflowgui.workflow.workflow.RemoteWorkflow¶
The workflow that is maintained in the “remote” process – ie, the one that actually does the processing.
- run(parent_workflow_conn, parent_mpl_conn=None)¶
The method that runs the main loop of the remote process
The method that runs in the
recv_threadto receive messages from the local process.
Shut down the remote process