[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 08/22: grc: add gr_message domain
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 08/22: grc: add gr_message domain |
Date: |
Tue, 23 Dec 2014 09:38:57 +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 eb40a41ec28d5f8320d9c0abcb7a2aa2602b9872
Author: Sebastian Koslowski <address@hidden>
Date: Fri Dec 5 10:24:08 2014 +0100
grc: add gr_message domain
---
grc/base/Constants.py | 4 +++-
grc/base/Port.py | 9 +++++++--
grc/blocks/gr_message_domain.xml | 15 +++++++++++++++
grc/gui/Connection.py | 4 +++-
grc/gui/Port.py | 6 ++++--
grc/python/Connection.py | 4 ++--
grc/python/Port.py | 10 +++++++++-
7 files changed, 43 insertions(+), 9 deletions(-)
diff --git a/grc/base/Constants.py b/grc/base/Constants.py
index 15f72ad..efae0ec 100644
--- a/grc/base/Constants.py
+++ b/grc/base/Constants.py
@@ -34,5 +34,7 @@ DEFAULT_PARAM_TAB = "General"
ADVANCED_PARAM_TAB = "Advanced"
# Port domains
-DEFAULT_DOMAIN ="gr_stream"
DOMAIN_DTD = os.path.join(DATA_DIR, 'domain.dtd')
+GR_STREAM_DOMAIN = "gr_stream"
+GR_MESSAGE_DOMAIN = "gr_message"
+DEFAULT_DOMAIN = GR_STREAM_DOMAIN
diff --git a/grc/base/Port.py b/grc/base/Port.py
index f8a9a6d..b393ba9 100644
--- a/grc/base/Port.py
+++ b/grc/base/Port.py
@@ -18,7 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA
"""
from Element import Element
-from . Constants import DEFAULT_DOMAIN
+from . Constants import GR_STREAM_DOMAIN, GR_MESSAGE_DOMAIN
class Port(Element):
@@ -37,7 +37,7 @@ class Port(Element):
self._name = n['name']
self._key = n['key']
self._type = n['type']
- self._domain = n.find('domain') or DEFAULT_DOMAIN
+ self._domain = n['domain']
self._hide = n.find('hide') or ''
self._dir = dir
self._type_evaluated = None # updated on rewrite()
@@ -61,6 +61,11 @@ class Port(Element):
self._type_evaluated =
self.get_parent().resolve_dependencies(self._type)
hide =
self.get_parent().resolve_dependencies(self._hide).strip().lower()
self._hide_evaluated = False if hide in ('false', 'off', '0') else
bool(hide)
+ # update domain if was deduced from (dynamic) port type
+ if self._domain == GR_STREAM_DOMAIN and self._type_evaluated ==
"message":
+ self._domain = GR_MESSAGE_DOMAIN
+ if self._domain == GR_MESSAGE_DOMAIN and self._type_evaluated !=
"message":
+ self._domain = GR_STREAM_DOMAIN
def __str__(self):
if self.is_source():
diff --git a/grc/blocks/gr_message_domain.xml b/grc/blocks/gr_message_domain.xml
new file mode 100644
index 0000000..dbacfcd
--- /dev/null
+++ b/grc/blocks/gr_message_domain.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##GNU Radio default domain 'gr_message'
+###################################################
+ -->
+ <domain>
+ <name>GR Message</name>
+ <key>gr_message</key>
+ <connection>
+ <source_domain>gr_message</source_domain>
+ <sink_domain>gr_message</sink_domain>
+ <make> self.connect($make_port_sig($source),
$make_port_sig($sink))</make>
+ </connection>
+</domain>
diff --git a/grc/gui/Connection.py b/grc/gui/Connection.py
index 8fea6f0..e8e925c 100644
--- a/grc/gui/Connection.py
+++ b/grc/gui/Connection.py
@@ -23,6 +23,8 @@ import Colors
from Constants import CONNECTOR_ARROW_BASE, CONNECTOR_ARROW_HEIGHT
import gtk
+from .. base.Constants import GR_MESSAGE_DOMAIN
+
class Connection(Element):
"""
A graphical connection for ports.
@@ -89,7 +91,7 @@ class Connection(Element):
self.clear() #FIXME do i want this here?
#source connector
source = self.get_source()
- if source.get_type() == "message":
+ if source.get_domain() == GR_MESSAGE_DOMAIN:
self.line_attributes[1] = gtk.gdk.LINE_ON_OFF_DASH
X, Y = source.get_connector_coordinate()
x1, y1 = self.x1 + X, self.y1 + Y
diff --git a/grc/gui/Port.py b/grc/gui/Port.py
index 995750a..9abda87 100644
--- a/grc/gui/Port.py
+++ b/grc/gui/Port.py
@@ -22,7 +22,7 @@ from Constants import \
PORT_SEPARATION, CONNECTOR_EXTENSION_MINIMAL, \
CONNECTOR_EXTENSION_INCREMENT, \
PORT_LABEL_PADDING, PORT_MIN_WIDTH, PORT_LABEL_HIDDEN_WIDTH, PORT_FONT
-from .. base.Constants import DEFAULT_DOMAIN
+from .. base.Constants import DEFAULT_DOMAIN, GR_MESSAGE_DOMAIN
import Utils
import Actions
import Colors
@@ -54,7 +54,9 @@ class Port(Element):
Element.create_shapes(self)
if self.get_hide():
return # this port is hidden, no need to create shapes
- if self.get_domain() != DEFAULT_DOMAIN:
+ if self.get_domain() == GR_MESSAGE_DOMAIN:
+ pass
+ elif self.get_domain() != DEFAULT_DOMAIN:
self.line_attributes[0] = 2
#get current rotation
rotation = self.get_rotation()
diff --git a/grc/python/Connection.py b/grc/python/Connection.py
index dff98c6..86ec08c 100644
--- a/grc/python/Connection.py
+++ b/grc/python/Connection.py
@@ -18,7 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA
"""
import Constants
-from .. base.Element import Element
+from .. base.Constants import GR_MESSAGE_DOMAIN
from .. base.Connection import Connection as _Connection
from .. gui.Connection import Connection as _GUIConnection
@@ -32,7 +32,7 @@ class Connection(_Connection, _GUIConnection):
return self.get_source().get_type() == self.get_sink().get_type() ==
'msg'
def is_message(self):
- return self.get_source().get_type() == self.get_sink().get_type() ==
'message'
+ return self.get_source().get_domain() == self.get_sink().get_domain()
== GR_MESSAGE_DOMAIN
def is_bus(self):
return self.get_source().get_type() == self.get_sink().get_type() ==
'bus'
diff --git a/grc/python/Port.py b/grc/python/Port.py
index cfeabf8..fdeb14a 100644
--- a/grc/python/Port.py
+++ b/grc/python/Port.py
@@ -18,9 +18,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA
"""
from .. base.Port import Port as _Port
+from .. base.Constants import DEFAULT_DOMAIN, GR_MESSAGE_DOMAIN
from .. gui.Port import Port as _GUIPort
import Constants
+
def _get_source_from_virtual_sink_port(vsp):
"""
Resolve the source port that is connected to the given virtual sink port.
@@ -91,8 +93,14 @@ class Port(_Port, _GUIPort):
dir: the direction
"""
self._n = n
+ if n['type'] == 'message':
+ n['domain'] = GR_MESSAGE_DOMAIN
+ if 'domain' not in n:
+ n['domain'] = DEFAULT_DOMAIN
+ elif n['domain'] == GR_MESSAGE_DOMAIN:
+ n['key'] = n['name']
+ n['type'] = 'message' # for port color
if n['type'] == 'msg': n['key'] = 'msg'
- if n['type'] == 'message': n['key'] = n['name']
if dir == 'source' and not n.find('key'):
n['key'] = str(block._source_count)
block._source_count += 1
- [Commit-gnuradio] [gnuradio] branch master updated (3427a66 -> 2402ccc), git, 2014/12/23
- [Commit-gnuradio] [gnuradio] 07/22: grc: per element line styles (for custom domain ports and message connections), git, 2014/12/23
- [Commit-gnuradio] [gnuradio] 08/22: grc: add gr_message domain,
git <=
- [Commit-gnuradio] [gnuradio] 12/22: grc: port connections by domain, block name in generated code, git, 2014/12/23
- [Commit-gnuradio] [gnuradio] 10/22: grc: add multiple_sources flag to domain.dtd, git, 2014/12/23
- [Commit-gnuradio] [gnuradio] 13/22: runtime: whitespace fixes, git, 2014/12/23
- [Commit-gnuradio] [gnuradio] 15/22: runtime: add tests for new decorators in hier_block2, git, 2014/12/23
- [Commit-gnuradio] [gnuradio] 14/22: runtime: refactor top/hier block python wrappers, git, 2014/12/23
- [Commit-gnuradio] [gnuradio] 17/22: grc: fix connections error log and color, git, 2014/12/23
- [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