Ver código fonte

Some nicer edges hopefully

Yentl Van Tendeloo 8 anos atrás
pai
commit
6b1db025dd
2 arquivos alterados com 17 adições e 5 exclusões
  1. 8 2
      classes/window/main_window.xml
  2. 9 3
      frontend.py

+ 8 - 2
classes/window/main_window.xml

@@ -1081,9 +1081,15 @@
                                                 attrs[key] = value
                                                 attrs[key] = value
                                         max_text = 0
                                         max_text = 0
 
 
+                                        #TODO doesn't work yet
+                                        if is_edge:
+                                            edge_edge = len([x for x in result if (x["id"] == element_source or x["id"] == element_target) and "__source" in x]) > 0
+                                        else:
+                                            edge_edge = False
+
                                         if is_edge:
                                         if is_edge:
                                             cs_elem_id = str(uuid.uuid4())
                                             cs_elem_id = str(uuid.uuid4())
-                                            edges.append({"id": cs_elem_id, "type": "ConnectingLine", "offsetSourceX": 0, "offsetSourceY": 0, "offsetTargetX": 0, "offsetTargetY": 0, "lineWidth": 1, "lineColour": "black", "arrow": True, "__asid": element_id, "layer": 0, "__source": element_source, "__target": element_target})
+                                            edges.append({"id": cs_elem_id, "type": "ConnectingLine", "offsetSourceX": 0 if edge_edge else 100, "offsetSourceY": 0 if edge_edge else 30, "offsetTargetX": 0 if edge_edge else 100, "offsetTargetY": 0 if edge_edge else 30, "lineWidth": 3, "lineColour": "black", "arrow": True, "__asid": element_id, "layer": 0, "__source": element_source, "__target": element_target})
                                             groups[element_id] = cs_elem_id
                                             groups[element_id] = cs_elem_id
                                         else:
                                         else:
                                             # Add the group
                                             # Add the group
@@ -1104,7 +1110,7 @@
                                             text_counter = 0
                                             text_counter = 0
                                             for key, value in attrs.items():
                                             for key, value in attrs.items():
                                                 cs_elem_id = str(uuid.uuid4())
                                                 cs_elem_id = str(uuid.uuid4())
-                                                self.rendered.append({"id": cs_elem_id, "type": "Text", "x": 10, "y": 25 + text_counter * 11, "text": "%s = %s" % (key, value), "lineWidth": 1, "lineColour": "black", "layer": 2})
+                                                self.rendered.append({"id": cs_elem_id, "type": "Text", "x": 10, "y": 25 + text_counter * 11, "text": "%s = %s" % (key, value), "lineWidth": 3, "lineColour": "black", "layer": 2})
                                                 max_text = max(len("%s = %s" % (key, value)), max_text)
                                                 max_text = max(len("%s = %s" % (key, value)), max_text)
                                                 self.rendered.append({"id": str(uuid.uuid4()), "type": "contains", "__source": group_id, "__target": cs_elem_id})
                                                 self.rendered.append({"id": str(uuid.uuid4()), "type": "contains", "__source": group_id, "__target": cs_elem_id})
                                                 text_counter += 1
                                                 text_counter += 1

+ 9 - 3
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)
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
 
-Date:   Wed Jan 24 15:02:21 2018
+Date:   Mon Jan 29 15:30:36 2018
 
 
 Model author: Yentl Van Tendeloo
 Model author: Yentl Van Tendeloo
 Model name:   Modelverse Visual Editor - Tkinter Version 
 Model name:   Modelverse Visual Editor - Tkinter Version 
@@ -6519,9 +6519,15 @@ class MainWindow(RuntimeClassBase, tk.Toplevel, SCCDWidget):
                     attrs[key] = value
                     attrs[key] = value
             max_text = 0
             max_text = 0
         
         
+            #TODO doesn't work yet
+            if is_edge:
+                edge_edge = len([x for x in result if (x["id"] == element_source or x["id"] == element_target) and "__source" in x]) > 0
+            else:
+                edge_edge = False
+        
             if is_edge:
             if is_edge:
                 cs_elem_id = str(uuid.uuid4())
                 cs_elem_id = str(uuid.uuid4())
-                edges.append({"id": cs_elem_id, "type": "ConnectingLine", "offsetSourceX": 0, "offsetSourceY": 0, "offsetTargetX": 0, "offsetTargetY": 0, "lineWidth": 1, "lineColour": "black", "arrow": True, "__asid": element_id, "layer": 0, "__source": element_source, "__target": element_target})
+                edges.append({"id": cs_elem_id, "type": "ConnectingLine", "offsetSourceX": 0 if edge_edge else 100, "offsetSourceY": 0 if edge_edge else 30, "offsetTargetX": 0 if edge_edge else 100, "offsetTargetY": 0 if edge_edge else 30, "lineWidth": 3, "lineColour": "black", "arrow": True, "__asid": element_id, "layer": 0, "__source": element_source, "__target": element_target})
                 groups[element_id] = cs_elem_id
                 groups[element_id] = cs_elem_id
             else:
             else:
                 # Add the group
                 # Add the group
@@ -6542,7 +6548,7 @@ class MainWindow(RuntimeClassBase, tk.Toplevel, SCCDWidget):
                 text_counter = 0
                 text_counter = 0
                 for key, value in attrs.items():
                 for key, value in attrs.items():
                     cs_elem_id = str(uuid.uuid4())
                     cs_elem_id = str(uuid.uuid4())
-                    self.rendered.append({"id": cs_elem_id, "type": "Text", "x": 10, "y": 25 + text_counter * 11, "text": "%s = %s" % (key, value), "lineWidth": 1, "lineColour": "black", "layer": 2})
+                    self.rendered.append({"id": cs_elem_id, "type": "Text", "x": 10, "y": 25 + text_counter * 11, "text": "%s = %s" % (key, value), "lineWidth": 3, "lineColour": "black", "layer": 2})
                     max_text = max(len("%s = %s" % (key, value)), max_text)
                     max_text = max(len("%s = %s" % (key, value)), max_text)
                     self.rendered.append({"id": str(uuid.uuid4()), "type": "contains", "__source": group_id, "__target": cs_elem_id})
                     self.rendered.append({"id": str(uuid.uuid4()), "type": "contains", "__source": group_id, "__target": cs_elem_id})
                     text_counter += 1
                     text_counter += 1