|
|
@@ -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: Thu Sep 14 16:38:00 2017
|
|
|
+Date: Fri Sep 15 10:41:28 2017
|
|
|
|
|
|
Model author: Yentl Van Tendeloo and Addis Gebremichael
|
|
|
Model name: Modelverse Visual Editor - Tkinter Version
|
|
|
@@ -358,7 +358,7 @@ class MainApp(RuntimeClassBase):
|
|
|
self.raiseInternalEvent(Event("mv_request_context", None, ['instantiate', [None, 'Association', ('abstract/Class', 'rendered/Group'), 'TracabilityClass'], self.context]))
|
|
|
|
|
|
def _parallel_behaviour_init_modelverse_logging_in_modelverse_upload_models_modify_render_SCD_trace_association_enter(self):
|
|
|
- self.raiseInternalEvent(Event("mv_request_context", None, ['instantiate', [None, 'Association', ('abstract/Association', 'rendered/Group'), 'TracabilityAssociation'], self.context]))
|
|
|
+ self.raiseInternalEvent(Event("mv_request_context", None, ['instantiate', [None, 'Association', ('abstract/Association', 'rendered/ConnectingLine'), 'TracabilityAssociation'], self.context]))
|
|
|
|
|
|
def _parallel_behaviour_init_modelverse_logging_in_modelverse_upload_models_modify_render_SCD_exit_enter(self):
|
|
|
self.raiseInternalEvent(Event("mv_request_context", None, ['exit', [], self.context]))
|
|
|
@@ -2352,7 +2352,6 @@ class Modelverse(RuntimeClassBase):
|
|
|
|
|
|
def _initialized_behaviour_operations_attr_assign_enter(self):
|
|
|
self.raiseInternalEvent(Event("request", None, [['attr_add', self.parameters[1], self.parameters[2], self.parameters[3]]]))
|
|
|
- print("Attr assign for parameters: " + str(self.parameters))
|
|
|
|
|
|
def _initialized_behaviour_operations_attr_assign_code_enter(self):
|
|
|
self.raiseInternalEvent(Event("request", None, [['attr_add_code', self.parameters[1], self.parameters[2], self.parameters[3]]]))
|
|
|
@@ -5651,6 +5650,8 @@ class Canvas(RuntimeClassBase, tk.Canvas, SCCDWidget):
|
|
|
|
|
|
self.assoc_links = {}
|
|
|
self.element_group = {}
|
|
|
+ self.group_location = {}
|
|
|
+ self.connecting_lines = {}
|
|
|
|
|
|
def user_defined_destructor(self):
|
|
|
self.destroy()
|
|
|
@@ -5705,7 +5706,17 @@ class Canvas(RuntimeClassBase, tk.Canvas, SCCDWidget):
|
|
|
_ready_3 = Transition(self, self.states["/ready"], [self.states["/ready"]])
|
|
|
_ready_3.setAction(self._ready_3_exec)
|
|
|
_ready_3.setTrigger(Event("draw_canvas", None))
|
|
|
+ _ready_3.setGuard(self._ready_3_guard)
|
|
|
self.states["/ready"].addTransition(_ready_3)
|
|
|
+ _ready_4 = Transition(self, self.states["/ready"], [self.states["/ready"]])
|
|
|
+ _ready_4.setAction(self._ready_4_exec)
|
|
|
+ _ready_4.setTrigger(Event("draw_canvas", None))
|
|
|
+ _ready_4.setGuard(self._ready_4_guard)
|
|
|
+ self.states["/ready"].addTransition(_ready_4)
|
|
|
+ _ready_5 = Transition(self, self.states["/ready"], [self.states["/ready"]])
|
|
|
+ _ready_5.setAction(self._ready_5_exec)
|
|
|
+ _ready_5.setTrigger(Event("moved_group", None))
|
|
|
+ self.states["/ready"].addTransition(_ready_5)
|
|
|
|
|
|
# transition /creating_group
|
|
|
_creating_group_0 = Transition(self, self.states["/creating_group"], [self.states["/ready"]])
|
|
|
@@ -5723,23 +5734,64 @@ class Canvas(RuntimeClassBase, tk.Canvas, SCCDWidget):
|
|
|
def _ready_1_exec(self, parameters):
|
|
|
element = parameters[0]
|
|
|
self.creating_id = element["id"]
|
|
|
- self.big_step.outputEventOM(Event("create_instance", None, [self, 'elements', 'CanvasElement', self, (element['x'], element['y'])]))
|
|
|
+ self.group_location[element['id']] = (element['x'], element['y'])
|
|
|
+ self.big_step.outputEventOM(Event("create_instance", None, [self, 'elements', 'CanvasElement', self, (element['x'], element['y']), element['id']]))
|
|
|
|
|
|
def _ready_2_exec(self, parameters):
|
|
|
element = parameters[0]
|
|
|
self.element_group[element["__target"]] = element["__source"]
|
|
|
- print("Binding element %s to group %s" % (element["__target"], element["__source"]))
|
|
|
|
|
|
def _ready_3_exec(self, parameters):
|
|
|
element = parameters[0]
|
|
|
- print("Drawing element %s" % element["id"])
|
|
|
self.big_step.outputEventOM(Event("narrow_cast", None, [self, self.assoc_links[self.element_group[element['id']]], Event("draw_element", None, [element])]))
|
|
|
|
|
|
+ def _ready_3_guard(self, parameters):
|
|
|
+ element = parameters[0]
|
|
|
+ return element['type'] != 'ConnectingLine'
|
|
|
+
|
|
|
+ def _ready_4_exec(self, parameters):
|
|
|
+ element = parameters[0]
|
|
|
+ source_x = self.group_location[element['__source']][0] + element['offsetSourceX']
|
|
|
+ source_y = self.group_location[element['__source']][1] + element['offsetSourceY']
|
|
|
+ target_x = self.group_location[element['__target']][0] + element['offsetTargetX']
|
|
|
+ target_y = self.group_location[element['__target']][1] + element['offsetTargetY']
|
|
|
+
|
|
|
+ self.connecting_lines.setdefault(element['__source'], []).append(element)
|
|
|
+ self.connecting_lines.setdefault(element['__target'], []).append(element)
|
|
|
+
|
|
|
+ line = self.create_line(source_x, source_y, target_x, target_y)
|
|
|
+ element['elem'] = line
|
|
|
+
|
|
|
+ def _ready_4_guard(self, parameters):
|
|
|
+ element = parameters[0]
|
|
|
+ return element['type'] == 'ConnectingLine'
|
|
|
+
|
|
|
+ def _ready_5_exec(self, parameters):
|
|
|
+ group_element = parameters[0]
|
|
|
+ new_location = parameters[1]
|
|
|
+ self.group_location[group_element] = new_location
|
|
|
+ if group_element in self.connecting_lines:
|
|
|
+ lines_to_move = self.connecting_lines[group_element]
|
|
|
+
|
|
|
+ for line_element in lines_to_move:
|
|
|
+ source_x, source_y, target_x, target_y = self.coords(line_element['elem'])
|
|
|
+
|
|
|
+ if line_element['__source'] == group_element:
|
|
|
+ # Moved source
|
|
|
+ source_x = self.group_location[group_element][0] + line_element['offsetSourceX']
|
|
|
+ source_y = self.group_location[group_element][1] + line_element['offsetSourceY']
|
|
|
+
|
|
|
+ if line_element['__target'] == group_element:
|
|
|
+ # Moved target
|
|
|
+ target_x = self.group_location[group_element][0] + line_element['offsetTargetX']
|
|
|
+ target_y = self.group_location[group_element][1] + line_element['offsetTargetY']
|
|
|
+
|
|
|
+ self.coords(line_element['elem'], source_x, source_y, target_x, target_y)
|
|
|
+
|
|
|
def _creating_group_0_exec(self, parameters):
|
|
|
assoc_name = parameters[0]
|
|
|
self.big_step.outputEventOM(Event("start_instance", None, [self, assoc_name]))
|
|
|
self.assoc_links[self.creating_id] = assoc_name
|
|
|
- print("Defining group " + str(self.creating_id))
|
|
|
self.big_step.outputEventOM(Event("narrow_cast", None, [self, 'parent', Event("group_ready", None, [])]))
|
|
|
|
|
|
def initializeStatechart(self):
|
|
|
@@ -5748,7 +5800,7 @@ class Canvas(RuntimeClassBase, tk.Canvas, SCCDWidget):
|
|
|
RuntimeClassBase.initializeStatechart(self)
|
|
|
|
|
|
class CanvasElement(RuntimeClassBase, SCCDWidget):
|
|
|
- def __init__(self, controller, parent, coordinates):
|
|
|
+ def __init__(self, controller, parent, coordinates, group_element):
|
|
|
RuntimeClassBase.__init__(self, controller)
|
|
|
|
|
|
self.semantics.big_step_maximality = StatechartSemantics.TakeMany
|
|
|
@@ -5761,14 +5813,15 @@ class CanvasElement(RuntimeClassBase, SCCDWidget):
|
|
|
self.build_statechart_structure()
|
|
|
|
|
|
# call user defined constructor
|
|
|
- CanvasElement.user_defined_constructor(self, parent, coordinates)
|
|
|
+ CanvasElement.user_defined_constructor(self, parent, coordinates, group_element)
|
|
|
|
|
|
- def user_defined_constructor(self, parent, coordinates):
|
|
|
+ def user_defined_constructor(self, parent, coordinates, group_element):
|
|
|
SCCDWidget.__init__(self, True)
|
|
|
self.containing_canvas = parent
|
|
|
self.coordinates = coordinates
|
|
|
self.elements = {}
|
|
|
self.tmp = {}
|
|
|
+ self.group_element = group_element
|
|
|
|
|
|
def user_defined_destructor(self):
|
|
|
# call super class destructors
|
|
|
@@ -5907,8 +5960,13 @@ class CanvasElement(RuntimeClassBase, SCCDWidget):
|
|
|
height = old_coords[3] - old_coords[1]
|
|
|
width = old_coords[2] - old_coords[0]
|
|
|
self.containing_canvas.coords(f, (new_x, new_y, new_x + width, new_y + height))
|
|
|
+
|
|
|
self.prev_x = self.last_x
|
|
|
self.prev_y = self.last_y
|
|
|
+
|
|
|
+ delta_x = self.original_coords[0] - self.last_x
|
|
|
+ delta_y = self.original_coords[1] - self.last_y
|
|
|
+ self.big_step.outputEventOM(Event("narrow_cast", None, [self, 'parent', Event("moved_group", None, [self.group_element, (self.coordinates[0] - delta_x, self.coordinates[1] - delta_y)])]))
|
|
|
|
|
|
def _dragging_0_guard(self, parameters):
|
|
|
ID = parameters[0]
|
|
|
@@ -6006,7 +6064,7 @@ class ObjectManager(ObjectManagerBase):
|
|
|
instance.associations["parent"] = Association("A", 1, 1)
|
|
|
instance.associations["elements"] = Association("CanvasElement", 0, -1)
|
|
|
elif class_name == "CanvasElement":
|
|
|
- instance = CanvasElement(self.controller, construct_params[0], construct_params[1])
|
|
|
+ instance = CanvasElement(self.controller, construct_params[0], construct_params[1], construct_params[2])
|
|
|
instance.associations = {}
|
|
|
instance.associations["parent"] = Association("A", 1, 1)
|
|
|
instance.associations["elements"] = Association("CanvasElement", 0, -1)
|