diff options
author | jblum | 2008-09-07 21:38:12 +0000 |
---|---|---|
committer | jblum | 2008-09-07 21:38:12 +0000 |
commit | c86f6c23c6883f73d953d64c28ab42cedb77e4d7 (patch) | |
tree | 0193b2a649eb0f7f1065912862de340a02848e16 /grc/src/platforms/python/Platform.py | |
parent | ddec4fc07744a6519086b1b111f29d551b7f19c6 (diff) | |
download | gnuradio-c86f6c23c6883f73d953d64c28ab42cedb77e4d7.tar.gz gnuradio-c86f6c23c6883f73d953d64c28ab42cedb77e4d7.tar.bz2 gnuradio-c86f6c23c6883f73d953d64c28ab42cedb77e4d7.zip |
Merged r9481:9518 on jblum/grc_reorganize into trunk. Reorganized grc source under gnuradio.grc module. Trunk passes make distcheck.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9525 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'grc/src/platforms/python/Platform.py')
-rw-r--r-- | grc/src/platforms/python/Platform.py | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/grc/src/platforms/python/Platform.py b/grc/src/platforms/python/Platform.py new file mode 100644 index 000000000..c31701e0e --- /dev/null +++ b/grc/src/platforms/python/Platform.py @@ -0,0 +1,73 @@ +""" +Copyright 2008 Free Software Foundation, Inc. +This file is part of GNU Radio + +GNU Radio Companion 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 2 +of the License, or (at your option) any later version. + +GNU Radio Companion 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 this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +""" + +import os +from .. base.Constants import FLOW_GRAPH_FILE_EXTENSION +from .. base.Platform import Platform as _Platform +from FlowGraph import FlowGraph as _FlowGraph +from Connection import Connection as _Connection +from Block import Block as _Block +from Port import Source,Sink +from Param import Param as _Param +from Generator import Generator +from Constants import \ + HIER_BLOCKS_LIB_DIR, BLOCK_DTD, \ + BLOCK_TREE, DEFAULT_FLOW_GRAPH, \ + BLOCKS_DIR + +class Platform(_Platform): + + def __init__(self, block_paths_internal_only=[], block_paths_external=[]): + """ + 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 + """ + #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) + #init + _Platform.__init__( + self, + name='GNURadio Python', + key='gnuradio_python', + block_paths=block_paths, + block_dtd=BLOCK_DTD, + block_tree=BLOCK_TREE, + default_flow_graph=DEFAULT_FLOW_GRAPH, + generator=Generator, + ) + + ############################################## + # Constructors + ############################################## + FlowGraph = _FlowGraph + Connection = _Connection + Block = _Block + Source = Source + Sink = Sink + Param = _Param |