00001 """
00002 Copyright 2008 Free Software Foundation, Inc.
00003 This file is part of GNU Radio
00004
00005 GNU Radio Companion is free software; you can redistribute it and/or
00006 modify it under the terms of the GNU General Public License
00007 as published by the Free Software Foundation; either version 2
00008 of the License, or (at your option) any later version.
00009
00010 GNU Radio Companion is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013 GNU General Public License for more details.
00014
00015 You should have received a copy of the GNU General Public License
00016 along with this program; if not, write to the Free Software
00017 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
00018 """
00019
00020
00021
00022
00023 import os
00024 from grc.Constants import FLOW_GRAPH_FILE_EXTENSION
00025 from grc.elements.Platform import Platform as _Platform
00026 from FlowGraph import FlowGraph as _FlowGraph
00027 from Connection import Connection as _Connection
00028 from Block import Block as _Block
00029 from Port import Source,Sink
00030 from Param import Param as _Param
00031 from Generator import Generator
00032 from Constants import *
00033
00034 class Platform(_Platform):
00035
00036 def __init__(self, block_paths_internal_only=[], block_paths_external=[]):
00037 """!
00038 Make a platform for gnuradio.
00039 The internal only list will replace the current block path.
00040 @param block_paths_internal_only a list of blocks internal to this platform
00041 @param block_paths_external a list of blocks to load in addition to the above blocks
00042 """
00043
00044 if not os.path.exists(HIER_BLOCKS_LIB_PATH): os.mkdir(HIER_BLOCKS_LIB_PATH)
00045
00046 if block_paths_internal_only:
00047 block_paths = map(lambda b: os.path.join(BLOCK_PATH, b), ['options.xml'] + block_paths_internal_only)
00048 else: block_paths = [BLOCK_PATH]
00049
00050 block_paths.extend(block_paths_external)
00051
00052 block_paths.append(HIER_BLOCKS_LIB_PATH)
00053
00054 _Platform.__init__(
00055 self,
00056 name='GNURadio Python',
00057 key='gnuradio_python',
00058 block_paths=block_paths,
00059 block_dtd=BLOCK_DTD,
00060 block_tree=BLOCK_TREE,
00061 default_flow_graph=DEFAULT_FLOW_GRAPH,
00062 generator=Generator,
00063 )
00064
00065
00066
00067
00068 FlowGraph = _FlowGraph
00069 Connection = _Connection
00070 Block = _Block
00071 Source = Source
00072 Sink = Sink
00073 Param = _Param
00074