diff options
author | Sebastian Koslowski <koslowski@kit.edu> | 2014-12-18 22:21:43 +0100 |
---|---|---|
committer | Sebastian Koslowski <koslowski@kit.edu> | 2014-12-18 22:24:45 +0100 |
commit | 7bebb64fc4d58ee25c7f84d378aad4bd9065536c (patch) | |
tree | b1f5aafb908b95bbc08495498d4d4b22f62c3b77 /grc | |
parent | 20c71cb44a6f7500e64a8e9e394e9e1b372aa46d (diff) |
grc: fix connections error log and color
Diffstat (limited to 'grc')
-rw-r--r-- | grc/base/Element.py | 3 | ||||
-rw-r--r-- | grc/base/Platform.py | 11 | ||||
-rw-r--r-- | grc/gui/Colors.py | 6 | ||||
-rw-r--r-- | 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 9c697b6393..04a3690282 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 5fd86ba0f9..c5d03e2ffc 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 fcde5c5974..7430705cf8 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 9655c0e38d..84004f5af6 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) |