commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r9370 - gnuradio/branches/developers/jblum/grc/grc/src


From: jblum
Subject: [Commit-gnuradio] r9370 - gnuradio/branches/developers/jblum/grc/grc/src/grc/gui/elements
Date: Fri, 22 Aug 2008 01:23:11 -0600 (MDT)

Author: jblum
Date: 2008-08-22 01:23:10 -0600 (Fri, 22 Aug 2008)
New Revision: 9370

Modified:
   gnuradio/branches/developers/jblum/grc/grc/src/grc/gui/elements/Connection.py
Log:
better connection drawing logic, 0 and 90 degrees

Modified: 
gnuradio/branches/developers/jblum/grc/grc/src/grc/gui/elements/Connection.py
===================================================================
--- 
gnuradio/branches/developers/jblum/grc/grc/src/grc/gui/elements/Connection.py   
    2008-08-22 04:02:37 UTC (rev 9369)
+++ 
gnuradio/branches/developers/jblum/grc/grc/src/grc/gui/elements/Connection.py   
    2008-08-22 07:23:10 UTC (rev 9370)
@@ -133,13 +133,17 @@
                                self.add_line((midX,y1),(midX,y2))
                                self.add_line((x2,y2),(midX,y2))
                else:
-                       p1 = (x1, y2)
-                       p2 = (x2, y1)
-                       if Utils.get_angle_from_coordinates((x1,y1),p1) == 
(source.get_connector_direction()+180)%360 or \
-                               Utils.get_angle_from_coordinates((x2,y2),p1) == 
(sink.get_connector_direction()+180)%360: p = p2
-                       else: p = p1
-                       self.add_line((x1,y1),p)
-                       self.add_line((x2,y2),p)
+                       #2 possible points to create a right-angled bend 
between the connectors
+                       points = [(x1, y2), (x2, y1)]
+                       #source connector -> points[0] should be in the 
direction of source (if possible)
+                       if Utils.get_angle_from_coordinates((x1, y1), 
points[0]) != source.get_connector_direction(): points.reverse()
+                       #points[0] -> sink connector should not be in the 
direction of sink
+                       if Utils.get_angle_from_coordinates(points[0], (x2, 
y2)) == sink.get_connector_direction(): points.reverse()
+                       #points[0] -> source connector should not be in the 
direction of source
+                       if Utils.get_angle_from_coordinates(points[0], (x1, 
y1)) == source.get_connector_direction(): points.reverse()
+                       #create right-angled connector
+                       self.add_line((x1, y1), points[0])
+                       self.add_line((x2, y2), points[0])
 
        def draw(self, window):
                """!





reply via email to

[Prev in Thread] Current Thread [Next in Thread]