Yentl Van Tendeloo пре 7 година
родитељ
комит
5d3543c411
5 измењених фајлова са 18 додато и 41 уклоњено
  1. 3 0
      classes/canvas/canvas_element.xml
  2. 3 18
      classes/window/create_activity.xml
  3. 2 16
      frontend.py
  4. 4 3
      models/render_OD.alc
  5. 6 4
      models/render_SCD.alc

+ 3 - 0
classes/canvas/canvas_element.xml

@@ -303,6 +303,9 @@
         <state id="update_mv" initial="x">
             <state id="x">
                 <onentry>
+                    <script>
+                        print("Moving element %s in model %s" % (self.cs_element, current_rendered_model))
+                    </script>
                     <raise event="mv_request" scope="broad">
                         <parameter expr="'attr_assign'"/>
                         <parameter expr="[current_rendered_model, self.cs_element, 'x', self.coordinates[0]]"/>

+ 3 - 18
classes/window/create_activity.xml

@@ -666,7 +666,6 @@
                 <parameter name="evt"/>
                 <script>
                     self.current = int(evt.split("input_browse_", 1)[1])
-                    print("Browse button pressed for " + str(self.input_map[self.current]))
                 </script>
             </transition>
 
@@ -674,7 +673,6 @@
                 <parameter name="evt"/>
                 <script>
                     self.current = int(evt.split("output_browse_", 1)[1])
-                    print("Browse button pressed for " + str(self.output_map[self.current]))
                 </script>
             </transition>
 
@@ -694,7 +692,6 @@
             <transition event="mv_response" target="../modifying_mm">
                 <parameter name="context"/>
                 <script>
-                    print("Got context: " + str(context))
                     self.context = context
                     model_to_modify = "merged/%s" % self.activity_name
                     self.subprocess = subprocess.Popen([sys.executable, sys.argv[0], "--address", data['mv_address'], "--username", data['username'], "--password", data['password'], "--model", model_to_modify, "--limited"])
@@ -703,16 +700,8 @@
         </state>
 
         <state id="modifying_mm">
-            <transition cond="self.subprocess.poll() is not None" target="../finish_transformation_add">
-                <script>
-                    print("Not alive anymore...")
-                </script>
-            </transition>
-            <transition after="0.5" target=".">
-                <script>
-                    print("Checking whether or not subprocess is still alive...")
-                </script>
-            </transition>
+            <transition cond="self.subprocess.poll() is not None" target="../finish_transformation_add"/>
+            <transition after="0.5" target="."/>
         </state>
 
         <state id="finish_transformation_add">
@@ -724,11 +713,7 @@
                 </raise>
             </onentry>
 
-            <transition event="mv_response" target="../closing">
-                <script>
-                    print("FINISHED")
-                </script>
-            </transition>
+            <transition event="mv_response" target="../closing"/>
         </state>
 
         <state id="closing">

+ 2 - 16
frontend.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Tue Nov  7 11:39:35 2017
+Date:   Tue Nov  7 13:29:19 2017
 
 Model author: Yentl Van Tendeloo
 Model name:   Modelverse Visual Editor - Tkinter Version 
@@ -9011,18 +9011,15 @@ class ActivityCreator(RuntimeClassBase, tk.Toplevel, SCCDWidget):
         
         # transition /modifying_mm
         _modifying_mm_0 = Transition(self, self.states["/modifying_mm"], [self.states["/finish_transformation_add"]])
-        _modifying_mm_0.setAction(self._modifying_mm_0_exec)
         _modifying_mm_0.setTrigger(None)
         _modifying_mm_0.setGuard(self._modifying_mm_0_guard)
         self.states["/modifying_mm"].addTransition(_modifying_mm_0)
         _modifying_mm_1 = Transition(self, self.states["/modifying_mm"], [self.states["/modifying_mm"]])
-        _modifying_mm_1.setAction(self._modifying_mm_1_exec)
         _modifying_mm_1.setTrigger(Event("_0after"))
         self.states["/modifying_mm"].addTransition(_modifying_mm_1)
         
         # transition /finish_transformation_add
         _finish_transformation_add_0 = Transition(self, self.states["/finish_transformation_add"], [self.states["/closing"]])
-        _finish_transformation_add_0.setAction(self._finish_transformation_add_0_exec)
         _finish_transformation_add_0.setTrigger(Event("mv_response", None))
         self.states["/finish_transformation_add"].addTransition(_finish_transformation_add_0)
         
@@ -9403,7 +9400,6 @@ class ActivityCreator(RuntimeClassBase, tk.Toplevel, SCCDWidget):
     def _ready_8_exec(self, parameters):
         evt = parameters[0]
         self.current = int(evt.split("input_browse_", 1)[1])
-        print("Browse button pressed for " + str(self.input_map[self.current]))
     
     def _ready_8_guard(self, parameters):
         evt = parameters[0]
@@ -9412,7 +9408,6 @@ class ActivityCreator(RuntimeClassBase, tk.Toplevel, SCCDWidget):
     def _ready_9_exec(self, parameters):
         evt = parameters[0]
         self.current = int(evt.split("output_browse_", 1)[1])
-        print("Browse button pressed for " + str(self.output_map[self.current]))
     
     def _ready_9_guard(self, parameters):
         evt = parameters[0]
@@ -9424,23 +9419,13 @@ class ActivityCreator(RuntimeClassBase, tk.Toplevel, SCCDWidget):
     
     def _creating_0_exec(self, parameters):
         context = parameters[0]
-        print("Got context: " + str(context))
         self.context = context
         model_to_modify = "merged/%s" % self.activity_name
         self.subprocess = subprocess.Popen([sys.executable, sys.argv[0], "--address", data['mv_address'], "--username", data['username'], "--password", data['password'], "--model", model_to_modify, "--limited"])
     
-    def _modifying_mm_0_exec(self, parameters):
-        print("Not alive anymore...")
-    
     def _modifying_mm_0_guard(self, parameters):
         return self.subprocess.poll() is not None
     
-    def _modifying_mm_1_exec(self, parameters):
-        print("Checking whether or not subprocess is still alive...")
-    
-    def _finish_transformation_add_0_exec(self, parameters):
-        print("FINISHED")
-    
     def _closing_0_exec(self, parameters):
         self.big_step.outputEventOM(Event("narrow_cast", None, [self, 'parent', Event("close_window", None, [])]))
     
@@ -12328,6 +12313,7 @@ class CanvasElement(RuntimeClassBase, SCCDWidget):
         self.big_step.outputEventOM(Event("broad_cast", None, [self, Event("mv_request", None, ['attr_assign', [current_rendered_model, self.cs_element, 'dirty', True]])]))
     
     def _update_mv_x_enter(self):
+        print("Moving element %s in model %s" % (self.cs_element, current_rendered_model))
         self.big_step.outputEventOM(Event("broad_cast", None, [self, Event("mv_request", None, ['attr_assign', [current_rendered_model, self.cs_element, 'x', self.coordinates[0]]])]))
     
     def _update_mv_y_enter(self):

+ 4 - 3
models/render_OD.alc

@@ -1,6 +1,7 @@
 include "primitives.alh"
 include "modelling.alh"
 include "object_operations.alh"
+include "utils.alh"
 
 Boolean function main(model : Element):
 	Element elements
@@ -90,7 +91,7 @@ Boolean function main(model : Element):
 				group = instantiate_node(model, "rendered/Group", "")
 				instantiate_attribute(model, group, "x", x)
 				instantiate_attribute(model, group, "y", y)
-				instantiate_attribute(model, group, "__asid", list_read(string_split(class, "/"), 1))
+				instantiate_attribute(model, group, "__asid", list_read(string_split_nr(class, "/", 1), 1))
 				instantiate_attribute(model, group, "layer", 0)
 				dict_add(groups, class, group)
 
@@ -115,7 +116,7 @@ Boolean function main(model : Element):
 				instantiate_attribute(model, elem, "y", 3)
 				instantiate_attribute(model, elem, "lineWidth", 1)
 				instantiate_attribute(model, elem, "lineColour", "black")
-				instantiate_attribute(model, elem, "text", string_join(cast_value(list_read(string_split(class, "/"), 1)), " : " + cast_value(list_read(string_split(read_type(model, class), "/"), 1))))
+				instantiate_attribute(model, elem, "text", string_join(cast_value(list_read(string_split_nr(class, "/", 1), 1)), " : " + cast_value(list_read(string_split_nr(read_type(model, class), "/", 1), 1))))
 				instantiate_attribute(model, elem, "layer", 2)
 				instantiate_link(model, "rendered/contains", "", group, elem)
 
@@ -199,7 +200,7 @@ Boolean function main(model : Element):
 			instantiate_attribute(model, elem, "lineWidth", 3)
 			instantiate_attribute(model, elem, "lineColour", "black")
 			instantiate_attribute(model, elem, "arrow", True)
-			instantiate_attribute(model, elem, "__asid", list_read(string_split(class, "/"), 1))
+			instantiate_attribute(model, elem, "__asid", list_read(string_split_nr(class, "/", 1), 1))
 			instantiate_attribute(model, elem, "layer", 0)
 			instantiate_link(model, "rendered/contains", "", group, elem)
 

+ 6 - 4
models/render_SCD.alc

@@ -1,6 +1,7 @@
 include "primitives.alh"
 include "modelling.alh"
 include "object_operations.alh"
+include "utils.alh"
 
 Boolean function main(model : Element):
 	Element elements
@@ -85,7 +86,7 @@ Boolean function main(model : Element):
 		group = instantiate_node(model, "rendered/Group", "")
 		instantiate_attribute(model, group, "x", x)
 		instantiate_attribute(model, group, "y", y)
-		instantiate_attribute(model, group, "__asid", list_read(string_split(class, "/"), 1))
+		instantiate_attribute(model, group, "__asid", list_read(string_split_nr(class, "/", 1), 1))
 		instantiate_attribute(model, group, "layer", 0)
 		dict_add(groups, class, group)
 		loc = loc + 200
@@ -146,7 +147,7 @@ Boolean function main(model : Element):
 			instantiate_attribute(model, elem, "y", text_loc + 20)
 			instantiate_attribute(model, elem, "lineWidth", 1)
 			instantiate_attribute(model, elem, "lineColour", "black")
-			instantiate_attribute(model, elem, "text", (attr_key + " : ") + cast_string(list_read(string_split(attrs[attr_key], "/"), 1)))
+			instantiate_attribute(model, elem, "text", (attr_key + " : ") + cast_string(list_read(string_split_nr(attrs[attr_key], "/", 1), 1)))
 			instantiate_attribute(model, elem, "layer", 2)
 			instantiate_link(model, "rendered/contains", "", group, elem)
 			text_loc = text_loc + 15
@@ -174,9 +175,10 @@ Boolean function main(model : Element):
 		instantiate_attribute(model, elem, "lineWidth", 1)
 		instantiate_attribute(model, elem, "lineColour", "black")
 		instantiate_attribute(model, elem, "arrow", True)
-		instantiate_attribute(model, elem, "__asid", list_read(string_split(class, "/"), 1))
+		instantiate_attribute(model, elem, "__asid", list_read(string_split_nr(class, "/", 1), 1))
 		instantiate_attribute(model, elem, "layer", 0)
-		log("Found ASID " + cast_value(list_read(string_split(class, "/"), 1)))
+		log("Real ASID: " + cast_value(class))
+		log("Found ASID " + cast_value(list_read(string_split_nr(class, "/", 1), 1)))
 		instantiate_link(model, "rendered/contains", "", group, elem)
 
 	return True!