summaryrefslogtreecommitdiff
path: root/gr-digital/swig
diff options
context:
space:
mode:
authorTom Rondeau <trondeau@vt.edu>2012-03-10 07:57:40 -0500
committerTom Rondeau <trondeau@vt.edu>2012-03-10 07:57:40 -0500
commit502d7466f7659154b015e6ce94eafad569604cb1 (patch)
tree81648c2df5790d77880070953543aafc219240e9 /gr-digital/swig
parentaabc6bd3ef6061cc48a8cf87be89a3f6094cf2fe (diff)
parent1c15d2ceefeacb261dcce2f70c3543f70862f4c0 (diff)
Merge remote branch 'benreynwar/maint'
Diffstat (limited to 'gr-digital/swig')
-rw-r--r--gr-digital/swig/digital_constellation.i17
1 files changed, 17 insertions, 0 deletions
diff --git a/gr-digital/swig/digital_constellation.i b/gr-digital/swig/digital_constellation.i
index 7e0ad6afec..acc7aad1a0 100644
--- a/gr-digital/swig/digital_constellation.i
+++ b/gr-digital/swig/digital_constellation.i
@@ -187,3 +187,20 @@ class digital_constellation_8psk : public digital_constellation
public:
digital_constellation_8psk ();
};
+
+/*
+ We want print(constellation) in python to produce nice useful output so
+ we include code at the end of the generated python file that overrides
+ the SWIG-generated __repr__ method.
+ */
+%pythoncode %{
+
+digital_constellation_calcdist_sptr.__repr__ = lambda self: '<constellation calcdist (m=%s)>' % str(len(self.points()))
+digital_constellation_rect_sptr.__repr__ = lambda self: '<constellation rect (m=%s)>' % str(len(self.points()))
+digital_constellation_psk_sptr.__repr__ = lambda self: '<constellation psk (m=%s)>' % str(len(self.points()))
+digital_constellation_bpsk_sptr.__repr__ = lambda self: '<constellation bpsk>'
+digital_constellation_qpsk_sptr.__repr__ = lambda self: '<constellation qpsk>'
+digital_constellation_dqpsk_sptr.__repr__ = lambda self: '<constellation dqpsk>'
+digital_constellation_8psk_sptr.__repr__ = lambda self: '<constellation 8psk>'
+
+%}