[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 68/101: grc: add error messages iterator
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 68/101: grc: add error messages iterator |
Date: |
Thu, 16 Mar 2017 14:58:08 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch python3
in repository gnuradio.
commit 79ca113fb294b6b5d478f9186f8a3000b13fd30a
Author: Sebastian Koslowski <address@hidden>
Date: Wed Aug 3 09:58:26 2016 +0200
grc: add error messages iterator
---
grc/core/Element.py | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/grc/core/Element.py b/grc/core/Element.py
index 32afabb..86e0746 100644
--- a/grc/core/Element.py
+++ b/grc/core/Element.py
@@ -66,7 +66,9 @@ class Element(object):
Returns:
true when the element is enabled and has no error messages or is
bypassed
"""
- return (not self.get_error_messages() or not self.enabled) or
self.get_bypassed()
+ if not self.enabled or self.get_bypassed():
+ return True
+ return not next(self.iter_error_messages(), False)
def add_error_message(self, msg):
"""
@@ -86,13 +88,20 @@ class Element(object):
Returns:
a list of error message strings
"""
- error_messages = list(self._error_messages) # Make a copy
+ return [msg if elem is self else "{}:\n\t{}".format(elem,
msg.replace("\n", "\n\t"))
+ for elem, msg in self.iter_error_messages()]
+
+ def iter_error_messages(self):
+ """
+ Iterate over error messages. Yields tuples of (element, message)
+ """
+ for msg in self._error_messages:
+ yield self, msg
for child in self.get_children():
if not child.enabled or child.get_bypassed():
continue
- for msg in child.get_error_messages():
- error_messages.append("{}:\n\t{}".format(child,
msg.replace("\n", "\n\t")))
- return error_messages
+ for element_msg in child.iter_error_messages():
+ yield element_msg
def rewrite(self):
"""
- [Commit-gnuradio] [gnuradio] 45/101: grc: fix block init, (continued)
- [Commit-gnuradio] [gnuradio] 45/101: grc: fix block init, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 38/101: grc: gtk3: update & fix port drawing code, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 32/101: grc: refactor: remote port domain getter, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 16/101: Merge remote-tracking branch 'grcwg/next_grcwg' into gtk3, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 57/101: grc: gtk3: remove left-over gtk2 usage in generator template, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 43/101: grc: refactor: minor clean-up and fixes, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 44/101: grc: gtk3: fix connection arrows, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 56/101: grc: gtk3: fix generating virtual/bypassed connections, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 46/101: grc: dynamic super-classing proof-of-concept =), git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 53/101: grc: make dummy blocks a block subclass, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 68/101: grc: add error messages iterator,
git <=
- [Commit-gnuradio] [gnuradio] 64/101: grc: gtk3: better lables/shapes handling during flowgraph update, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 62/101: grc: refactor: handle flowgraph and connection super init same as in block, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 65/101: grc: gtk3: dashed lines for message connections, thicker ones for custom domains, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 54/101: grc: refactor: replace get_enabled by prop, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 67/101: grc: remove support for old msg queues, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 60/101: grc: gtk3: update various deprecated gtk calls, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 52/101: grc: refactor: remove get for port and param name, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 40/101: grc: gtk3: remove coordinate getter/setter, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 69/101: grc: gtk3: use darkened bg color for port border, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 55/101: grc: various clean-ups and fixes, git, 2017/03/16