commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r11163 - in gnuradio/trunk/grc: scripts src/platforms/


From: jblum
Subject: [Commit-gnuradio] r11163 - in gnuradio/trunk/grc: scripts src/platforms/base src/platforms/python
Date: Fri, 29 May 2009 00:43:36 -0600 (MDT)

Author: jblum
Date: 2009-05-29 00:43:35 -0600 (Fri, 29 May 2009)
New Revision: 11163

Modified:
   gnuradio/trunk/grc/scripts/grc
   gnuradio/trunk/grc/scripts/usrp2_probe
   gnuradio/trunk/grc/scripts/usrp_probe
   gnuradio/trunk/grc/src/platforms/base/Platform.py
   gnuradio/trunk/grc/src/platforms/python/Platform.py
Log:
Did a little work with path handling.
Additional blocks paths can be specified with environment variable 
GRC_BLOCKS_PATH



Modified: gnuradio/trunk/grc/scripts/grc
===================================================================
--- gnuradio/trunk/grc/scripts/grc      2009-05-29 00:25:16 UTC (rev 11162)
+++ gnuradio/trunk/grc/scripts/grc      2009-05-29 06:43:35 UTC (rev 11163)
@@ -18,6 +18,8 @@
 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 """
 
+import os
+
 import pygtk
 pygtk.require('2.0')
 import gtk
@@ -50,5 +52,8 @@
        #setup icon using icon theme
        try: 
gtk.window_set_default_icon(gtk.IconTheme().load_icon('gnuradio-grc', 256, 0))
        except: pass
-       ActionHandler(args, Platform())
+       #extract extra block paths from environment variable, separated by 
semicolon
+       try: extra_blocks = os.environ['GRC_BLOCKS_PATH'].split(';')
+       except: extra_blocks = list()
+       ActionHandler(args, Platform(extra_blocks=extra_blocks))
 

Modified: gnuradio/trunk/grc/scripts/usrp2_probe
===================================================================
--- gnuradio/trunk/grc/scripts/usrp2_probe      2009-05-29 00:25:16 UTC (rev 
11162)
+++ gnuradio/trunk/grc/scripts/usrp2_probe      2009-05-29 06:43:35 UTC (rev 
11163)
@@ -30,7 +30,7 @@
 from gnuradio.grc.gui.Dialogs import TextDisplay
 
 from gnuradio.grc.platforms.python.Platform import Platform
-platform = Platform(block_paths_internal_only=['usrp2_probe.xml'])
+platform = Platform(critical_only=True)
 
 from gnuradio.grc.platforms.gui.Platform import Platform
 platform = Platform(platform)

Modified: gnuradio/trunk/grc/scripts/usrp_probe
===================================================================
--- gnuradio/trunk/grc/scripts/usrp_probe       2009-05-29 00:25:16 UTC (rev 
11162)
+++ gnuradio/trunk/grc/scripts/usrp_probe       2009-05-29 06:43:35 UTC (rev 
11163)
@@ -28,7 +28,7 @@
 from gnuradio.grc.gui.Dialogs import TextDisplay
 
 from gnuradio.grc.platforms.python.Platform import Platform
-platform = Platform(block_paths_internal_only=['usrp_probe.xml'])
+platform = Platform(critical_only=True)
 
 from gnuradio.grc.platforms.gui.Platform import Platform
 platform = Platform(platform)

Modified: gnuradio/trunk/grc/src/platforms/base/Platform.py
===================================================================
--- gnuradio/trunk/grc/src/platforms/base/Platform.py   2009-05-29 00:25:16 UTC 
(rev 11162)
+++ gnuradio/trunk/grc/src/platforms/base/Platform.py   2009-05-29 06:43:35 UTC 
(rev 11163)
@@ -61,8 +61,6 @@
                                        for filename in filter(lambda f: 
f.endswith('.xml'), filenames):
                                                
self._load_blocks(os.path.join(dirpath, filename))
 
-       def get_prefs_block(self): return 
self.get_new_flow_graph().get_new_block('preferences')
-
        def _load_blocks(self, f):
                """
                Load the block wrappers from the file path.

Modified: gnuradio/trunk/grc/src/platforms/python/Platform.py
===================================================================
--- gnuradio/trunk/grc/src/platforms/python/Platform.py 2009-05-29 00:25:16 UTC 
(rev 11162)
+++ gnuradio/trunk/grc/src/platforms/python/Platform.py 2009-05-29 06:43:35 UTC 
(rev 11163)
@@ -30,25 +30,22 @@
        BLOCK_TREE, DEFAULT_FLOW_GRAPH, \
        BLOCKS_DIR
 
+_critical_blocks_only = map(lambda b: os.path.join(BLOCKS_DIR, b), 
['options.xml', 'usrp_probe.xml', 'usrp2_probe.xml'])
+
 class Platform(_Platform):
 
-       def __init__(self, block_paths_internal_only=[], 
block_paths_external=[]):
+       def __init__(self, extra_blocks=[], critical_only=False):
                """
                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
+               @param extra_blocks a list of block paths to load in addition 
to main block library
+               @param critical_only only load critical blocks (used only for 
usrp probe scripts to speed up load time)
                """
                #ensure hier dir
                if not os.path.exists(HIER_BLOCKS_LIB_DIR): 
os.mkdir(HIER_BLOCKS_LIB_DIR)
-               #handle internal/only
-               if block_paths_internal_only:
-                       block_paths = map(lambda b: os.path.join(BLOCKS_DIR, 
b), ['options.xml'] + block_paths_internal_only)
-               else: block_paths = [BLOCKS_DIR]
-               #handle external
-               block_paths.extend(block_paths_external)
-               #append custom hiers
-               block_paths.append(HIER_BLOCKS_LIB_DIR)
+               if critical_only: block_paths = _critical_blocks_only
+               else: block_paths = extra_blocks + [HIER_BLOCKS_LIB_DIR, 
BLOCKS_DIR]
+               #convert block paths to absolute paths, ensure uniqueness
+               block_paths = set(map(os.path.abspath, block_paths))
                #init
                _Platform.__init__(
                        self,





reply via email to

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