Selaa lähdekoodia

Open a new GUI editor for manual activities

Yentl Van Tendeloo 8 vuotta sitten
vanhempi
commit
c295c566e4
1 muutettua tiedostoa jossa 38 lisäystä ja 20 poistoa
  1. 38 20
      classes/window/activity.xml

+ 38 - 20
classes/window/activity.xml

@@ -213,15 +213,9 @@
 
                 <state id="execute">
                     <onentry>
-                        <script>
-                            print("Executing activity %s" % self.activity)
-                            print("   Inputs  " + str(self.exec_input_signature))
-                            print("   Outputs " + str(self.exec_output_signature))
-                        </script>
-
                         <raise event="mv_request" scope="broad">
                             <parameter expr="'transformation_execute'"/>
-                            <parameter expr="[self.activity, self.exec_input_signature, self.exec_output_signature]"/>
+                            <parameter expr="[self.activity, self.exec_input_signature, self.exec_output_signature, '']"/>
                         </raise>
                     </onentry>
 
@@ -229,29 +223,53 @@
                         <parameter name="context"/>
                         <script>
                             self.current_context = context
+                            print("Entering context: " + str(self.current_context))
                         </script>
                     </transition>
                 </state>
 
-                <state id="in_context">
-                    <!-- TODO Add data_input and data_output -->
-                    <onentry>
-                        <script>
-                            print("Waiting in context: " + str(self.current_context))
-                        </script>
-                    </onentry>
+                <state id="in_context" initial="choice">
+                    <state id="choice">
+                        <transition cond="self.current_context[0] == 'SC'" target="../statechart"/>
+                        <transition cond="self.current_context[0] == 'OP'" target="../operations">
+                            <script>
+                                self.subprocess = subprocess.Popen([sys.executable, sys.argv[0], "--address", data['mv_address'], "--username", data['username'], "--password", data['password'], "--model", self.current_context[3], "--limited"])
+                            </script>
+                        </transition>
+                    </state>
 
-                    <onexit>
-                        <script>
-                            print("Finished context: " + str(self.current_context))
-                        </script>
-                    </onexit>
+                    <state id="operations">
+                        <transition cond="self.subprocess.poll() is not None" target="../finished">
+                            <raise event="mv_request_context" scope="broad">
+                                <parameter expr="'exit'"/>
+                                <parameter expr="[]"/>
+                                <parameter expr="self.current_context[2]"/>
+                            </raise>
+                        </transition>
+                        <transition after="0.5" target="."/>
+                    </state>
+
+                    <state id="statechart">
+                        <onentry>
+                            <script>
+                                print("Executing SC activity")
+                            </script>
+                        </onentry>
+                    </state>
+
+                    <state id="finished"/>
 
                     <transition event="mv_response" cond="result == True" target="../alter_context_result">
                         <parameter name="result"/>
+                        <script>
+                            print("Finished with TRUE")
+                        </script>
                     </transition>
                     <transition event="mv_response" cond="result == False" target="../../ready">
                         <parameter name="result"/>
+                        <script>
+                            print("Finished with FALSE")
+                        </script>
                     </transition>
                 </state>
 
@@ -274,7 +292,7 @@
                             </raise>
                         </onentry>
 
-                        <transition event="mv_response" target="../check_next"/>
+                        <transition target="../check_next"/>
                     </state>
                 </state>
             </state>