From 8f4ad6b9a85de1d33ebe7feb82a06e87e57e02ad Mon Sep 17 00:00:00 2001
From: Stefano Borini <sborini@enthought.com>
Date: Tue, 3 Jul 2018 13:00:01 +0100
Subject: [PATCH] Make workflow accessible via application

---
 force_bdss/bdss_application.py | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/force_bdss/bdss_application.py b/force_bdss/bdss_application.py
index a822528..4e5d49b 100644
--- a/force_bdss/bdss_application.py
+++ b/force_bdss/bdss_application.py
@@ -6,8 +6,9 @@ from stevedore.exception import NoMatches
 
 from envisage.api import Application
 from envisage.core_plugin import CorePlugin
-from traits.api import Unicode, Bool
+from traits.api import Unicode, Bool, Property
 
+from force_bdss.ids import InternalPluginID
 from .factory_registry_plugin import FactoryRegistryPlugin
 from .core_evaluation_driver import CoreEvaluationDriver
 from .core_mco_driver import CoreMCODriver
@@ -28,6 +29,9 @@ class BDSSApplication(Application):
     #: coordination of the MCO itself. See design notes for more details.
     evaluate = Bool()
 
+    #: Gives the currently opened workflow
+    workflow = Property()
+
     def __init__(self, evaluate, workflow_filepath):
         self.evaluate = evaluate
         self.workflow_filepath = workflow_filepath
@@ -53,6 +57,15 @@ class BDSSApplication(Application):
 
         super(BDSSApplication, self).__init__(plugins=plugins)
 
+    def _get_workflow(self):
+        if self.evaluate:
+            plugin = self.get_plugin(
+                InternalPluginID.CORE_EVALUATION_DRIVER_ID)
+        else:
+            plugin = self.get_plugin(InternalPluginID.CORE_MCO_DRIVER_ID)
+
+        return plugin.workflow
+
 
 def _import_extensions(plugins, ext):
     """Service routine extracted for testing.
-- 
GitLab