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
19 ##@package grc_gnuradio.Platform
20 #Gnuradio python specific platform.
24 from grc.Constants import FLOW_GRAPH_FILE_EXTENSION
25 from grc.elements.Platform import Platform as _Platform
26 from FlowGraph import FlowGraph as _FlowGraph
27 from Connection import Connection as _Connection
28 from Block import Block as _Block
29 from Port import Source,Sink
30 from Param import Param as _Param
31 from Generator import Generator
32 from Constants import *
34 class Platform(_Platform):
36 def __init__(self, block_paths_internal_only=[], block_paths_external=[]):
38 Make a platform for gnuradio.
39 The internal only list will replace the current block path.
40 @param block_paths_internal_only a list of blocks internal to this platform
41 @param block_paths_external a list of blocks to load in addition to the above blocks
44 if not os.path.exists(HIER_BLOCKS_LIB_DIR): os.mkdir(HIER_BLOCKS_LIB_DIR)
46 if block_paths_internal_only:
47 block_paths = map(lambda b: os.path.join(BLOCKS_DIR, b), ['options.xml'] + block_paths_internal_only)
48 else: block_paths = [BLOCKS_DIR]
50 block_paths.extend(block_paths_external)
52 block_paths.append(HIER_BLOCKS_LIB_DIR)
56 name='GNURadio Python',
57 key='gnuradio_python',
58 block_paths=block_paths,
60 block_tree=BLOCK_TREE,
61 default_flow_graph=DEFAULT_FLOW_GRAPH,
65 ##############################################
67 ##############################################
68 FlowGraph = _FlowGraph
69 Connection = _Connection