summaryrefslogtreecommitdiff
path: root/grc
diff options
context:
space:
mode:
Diffstat (limited to 'grc')
-rw-r--r--grc/core/Block.py6
-rw-r--r--grc/core/CMakeLists.txt20
-rw-r--r--grc/core/Connection.py3
-rw-r--r--grc/core/FlowGraph.py11
-rw-r--r--grc/core/Param.py10
-rw-r--r--grc/core/ParseXML.py3
-rw-r--r--grc/core/Platform.py8
-rw-r--r--grc/core/generator/CMakeLists.txt34
-rw-r--r--grc/core/generator/Generator.py7
-rw-r--r--grc/core/generator/__init__.py19
-rw-r--r--grc/core/utils/CMakeLists.txt29
-rw-r--r--grc/core/utils/__init__.py26
-rw-r--r--grc/core/utils/epy_block_io.py (renamed from grc/core/epy_block_io.py)0
-rw-r--r--grc/core/utils/expr_utils.py (renamed from grc/core/expr_utils.py)0
-rw-r--r--grc/core/utils/extract_docs.py (renamed from grc/core/extract_docs.py)0
-rw-r--r--grc/core/utils/odict.py (renamed from grc/core/odict.py)0
-rw-r--r--grc/gui/Block.py2
17 files changed, 136 insertions, 42 deletions
diff --git a/grc/core/Block.py b/grc/core/Block.py
index 8af3e98456..d36fe3b049 100644
--- a/grc/core/Block.py
+++ b/grc/core/Block.py
@@ -23,17 +23,15 @@ import itertools
from Cheetah.Template import Template
from UserDict import UserDict
+from .utils import epy_block_io, odict
from . Constants import (
BLOCK_FLAG_NEED_QT_GUI, BLOCK_FLAG_NEED_WX_GUI,
ADVANCED_PARAM_TAB, DEFAULT_PARAM_TAB,
BLOCK_FLAG_THROTTLE, BLOCK_FLAG_DISABLE_BYPASS,
BLOCK_ENABLED, BLOCK_BYPASSED, BLOCK_DISABLED
)
-
-from . import epy_block_io
-from . odict import odict
-from . FlowGraph import _variable_matcher
from . Element import Element
+from . FlowGraph import _variable_matcher
class TemplateArg(UserDict):
diff --git a/grc/core/CMakeLists.txt b/grc/core/CMakeLists.txt
index 123bad2674..623d912d47 100644
--- a/grc/core/CMakeLists.txt
+++ b/grc/core/CMakeLists.txt
@@ -19,28 +19,30 @@
########################################################################
GR_PYTHON_INSTALL(FILES
- expr_utils.py
- extract_docs.py
- epy_block_io.py
Block.py
Connection.py
Constants.py
+ Element.py
FlowGraph.py
- Generator.py
+ __init__.py
+ odict.py
Param.py
+ ParseXML.py
Platform.py
Port.py
- __init__.py
- DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/python
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/core
COMPONENT "grc"
)
install(FILES
block.dtd
+ block_tree.dtd
default_flow_graph.grc
- flow_graph.tmpl
- DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/python
+ domain.dtd
+ flow_graph.dtd
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/core
COMPONENT "grc"
)
-add_subdirectory(base)
+add_subdirectory(generator)
+add_subdirectory(utils)
diff --git a/grc/core/Connection.py b/grc/core/Connection.py
index a7b428dfe6..b55ba7e4e5 100644
--- a/grc/core/Connection.py
+++ b/grc/core/Connection.py
@@ -18,9 +18,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
from . import Constants
-
from .Element import Element
-from .odict import odict
+from .utils import odict
class Connection(Element):
diff --git a/grc/core/FlowGraph.py b/grc/core/FlowGraph.py
index fd391c6b32..e7a4b10c80 100644
--- a/grc/core/FlowGraph.py
+++ b/grc/core/FlowGraph.py
@@ -15,18 +15,17 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-import re
import imp
import time
-from operator import methodcaller
from itertools import ifilter, chain
+from operator import methodcaller
-from ..gui import Messages
+import re
-from . import expr_utils
-from .odict import odict
-from .Element import Element
+from .utils import odict, expr_utils
from .Constants import FLOW_GRAPH_FILE_FORMAT_VERSION
+from .Element import Element
+from ..gui import Messages
_variable_matcher = re.compile('^(variable\w*)$')
_parameter_matcher = re.compile('^(parameter)$')
diff --git a/grc/core/Param.py b/grc/core/Param.py
index f064097256..0be30975e0 100644
--- a/grc/core/Param.py
+++ b/grc/core/Param.py
@@ -20,14 +20,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
import ast
import re
-from gnuradio import eng_notation
-from gnuradio import gr
+from gnuradio import eng_notation, gr
-import Constants
-from Constants import VECTOR_TYPES, COMPLEX_TYPES, REAL_TYPES, INT_TYPES
-
-from .odict import odict
+from . import Constants
+from .Constants import VECTOR_TYPES, COMPLEX_TYPES, REAL_TYPES, INT_TYPES
from .Element import Element
+from .utils import odict
# Blacklist certain ids, its not complete, but should help
import __builtin__
diff --git a/grc/core/ParseXML.py b/grc/core/ParseXML.py
index adf5cc97b7..987fa2a13d 100644
--- a/grc/core/ParseXML.py
+++ b/grc/core/ParseXML.py
@@ -18,7 +18,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
from lxml import etree
-from .odict import odict
+
+from .utils import odict
xml_failures = {}
diff --git a/grc/core/Platform.py b/grc/core/Platform.py
index f04dd04e90..7aa1caedd1 100644
--- a/grc/core/Platform.py
+++ b/grc/core/Platform.py
@@ -21,14 +21,14 @@ import os
import sys
from gnuradio import gr
-from . import ParseXML, extract_docs
+from . import ParseXML
from .Constants import (
BLOCK_TREE_DTD, FLOW_GRAPH_DTD, DOMAIN_DTD,
HIER_BLOCKS_LIB_DIR, BLOCK_DTD, DEFAULT_FLOW_GRAPH, BLOCKS_DIRS,
PREFS_FILE, CORE_TYPES, PREFS_FILE_OLD,
)
from .Element import Element
-from .odict import odict
+from .utils import odict, extract_docs
from ..gui import Messages
from .generator import Generator
@@ -70,7 +70,7 @@ class Platform(Element):
Element.__init__(self)
self._name = 'GNU Radio Companion'
- # Save the verion string to the first
+ # Save the version string to the first
version = (gr.version(), gr.major_version(), gr.api_version(), gr.minor_version())
self._version = version[0]
self._version_major = version[1]
@@ -88,6 +88,7 @@ class Platform(Element):
self._colors = [(name, color) for name, key, sizeof, color in CORE_TYPES]
# Create a dummy flow graph for the blocks
self._flow_graph = Element(self)
+ self._flow_graph.connections = []
self._blocks = None
self._blocks_n = None
@@ -206,6 +207,7 @@ class Platform(Element):
# print >> sys.stderr, 'Warning: Block validation failed:\n\t%s\n\tIgnoring: %s' % (e, xml_file)
pass
except Exception as e:
+ raise
print >> sys.stderr, 'Warning: XML parsing failed:\n\t%r\n\tIgnoring: %s' % (e, xml_file)
def iter_xml_files(self):
diff --git a/grc/core/generator/CMakeLists.txt b/grc/core/generator/CMakeLists.txt
new file mode 100644
index 0000000000..c129d6051c
--- /dev/null
+++ b/grc/core/generator/CMakeLists.txt
@@ -0,0 +1,34 @@
+# Copyright 2011 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio 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 3, or (at your option)
+# any later version.
+#
+# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+
+########################################################################
+GR_PYTHON_INSTALL(FILES
+ __init__.py
+ Generator.py
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/core/generator
+ COMPONENT "grc"
+)
+
+install(FILES
+ flow_graph.tmpl
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/core/generator
+ COMPONENT "grc"
+)
+
+add_subdirectory(utils)
diff --git a/grc/core/generator/Generator.py b/grc/core/generator/Generator.py
index b1fb73b821..4cb04bd4da 100644
--- a/grc/core/generator/Generator.py
+++ b/grc/core/generator/Generator.py
@@ -28,9 +28,8 @@ from distutils.spawn import find_executable
from Cheetah.Template import Template
-from .. import ParseXML, expr_utils
-from ..odict import odict
-
+from .. import ParseXML
+from ..utils import expr_utils, odict
from ..Constants import (
TOP_BLOCK_FILE_MODE, BLOCK_FLAG_NEED_QT_GUI,
XTERM_EXECUTABLE, HIER_BLOCK_FILE_MODE, HIER_BLOCKS_LIB_DIR, BLOCK_DTD
@@ -262,7 +261,7 @@ class TopBlockGenerator(object):
callbacks = [
expr_utils.expr_replace(cb, replace_dict)
for cb in sum([block.get_callbacks() for block in fg.get_enabled_blocks()], [])
- ]
+ ]
# Map var id to callbacks
var_id2cbs = dict([
(var_id, filter(lambda c: expr_utils.get_variable_dependencies(c, [var_id]), callbacks))
diff --git a/grc/core/generator/__init__.py b/grc/core/generator/__init__.py
index fb1e44120a..f44b94a85d 100644
--- a/grc/core/generator/__init__.py
+++ b/grc/core/generator/__init__.py
@@ -1 +1,18 @@
-from .Generator import Generator
+# Copyright 2008-2015 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
+
+from Generator import Generator
diff --git a/grc/core/utils/CMakeLists.txt b/grc/core/utils/CMakeLists.txt
new file mode 100644
index 0000000000..fbbfbf6499
--- /dev/null
+++ b/grc/core/utils/CMakeLists.txt
@@ -0,0 +1,29 @@
+# Copyright 2015 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio 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 3, or (at your option)
+# any later version.
+#
+# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+
+########################################################################
+GR_PYTHON_INSTALL(FILES
+ complexity.py
+ epy_block_io.py
+ expr_utils.py
+ extract_docs.py
+ __init__.py
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/core/utils
+ COMPONENT "grc"
+)
diff --git a/grc/core/utils/__init__.py b/grc/core/utils/__init__.py
index 805d6f4aec..6b23da2723 100644
--- a/grc/core/utils/__init__.py
+++ b/grc/core/utils/__init__.py
@@ -1,6 +1,22 @@
-# -*- coding: utf-8 -*-
-""""""
+# Copyright 2008-2015 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
-__author__ = "Sebastian Koslowski"
-__email__ = "sebastian.koslowski@gmail.com"
-__copyright__ = "Copyright 2015, Sebastian Koslowski"
+import expr_utils
+import epy_block_io
+import extract_docs
+
+from odict import odict
diff --git a/grc/core/epy_block_io.py b/grc/core/utils/epy_block_io.py
index e089908a01..e089908a01 100644
--- a/grc/core/epy_block_io.py
+++ b/grc/core/utils/epy_block_io.py
diff --git a/grc/core/expr_utils.py b/grc/core/utils/expr_utils.py
index 66911757d6..66911757d6 100644
--- a/grc/core/expr_utils.py
+++ b/grc/core/utils/expr_utils.py
diff --git a/grc/core/extract_docs.py b/grc/core/utils/extract_docs.py
index a6e0bc971e..a6e0bc971e 100644
--- a/grc/core/extract_docs.py
+++ b/grc/core/utils/extract_docs.py
diff --git a/grc/core/odict.py b/grc/core/utils/odict.py
index 20970e947c..20970e947c 100644
--- a/grc/core/odict.py
+++ b/grc/core/utils/odict.py
diff --git a/grc/gui/Block.py b/grc/gui/Block.py
index 9d718bc71d..95135310b8 100644
--- a/grc/gui/Block.py
+++ b/grc/gui/Block.py
@@ -30,8 +30,8 @@ from .Constants import (
BORDER_PROXIMITY_SENSITIVITY
)
from . Element import Element
-from ..core.odict import odict
from ..core.Param import num_to_str
+from ..core.utils import odict
from ..core.utils.complexity import calculate_flowgraph_complexity
from ..core.Block import Block as _Block