commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r10490 - in gnuradio/branches/releases/3.2/grc: . src/


From: jcorgan
Subject: [Commit-gnuradio] r10490 - in gnuradio/branches/releases/3.2/grc: . src/platforms/base src/platforms/gui src/platforms/python
Date: Mon, 23 Feb 2009 16:03:17 -0700 (MST)

Author: jcorgan
Date: 2009-02-23 16:03:17 -0700 (Mon, 23 Feb 2009)
New Revision: 10490

Modified:
   gnuradio/branches/releases/3.2/grc/src/platforms/base/Block.py
   gnuradio/branches/releases/3.2/grc/src/platforms/gui/FlowGraph.py
   gnuradio/branches/releases/3.2/grc/src/platforms/python/Block.py
   gnuradio/branches/releases/3.2/grc/todo.txt
Log:
Merged r10442, r10443 from trunk into release 3.2 branch

Modified: gnuradio/branches/releases/3.2/grc/src/platforms/base/Block.py
===================================================================
--- gnuradio/branches/releases/3.2/grc/src/platforms/base/Block.py      
2009-02-23 22:57:51 UTC (rev 10489)
+++ gnuradio/branches/releases/3.2/grc/src/platforms/base/Block.py      
2009-02-23 23:03:17 UTC (rev 10490)
@@ -196,6 +196,42 @@
                except Exception, e: return "-------->\n%s: %s\n<--------"%(e, 
tmpl)
 
        ##############################################
+       # Controller Modify
+       ##############################################
+       def type_controller_modify(self, direction):
+               """
+               Change the type controller.
+               @param direction +1 or -1
+               @return true for change
+               """
+               changed = False
+               type_param = None
+               for param in filter(lambda p: p.is_enum(), self.get_params()):
+                       children = self.get_ports() + self.get_params()
+                       #priority to the type controller
+                       if param.get_key() in ' '.join(map(lambda p: p._type, 
children)): type_param = param
+                       #use param if type param is unset
+                       if not type_param: type_param = param
+               if type_param:
+                       #try to increment the enum by direction
+                       try:
+                               keys = type_param.get_option_keys()
+                               old_index = keys.index(type_param.get_value())
+                               new_index = (old_index + direction + 
len(keys))%len(keys)
+                               type_param.set_value(keys[new_index])
+                               changed = True
+                       except: pass
+               return changed
+
+       def port_controller_modify(self, direction):
+               """
+               Change the port controller.
+               @param direction +1 or -1
+               @return true for change
+               """
+               return False
+
+       ##############################################
        ## Import/Export Methods
        ##############################################
        def export_data(self):

Modified: gnuradio/branches/releases/3.2/grc/src/platforms/gui/FlowGraph.py
===================================================================
--- gnuradio/branches/releases/3.2/grc/src/platforms/gui/FlowGraph.py   
2009-02-23 22:57:51 UTC (rev 10489)
+++ gnuradio/branches/releases/3.2/grc/src/platforms/gui/FlowGraph.py   
2009-02-23 23:03:17 UTC (rev 10490)
@@ -176,25 +176,7 @@
                @param direction +1 or -1
                @return true for change
                """
-               changed = False
-               for selected_block in self.get_selected_blocks():
-                       type_param = None
-                       for param in filter(lambda p: p.is_enum(), 
selected_block.get_params()):
-                               children = param.get_parent().get_ports() + 
param.get_parent().get_params()
-                               #priority to the type controller
-                               if param.get_key() in ' '.join(map(lambda p: 
p._type, children)): type_param = param
-                               #use param if type param is unset
-                               if not type_param: type_param = param
-                       if type_param:
-                               #try to increment the enum by direction
-                               try:
-                                       keys = type_param.get_option_keys()
-                                       old_index = 
keys.index(type_param.get_value())
-                                       new_index = (old_index + direction + 
len(keys))%len(keys)
-                                       type_param.set_value(keys[new_index])
-                                       changed = True
-                               except: pass
-               return changed
+               return any([sb.type_controller_modify(direction) for sb in 
self.get_selected_blocks()])
 
        def port_controller_modify_selected(self, direction):
                """
@@ -202,32 +184,15 @@
                @param direction +1 or -1
                @return true for changed
                """
-               changed = False
-               for selected_block in self.get_selected_blocks():
-                       for ports in (selected_block.get_sinks(), 
selected_block.get_sources()):
-                               if ports and hasattr(ports[0], 'get_nports') 
and ports[0].get_nports():
-                                       #find the param that controls port0
-                                       for param in 
selected_block.get_params():
-                                               if param.get_key() in 
ports[0]._nports:
-                                                       #try to increment the 
port controller by direction
-                                                       try:
-                                                               value = 
param.evaluate()
-                                                               value = value + 
direction
-                                                               assert 0 < value
-                                                               
param.set_value(value)
-                                                               changed = True
-                                                       except: pass
-               return changed
+               return any([sb.port_controller_modify(direction) for sb in 
self.get_selected_blocks()])
 
        def param_modify_selected(self):
                """
                Create and show a param modification dialog for the selected 
block.
                @return true if parameters were changed
                """
-               if self.get_selected_block():
-                       signal_block_params_dialog = 
ParamsDialog(self.get_selected_block())
-                       return signal_block_params_dialog.run()
-               return False
+               if not self.get_selected_block(): return False
+               return ParamsDialog(self.get_selected_block()).run()
 
        def enable_selected(self, enable):
                """

Modified: gnuradio/branches/releases/3.2/grc/src/platforms/python/Block.py
===================================================================
--- gnuradio/branches/releases/3.2/grc/src/platforms/python/Block.py    
2009-02-23 22:57:51 UTC (rev 10489)
+++ gnuradio/branches/releases/3.2/grc/src/platforms/python/Block.py    
2009-02-23 23:03:17 UTC (rev 10490)
@@ -104,6 +104,28 @@
                                        ports[key] = port
                                continue
 
+       def port_controller_modify(self, direction):
+               """
+               Change the port controller.
+               @param direction +1 or -1
+               @return true for change
+               """
+               changed = False
+               for ports in (self.get_sinks(), self.get_sources()):
+                       if ports and ports[0].get_nports():
+                               #find the param that controls port0
+                               for param in self.get_params():
+                                       if not param.is_enum() and 
param.get_key() in ports[0]._nports:
+                                               #try to increment the port 
controller by direction
+                                               try:
+                                                       value = param.evaluate()
+                                                       value = value + 
direction
+                                                       assert 0 < value
+                                                       param.set_value(value)
+                                                       changed = True
+                                               except: pass
+               return changed
+
        def get_doc(self):
                doc = self._doc.strip('\n').replace('\\\n', '')
                #merge custom doc with doxygen docs

Modified: gnuradio/branches/releases/3.2/grc/todo.txt
===================================================================
--- gnuradio/branches/releases/3.2/grc/todo.txt 2009-02-23 22:57:51 UTC (rev 
10489)
+++ gnuradio/branches/releases/3.2/grc/todo.txt 2009-02-23 23:03:17 UTC (rev 
10490)
@@ -2,9 +2,8 @@
 # Blocks
 ##################################################
 -ofdm wrappers
--controlled step block
 -probe: also non-float outputs
--RFID, ATSC
+-log slider gui control
 
 ##################################################
 # Features
@@ -12,7 +11,6 @@
 -param editor, expand entry boxes in focus
 -change param dialog to panel within main window
 -command line option for additional block wrappers
--log slider gui control
 -zoom in/out (cairo vector graphics) (use scroll wheel as control)
 -search for blocks
 -click and drag on whitespace to scroll
@@ -28,18 +26,5 @@
 -add hier blocks to tree without restart?
 -dont generate py files in .grc file dir
 -save/restore cwd
--special connection validation rules for disabled blocks
 -threads dont die on exit in probe and variable sink
 -overloaded gui classes for each platform, move param input objects into 
overloaded
-
-##################################################
-# External
-##################################################
--simple usrp
--global wxgui controls and top block window
-
-##################################################
-# Documentation
-##################################################
--notes on throttle
--notes on xdg-utils





reply via email to

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