commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r8772 - in grc/trunk: . scripts src/grc src/grc/elemen


From: jblum
Subject: [Commit-gnuradio] r8772 - in grc/trunk: . scripts src/grc src/grc/elements src/grc/gui src/grc_gnuradio src/grc_gnuradio/blocks src/grc_gnuradio/blocks/modulators src/grc_gnuradio/blocks/synchronizers src/grc_gnuradio/data
Date: Wed, 2 Jul 2008 19:37:03 -0600 (MDT)

Author: jblum
Date: 2008-07-02 19:37:02 -0600 (Wed, 02 Jul 2008)
New Revision: 8772

Added:
   grc/trunk/src/grc_gnuradio/blocks/synchronizers/gr_mpsk_receiver_cc.xml
   grc/trunk/src/grc_gnuradio/blocks/synchronizers/gr_mpsk_sync_cc.xml
Removed:
   grc/trunk/src/grc_gnuradio/blocks/custom/
   grc/trunk/src/grc_gnuradio/blocks/modulators/gr_mpsk_receiver_cc.xml
   grc/trunk/src/grc_gnuradio/blocks/modulators/gr_mpsk_sync_cc.xml
Modified:
   grc/trunk/Makefile
   grc/trunk/scripts/grc
   grc/trunk/scripts/usrp_diagnostics
   grc/trunk/setup.py
   grc/trunk/src/grc/Preferences.py
   grc/trunk/src/grc/elements/Platform.py
   grc/trunk/src/grc/gui/SignalBlockSelectionWindow.py
   grc/trunk/src/grc_gnuradio/Platform.py
   grc/trunk/src/grc_gnuradio/data/block_tree.xml
Log:
better handling for custom block wrappers

Modified: grc/trunk/Makefile
===================================================================
--- grc/trunk/Makefile  2008-07-02 07:18:06 UTC (rev 8771)
+++ grc/trunk/Makefile  2008-07-03 01:37:02 UTC (rev 8772)
@@ -1,45 +1,45 @@
 #
 # Copyright 2008 Free Software Foundation, Inc.
-# 
+#
 # This file is part of GNU Radio
-# 
+#
 # GNU Radio 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 3, or (at your option)
 # any later version.
-# 
+#
 # GNU Radio 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 GNU Radio; see the file COPYING.  If not, write to
 # the Free Software Foundation, Inc., 51 Franklin Street,
 # Boston, MA 02110-1301, USA.
-# 
+#
 
 DOCS_URL = http://www.ece.jhu.edu/~jblum/downloads/grc_gnuradio_docs.tar.gz
 DOCS_DEST = /usr/local/share/doc/
 
-all: 
+all:
        @echo Options: build, clean, install, uninstall, docs_install, 
docs_uninstall
 
 build: clean
-       python setup.py build   
+       python setup.py build
 
 clean:
        if [ -d build ]; then rm -rf build; fi
 
 install: build
        python setup.py install
-       
+
 uninstall:
        rm -rf `python -c "import grc,os;print os.path.dirname(grc.__file__)"`*
-       
+
 docs_install:
        mkdir -p $(DOCS_DEST)
        wget $(DOCS_URL) -O - | tar -xzv -C $(DOCS_DEST)
-       
+
 docs_uninstall:
        rm -rf $(DOCS_DEST)grc*

Modified: grc/trunk/scripts/grc
===================================================================
--- grc/trunk/scripts/grc       2008-07-02 07:18:06 UTC (rev 8771)
+++ grc/trunk/scripts/grc       2008-07-03 01:37:02 UTC (rev 8772)
@@ -17,36 +17,36 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 """
address@hidden Editor 
address@hidden Editor
 #Execute the flow graph editor GUI. This file must be called by the python 
interpreter.
 address@hidden Josh Blum
 
 from grc.Constants import VERSION,FLOW_GRAPH_FILE_EXTENSION
 from optparse import OptionParser
 
-if __name__ == "__main__": 
+if __name__ == "__main__":
        usage = 'usage: %prog 
[optional_flow_graphs'+FLOW_GRAPH_FILE_EXTENSION+']'
        version = """
 GNU Radio Companion %s
 
 This program is part of GNU Radio
-GRC comes with ABSOLUTELY NO WARRANTY. 
-This is free software, 
+GRC comes with ABSOLUTELY NO WARRANTY.
+This is free software,
 and you are welcome to redistribute it.
 """%VERSION
-       parser = OptionParser(usage=usage, version=version)     
-       (options, args) = parser.parse_args()   
+       parser = OptionParser(usage=usage, version=version)
+       (options, args) = parser.parse_args()
        #"test" import modules that this program will use
        error = False
        for module in ('pygtk', 'wx', 'numpy', 'lxml', 'gnuradio', 
'gnuradio.gr.hier_block2', 'Cheetah'):
-               try: __import__(module)         
+               try: __import__(module)
                except ImportError: #print error
                        error = True
                        print '\nMissing critical module: "%s"'%module
-       if error: #exit         
-               print '\nExiting!\n'            
+       if error: #exit
+               print '\nExiting!\n'
                exit(-1)
-       #end import of modules  
+       #end import of modules
        from grc_gnuradio.Platform import Platform
        from grc.ActionHandler import ActionHandler
        ActionHandler(args, Platform())

Modified: grc/trunk/scripts/usrp_diagnostics
===================================================================
--- grc/trunk/scripts/usrp_diagnostics  2008-07-02 07:18:06 UTC (rev 8771)
+++ grc/trunk/scripts/usrp_diagnostics  2008-07-03 01:37:02 UTC (rev 8772)
@@ -31,7 +31,7 @@
 from grc.gui.Dialogs import TextDisplay
 
 from grc_gnuradio.Platform import Platform
-platform = Platform(os.path.join('usrp', 'usrp_diagnostics.xml'))
+platform = Platform(block_paths_internal_only=[os.path.join('usrp', 
'usrp_diagnostics.xml')])
 
 from grc.gui.elements.Platform import Platform
 platform = Platform(platform)
@@ -48,16 +48,16 @@
        """
        The main window for USRP Dignostics.
        """
-       
+
        def delete_event(self, widget, event, data=None): return False
-       
+
        def destroy(self, widget, data=None): gtk.main_quit()
-       
+
        def __init__(self):
                """
                USRPDiagnosticsWindow contructor.
                Create a new gtk Dialog with a close button, USRP input 
paramaters, and output labels.
-               """             
+               """
                gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
                #quit signals
                self.connect("delete_event", self.delete_event)
@@ -75,15 +75,15 @@
                vbox.pack_start(side_subdev_param.get_input_object(), False)
                self.diagnose_button = gtk.Button('Query')
                self.diagnose_button.connect('clicked', self._diagnose_usrp)
-               vbox.pack_start(self.diagnose_button, False)            
+               vbox.pack_start(self.diagnose_button, False)
                #Create a text box for USRP queries
                self.query_buffer = TextDisplay()
-               self.query_buffer.set_text('Press "Query" to retrieve USRP 
information...')                     
-               vbox.pack_start(self.query_buffer)      
+               self.query_buffer.set_text('Press "Query" to retrieve USRP 
information...')
+               vbox.pack_start(self.query_buffer)
                self.show_all()
-               
+
        def _diagnose_usrp(self, widget=None):
-               """Query the USRP device and copy the results into the query 
text box."""               
+               """Query the USRP device and copy the results into the query 
text box."""
                type = usrp_type_param.evaluate()
                if type == 'rx':        #for the rx query, use the source and 
rx methods
                        make = usrp.source_c
@@ -91,7 +91,7 @@
                elif type == 'tx':      #for the tx query, use the sink and tx 
methods
                        make = usrp.sink_c
                        get_mux = usrp.determine_tx_mux_value
-               try:            
+               try:
                        u = make(usrp_number_param.evaluate())
                        subdev_spec = eval(side_subdev_param.evaluate())
                        subdev = usrp.selected_subdev(u, subdev_spec)#get the 
subdev
@@ -111,11 +111,11 @@
 
 If the USRP cannot be found, make sure that the USRP is plugged-in and restart 
this program. \
 If the problem persists, there may be a problem with you gnuradio installation 
or USB 2.0.
-'''%str(e))    
+'''%str(e))
 
-#enter the mainloop            
+#enter the mainloop
 gtk.gdk.threads_init()
 gtk.gdk.threads_enter()
 USRPDiagnosticsWindow()
 gtk.main()
-gtk.gdk.threads_leave()        
+gtk.gdk.threads_leave()

Modified: grc/trunk/setup.py
===================================================================
--- grc/trunk/setup.py  2008-07-02 07:18:06 UTC (rev 8771)
+++ grc/trunk/setup.py  2008-07-03 01:37:02 UTC (rev 8772)
@@ -43,7 +43,6 @@
        'data/*.*',     
        'blocks/*.*',
        'blocks/conversions/*.xml',
-       'blocks/custom/*.xml',
        'blocks/error_correction/*.xml',
        'blocks/filters/*.xml',
        'blocks/graphical_sinks/*.xml',

Modified: grc/trunk/src/grc/Preferences.py
===================================================================
--- grc/trunk/src/grc/Preferences.py    2008-07-02 07:18:06 UTC (rev 8771)
+++ grc/trunk/src/grc/Preferences.py    2008-07-03 01:37:02 UTC (rev 8772)
@@ -26,7 +26,7 @@
 import os
 
 from grc_gnuradio.Platform import Platform
-platform = Platform('preferences.xml')
+platform = Platform(block_paths_internal_only=['preferences.xml'])
 
 from grc.gui.elements.Platform import Platform
 platform = Platform(platform)
@@ -51,27 +51,27 @@
 ##Preferences: title, notes, params
 PREFERENCES = [
        (
-               'Grid', 
+               'Grid',
                '''
 Show grid will draw a square grid onto the flow graph with grid points 
separated by grid size pixels. \
-Snap to Grid forces the upper right corner of the signal block to align with a 
grid point.             
-''', 
+Snap to Grid forces the upper right corner of the signal block to align with a 
grid point.
+''',
                [snap_to_grid_param, grid_size_param, show_grid_param],
        ),
        (
-               'Appearance', 
+               'Appearance',
                '''
-Show or hide the reports window at the bottom of the main window. 
+Show or hide the reports window at the bottom of the main window.
 Show or hide all paramater labels in the signal blocks.
 Show or hide the ID label in the signal blocks.
-''', 
+''',
                [show_reports_param, show_params_param, show_id_param],
        ),
        (
-               'Misc', 
+               'Misc',
                '''
 Restore previously opened files on start-up.
-''', 
+''',
                [restore_files_param],
        ),
 ]
@@ -80,29 +80,29 @@
        """!
        Load the preferences from the preferences file.
        """
-       try: 
+       try:
                ParseXML.validate_dtd(PREFERENCES_FILE_PATH, 
os.path.join(DATA_DIR, 'flow_graph.dtd'))
                n = ParseXML.from_file(PREFERENCES_FILE_PATH)
                block.import_data(n['block'])
-       except: Messages.send_fail_load_preferences()           
+       except: Messages.send_fail_load_preferences()
 
 def save():
-       try: ParseXML.to_file({'block': block.export_data()}, 
PREFERENCES_FILE_PATH)    
+       try: ParseXML.to_file({'block': block.export_data()}, 
PREFERENCES_FILE_PATH)
        except IOError: Messages.send_fail_save_preferences()
-               
+
 ###########################################################################
 #      Special methods for specific program functionalities
 ###########################################################################
-       
+
 def window_size(size=None):
        if size: window_size_param.set_value(size)
-       else: 
+       else:
                try: return window_size_param.evaluate()
                except: return (-1, -1)
-       
+
 def restore_files():
-       return restore_files_param.get_value() == 'yes' 
-       
+       return restore_files_param.get_value() == 'yes'
+
 def file_open(file=None):
        if file is not None: file_open_param.set_value(file)
        else: return file_open_param.get_value()
@@ -110,22 +110,22 @@
 def files_open(files=None):
        if files is not None: files_open_param.set_value('\n'.join(files))
        else: return files_open_param.get_value().split('\n')
-       
+
 def show_reports_window():
        return show_reports_param.get_value() == 'show'
-       
+
 def get_grid_size():
-       return int(grid_size_param.get_value()) 
+       return int(grid_size_param.get_value())
 
 def snap_to_grid():
        return snap_to_grid_param.get_value() == 'on'
-       
+
 def show_grid():
        return show_grid_param.get_value() == 'show'
-       
+
 def show_params():
        return show_params_param.get_value() == 'show'
-       
+
 def show_id():
        return show_id_param.get_value() == 'show'
 

Modified: grc/trunk/src/grc/elements/Platform.py
===================================================================
--- grc/trunk/src/grc/elements/Platform.py      2008-07-02 07:18:06 UTC (rev 
8771)
+++ grc/trunk/src/grc/elements/Platform.py      2008-07-03 01:37:02 UTC (rev 
8772)
@@ -22,6 +22,7 @@
 
 import os
 from grc import ParseXML
+from grc import Utils
 from grc.elements.Element import Element as _Element
 from grc.elements.FlowGraph import FlowGraph as _FlowGraph
 from grc.elements.Connection import Connection as _Connection
@@ -31,13 +32,13 @@
 from grc.Constants import DATA_DIR
 
 class Platform(_Element):
-       
-       def __init__(self, name, key, path, block_tree, default_flow_graph, 
generator, load_one=None):
+
+       def __init__(self, name, key, block_paths, block_tree, 
default_flow_graph, generator):
                """!
                Make a platform from the arguments.
                @param name the platform name
                @param key the unique platform key
-               @param path the file path to this platform
+               @param block_paths the file paths to blocks in this platform
                @param block_tree the nested tree of block keys and categories
                @param default_flow_graph the default flow graph file path
                @param load_one a single file to load into this platform or None
@@ -45,28 +46,47 @@
                """
                _Element.__init__(self)
                self._name = name
-               self._key = key 
-               self._path = path
+               self._key = key
+               self._block_paths = block_paths
                self._block_tree = block_tree
                self._default_flow_graph = default_flow_graph
                self._generator = generator
+               #load the block tree
+               f = self._block_tree
+               try: ParseXML.validate_dtd(f, os.path.join(DATA_DIR, 
'block_tree.dtd'))
+               except ParseXML.XMLSyntaxError, e: self._exit_with_error('Block 
tree "%s" failed: \n\t%s'%(f, e))
+               n = ParseXML.from_file(f)['block_tree']
+               #build nested tree object
+               self._block_tree_nested = [(c['name'], Utils.listify(c, 
'block')) for c in Utils.listify(n, 'cat')]
+               self._keys_in_tree = sum([Utils.listify(c, 'block') for c in 
Utils.listify(n, 'cat')], [])
                #create a dummy flow graph for the blocks
-               self.flow_graph = _Element(self)
+               self._flow_graph = _Element(self)
                #load the blocks
                self._blocks = dict()
                self._blocks_n = dict()
-               if load_one:
-                       self._load_block(os.path.join(self._path, 'blocks', 
load_one))  
-               else:
-                       for dirpath,dirnames,filenames in 
os.walk(os.path.join(self._path, 'blocks')):
-                               for filename in filter(lambda f: 
f.endswith('.xml'), filenames):
-                                       self._load_block(os.path.join(dirpath, 
filename))                               
-       
+               for block_path in self._block_paths:
+                       if os.path.isfile(block_path): 
self._load_block(block_path)
+                       elif os.path.isdir(block_path):
+                               for dirpath,dirnames,filenames in 
os.walk(block_path):
+                                       for filename in filter(lambda f: 
f.endswith('.xml'), filenames):
+                                               
self._load_block(os.path.join(dirpath, filename))
+               #handle blocks not in the tree
+               custom_keys = set(self.get_block_keys()) - 
set(self._keys_in_tree)
+               custom_keys = filter(lambda k: 
self._blocks_n[k].has_key('category') , custom_keys)
+               for custom_key in custom_keys:
+                       custom_category = self._blocks_n[custom_key]['category']
+                       found = False
+                       for category, keys in self._block_tree_nested:
+                               if category == custom_category:
+                                       category.append(custom_key)
+                                       found = True
+                       if not found: 
self._block_tree_nested.append((custom_category, [custom_key]))
+
        def _load_block(self, f):
                try: ParseXML.validate_dtd(f)
                except ParseXML.XMLSyntaxError, e: self._exit_with_error('Block 
definition "%s" failed: \n\t%s'%(f, e))
                n = ParseXML.from_file(f)['block']
-               block = self.Block(self.flow_graph, n)
+               block = self.Block(self._flow_graph, n)
                key = block.get_key()
                #test against repeated keys
                try: assert(key not in self.get_block_keys())
@@ -74,24 +94,19 @@
                #store the block
                self._blocks[key] = block
                self._blocks_n[key] = n
-       
+
        def __str__(self): return 'Platform - %s(%s)'%(self.get_name(), 
self.get_key())
-       
+
        def is_platform(self): return True
-       
+
        def get_new_flow_graph(self): return self.FlowGraph(self)
-               
-       def get_block_tree(self):
-               f = self._block_tree
-               try: ParseXML.validate_dtd(f, os.path.join(DATA_DIR, 
'block_tree.dtd'))
-               except ParseXML.XMLSyntaxError, e: self._exit_with_error('Block 
tree "%s" failed: \n\t%s'%(f, e))
-               n = ParseXML.from_file(f)['block_tree']
-               return n
-       
+
+       def get_block_tree(self): return self._block_tree_nested
+
        def get_default_flow_graph(self): return self._default_flow_graph
-       
+
        def get_generator(self): return self._generator
-       
+
        ##############################################
        # Access Blocks
        ##############################################
@@ -99,11 +114,11 @@
        def get_block(self, key): return self._blocks[key]
        def get_blocks(self): return self._blocks.values()
        def get_new_block(self, flow_graph, key): return self.Block(flow_graph, 
n=self._blocks_n[key])
-       
+
        def get_name(self): return self._name
-       
+
        def get_key(self): return self._key
-       
+
        ##############################################
        # Constructors
        ##############################################

Modified: grc/trunk/src/grc/gui/SignalBlockSelectionWindow.py
===================================================================
--- grc/trunk/src/grc/gui/SignalBlockSelectionWindow.py 2008-07-02 07:18:06 UTC 
(rev 8771)
+++ grc/trunk/src/grc/gui/SignalBlockSelectionWindow.py 2008-07-03 01:37:02 UTC 
(rev 8772)
@@ -20,7 +20,6 @@
 #The signal block selection window gives the user a tree selection to choose a 
signal block.
 address@hidden Josh Blum
 
-from grc import Utils
 from grc.Constants import *
 import pygtk
 pygtk.require('2.0')
@@ -29,70 +28,70 @@
 
 class SignalBlockSelectionWindow(gtk.VBox):
        """The signal block selection window."""
-       
+
        def __init__(self, platform, get_flow_graph):
                """!
                SignalBlockSelectionWindow constructor.
-               Show all possible signal blocks in this dialog. 
-               Each signal block is represented by a gtk label of its tag and 
an add button. 
+               Show all possible signal blocks in this dialog.
+               Each signal block is represented by a gtk label of its tag and 
an add button.
                The add button tells the flow graph to create the selected 
block. and add it to the flow graph.
                @param platform the particular platform will all block 
prototypes
                @param get_flow_graph get the selected flow graph
-               """     
+               """
                gtk.VBox.__init__(self)
                self.get_flow_graph = get_flow_graph
-               #make the tree model for holding blocks 
+               #make the tree model for holding blocks
                self.treestore = gtk.TreeStore(gobject.TYPE_STRING)
-               self.treeview = gtk.TreeView(self.treestore)            
+               self.treeview = gtk.TreeView(self.treestore)
                self.treeview.set_enable_search(False) #disable pop up search 
box
                self.treeview.add_events(gtk.gdk.BUTTON_PRESS_MASK)
                self.treeview.connect('button_press_event', 
self._handle_mouse_button_press)
                selection = self.treeview.get_selection()
                selection.set_mode('single')
-               selection.connect('changed', self._handle_selection_change)     
+               selection.connect('changed', self._handle_selection_change)
                renderer = gtk.CellRendererText()
                column = gtk.TreeViewColumn("Signal Blocks", renderer, text=0)
                self.treeview.append_column(column)
-               #make the scrolled window to hold the tree view 
+               #make the scrolled window to hold the tree view
                scrolled_window = gtk.ScrolledWindow()
                scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, 
gtk.POLICY_AUTOMATIC)
                scrolled_window.add_with_viewport(self.treeview)
                scrolled_window.set_size_request(BLOCK_SELECTION_WINDOW_WIDTH, 
-1)
                self.pack_start(scrolled_window)
                #add button
-               self.add_button = gtk.Button(None, 'gtk-add')           
+               self.add_button = gtk.Button(None, 'gtk-add')
                self.add_button.connect('clicked', self._handle_add_button)
                self.pack_start(self.add_button, False)
                #map names to keys
                self.names = dict()
-               #add blocks and categories              
-               for category_n in Utils.listify(platform.get_block_tree(), 
'cat'):
+               #add blocks and categories
+               for category, keys in platform.get_block_tree():
                        iter = self.treestore.insert_before(None, None)
-                       self.treestore.set_value(iter, 0, category_n['name'])
-                       for key in Utils.listify(category_n, 'block'):          
                
+                       self.treestore.set_value(iter, 0, category)
+                       for key in keys:
                                if key not in platform.get_block_keys():
                                        print 'Block with key "%s" cannot be 
found in %s -> ignoring...'%(key, platform)
                                        continue
                                name = platform.get_block(key).get_name()
-                               if name in self.names.keys(): 
+                               if name in self.names.keys():
                                        print '%s has more than one block with 
name "%s".'%(platform, name)
                                        print 'Although block names do not have 
to be unique, this gui requires that that are.'
                                        print 'Please rename the block to avoid 
problems.'
                                        continue
                                self.names[name] = key
-                               new_iter = self.treestore.insert_before(iter, 
None)             
+                               new_iter = self.treestore.insert_before(iter, 
None)
                                self.treestore.set_value(new_iter, 0, name)
                #initialize
                self._handle_selection_change()
-               
+
        def _handle_mouse_button_press(self, widget, event):
                """!
                Handle the mouse button press.
-               If a left double click is detected, 
+               If a left double click is detected,
                let the handler for the add button decide to add a block.
                """
                if event.button == 1 and event.type == gtk.gdk._2BUTTON_PRESS: 
self._handle_add_button(widget)
-               
+
        def _handle_selection_change(self, selection=None):
                """!
                Handle a selection change in the tree view.
@@ -102,7 +101,7 @@
                model, iter = selection.get_selected()
                sensitive = bool(iter and not model.iter_has_child(iter))
                self.add_button.set_sensitive(sensitive)
-       
+
        def _handle_add_button(self, widget):
                """!
                Handle the add button clicked signal.
@@ -110,8 +109,8 @@
                """
                selection = self.treeview.get_selection()
                treestore, iter = selection.get_selected()
-               if iter and not treestore.iter_has_child(iter): 
+               if iter and not treestore.iter_has_child(iter):
                        name = treestore.get_value(iter, 0)
                        key = self.names[name]
-                       self.get_flow_graph().add_new_block(key)                
+                       self.get_flow_graph().add_new_block(key)
 

Modified: grc/trunk/src/grc_gnuradio/Platform.py
===================================================================
--- grc/trunk/src/grc_gnuradio/Platform.py      2008-07-02 07:18:06 UTC (rev 
8771)
+++ grc/trunk/src/grc_gnuradio/Platform.py      2008-07-03 01:37:02 UTC (rev 
8772)
@@ -31,31 +31,38 @@
 
 PATH = os.path.abspath(os.path.dirname(__file__))
 
+BLOCK_PATH = os.path.join(PATH, 'blocks')
+
 BLOCK_TREE = os.path.join(PATH, 'data', 'block_tree.xml')
 
 DEFAULT_FLOW_GRAPH = os.path.join(PATH, 'data', 'default_flow_graph.grc.xml')
 
 class Platform(_Platform):
-       
-       def __init__(self, load_one=None):
+
+       def __init__(self, block_paths_internal_only=[], 
block_paths_external=[]):
                """!
-               Make a platform from the arguments.
-               @param name the platform name
-               @param key the unique platform key
-               @param path the file path to this platform
-               @param load_one a single file to load into this platform or None
-               @return a platform object
+               Make a platform for gnuradio.
+               The internal only list will replace the current block path.
+               @param block_paths_internal_only a list of blocks internal to 
this platform
+               @param block_paths_external a list of blocks to load in 
addition to the above blocks
                """
+               #handle internal/only
+               if block_paths_internal_only: 
+                       block_paths = map(lambda b: os.path.join(BLOCK_PATH, 
b), ['options.xml'] + block_paths_internal_only)
+               else: block_paths = [BLOCK_PATH]
+               #handle external
+               block_paths.extend(block_paths_external)
+               #init
                _Platform.__init__(
                        self,
-                       name='GNURadio Python', 
-                       key='gnuradio_python',  
-                       path=PATH,
+                       name='GNURadio Python',
+                       key='gnuradio_python',
+                       block_paths=block_paths,
                        block_tree=BLOCK_TREE,
                        default_flow_graph=DEFAULT_FLOW_GRAPH,
                        generator=Generator,
                )
-               
+
        ##############################################
        # Constructors
        ##############################################
@@ -65,4 +72,4 @@
        Source = Source
        Sink = Sink
        Param = _Param
-       
+

Deleted: grc/trunk/src/grc_gnuradio/blocks/modulators/gr_mpsk_receiver_cc.xml

Deleted: grc/trunk/src/grc_gnuradio/blocks/modulators/gr_mpsk_sync_cc.xml

Copied: grc/trunk/src/grc_gnuradio/blocks/synchronizers/gr_mpsk_receiver_cc.xml 
(from rev 8599, 
grc/trunk/src/grc_gnuradio/blocks/modulators/gr_mpsk_receiver_cc.xml)
===================================================================
--- grc/trunk/src/grc_gnuradio/blocks/synchronizers/gr_mpsk_receiver_cc.xml     
                        (rev 0)
+++ grc/trunk/src/grc_gnuradio/blocks/synchronizers/gr_mpsk_receiver_cc.xml     
2008-07-03 01:37:02 UTC (rev 8772)
@@ -0,0 +1,82 @@
+<?xml version="1.0"?>
+<!DOCTYPE block SYSTEM "../block.dtd">
+<!-- 
+###################################################
+##MPSK Receiver
+###################################################
+ -->
+<block>
+       <name>MPSK Receiver</name>
+       <key>gr_mpsk_receiver_cc</key>
+       <import>from gnuradio import gr</import>
+       <make>gr.mpsk_receiver_cc($M, $theta, $alpha, $beta, $fmin, $fmax, $mu, 
$gain_mu, $omega, $gain_omega, $omega_relative_limit)</make>
+       <callback>set_alpha($alpha)</callback>
+       <callback>set_beta($beta)</callback>
+       <callback>set_mu($mu)</callback>
+       <callback>set_gain_mu($gain_mu)</callback>
+       <callback>set_omega($omega)</callback>
+       <callback>set_gain_omega($gain_omega)</callback>
+       <param>
+               <name>M</name>
+               <key>M</key>
+               <type>int</type>
+       </param>
+       <param>
+               <name>Theta</name>
+               <key>theta</key>
+               <type>real</type>
+       </param>
+       <param>
+               <name>Alpha</name>
+               <key>alpha</key>
+               <type>real</type>
+       </param>
+       <param>
+               <name>Beta</name>
+               <key>beta</key>
+               <type>real</type>
+       </param>
+       <param>
+               <name>Min Freq</name>
+               <key>fmin</key>
+               <type>real</type>
+       </param>
+       <param>
+               <name>Max Freq</name>
+               <key>fmax</key>
+               <type>real</type>
+       </param>        
+       <param>
+               <name>Mu</name>
+               <key>mu</key>
+               <type>real</type>
+       </param>
+       <param>
+               <name>Gain Mu</name>
+               <key>gain_mu</key>
+               <type>real</type>
+       </param>
+       <param>
+               <name>Omega</name>
+               <key>omega</key>
+               <type>real</type>
+       </param>
+       <param>
+               <name>Gain Omega</name>
+               <key>gain_omega</key>
+               <type>real</type>
+       </param>
+       <param>
+               <name>Omega Relative Limit</name>
+               <key>omega_relative_limit</key>
+               <type>real</type>
+       </param>
+       <sink>
+               <name>in</name>
+               <type>complex</type>
+       </sink>
+       <source>
+               <name>out</name>
+               <type>complex</type>
+       </source>
+</block>

Copied: grc/trunk/src/grc_gnuradio/blocks/synchronizers/gr_mpsk_sync_cc.xml 
(from rev 8599, 
grc/trunk/src/grc_gnuradio/blocks/modulators/gr_mpsk_sync_cc.xml)
===================================================================
--- grc/trunk/src/grc_gnuradio/blocks/synchronizers/gr_mpsk_sync_cc.xml         
                (rev 0)
+++ grc/trunk/src/grc_gnuradio/blocks/synchronizers/gr_mpsk_sync_cc.xml 
2008-07-03 01:37:02 UTC (rev 8772)
@@ -0,0 +1,70 @@
+<?xml version="1.0"?>
+<!DOCTYPE block SYSTEM "../block.dtd">
+<!-- 
+###################################################
+##MPSK Sync
+###################################################
+ -->
+<block>
+       <name>MPSK Sync</name>
+       <key>gr_mpsk_sync_cc</key>
+       <import>from gnuradio import gr</import>
+       <make>gr.mpsk_sync_cc($alpha, $beta, $max_freq, $min_freq, $ref_phase, 
$omega, $gain_omega, $mu, $gain_mu)</make>
+       <callback>set_mu($mu)</callback>
+       <callback>set_gain_mu($gain_mu)</callback>
+       <callback>set_omega($omega)</callback>
+       <callback>set_gain_omega($gain_omega)</callback>
+       <param>
+               <name>Alpha</name>
+               <key>alpha</key>
+               <type>real</type>
+       </param>
+       <param>
+               <name>Beta</name>
+               <key>beta</key>
+               <type>real</type>
+       </param>        
+       <param>
+               <name>Max Freq</name>
+               <key>max_freq</key>
+               <type>real</type>
+       </param>
+       <param>
+               <name>Min Freq</name>
+               <key>min_freq</key>
+               <type>real</type>
+       </param>
+       <param>
+               <name>Reference Phase</name>
+               <key>ref_phase</key>
+               <type>real</type>
+       </param>
+       <param>
+               <name>Omega</name>
+               <key>omega</key>
+               <type>real</type>
+       </param>
+       <param>
+               <name>Gain Omega</name>
+               <key>gain_omega</key>
+               <type>real</type>
+       </param>
+       <param>
+               <name>Mu</name>
+               <key>mu</key>
+               <type>real</type>
+       </param>
+       <param>
+               <name>Gain Mu</name>
+               <key>gain_mu</key>
+               <type>real</type>
+       </param>
+       <sink>
+               <name>in</name>
+               <type>complex</type>
+       </sink>
+       <source>
+               <name>out</name>
+               <type>complex</type>
+       </source>
+</block>

Modified: grc/trunk/src/grc_gnuradio/data/block_tree.xml
===================================================================
--- grc/trunk/src/grc_gnuradio/data/block_tree.xml      2008-07-02 07:18:06 UTC 
(rev 8771)
+++ grc/trunk/src/grc_gnuradio/data/block_tree.xml      2008-07-03 01:37:02 UTC 
(rev 8772)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<!-- 
+<!--
 ###################################################
 ##Block Tree for platform gnuradio python.
 ###################################################
@@ -7,15 +7,15 @@
 <block_tree>
        <cat>
                <name>Sources</name>
-               <block>gr_sig_source_x</block>  
-               <block>gr_noise_source_x</block>        
+               <block>gr_sig_source_x</block>
+               <block>gr_noise_source_x</block>
                <block>gr_vector_source_x</block>
                <block>random_source_x</block>
                <block>gr_glfsr_source_x</block>
-               <block>gr_null_source</block>   
-               <block>gr_file_source</block>   
+               <block>gr_null_source</block>
+               <block>gr_file_source</block>
                <block>gr_udp_source</block>
-               <block>audio_source</block>     
+               <block>audio_source</block>
                <block>gr_wavfile_source</block>
                <block>pad_source</block>
        </cat>
@@ -32,7 +32,7 @@
        <cat>
                <name>Graphical Sinks</name>
                <block>wxgui_numbersink2</block>
-               <block>wxgui_scopesink2</block> 
+               <block>wxgui_scopesink2</block>
                <block>wxgui_fftsink2</block>
                <block>wxgui_constellationsink2</block>
                <block>wxgui_waterfallsink2</block>
@@ -44,20 +44,20 @@
                <block>gr_multiply_vxx</block>
                <block>gr_divide_xx</block>
                <block>gr_nlog10_ff</block>
-               
+
                <block>gr_add_const_vxx</block>
                <block>gr_multiply_const_vxx</block>
-               
+
                <block>gr_not_xx</block>
                <block>gr_and_xx</block>
                <block>gr_or_xx</block>
                <block>gr_xor_xx</block>
-               
+
                <block>gr_max_xx</block>
                <block>gr_argmax_xx</block>
                <block>gr_rms_xx</block>
                <block>gr_integrate_xx</block>
-               
+
                <block>gr_conjugate_cc</block>
        </cat>
        <cat>
@@ -67,19 +67,19 @@
                <block>gr_complex_to_mag_squared</block>
                <block>gr_complex_to_real</block>
                <block>gr_complex_to_imag</block>
-               
+
                <block>gr_complex_to_float</block>
                <block>gr_float_to_complex</block>
-               
+
                <block>gr_float_to_short</block>
                <block>gr_short_to_float</block>
-               
+
                <block>gr_float_to_char</block>
                <block>gr_char_to_float</block>
-               
+
                <block>gr_float_to_uchar</block>
                <block>gr_uchar_to_float</block>
-               
+
                <block>gr_complex_to_interleaved_short</block>
                <block>gr_interleaved_short_to_complex</block>
        </cat>
@@ -87,13 +87,13 @@
                <name>Stream Conversions</name>
                <block>gr_interleave</block>
                <block>gr_deinterleave</block>
-               
+
                <block>gr_streams_to_stream</block>
                <block>gr_stream_to_streams</block>
-               
+
                <block>gr_streams_to_vector</block>
                <block>gr_vector_to_streams</block>
-               
+
                <block>gr_stream_to_vector</block>
                <block>gr_vector_to_stream</block>
        </cat>
@@ -101,20 +101,24 @@
                <name>Misc Conversions</name>
                <block>gr_unpacked_to_packed_xx</block>
                <block>gr_packed_to_unpacked_xx</block>
-               <block>gr_unpack_k_bits_bb</block>              
-               <block>gr_binary_slicer_fb</block>              
-               <block>gr_chunks_to_symbols_xx</block>          
-               <block>gr_map_bb</block>        
+               <block>gr_unpack_k_bits_bb</block>
+               <block>gr_binary_slicer_fb</block>
+               <block>gr_chunks_to_symbols_xx</block>
+               <block>gr_map_bb</block>
        </cat>
        <cat>
                <name>Synchronizers</name>
-               <block>gr_clock_recovery_mm_xx</block>          
+               <block>gr_clock_recovery_mm_xx</block>
+               
                <block>gr_costas_loop_cc</block>
                <block>gr_dd_mpsk_sync_cc</block>
+               <block>gr_mpsk_sync_cc</block>
+               <block>gr_mpsk_receiver_cc</block>
+               
                <block>gr_pll_carriertracking_cc</block>
                <block>gr_pll_freqdet_cf</block>
                <block>gr_pll_refout_cc</block>
-               
+
                <block>gr_correlate_access_code_bb</block>
                <block>gr_pn_correlator_cc</block>
                <block>gr_simple_correlator</block>
@@ -126,15 +130,15 @@
                <block>gr_peak_detector_xb</block>
                <block>gr_peak_detector2_fb</block>
                <block>gr_sample_and_hold_xx</block>
-               
+
                <block>gr_agc_xx</block>
                <block>gr_agc2_xx</block>
-               <block>gr_feedforward_agc_cc</block>            
-               
+               <block>gr_feedforward_agc_cc</block>
+
                <block>gr_mute_xx</block>
                <block>gr_simple_squelch_cc</block>
                <block>blks2_standard_squelch</block>
-               <block>gr_pwr_squelch_xx</block>                
+               <block>gr_pwr_squelch_xx</block>
                <block>gr_threshold_ff</block>
        </cat>
        <cat>
@@ -157,10 +161,10 @@
                <block>gr_single_pole_iir_filter_xx</block>
                <block>gr_hilbert_fc</block>
                <block>gr_goertzel_fc</block>
-               <block>gr_cma_equalizer_cc</block>      
+               <block>gr_cma_equalizer_cc</block>
                <block>gr_rational_resampler_base_xxx</block>
                <block>blks2_rational_resampler_xxx</block>
-               <block>gr_fractional_interpolator_xx</block>            
+               <block>gr_fractional_interpolator_xx</block>
                <block>gr_keep_one_in_n</block>
        </cat>
        <cat>
@@ -169,50 +173,47 @@
                <block>gr_frequency_modulator_fc</block>
                <block>gr_phase_modulator_fc</block>
                <block>gr_quadrature_demod_cf</block>
-               
+
                <block>gr_diff_phasor_cc</block>
                <block>gr_constellation_decoder_cb</block>
-               
+
                <block>gr_diff_encoder_bb</block>
                <block>gr_diff_decoder_bb</block>
-               
-               <block>gr_mpsk_receiver_cc</block>
-               <block>gr_mpsk_sync_cc</block>
-               
-               <block>blks2_wfm_tx</block>             
+
+               <block>blks2_wfm_tx</block>
                <block>blks2_wfm_rcv</block>
                <block>blks2_wfm_rcv_pll</block>
-               
+
                <block>blks2_nbfm_tx</block>
                <block>blks2_nbfm_rx</block>
-               
+
                <block>blks2_am_demod_cf</block>
                <block>blks2_fm_demod_cf</block>
                <block>blks2_fm_deemph</block>
                <block>blks2_fm_preemph</block>
-               
+
                <block>blks2_dxpsk_mod</block>
                <block>blks2_dxpsk_demod</block>
-               
+
                <block>blks2_gmsk_mod</block>
                <block>blks2_gmsk_demod</block>
-               
+
                <block>blks2_qamx_mod</block>
                <block>blks2_qamx_demod</block>
-               
+
                <block>blks2_synthesis_filterbank</block>
                <block>blks2_analysis_filterbank</block>
        </cat>
        <cat>
-               <name>Error Correction</name>   
-               
+               <name>Error Correction</name>
+
                <block>blks2_packet_decoder</block>
                <block>blks2_packet_encoder</block>
-                       
+
                <block>gr_encode_ccsds_27_bb</block>
                <block>gr_decode_ccsds_27_fb</block>
        </cat>
-       <cat>           
+       <cat>
                <name>Trellis</name>
                <block>trellis_encoder_xx</block>
                <block>trellis_metrics_x</block>
@@ -242,19 +243,19 @@
                <block>gr_throttle</block>
                <block>gr_delay</block>
                <block>gr_repeat</block>
-               
+
                <block>blks2_selector</block>
                <block>blks2_valve</block>
                <block>blks2_error_rate</block>
-               
+
                <block>gr_head</block>
-               <block>gr_skiphead</block>              
-               
-               <block>gr_kludge_copy</block>           
+               <block>gr_skiphead</block>
+
+               <block>gr_kludge_copy</block>
                <block>gr_nop</block>
-               
+
                <block>hier_block</block>
-               
+
                <block>xmlrpc_server</block>
                <block>xmlrpc_client</block>
        </cat>





reply via email to

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