OpenMS
2.5.0
|
A container for all visual items of a TOPPAS workflow. More...
#include <OpenMS/VISUAL/TOPPASScene.h>
Classes | |
struct | TOPPProcess |
Stores the information for a TOPP process. More... | |
Public Types | |
enum | ActionMode { AM_NEW_EDGE, AM_MOVE } |
The current action mode (creation of a new edge, or panning of the widget) More... | |
enum | RefreshStatus { ST_REFRESH_NOCHANGE, ST_REFRESH_CHANGED, ST_REFRESH_CHANGEINVALID, ST_REFRESH_REMAINSINVALID } |
Pipeline status after refreshParameters() was called. More... | |
typedef QList< TOPPASEdge * > | EdgeContainer |
The container for edges. More... | |
typedef EdgeContainer::iterator | EdgeIterator |
A mutable iterator for edges. More... | |
typedef EdgeContainer::const_iterator | ConstEdgeIterator |
A const iterator for edges. More... | |
typedef QList< TOPPASVertex * > | VertexContainer |
The container for vertices. More... | |
typedef VertexContainer::iterator | VertexIterator |
A mutable iterator for vertices. More... | |
typedef VertexContainer::const_iterator | ConstVertexIterator |
A const iterator for vertices. More... | |
Public Slots | |
void | abortPipeline () |
Terminates the currently running pipeline. More... | |
void | itemClicked () |
Called when an item is clicked. More... | |
void | itemReleased () |
Called when an item is released. More... | |
void | updateHoveringEdgePos (const QPointF &new_pos) |
Called when the position of the hovering edge changes. More... | |
void | addHoveringEdge (const QPointF &pos) |
Called when a new out edge is supposed to be created. More... | |
void | finishHoveringEdge () |
Called when the new edge is being "released". More... | |
void | pipelineErrorSlot (const QString msg="") |
Called by vertices at which an error occurred during pipeline execution. More... | |
void | moveSelectedItems (qreal dx, qreal dy) |
Moves all selected items by dx, dy. More... | |
void | snapToGrid () |
Makes all vertices snap to the grid. More... | |
void | setPipelineRunning (bool b=true) |
void | changedParameter (const bool invalidates_running_pipeline) |
Invoked by TTV or other vertices if a parameter was edited. More... | |
void | changedOutputFolder () |
Invoked by OutfilelistVertex of user changed the folder name. More... | |
void | processFinished () |
Called by a finished QProcess to indicate that we are free to start a new one. More... | |
void | quitWithError () |
dirty solution: when using ExecutePipeline this slot is called when the pipeline crashes. This will quit the app More... | |
Public Member Functions | |
TOPPASScene (QObject *parent, const QString &tmp_path, bool gui=true) | |
Constructor. More... | |
~TOPPASScene () override | |
Destructor. More... | |
void | addVertex (TOPPASVertex *tv) |
Adds a vertex. More... | |
void | addEdge (TOPPASEdge *te) |
Adds an edge. More... | |
void | setActionMode (ActionMode mode) |
Sets the action mode. More... | |
ActionMode | getActionMode () |
Returns the action mode. More... | |
VertexIterator | verticesBegin () |
Returns begin() iterator of all vertices. More... | |
VertexIterator | verticesEnd () |
Returns end() iterator of all vertices. More... | |
EdgeIterator | edgesBegin () |
Returns begin() iterator of all edges. More... | |
EdgeIterator | edgesEnd () |
Returns end() iterator of all edges. More... | |
void | copySelected () |
Copies all currently selected edges and vertices. More... | |
void | paste (QPointF pos=QPointF()) |
Pastes the copied items. More... | |
void | removeSelected () |
Removes all currently selected edges and vertices. More... | |
void | unselectAll () |
Unselects all items. More... | |
void | updateEdgeColors () |
Updates all edge colors (color of green and yellow edges can change when edges are added/removed) More... | |
void | resetDownstream (TOPPASVertex *vertex) |
Called when user fires "Resume" action, to clear downstream nodes from previous results. More... | |
void | runPipeline () |
Runs the pipeline. More... | |
bool | store (const String &file) |
Stores the pipeline to file , returns true on success. More... | |
void | load (const String &file) |
Loads the pipeline from file . More... | |
void | include (TOPPASScene *new_scene, QPointF pos=QPointF()) |
Includes the pipeline scene . More... | |
const String & | getSaveFileName () |
Returns the file name. More... | |
void | setSaveFileName (const String &name) |
Sets the file name. More... | |
void | topoSort (bool resort_all=true) |
Performs a topological sort of all vertices. More... | |
const QString & | getOutDir () const |
Returns the name of the directory for output files. More... | |
const QString & | getTempDir () const |
Returns the name of the directory for temporary files. More... | |
void | setOutDir (const QString &dir) |
Sets the name of the directory for output files. More... | |
bool | saveIfChanged () |
Saves the pipeline if it has been changed since the last save. More... | |
void | setChanged (bool b) |
Sets the changed flag. More... | |
bool | isPipelineRunning () |
Returns if a pipeline is currently running. More... | |
bool | askForOutputDir (bool always_ask=true) |
Shows a dialog that allows to specify the output directory. If always_ask == false, the dialog won't be shown if a directory has been set, already. More... | |
void | enqueueProcess (const TOPPProcess &process) |
Enqueues the process, it will be run when the currently pending processes have finished. More... | |
void | runNextProcess () |
Runs the next process in the queue, if any. More... | |
void | resetProcessesQueue () |
Resets the processes queue. More... | |
void | setClipboard (TOPPASScene *clipboard) |
Sets the clipboard content. More... | |
void | connectVertexSignals (TOPPASVertex *tv) |
Connects the signals to slots. More... | |
void | connectToolVertexSignals (TOPPASToolVertex *ttv) |
Connects the signals to slots. More... | |
void | connectOutputVertexSignals (TOPPASOutputFileListVertex *oflv) |
Connects the signals to slots. More... | |
void | connectMergerVertexSignals (TOPPASMergerVertex *tmv) |
Connects the signals to slots. More... | |
void | connectEdgeSignals (TOPPASEdge *e) |
Connects the signals to slots. More... | |
void | loadResources (const TOPPASResources &resources) |
Loads the resources into the input nodes of this workflow. More... | |
void | createResources (TOPPASResources &resources) |
Create resources from the current workflow. More... | |
bool | wasChanged () |
Returns whether the workflow has been changed since the latest "save". More... | |
RefreshStatus | refreshParameters () |
Refreshes the parameters of the TOPP tools in this workflow. More... | |
bool | isGUIMode () const |
is TOPPASScene run in GUI or non-GUI (ExecutePipeline) mode, i.e. are MessageBoxes allowed? More... | |
bool | isDryRun () const |
determine dry run status (are tools actually called?) More... | |
QString | getDescription () const |
workflow description (to be displayed in TOPPAS window) More... | |
void | setDescription (const QString &desc) |
when description is updated by user, use this to update the description for later storage in file More... | |
void | setAllowedThreads (int num_threads) |
sets the maximum number of jobs More... | |
TOPPASEdge * | getHoveringEdge () |
returns the hovering edge More... | |
void | checkIfWeAreDone () |
Checks whether all output vertices are finished, and if yes, emits entirePipelineFinished() (called by finished output vertices) More... | |
Protected Member Functions | |
reimplemented Qt events | |
void | contextMenuEvent (QGraphicsSceneContextMenuEvent *event) override |
void | writeToLogFile_ (const QString &text) |
Writes the text to the logfile. More... | |
Slots for printing log/error output when no GUI is available | |
ActionMode | action_mode_ |
The current action mode. More... | |
VertexContainer | vertices_ |
The list of all vertices. More... | |
EdgeContainer | edges_ |
The list of all edges. More... | |
TOPPASEdge * | hover_edge_ |
The hovering edge which is currently being created. More... | |
TOPPASVertex * | potential_target_ |
The current potential target vertex of the hovering edge. More... | |
String | file_name_ |
The file name of this pipeline. More... | |
QString | tmp_path_ |
The path for temporary files. More... | |
bool | gui_ |
Are we in a GUI or is the scene used by ExecutePipeline (at the command line)? More... | |
QString | out_dir_ |
The directory where the output files will be written. More... | |
bool | changed_ |
Flag that indicates if the pipeline has been changed since the last save. More... | |
bool | running_ |
Indicates if a pipeline is currently running. More... | |
bool | error_occured_ |
true if an error occurred during pipeline execution More... | |
bool | user_specified_out_dir_ |
Indicates if the output directory has been specified by the user already. More... | |
QList< TOPPProcess > | topp_processes_queue_ |
The queue of pending TOPP processes. More... | |
TOPPASScene * | clipboard_ |
Stores the clipboard content when requested from TOPPASBase. More... | |
bool | dry_run_ |
dry run mode (no tools are actually called) More... | |
int | threads_active_ |
currently running processes... More... | |
QString | description_text_ |
description text More... | |
int | allowed_threads_ |
maximum number of allowed threads More... | |
TOPPASToolVertex * | resume_source_ |
last node where 'resume' was started More... | |
void | logTOPPOutput (const QString &out) |
Writes the TOPP tool output to the logfile (and to stdout if no gui available) More... | |
void | logToolStarted () |
Writes the "tool started" message to the logfile (and to stdout if no gui available) More... | |
void | logToolFinished () |
Writes the "tool finished" message to the logfile (and to stdout if no gui available) More... | |
void | logToolFailed () |
Writes the "tool failed" message to the logfile (and to stdout if no gui available) More... | |
void | logToolCrashed () |
Writes the "tool crashed" message to the logfile (and to stdout if no gui available) More... | |
void | logOutputFileWritten (const String &file) |
Writes the "output file written" message to the logfile (and to stdout if no gui available) More... | |
void | entirePipelineFinished () |
Emitted when the entire pipeline execution is finished. More... | |
void | pipelineExecutionFailed () |
Emitted when the pipeline execution has failed. More... | |
void | saveMe () |
Emitted when the pipeline should be saved (showing a save as file dialog and so on) More... | |
void | terminateCurrentPipeline () |
Kills all connected TOPP processes. More... | |
void | selectionCopied (TOPPASScene *ts) |
Emitted when a selection is copied to the clipboard. More... | |
void | requestClipboardContent () |
Requests the clipboard content from TOPPASBase, will be stored in clipboard_. More... | |
void | mainWindowNeedsUpdate () |
Emitted when the main window needs to be updated. More... | |
void | openInTOPPView (QStringList all_files) |
Emitted when files are triggered for opening in TOPPView. More... | |
void | dryRunFinished (int, QProcess::ExitStatus) |
Emitted when in dry run mode and asked to run a TOPP tool (to fake success) More... | |
void | messageReady (const QString &msg) |
Emitted when there is an important message that needs to be printed in TOPPAS. More... | |
TOPPASVertex * | getVertexAt_ (const QPointF &pos) |
Returns the vertex in the foreground at position pos , if existent, otherwise 0. More... | |
bool | isEdgeAllowed_ (TOPPASVertex *u, TOPPASVertex *v) |
Returns whether an edge between node u and v would be allowed. More... | |
bool | dfsVisit_ (TOPPASVertex *vertex) |
DFS helper method. Returns true, if a back edge has been discovered. More... | |
bool | sanityCheck_ (bool allowUserOverride) |
A container for all visual items of a TOPPAS workflow.
TOPPASScene is a subclass of QGraphicsScene and acts as a container for all visual items (i.e. all vertices and edges). It is visualized by a TOPPASWidget (a subclass of QGraphicsView). This class also provides large parts of the functionality of TOPPAS, e.g., the methods for loading, saving, running, and aborting pipelines are located here.
TOPPASScene can also be used without a visualizing TOPPASWidget (i.e., without a gui) which can be indicated via the constructor. In this case, the signals for log message output are connected to standard out. This is utilized for the ExecutePipeline tool.
Temporary files of the pipeline are stored in the member tmp_path_. Update it when loading a pipeline which has tmp data from an old run. TOPPASToolVertex will ask its parent scene() whenever it wants to know the tmp directory.
typedef EdgeContainer::const_iterator ConstEdgeIterator |
A const iterator for edges.
typedef VertexContainer::const_iterator ConstVertexIterator |
A const iterator for vertices.
typedef QList<TOPPASEdge *> EdgeContainer |
The container for edges.
typedef EdgeContainer::iterator EdgeIterator |
A mutable iterator for edges.
typedef QList<TOPPASVertex *> VertexContainer |
The container for vertices.
typedef VertexContainer::iterator VertexIterator |
A mutable iterator for vertices.
enum ActionMode |
enum RefreshStatus |
Pipeline status after refreshParameters() was called.
TOPPASScene | ( | QObject * | parent, |
const QString & | tmp_path, | ||
bool | gui = true |
||
) |
Constructor.
|
override |
Destructor.
|
slot |
Terminates the currently running pipeline.
Referenced by TOPPASBase::abortPipeline().
void addEdge | ( | TOPPASEdge * | te | ) |
Adds an edge.
|
slot |
Called when a new out edge is supposed to be created.
void addVertex | ( | TOPPASVertex * | tv | ) |
Adds a vertex.
Referenced by TOPPASBase::insertNewVertex_().
bool askForOutputDir | ( | bool | always_ask = true | ) |
Shows a dialog that allows to specify the output directory. If always_ask
== false, the dialog won't be shown if a directory has been set, already.
|
slot |
Invoked by OutfilelistVertex of user changed the folder name.
|
slot |
Invoked by TTV or other vertices if a parameter was edited.
void checkIfWeAreDone | ( | ) |
Checks whether all output vertices are finished, and if yes, emits entirePipelineFinished() (called by finished output vertices)
void connectEdgeSignals | ( | TOPPASEdge * | e | ) |
Connects the signals to slots.
void connectMergerVertexSignals | ( | TOPPASMergerVertex * | tmv | ) |
Connects the signals to slots.
void connectOutputVertexSignals | ( | TOPPASOutputFileListVertex * | oflv | ) |
Connects the signals to slots.
Referenced by TOPPASBase::insertNewVertex_().
void connectToolVertexSignals | ( | TOPPASToolVertex * | ttv | ) |
Connects the signals to slots.
Referenced by TOPPASBase::insertNewVertex_().
void connectVertexSignals | ( | TOPPASVertex * | tv | ) |
Connects the signals to slots.
Referenced by TOPPASBase::insertNewVertex_().
|
overrideprotected |
void copySelected | ( | ) |
Copies all currently selected edges and vertices.
void createResources | ( | TOPPASResources & | resources | ) |
Create resources
from the current workflow.
Referenced by TOPPASBase::savePipelineResourceFile().
|
protected |
DFS helper method. Returns true, if a back edge has been discovered.
|
signal |
Emitted when in dry run mode and asked to run a TOPP tool (to fake success)
EdgeIterator edgesBegin | ( | ) |
Returns begin() iterator of all edges.
EdgeIterator edgesEnd | ( | ) |
Returns end() iterator of all edges.
void enqueueProcess | ( | const TOPPProcess & | process | ) |
Enqueues the process, it will be run when the currently pending processes have finished.
|
signal |
Emitted when the entire pipeline execution is finished.
|
slot |
Called when the new edge is being "released".
ActionMode getActionMode | ( | ) |
Returns the action mode.
QString getDescription | ( | ) | const |
workflow description (to be displayed in TOPPAS window)
Referenced by TOPPASBase::focusByTab(), and TOPPASBase::showAsWindow_().
TOPPASEdge* getHoveringEdge | ( | ) |
returns the hovering edge
const QString& getOutDir | ( | ) | const |
Returns the name of the directory for output files.
const String& getSaveFileName | ( | ) |
Returns the file name.
Referenced by TOPPASBase::savePipeline().
const QString& getTempDir | ( | ) | const |
Returns the name of the directory for temporary files.
|
protected |
Returns the vertex in the foreground at position pos
, if existent, otherwise 0.
void include | ( | TOPPASScene * | new_scene, |
QPointF | pos = QPointF() |
||
) |
Includes the pipeline scene
.
Referenced by TOPPASBase::addTOPPASFile().
bool isDryRun | ( | ) | const |
determine dry run status (are tools actually called?)
|
protected |
Returns whether an edge between node u and v would be allowed.
bool isGUIMode | ( | ) | const |
is TOPPASScene run in GUI or non-GUI (ExecutePipeline) mode, i.e. are MessageBoxes allowed?
bool isPipelineRunning | ( | ) |
Returns if a pipeline is currently running.
Referenced by TOPPASBase::updateMenu().
|
slot |
Called when an item is clicked.
|
slot |
Called when an item is released.
void load | ( | const String & | file | ) |
Loads the pipeline from file
.
Referenced by TOPPASBase::addTOPPASFile().
void loadResources | ( | const TOPPASResources & | resources | ) |
Loads the resources
into the input nodes of this workflow.
Referenced by TOPPASBase::loadPipelineResourceFile().
|
slot |
Writes the "output file written" message to the logfile (and to stdout if no gui available)
|
slot |
Writes the "tool crashed" message to the logfile (and to stdout if no gui available)
|
slot |
Writes the "tool failed" message to the logfile (and to stdout if no gui available)
|
slot |
Writes the "tool finished" message to the logfile (and to stdout if no gui available)
|
slot |
Writes the "tool started" message to the logfile (and to stdout if no gui available)
|
slot |
Writes the TOPP tool output to the logfile (and to stdout if no gui available)
|
signal |
Emitted when the main window needs to be updated.
|
signal |
Emitted when there is an important message that needs to be printed in TOPPAS.
|
slot |
Moves all selected items by dx, dy.
|
signal |
Emitted when files are triggered for opening in TOPPView.
void paste | ( | QPointF | pos = QPointF() | ) |
Pastes the copied items.
|
slot |
Called by vertices at which an error occurred during pipeline execution.
|
signal |
Emitted when the pipeline execution has failed.
|
slot |
Called by a finished QProcess to indicate that we are free to start a new one.
|
slot |
dirty solution: when using ExecutePipeline this slot is called when the pipeline crashes. This will quit the app
RefreshStatus refreshParameters | ( | ) |
Refreshes the parameters of the TOPP tools in this workflow.
Referenced by TOPPASBase::refreshPipelineParameters().
void removeSelected | ( | ) |
Removes all currently selected edges and vertices.
|
signal |
Requests the clipboard content from TOPPASBase, will be stored in clipboard_.
void resetDownstream | ( | TOPPASVertex * | vertex | ) |
Called when user fires "Resume" action, to clear downstream nodes from previous results.
void resetProcessesQueue | ( | ) |
Resets the processes queue.
void runNextProcess | ( | ) |
Runs the next process in the queue, if any.
void runPipeline | ( | ) |
Runs the pipeline.
Referenced by TOPPASBase::keyPressEvent(), and TOPPASBase::runPipeline().
|
protected |
Performs a sanity check of the pipeline and notifies user when it finds something strange. Returns if pipeline OK. if 'allowUserOverride' is true, some dialogs are shown which allow the user to ignore some warnings (e.g. disconnected nodes)
bool saveIfChanged | ( | ) |
Saves the pipeline if it has been changed since the last save.
Referenced by TOPPASBase::closeEvent().
|
signal |
Emitted when the pipeline should be saved (showing a save as file dialog and so on)
|
signal |
Emitted when a selection is copied to the clipboard.
void setActionMode | ( | ActionMode | mode | ) |
Sets the action mode.
void setAllowedThreads | ( | int | num_threads | ) |
sets the maximum number of jobs
void setChanged | ( | bool | b | ) |
Sets the changed flag.
Referenced by TOPPASBase::descriptionUpdated_(), TOPPASBase::insertNewVertex_(), and TOPPASBase::refreshPipelineParameters().
void setClipboard | ( | TOPPASScene * | clipboard | ) |
Sets the clipboard content.
Referenced by TOPPASBase::sendClipboardContent().
void setDescription | ( | const QString & | desc | ) |
when description is updated by user, use this to update the description for later storage in file
Referenced by TOPPASBase::descriptionUpdated_(), and TOPPASBase::exportAsImage().
void setOutDir | ( | const QString & | dir | ) |
Sets the name of the directory for output files.
|
slot |
Sets if the running_ flag to true, or false If set to false, the application emits an 'alert' sign, demanding user attention (to let him know it finished)
void setSaveFileName | ( | const String & | name | ) |
Sets the file name.
|
slot |
Makes all vertices snap to the grid.
bool store | ( | const String & | file | ) |
Stores the pipeline to file
, returns true on success.
Referenced by TOPPASBase::savePipeline(), and TOPPASBase::savePipelineAs().
|
signal |
Kills all connected TOPP processes.
void topoSort | ( | bool | resort_all = true | ) |
Performs a topological sort of all vertices.
Referenced by TOPPASBase::insertNewVertex_().
void unselectAll | ( | ) |
Unselects all items.
void updateEdgeColors | ( | ) |
Updates all edge colors (color of green and yellow edges can change when edges are added/removed)
Referenced by TOPPASBase::refreshPipelineParameters().
|
slot |
Called when the position of the hovering edge changes.
VertexIterator verticesBegin | ( | ) |
Returns begin() iterator of all vertices.
Referenced by TOPPASBase::addTOPPASFile().
VertexIterator verticesEnd | ( | ) |
Returns end() iterator of all vertices.
Referenced by TOPPASBase::addTOPPASFile().
bool wasChanged | ( | ) |
Returns whether the workflow has been changed since the latest "save".
Referenced by TOPPASBase::addTOPPASFile(), and TOPPASBase::updateMenu().
|
protected |
Writes the text
to the logfile.
|
protected |
The current action mode.
|
protected |
maximum number of allowed threads
|
protected |
Flag that indicates if the pipeline has been changed since the last save.
|
protected |
Stores the clipboard content when requested from TOPPASBase.
|
protected |
description text
|
protected |
dry run mode (no tools are actually called)
|
protected |
The list of all edges.
|
protected |
true if an error occurred during pipeline execution
|
protected |
The file name of this pipeline.
|
protected |
Are we in a GUI or is the scene used by ExecutePipeline (at the command line)?
|
protected |
The hovering edge which is currently being created.
|
protected |
The directory where the output files will be written.
|
protected |
The current potential target vertex of the hovering edge.
|
protected |
last node where 'resume' was started
|
protected |
Indicates if a pipeline is currently running.
|
protected |
currently running processes...
|
protected |
The path for temporary files.
|
protected |
The queue of pending TOPP processes.
|
protected |
Indicates if the output directory has been specified by the user already.
|
protected |
The list of all vertices.