commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] [gnuradio] 17/22: grc: fix connections error log and c


From: git
Subject: [Commit-gnuradio] [gnuradio] 17/22: grc: fix connections error log and color
Date: Tue, 23 Dec 2014 09:38:58 +0000 (UTC)

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

jcorgan pushed a commit to branch master
in repository gnuradio.

commit 7bebb64fc4d58ee25c7f84d378aad4bd9065536c
Author: Sebastian Koslowski <address@hidden>
Date:   Thu Dec 18 22:21:43 2014 +0100

    grc: fix connections error log and color
---
 grc/base/Element.py   |  3 ++-
 grc/base/Platform.py  | 11 +++++------
 grc/gui/Colors.py     |  6 +++---
 grc/gui/Connection.py |  9 +++++----
 4 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/grc/base/Element.py b/grc/base/Element.py
index 9c697b6..04a3690 100644
--- a/grc/base/Element.py
+++ b/grc/base/Element.py
@@ -21,6 +21,7 @@ class Element(object):
 
     def __init__(self, parent=None):
         self._parent = parent
+        self._error_messages = list()
 
     ##################################################
     # Element Validation API
@@ -30,7 +31,7 @@ class Element(object):
         Validate this element and call validate on all children.
         Call this base method before adding error messages in the subclass.
         """
-        self._error_messages = list()
+        del self._error_messages[:]
         for child in self.get_children(): child.validate()
 
     def is_valid(self):
diff --git a/grc/base/Platform.py b/grc/base/Platform.py
index 5fd86ba..c5d03e2 100644
--- a/grc/base/Platform.py
+++ b/grc/base/Platform.py
@@ -149,15 +149,14 @@ class Platform(_Element):
         to_bool = lambda s, d: d if s is None else \
             s.lower() not in ('false', 'off', '0', '')
 
-        color_code = n.find('color') or ''
+        color = n.find('color') or ''
         try:
             import gtk  # ugly, but handy
-            color = gtk.gdk.color_parse(color_code)
+            gtk.gdk.color_parse(color)
         except (ValueError, ImportError):
-            if color_code:  # no color is okay
-                print >> sys.stderr, 'Warning: Can\'t parse color code "%s" ' \
-                                     'for domain "%s" ' % (key, 
str(color_code))
-            color = None  # default color set in gui
+            if color:  # no color is okay
+                print >> sys.stderr, 'Warning: Can\'t parse color code "%s" 
for domain "%s" ' % (color, key)
+                color = None
 
         self._domains[key] = dict(
             name=n.find('name') or key,
diff --git a/grc/gui/Colors.py b/grc/gui/Colors.py
index fcde5c5..7430705 100644
--- a/grc/gui/Colors.py
+++ b/grc/gui/Colors.py
@@ -39,9 +39,9 @@ try:
     BLOCK_DISABLED_COLOR = get_color('#CCCCCC')
     #connection color constants
     CONNECTION_ENABLED_COLOR = get_color('black')
-    CONNECTION_DISABLED_COLOR = get_color('#999999')
+    CONNECTION_DISABLED_COLOR = get_color('#BBBBBB')
     CONNECTION_ERROR_COLOR = get_color('red')
-
-    DEFAULT_DOMAIN_COLOR = get_color('#666666')
 except:
     print 'Unable to import Colors'
+
+DEFAULT_DOMAIN_COLOR_CODE = '#777777'
diff --git a/grc/gui/Connection.py b/grc/gui/Connection.py
index 9655c0e..84004f5 100644
--- a/grc/gui/Connection.py
+++ b/grc/gui/Connection.py
@@ -87,9 +87,11 @@ class Connection(Element):
             self.line_attributes[1] = gtk.gdk.LINE_ON_OFF_DASH
         else:
             self.line_attributes[1] = gtk.gdk.LINE_DOUBLE_DASH
-            get_domain_color = lambda d: (
+            if source_domain != sink_domain:
+                self.line_attributes[0] = 2
+            get_domain_color = lambda d: Colors.get_color((
                 self.get_parent().get_parent().get_domain(d) or {}
-            ).get('color') or Colors.DEFAULT_DOMAIN_COLOR
+            ).get('color') or Colors.DEFAULT_DOMAIN_COLOR_CODE)
             self._color = get_domain_color(source_domain)
             self._bg_color = get_domain_color(sink_domain)
 
@@ -172,9 +174,8 @@ class Connection(Element):
             Colors.CONNECTION_DISABLED_COLOR if not self.get_enabled() else
             self._bg_color
         )
-        # make message connections dashed (no areas here)
         Element.draw(self, gc, window, border_color, bg_color)
-        #draw arrow on sink port
+        # draw arrow on sink port
         try:
             gc.set_foreground(bg_color)
             gc.set_line_attributes(0, gtk.gdk.LINE_SOLID, gtk.gdk.CAP_BUTT, 
gtk.gdk.JOIN_MITER)



reply via email to

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