From 9988664127b367fa8fee4409f8460673d6f265e1 Mon Sep 17 00:00:00 2001 From: jblum Date: Tue, 23 Jun 2009 20:38:18 +0000 Subject: Merging r11186:11273 from grc branch. Fixes, features, and reorganization for grc. Minor fixes and features for wxgui forms. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11274 221aa14e-8319-0410-a670-987f0aec2ac5 --- grc/python/Connection.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 grc/python/Connection.py (limited to 'grc/python/Connection.py') diff --git a/grc/python/Connection.py b/grc/python/Connection.py new file mode 100644 index 000000000..d8a894bb1 --- /dev/null +++ b/grc/python/Connection.py @@ -0,0 +1,34 @@ +""" +Copyright 2008 Free Software Foundation, Inc. +This file is part of GNU Radio + +GNU Radio Companion is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +GNU Radio Companion is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +""" + +from .. base.Connection import Connection as _Connection + +class Connection(_Connection): + + def validate(self): + """ + Validate the connections. + The ports must match in type and vector length. + """ + _Connection.validate(self) #checks type + #check vector length + source_vlen = self.get_source().get_vlen() + sink_vlen = self.get_sink().get_vlen() + try: assert source_vlen == sink_vlen + except AssertionError: self.add_error_message('Source vector length "%s" does not match sink vector length "%s".'%(source_vlen, sink_vlen)) -- cgit From 0a73facce3ce4eba23676df5f22f222df319ed87 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 13 Aug 2009 23:59:06 -0700 Subject: this time commit the file changes --- grc/python/Connection.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'grc/python/Connection.py') diff --git a/grc/python/Connection.py b/grc/python/Connection.py index d8a894bb1..5eba9f24d 100644 --- a/grc/python/Connection.py +++ b/grc/python/Connection.py @@ -21,6 +21,9 @@ from .. base.Connection import Connection as _Connection class Connection(_Connection): + def is_msg(self): + return self.get_source().get_type() == self.get_sink().get_type() == 'msg' + def validate(self): """ Validate the connections. -- cgit From cadc9548afb7b4a385cea51f48745f0a1c702607 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 28 Aug 2009 18:15:49 -0700 Subject: Recursive resolution of virtual sources. Flow graph generation code working. Also, mod to fft window to use clean/nice Db/div. --- grc/python/Connection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'grc/python/Connection.py') diff --git a/grc/python/Connection.py b/grc/python/Connection.py index 5eba9f24d..85b5b2c52 100644 --- a/grc/python/Connection.py +++ b/grc/python/Connection.py @@ -1,5 +1,5 @@ """ -Copyright 2008 Free Software Foundation, Inc. +Copyright 2008, 2009 Free Software Foundation, Inc. This file is part of GNU Radio GNU Radio Companion is free software; you can redistribute it and/or -- cgit From 152fcbc219cd2e4f6df7b38843844bc85fdf2bc2 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sun, 30 Aug 2009 10:34:10 -0700 Subject: Switched the python classes to inherit from the base and gui classes. Use only **kwargs so all contructor parameters must be passed with keys. Moved gui input forms classes from base to gui param module. --- grc/python/Connection.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'grc/python/Connection.py') diff --git a/grc/python/Connection.py b/grc/python/Connection.py index 85b5b2c52..edc18841a 100644 --- a/grc/python/Connection.py +++ b/grc/python/Connection.py @@ -18,8 +18,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ from .. base.Connection import Connection as _Connection +from .. gui.Connection import Connection as _GUIConnection -class Connection(_Connection): +class Connection(_Connection, _GUIConnection): + + def __init__(self, **kwargs): + _Connection.__init__(self, **kwargs) + _GUIConnection.__init__(self) def is_msg(self): return self.get_source().get_type() == self.get_sink().get_type() == 'msg' -- cgit From 4cdd41c1046cef12601602bd38dc8ebf42d1550d Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 14 Apr 2011 10:05:33 -0700 Subject: grc: replaced asserts in python subdirectory --- grc/python/Connection.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'grc/python/Connection.py') diff --git a/grc/python/Connection.py b/grc/python/Connection.py index edc18841a..39f915740 100644 --- a/grc/python/Connection.py +++ b/grc/python/Connection.py @@ -1,5 +1,5 @@ """ -Copyright 2008, 2009 Free Software Foundation, Inc. +Copyright 2008-2011 Free Software Foundation, Inc. This file is part of GNU Radio GNU Radio Companion is free software; you can redistribute it and/or @@ -38,5 +38,5 @@ class Connection(_Connection, _GUIConnection): #check vector length source_vlen = self.get_source().get_vlen() sink_vlen = self.get_sink().get_vlen() - try: assert source_vlen == sink_vlen - except AssertionError: self.add_error_message('Source vector length "%s" does not match sink vector length "%s".'%(source_vlen, sink_vlen)) + if source_vlen != sink_vlen: + self.add_error_message('Source vector length "%s" does not match sink vector length "%s".'%(source_vlen, sink_vlen)) -- cgit From 413964379c19fce5c2c0ad25d1de968a68744f4d Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sat, 8 Oct 2011 10:23:00 -0700 Subject: grc: added new IO types Added all complex/real float/integer types. Used volk naming convention: fc32, etc... The port type checking now relies on IO size, therefore a short vector of length 2 can connect to a complex short, a float can connect to an int. Basically, the same size checking done in gnuradio runtime. --- grc/python/Connection.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'grc/python/Connection.py') diff --git a/grc/python/Connection.py b/grc/python/Connection.py index 39f915740..218baf074 100644 --- a/grc/python/Connection.py +++ b/grc/python/Connection.py @@ -17,6 +17,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ +import Constants +from .. base.Element import Element from .. base.Connection import Connection as _Connection from .. gui.Connection import Connection as _GUIConnection @@ -32,11 +34,10 @@ class Connection(_Connection, _GUIConnection): def validate(self): """ Validate the connections. - The ports must match in type and vector length. + The ports must match in io size. """ - _Connection.validate(self) #checks type - #check vector length - source_vlen = self.get_source().get_vlen() - sink_vlen = self.get_sink().get_vlen() - if source_vlen != sink_vlen: - self.add_error_message('Source vector length "%s" does not match sink vector length "%s".'%(source_vlen, sink_vlen)) + Element.validate(self) + source_size = Constants.TYPE_TO_SIZEOF[self.get_source().get_type()] * self.get_source().get_vlen() + sink_size = Constants.TYPE_TO_SIZEOF[self.get_sink().get_type()] * self.get_sink().get_vlen() + if source_size != sink_size: + self.add_error_message('Source IO size "%s" does not match sink IO size "%s".'%(source_size, sink_size)) -- cgit From 92cfb0240005675f4e7a55a81552f4c7a5128cd8 Mon Sep 17 00:00:00 2001 From: Tim O'Shea Date: Wed, 28 Nov 2012 15:15:58 -0800 Subject: core: adding msg_connect, updating msg interface, adding symbolic block names --- grc/python/Connection.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'grc/python/Connection.py') diff --git a/grc/python/Connection.py b/grc/python/Connection.py index 218baf074..341dd2d82 100644 --- a/grc/python/Connection.py +++ b/grc/python/Connection.py @@ -31,6 +31,9 @@ class Connection(_Connection, _GUIConnection): def is_msg(self): 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' + def validate(self): """ Validate the connections. -- cgit