2 Copyright 2008 Free Software Foundation, Inc.
3 This file is part of GNU Radio
5 GNU Radio Companion is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 GNU Radio Companion is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
21 from .. base.Platform import Platform as _Platform
22 from FlowGraph import FlowGraph as _FlowGraph
23 from Connection import Connection as _Connection
24 from Block import Block as _Block
25 from Port import Source,Sink
26 from Param import Param as _Param
27 from Generator import Generator
28 from Constants import \
29 HIER_BLOCKS_LIB_DIR, BLOCK_DTD, \
30 BLOCK_TREE, DEFAULT_FLOW_GRAPH, \
33 _critical_blocks_only = map(lambda b: os.path.join(BLOCKS_DIR, b), ['options.xml', 'usrp_probe.xml', 'usrp2_probe.xml'])
35 class Platform(_Platform):
37 def __init__(self, extra_blocks=[], critical_only=False):
39 Make a platform for gnuradio.
40 @param extra_blocks a list of block paths to load in addition to main block library
41 @param critical_only only load critical blocks (used only for usrp probe scripts to speed up load time)
44 if not os.path.exists(HIER_BLOCKS_LIB_DIR): os.mkdir(HIER_BLOCKS_LIB_DIR)
45 if critical_only: block_paths = _critical_blocks_only
46 else: block_paths = extra_blocks + [HIER_BLOCKS_LIB_DIR, BLOCKS_DIR]
47 #convert block paths to absolute paths, ensure uniqueness
48 block_paths = set(map(os.path.abspath, block_paths))
54 block_paths=block_paths,
56 block_tree=BLOCK_TREE,
57 default_flow_graph=DEFAULT_FLOW_GRAPH,
61 ##############################################
63 ##############################################
64 FlowGraph = _FlowGraph
65 Connection = _Connection