commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] [gnuradio] 03/05: grc: fix connection validation and e


From: git
Subject: [Commit-gnuradio] [gnuradio] 03/05: grc: fix connection validation and error state display
Date: Tue, 13 Jan 2015 20:52:29 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

jcorgan pushed a commit to branch maint
in repository gnuradio.

commit ce016bedf1936c7eeba3edca566b1ea9da0e578a
Author: Sebastian Koslowski <address@hidden>
Date:   Tue Jan 13 11:28:50 2015 +0100

    grc: fix connection validation and error state display
---
 grc/gui/Connection.py    | 16 ++++++----------
 grc/python/Connection.py |  2 +-
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/grc/gui/Connection.py b/grc/gui/Connection.py
index 00343a2..f075a18 100644
--- a/grc/gui/Connection.py
+++ b/grc/gui/Connection.py
@@ -38,7 +38,7 @@ class Connection(Element):
     def __init__(self):
         Element.__init__(self)
         self._color = Colors.CONNECTION_ENABLED_COLOR
-        self._bg_color = Colors.CONNECTION_ENABLED_COLOR
+        self._bg_color = self._arrow_color = self._color
 
     def get_coordinate(self):
         """
@@ -92,6 +92,7 @@ class Connection(Element):
         ).get('color') or Colors.DEFAULT_DOMAIN_COLOR_CODE)
         self._color = get_domain_color(source_domain)
         self._bg_color = get_domain_color(sink_domain)
+        self._arrow_color = self._bg_color if self.is_valid() else 
Colors.CONNECTION_ERROR_COLOR
         self._update_after_move()
 
     def _update_after_move(self):
@@ -161,20 +162,15 @@ class Connection(Element):
         self._sink_coor = sink.get_coordinate()
         self._source_coor = source.get_coordinate()
         #draw
-        border_color = (
+        mod_color = lambda color: (
             Colors.HIGHLIGHT_COLOR if self.is_highlighted() else
             Colors.CONNECTION_DISABLED_COLOR if not self.get_enabled() else
-            self._color
+            color
         )
-        bg_color = (
-            Colors.HIGHLIGHT_COLOR if self.is_highlighted() else
-            Colors.CONNECTION_DISABLED_COLOR if not self.get_enabled() else
-            self._bg_color
-        )
-        Element.draw(self, gc, window, border_color, bg_color)
+        Element.draw(self, gc, window, mod_color(self._color), 
mod_color(self._bg_color))
         # draw arrow on sink port
         try:
-            gc.set_foreground(bg_color)
+            gc.set_foreground(mod_color(self._arrow_color))
             gc.set_line_attributes(0, gtk.gdk.LINE_SOLID, gtk.gdk.CAP_BUTT, 
gtk.gdk.JOIN_MITER)
             window.draw_polygon(gc, True, self._arrow)
         except:
diff --git a/grc/python/Connection.py b/grc/python/Connection.py
index 0a6cf5f..822876a 100644
--- a/grc/python/Connection.py
+++ b/grc/python/Connection.py
@@ -38,8 +38,8 @@ class Connection(_Connection, _GUIConnection):
         Validate the connections.
         The ports must match in io size.
         """
+        _Connection.validate(self)
         source_size = Constants.TYPE_TO_SIZEOF[self.get_source().get_type()] * 
self.get_source().get_vlen()
         sink_size = Constants.TYPE_TO_SIZEOF[self.get_sink().get_type()] * 
self.get_sink().get_vlen()
         if source_size != sink_size:
             self.add_error_message('Source IO size "%s" does not match sink IO 
size "%s".'%(source_size, sink_size))
-        _Connection.validate(self)



reply via email to

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