[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 18/22: grc: port domain code clean-up
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 18/22: grc: port domain code clean-up |
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 01b993385bb645d1d2e9660021533610ab35b741
Author: Sebastian Koslowski <address@hidden>
Date: Fri Dec 19 13:50:41 2014 +0100
grc: port domain code clean-up
---
grc/base/Platform.py | 18 +++++++++++-------
grc/python/FlowGraph.py | 4 ++--
2 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/grc/base/Platform.py b/grc/base/Platform.py
index c5d03e2..9fb6732 100644
--- a/grc/base/Platform.py
+++ b/grc/base/Platform.py
@@ -26,7 +26,7 @@ from Connection import Connection as _Connection
from Block import Block as _Block
from Port import Port as _Port
from Param import Param as _Param
-from Constants import BLOCK_TREE_DTD, FLOW_GRAPH_DTD, DOMAIN_DTD,
DEFAULT_DOMAIN
+from Constants import BLOCK_TREE_DTD, FLOW_GRAPH_DTD, DOMAIN_DTD
class Platform(_Element):
@@ -135,6 +135,7 @@ class Platform(_Element):
self._category_trees_n.append(n)
def load_domain_xml(self, xml_file):
+ """Load a domain properties and connection templates from XML"""
ParseXML.validate_dtd(xml_file, DOMAIN_DTD)
n = ParseXML.from_file(xml_file).find('domain')
@@ -151,10 +152,10 @@ class Platform(_Element):
color = n.find('color') or ''
try:
- import gtk # ugly, but handy
+ import gtk # ugly but handy
gtk.gdk.color_parse(color)
except (ValueError, ImportError):
- if color: # no color is okay
+ if color: # no color is okay, default set in GUI
print >> sys.stderr, 'Warning: Can\'t parse color code "%s"
for domain "%s" ' % (color, key)
color = None
@@ -165,10 +166,13 @@ class Platform(_Element):
color=color
)
for connection_n in n.findall('connection'):
- source_domain = connection_n.find('source_domain') or
DEFAULT_DOMAIN
- sink_domain = connection_n.find('sink_domain') or DEFAULT_DOMAIN
- make = connection_n.find('make') or ''
- self._connection_templates[(source_domain, sink_domain)] = make
+ key = (connection_n.find('source_domain'),
connection_n.find('sink_domain'))
+ if not all(key):
+ print >> sys.stderr, 'Warning: Empty domain key(s) in
connection template.\n\t%s' % xml_file
+ elif key in self._connection_templates:
+ print >> sys.stderr, 'Warning: Connection template "%s"
already exists.\n\t%s' % (key, xml_file)
+ else:
+ self._connection_templates[key] = connection_n.find('make') or
''
def parse_flow_graph(self, flow_graph_file):
"""
diff --git a/grc/python/FlowGraph.py b/grc/python/FlowGraph.py
index 03280cc..d7337b8 100644
--- a/grc/python/FlowGraph.py
+++ b/grc/python/FlowGraph.py
@@ -146,8 +146,8 @@ class FlowGraph(_FlowGraph, _GUIFlowGraph):
key_offset = 0
pads = self.get_pad_sources() if port.is_source() else
self.get_pad_sinks()
for pad in pads:
- # using the block type param instead of the port domain here
- # to stress that hier block generation is domain agnostic
+ # using the block param 'type' instead of the port domain here
+ # to emphasize that hier block generation is domain agnostic
is_message_pad = pad.get_param('type').get_evaluated() == "message"
if port.get_parent() == pad:
if is_message_pad:
- [Commit-gnuradio] [gnuradio] 11/22: grc: PEP8 fixes in Generator, (continued)
- [Commit-gnuradio] [gnuradio] 11/22: grc: PEP8 fixes in Generator, git, 2014/12/23
- [Commit-gnuradio] [gnuradio] 16/22: grc: add domain property color and use it for connections, git, 2014/12/23
- [Commit-gnuradio] [gnuradio] 06/22: grc: domain-specific port keys, git, 2014/12/23
- [Commit-gnuradio] [gnuradio] 09/22: grc: make Generator use gr_message domain, git, 2014/12/23
- [Commit-gnuradio] [gnuradio] 03/22: grc: draw ports with custom domain differently, git, 2014/12/23
- [Commit-gnuradio] [gnuradio] 22/22: Merge remote-tracking branch 'gnuradio-wg-grc/master_grcwg', git, 2014/12/23
- [Commit-gnuradio] [gnuradio] 04/22: grc: don't fail for unknown domains, git, 2014/12/23
- [Commit-gnuradio] [gnuradio] 19/22: Merge branch 'port_domains' into master_grcwg, git, 2014/12/23
- [Commit-gnuradio] [gnuradio] 05/22: grc: use domain connection templates in Generator, git, 2014/12/23
- [Commit-gnuradio] [gnuradio] 21/22: Merge remote-tracking branch 'skoslowski/msg_connect_extended', git, 2014/12/23
- [Commit-gnuradio] [gnuradio] 18/22: grc: port domain code clean-up,
git <=
- [Commit-gnuradio] [gnuradio] 20/22: Merge branch 'maint', git, 2014/12/23
- [Commit-gnuradio] [gnuradio] 02/22: grc: add domain attribute to ports, git, 2014/12/23
- [Commit-gnuradio] [gnuradio] 01/22: grc: add domain xml DTD and parsing, git, 2014/12/23