|
@@ -1,7 +1,7 @@
|
|
|
"""
|
|
"""
|
|
|
Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
|
|
Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
|
|
|
|
|
|
|
|
-Date: Thu Oct 5 16:13:47 2017
|
|
|
|
|
|
|
+Date: Thu Oct 5 16:46:48 2017
|
|
|
|
|
|
|
|
Model author: Yentl Van Tendeloo
|
|
Model author: Yentl Van Tendeloo
|
|
|
Model name: Modelverse Visual Editor - Tkinter Version
|
|
Model name: Modelverse Visual Editor - Tkinter Version
|
|
@@ -7201,8 +7201,12 @@ class Canvas(RuntimeClassBase, tk.Canvas, SCCDWidget):
|
|
|
self.states["/ready"].addTransition(_ready_4)
|
|
self.states["/ready"].addTransition(_ready_4)
|
|
|
_ready_5 = Transition(self, self.states["/ready"], [self.states["/ready"]])
|
|
_ready_5 = Transition(self, self.states["/ready"], [self.states["/ready"]])
|
|
|
_ready_5.setAction(self._ready_5_exec)
|
|
_ready_5.setAction(self._ready_5_exec)
|
|
|
- _ready_5.setTrigger(Event("moved_group", None))
|
|
|
|
|
|
|
+ _ready_5.setTrigger(Event("instance_created", None))
|
|
|
self.states["/ready"].addTransition(_ready_5)
|
|
self.states["/ready"].addTransition(_ready_5)
|
|
|
|
|
+ _ready_6 = Transition(self, self.states["/ready"], [self.states["/ready"]])
|
|
|
|
|
+ _ready_6.setAction(self._ready_6_exec)
|
|
|
|
|
+ _ready_6.setTrigger(Event("moved_group", None))
|
|
|
|
|
+ self.states["/ready"].addTransition(_ready_6)
|
|
|
|
|
|
|
|
# transition /creating_group
|
|
# transition /creating_group
|
|
|
_creating_group_0 = Transition(self, self.states["/creating_group"], [self.states["/ready"]])
|
|
_creating_group_0 = Transition(self, self.states["/creating_group"], [self.states["/ready"]])
|
|
@@ -7215,17 +7219,13 @@ class Canvas(RuntimeClassBase, tk.Canvas, SCCDWidget):
|
|
|
|
|
|
|
|
def _ready_0_exec(self, parameters):
|
|
def _ready_0_exec(self, parameters):
|
|
|
self.big_step.outputEventOM(Event("delete_instance", None, [self, 'elements']))
|
|
self.big_step.outputEventOM(Event("delete_instance", None, [self, 'elements']))
|
|
|
- self.shift = {}
|
|
|
|
|
- for l in self.lines:
|
|
|
|
|
- self.delete(l)
|
|
|
|
|
- self.connecting_lines = {}
|
|
|
|
|
|
|
+ self.big_step.outputEventOM(Event("delete_instance", None, [self, 'connecting_lines']))
|
|
|
self.group_location = {}
|
|
self.group_location = {}
|
|
|
|
|
|
|
|
def _ready_1_exec(self, parameters):
|
|
def _ready_1_exec(self, parameters):
|
|
|
element = parameters[0]
|
|
element = parameters[0]
|
|
|
self.creating_id = element["id"]
|
|
self.creating_id = element["id"]
|
|
|
self.group_location[element['id']] = (element['x'], element['y'])
|
|
self.group_location[element['id']] = (element['x'], element['y'])
|
|
|
- print("Creating new group %s --> %s" % (element['id'], (element['x'], element['y'])))
|
|
|
|
|
self.big_step.outputEventOM(Event("create_instance", None, [self, 'elements', 'CanvasElement', self, (element['x'], element['y']), element['id'], element['__asid']]))
|
|
self.big_step.outputEventOM(Event("create_instance", None, [self, 'elements', 'CanvasElement', self, (element['x'], element['y']), element['id'], element['__asid']]))
|
|
|
|
|
|
|
|
def _ready_2_exec(self, parameters):
|
|
def _ready_2_exec(self, parameters):
|
|
@@ -7242,34 +7242,21 @@ class Canvas(RuntimeClassBase, tk.Canvas, SCCDWidget):
|
|
|
|
|
|
|
|
def _ready_4_exec(self, parameters):
|
|
def _ready_4_exec(self, parameters):
|
|
|
element = parameters[0]
|
|
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']
|
|
|
|
|
- middle_x = (source_x + target_x) / 2
|
|
|
|
|
- middle_y = (source_y + target_y) / 2
|
|
|
|
|
- self.group_location[element['id']] = (middle_x, middle_y)
|
|
|
|
|
-
|
|
|
|
|
- self.connecting_lines.setdefault(element['__source'], []).append(element)
|
|
|
|
|
- self.connecting_lines.setdefault(element['__target'], []).append(element)
|
|
|
|
|
-
|
|
|
|
|
- print("DRAW connecting line from ((%s, %s) to (%s, %s))" % (source_x, source_y, target_x, target_y))
|
|
|
|
|
- print("Source: " + str(element['__source']))
|
|
|
|
|
- print("Target: " + str(element['__target']))
|
|
|
|
|
- line1 = self.create_line(source_x, source_y, middle_x, middle_y, fill=element['lineColour'], width=element['lineWidth'], arrow=tk.LAST if element['arrow'] else tk.NONE)
|
|
|
|
|
- line2 = self.create_line(middle_x, middle_y, target_x, target_y, fill=element['lineColour'], width=element['lineWidth'])
|
|
|
|
|
- element['elem'] = (line1, line2)
|
|
|
|
|
- self.lines.add(line1)
|
|
|
|
|
- self.lines.add(line2)
|
|
|
|
|
|
|
+ self.big_step.outputEventOM(Event("create_instance", None, [self, 'connecting_lines', 'ConnectingLine', self, element]))
|
|
|
|
|
|
|
|
def _ready_4_guard(self, parameters):
|
|
def _ready_4_guard(self, parameters):
|
|
|
element = parameters[0]
|
|
element = parameters[0]
|
|
|
return element['type'] == 'ConnectingLine'
|
|
return element['type'] == 'ConnectingLine'
|
|
|
|
|
|
|
|
def _ready_5_exec(self, parameters):
|
|
def _ready_5_exec(self, parameters):
|
|
|
|
|
+ result = parameters[0]
|
|
|
|
|
+ self.big_step.outputEventOM(Event("start_instance", None, [self, result]))
|
|
|
|
|
+
|
|
|
|
|
+ def _ready_6_exec(self, parameters):
|
|
|
group_element = parameters[0]
|
|
group_element = parameters[0]
|
|
|
new_location = parameters[1]
|
|
new_location = parameters[1]
|
|
|
- self.move_element(group_element, new_location)
|
|
|
|
|
|
|
+ self.group_location[group_element] = new_location
|
|
|
|
|
+ self.big_step.outputEventOM(Event("narrow_cast", None, [self, 'connecting_lines', Event("moved_element", None, ['group_element', 'new_location'])]))
|
|
|
|
|
|
|
|
def _creating_group_0_exec(self, parameters):
|
|
def _creating_group_0_exec(self, parameters):
|
|
|
assoc_name = parameters[0]
|
|
assoc_name = parameters[0]
|
|
@@ -7686,6 +7673,7 @@ class ObjectManager(ObjectManagerBase):
|
|
|
instance.associations = {}
|
|
instance.associations = {}
|
|
|
instance.associations["parent"] = Association("A", 1, 1)
|
|
instance.associations["parent"] = Association("A", 1, 1)
|
|
|
instance.associations["elements"] = Association("CanvasElement", 0, -1)
|
|
instance.associations["elements"] = Association("CanvasElement", 0, -1)
|
|
|
|
|
+ instance.associations["connecting_lines"] = Association("ConnectingLines", 0, -1)
|
|
|
elif class_name == "CanvasElement":
|
|
elif class_name == "CanvasElement":
|
|
|
instance = CanvasElement(self.controller, construct_params[0], construct_params[1], construct_params[2], construct_params[3])
|
|
instance = CanvasElement(self.controller, construct_params[0], construct_params[1], construct_params[2], construct_params[3])
|
|
|
instance.associations = {}
|
|
instance.associations = {}
|