Browse Source

Made wrapper more robust when handling modelling -> megamodelling
switch; add support for user_logout operation

Yentl Van Tendeloo 7 years ago
parent
commit
97f4ab44c2
2 changed files with 8 additions and 4 deletions
  1. 4 2
      wrappers/classes/modelverse.xml
  2. 4 2
      wrappers/modelverse_SCCD.py

+ 4 - 2
wrappers/classes/modelverse.xml

@@ -91,6 +91,8 @@
             self.registered_metamodel = {}
             self.inputs = []
             self.finish_output_thread = False
+
+            self.modelling_operations = ['element_list', 'element_list_nice', 'types', 'types_full', 'read_info', 'read_attrs', 'read_defined_attrs', 'instantiate', 'delete_element', 'attr_assign', 'attr_assign_code', 'attr_delete', 'read_outgoing', 'read_incoming', 'read_association_source', 'read_association_destination', 'connections_between', 'define_attribute', 'undefine_attribute', 'all_instances', 'attr_optional', 'attr_type', 'attr_name']
         </body>
     </constructor>
 
@@ -1833,7 +1835,7 @@
                             <state id="manual">
                                 <transition cond="self.expect_action('exit')" target="../../../../leaving_manual"/>
 
-                                <transition cond="self.actions and self.actions[0]['parameters'][0] != self.current_model" target="../../../../leaving_manual"/>
+                                <transition cond="self.actions and self.actions[0] in self.modelling_operations and self.actions[0]['parameters'][0] != self.current_model" target="../../../../leaving_manual"/>
                             </state>
 
                             <state id="scripted">
@@ -1989,7 +1991,7 @@
                             </transition>
                         </state>
 
-                        <transition cond="self.actions" target="../../leaving_manual"/>
+                        <transition cond="self.actions and self.actions[0] not in self.modelling_operations" target="../../leaving_manual"/>
                     </state>
 
                     <state id="finished"/>

+ 4 - 2
wrappers/modelverse_SCCD.py

@@ -49,6 +49,8 @@ class Modelverse(RuntimeClassBase):
         self.registered_metamodel = {}
         self.inputs = []
         self.finish_output_thread = False
+        
+        self.modelling_operations = ['element_list', 'element_list_nice', 'types', 'types_full', 'read_info', 'read_attrs', 'read_defined_attrs', 'instantiate', 'delete_element', 'attr_assign', 'attr_assign_code', 'attr_delete', 'read_outgoing', 'read_incoming', 'read_association_source', 'read_association_destination', 'connections_between', 'define_attribute', 'undefine_attribute', 'all_instances', 'attr_optional', 'attr_type', 'attr_name']
     
     def user_defined_destructor(self):
         pass
@@ -2276,7 +2278,7 @@ class Modelverse(RuntimeClassBase):
         return self.actions
     
     def _initialized_behaviour_wait_for_action_modelling_0_guard(self, parameters):
-        return self.actions
+        return self.actions and self.actions[0] not in self.modelling_operations
     
     def _initialized_behaviour_wait_for_action_modelling_recognized_0_exec(self, parameters):
         self.load_action()
@@ -3344,7 +3346,7 @@ class Modelverse(RuntimeClassBase):
         return self.expect_action('exit')
     
     def _initialized_behaviour_wait_for_action_modelling_recognized_manual_1_guard(self, parameters):
-        return self.actions and self.actions[0]['parameters'][0] != self.current_model
+        return self.actions and self.actions[0] in self.modelling_operations and self.actions[0]['parameters'][0] != self.current_model
     
     def _initialized_behaviour_wait_for_action_modelling_recognized_scripted_0_exec(self, parameters):
         self.raiseInternalEvent(Event("request", None, ['exit']))