commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r10510 - gnuradio/branches/developers/jblum/gui_guts/g


From: jblum
Subject: [Commit-gnuradio] r10510 - gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python
Date: Wed, 25 Feb 2009 14:30:25 -0700 (MST)

Author: jblum
Date: 2009-02-25 14:30:25 -0700 (Wed, 25 Feb 2009)
New Revision: 10510

Modified:
   gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/common.py
   
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/constsink_gl.py
   gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/fftsink_gl.py
   
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/scopesink_gl.py
   
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/waterfallsink_gl.py
Log:
register access methods working

Modified: 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/common.py
===================================================================
--- gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/common.py   
2009-02-25 20:47:12 UTC (rev 10509)
+++ gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/common.py   
2009-02-25 21:30:25 UTC (rev 10510)
@@ -27,17 +27,24 @@
 #A macro to apply an index to a key
 index_key = lambda key, i: "%s_%d"%(key, i+1)
 
+def _register_access_method(destination, controller, key):
+       """
+       Helper function for register access methods.
+       This helper creates distinct set and get methods for each key
+       and adds them to the destination object.
+       """
+       def set(value): controller[key] = value
+       setattr(destination, 'set_'+key, set)
+       def get(): return controller[key]
+       setattr(destination, 'get_'+key, get) 
+
 def register_access_methods(destination, controller):
        """
        Register setter and getter functions in the destination object for all 
keys in the controller.
        @param destination the object to get new setter and getter methods
        @param controller the pubsub controller
        """
-       for key in controller.keys():
-               def set(value): controller[key] = value
-               setattr(destination, 'set_'+key, set)
-               def get(): return controller[key]
-               setattr(destination, 'get_'+key, get) 
+       for key in controller.keys(): _register_access_method(destination, 
controller, key)
 
 ##################################################
 # Custom Data Event

Modified: 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/constsink_gl.py
===================================================================
--- 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/constsink_gl.py 
    2009-02-25 20:47:12 UTC (rev 10509)
+++ 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/constsink_gl.py 
    2009-02-25 21:30:25 UTC (rev 10510)
@@ -131,6 +131,6 @@
                        omega_key=OMEGA_KEY,
                        sample_rate_key=SAMPLE_RATE_KEY,
                )
-               common.register_access_methods(self, self.controller)
+               common.register_access_methods(self, self.win)
 
 

Modified: 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/fftsink_gl.py
===================================================================
--- 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/fftsink_gl.py   
    2009-02-25 20:47:12 UTC (rev 10509)
+++ 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/fftsink_gl.py   
    2009-02-25 21:30:25 UTC (rev 10510)
@@ -104,7 +104,7 @@
                        peak_hold=peak_hold,
                        msg_key=MSG_KEY,
                )
-               common.register_access_methods(self, self.controller)
+               common.register_access_methods(self, self.win)
 
 class fft_sink_f(_fft_sink_base):
        _fft_chain = blks2.logpwrfft_f

Modified: 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/scopesink_gl.py
===================================================================
--- 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/scopesink_gl.py 
    2009-02-25 20:47:12 UTC (rev 10509)
+++ 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/scopesink_gl.py 
    2009-02-25 21:30:25 UTC (rev 10510)
@@ -144,7 +144,7 @@
                        decimation_key=DECIMATION_KEY,
                        msg_key=MSG_KEY,
                )
-               common.register_access_methods(self, self.controller)
+               common.register_access_methods(self, self.win)
                #backwards compadibility
                def setter(x, y, z): x[y] = z
                self.win.set_format_line = lambda: setter(self.win, MARKER_KEY, 
None)

Modified: 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/waterfallsink_gl.py
===================================================================
--- 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/waterfallsink_gl.py
 2009-02-25 20:47:12 UTC (rev 10509)
+++ 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/waterfallsink_gl.py
 2009-02-25 21:30:25 UTC (rev 10510)
@@ -109,7 +109,7 @@
                        avg_alpha_key=AVG_ALPHA_KEY,
                        msg_key=MSG_KEY,
                )
-               common.register_access_methods(self, self.controller)
+               common.register_access_methods(self, self.win)
 
 class waterfall_sink_f(_waterfall_sink_base):
        _fft_chain = blks2.logpwrfft_f





reply via email to

[Prev in Thread] Current Thread [Next in Thread]