summaryrefslogtreecommitdiff
path: root/gr-digital/swig/digital_constellation.i
diff options
context:
space:
mode:
Diffstat (limited to 'gr-digital/swig/digital_constellation.i')
-rw-r--r--gr-digital/swig/digital_constellation.i21
1 files changed, 20 insertions, 1 deletions
diff --git a/gr-digital/swig/digital_constellation.i b/gr-digital/swig/digital_constellation.i
index 7e0ad6afe..248f90014 100644
--- a/gr-digital/swig/digital_constellation.i
+++ b/gr-digital/swig/digital_constellation.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2010, 2011 Free Software Foundation, Inc.
+ * Copyright 2010,2011,2012 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -187,3 +187,22 @@ class digital_constellation_8psk : public digital_constellation
public:
digital_constellation_8psk ();
};
+
+#if SWIGPYTHON
+/*
+ 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>'
+
+%}
+#endif