diff options
author | Sebastian Koslowski <koslowski@kit.edu> | 2015-11-20 17:28:17 +0100 |
---|---|---|
committer | Sebastian Koslowski <koslowski@kit.edu> | 2016-02-17 19:55:16 +0100 |
commit | 9f5ef34ac05de070a99fae07eb1a8087ba60a653 (patch) | |
tree | 44ab20b78404c94e85689b8511521e7456d58e3d | |
parent | 64f3b70cf135a8641a0271ee27b431e05a8df97b (diff) |
grc-refactor: move grc.base to grc.python.base
-rw-r--r-- | grc/gui/ActionHandler.py | 9 | ||||
-rw-r--r-- | grc/gui/Block.py | 25 | ||||
-rw-r--r-- | grc/gui/Connection.py | 16 | ||||
-rw-r--r-- | grc/gui/Element.py | 16 | ||||
-rw-r--r-- | grc/gui/FlowGraph.py | 7 | ||||
-rw-r--r-- | grc/gui/Param.py | 9 | ||||
-rw-r--r-- | grc/gui/Platform.py | 45 | ||||
-rw-r--r-- | grc/gui/Port.py | 25 | ||||
-rw-r--r-- | grc/python/Block.py | 15 | ||||
-rw-r--r-- | grc/python/Connection.py | 14 | ||||
-rw-r--r-- | grc/python/FlowGraph.py | 6 | ||||
-rw-r--r-- | grc/python/Generator.py | 11 | ||||
-rw-r--r-- | grc/python/Param.py | 12 | ||||
-rw-r--r-- | grc/python/Platform.py | 32 | ||||
-rw-r--r-- | grc/python/Port.py | 15 | ||||
-rw-r--r-- | grc/python/base/Block.py (renamed from grc/base/Block.py) | 0 | ||||
-rw-r--r-- | grc/python/base/CMakeLists.txt (renamed from grc/base/CMakeLists.txt) | 0 | ||||
-rw-r--r-- | grc/python/base/Connection.py (renamed from grc/base/Connection.py) | 3 | ||||
-rw-r--r-- | grc/python/base/Constants.py (renamed from grc/base/Constants.py) | 0 | ||||
-rw-r--r-- | grc/python/base/Element.py (renamed from grc/base/Element.py) | 1 | ||||
-rw-r--r-- | grc/python/base/FlowGraph.py (renamed from grc/base/FlowGraph.py) | 2 | ||||
-rw-r--r-- | grc/python/base/Param.py (renamed from grc/base/Param.py) | 0 | ||||
-rw-r--r-- | grc/python/base/ParseXML.py (renamed from grc/base/ParseXML.py) | 0 | ||||
-rw-r--r-- | grc/python/base/Platform.py (renamed from grc/base/Platform.py) | 25 | ||||
-rw-r--r-- | grc/python/base/Port.py (renamed from grc/base/Port.py) | 0 | ||||
-rw-r--r-- | grc/python/base/__init__.py (renamed from grc/base/__init__.py) | 0 | ||||
-rw-r--r-- | grc/python/base/block_tree.dtd (renamed from grc/base/block_tree.dtd) | 0 | ||||
-rw-r--r-- | grc/python/base/domain.dtd (renamed from grc/base/domain.dtd) | 0 | ||||
-rw-r--r-- | grc/python/base/flow_graph.dtd (renamed from grc/base/flow_graph.dtd) | 0 | ||||
-rw-r--r-- | grc/python/base/odict.py (renamed from grc/base/odict.py) | 0 | ||||
-rwxr-xr-x | grc/scripts/gnuradio-companion | 4 |
31 files changed, 162 insertions, 130 deletions
diff --git a/grc/gui/ActionHandler.py b/grc/gui/ActionHandler.py index 0f227d08f5..726784f7cf 100644 --- a/grc/gui/ActionHandler.py +++ b/grc/gui/ActionHandler.py @@ -17,16 +17,18 @@ 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 import subprocess from threading import Thread +import os import pygtk + pygtk.require('2.0') import gtk import gobject -from .. base import ParseXML, Constants +from grc.python.base import Constants +from grc.python.base import ParseXML from .. python.Constants import XTERM_EXECUTABLE from . import Dialogs, Messages, Preferences, Actions @@ -560,7 +562,8 @@ class ActionHandler: self.platform.load_blocks() self.main_window.btwin.clear() self.platform.load_block_tree(self.main_window.btwin) - Actions.XML_PARSER_ERRORS_DISPLAY.set_sensitive(bool(ParseXML.xml_failures)) + Actions.XML_PARSER_ERRORS_DISPLAY.set_sensitive(bool( + ParseXML.xml_failures)) Messages.send_xml_errors_if_any(ParseXML.xml_failures) # Force a redraw of the graph, by getting the current state and re-importing it self.main_window.update_pages() diff --git a/grc/gui/Block.py b/grc/gui/Block.py index 67b80695fa..f961c2281e 100644 --- a/grc/gui/Block.py +++ b/grc/gui/Block.py @@ -17,22 +17,26 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ -from Element import Element -import Utils +import pygtk + +import Actions import Colors -from .. base import odict -from .. python.Param import num_to_str -from Constants import BORDER_PROXIMITY_SENSITIVITY +import Utils from Constants import ( BLOCK_LABEL_PADDING, PORT_SPACING, PORT_SEPARATION, LABEL_SEPARATION, PORT_BORDER_SEPARATION, POSSIBLE_ROTATIONS, BLOCK_FONT, PARAM_FONT ) -import Actions -import pygtk +from Constants import BORDER_PROXIMITY_SENSITIVITY +from Element import Element +from grc.python.base import odict +from .. python.Param import num_to_str + pygtk.require('2.0') import gtk import pango +from ..python.Block import Block as _Block + BLOCK_MARKUP_TMPL="""\ #set $foreground = $block.is_valid() and 'black' or 'red' <span foreground="$foreground" font_desc="$font"><b>$encode($block.get_name())</b></span>""" @@ -52,15 +56,16 @@ COMMENT_COMPLEXITY_MARKUP_TMPL="""\ """ - -class Block(Element): +class Block(Element, _Block): """The graphical signal block.""" - def __init__(self): + def __init__(self, flow_graph, n): """ Block contructor. Add graphics related params to the block. """ + _Block.__init__(self, flow_graph, n) + self.W = 0 self.H = 0 #add the position param diff --git a/grc/gui/Connection.py b/grc/gui/Connection.py index badf8e8a82..9a7777434d 100644 --- a/grc/gui/Connection.py +++ b/grc/gui/Connection.py @@ -17,15 +17,18 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ -import Utils -from Element import Element +import gtk + import Colors +import Utils from Constants import CONNECTOR_ARROW_BASE, CONNECTOR_ARROW_HEIGHT -import gtk +from Element import Element + +from ..python.base.Constants import GR_MESSAGE_DOMAIN +from ..python.Connection import Connection as _Connection -from .. base.Constants import GR_MESSAGE_DOMAIN -class Connection(Element): +class Connection(Element, _Connection): """ A graphical connection for ports. The connection has 2 parts, the arrow and the wire. @@ -35,8 +38,9 @@ class Connection(Element): The arrow coloring exposes the enabled and valid states. """ - def __init__(self): + def __init__(self, **kwargs): Element.__init__(self) + _Connection.__init__(self, **kwargs) # can't use Colors.CONNECTION_ENABLED_COLOR here, might not be defined (grcc) self._bg_color = self._arrow_color = self._color = None diff --git a/grc/gui/Element.py b/grc/gui/Element.py index 18fb321929..9385424772 100644 --- a/grc/gui/Element.py +++ b/grc/gui/Element.py @@ -132,14 +132,14 @@ class Element(object): """ self.coor = coor - def get_parent(self): - """ - Get the parent of this element. - - Returns: - the parent - """ - return self.parent + # def get_parent(self): + # """ + # Get the parent of this element. + # + # Returns: + # the parent + # """ + # return self.parent def set_highlighted(self, highlighted): """ diff --git a/grc/gui/FlowGraph.py b/grc/gui/FlowGraph.py index 867a7cd2e8..9cd8067966 100644 --- a/grc/gui/FlowGraph.py +++ b/grc/gui/FlowGraph.py @@ -30,20 +30,23 @@ from . Element import Element from . Constants import SCROLL_PROXIMITY_SENSITIVITY, SCROLL_DISTANCE from . external_editor import ExternalEditor +from ..python.FlowGraph import FlowGraph as _Flowgraph -class FlowGraph(Element): + +class FlowGraph(Element, _Flowgraph): """ FlowGraph is the data structure to store graphical signal blocks, graphical inputs and outputs, and the connections between inputs and outputs. """ - def __init__(self): + def __init__(self, **kwargs): """ FlowGraph constructor. Create a list for signal blocks and connections. Connect mouse handlers. """ Element.__init__(self) + _Flowgraph.__init__(self, **kwargs) #when is the flow graph selected? (used by keyboard event handler) self.is_selected = lambda: bool(self.get_selected_elements()) #important vars dealing with mouse event tracking diff --git a/grc/gui/Param.py b/grc/gui/Param.py index 6884d6530a..ddfbdcbb1a 100644 --- a/grc/gui/Param.py +++ b/grc/gui/Param.py @@ -24,7 +24,9 @@ pygtk.require('2.0') import gtk from . import Colors, Utils, Constants, Dialogs -from . Element import Element +from .Element import Element + +from ..python.Param import Param as _Param class InputParam(gtk.HBox): @@ -378,11 +380,12 @@ Error: #end if""" -class Param(Element): +class Param(Element, _Param): """The graphical parameter.""" - def __init__(self): + def __init__(self, **kwargs): Element.__init__(self) + _Param.__init__(self, **kwargs) def get_input(self, *args, **kwargs): """ diff --git a/grc/gui/Platform.py b/grc/gui/Platform.py index eda28a0e94..fa0bcf65ea 100644 --- a/grc/gui/Platform.py +++ b/grc/gui/Platform.py @@ -17,12 +17,47 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ -from Element import Element +import os +import sys + +from .Element import Element + +from ..python.Platform import Platform as _Platform +from ..python.Constants import PREFS_FILE, PREFS_FILE_OLD + +from .Block import Block as _Block +from .FlowGraph import FlowGraph as _FlowGraph +from .Param import Param as _Param +from .Port import Port as _Port +from .Connection import Connection as _Connection -class Platform(Element): - def __init__(self, prefs_file): - Element.__init__(self) - self._prefs_file = prefs_file +class Platform(Element, _Platform): + + def __init__(self): + Element.__init__(self) + _Platform.__init__(self) + self._move_old_pref_file() + self._prefs_file = PREFS_FILE def get_prefs_file(self): return self._prefs_file + + @staticmethod + def _move_old_pref_file(): + if PREFS_FILE == PREFS_FILE_OLD: + return # prefs file overridden with env var + if os.path.exists(PREFS_FILE_OLD) and not os.path.exists(PREFS_FILE): + try: + import shutil + shutil.move(PREFS_FILE_OLD, PREFS_FILE) + except Exception as e: + print >> sys.stderr, e + + ############################################## + # Constructors + ############################################## + FlowGraph = _FlowGraph + Connection = _Connection + Block = _Block + Port = _Port + Param = _Param diff --git a/grc/gui/Port.py b/grc/gui/Port.py index ae1a1d223f..849465fc69 100644 --- a/grc/gui/Port.py +++ b/grc/gui/Port.py @@ -17,32 +17,33 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ -from Element import Element -from Constants import ( - PORT_SEPARATION, PORT_SPACING, CONNECTOR_EXTENSION_MINIMAL, - CONNECTOR_EXTENSION_INCREMENT, CANVAS_GRID_SIZE, - PORT_LABEL_PADDING, PORT_MIN_WIDTH, PORT_LABEL_HIDDEN_WIDTH, PORT_FONT -) -from .. base.Constants import DEFAULT_DOMAIN, GR_MESSAGE_DOMAIN -import Utils -import Actions -import Colors import pygtk pygtk.require('2.0') import gtk +from . import Actions, Colors, Utils +from .Constants import ( + PORT_SEPARATION, PORT_SPACING, CONNECTOR_EXTENSION_MINIMAL, + CONNECTOR_EXTENSION_INCREMENT, PORT_LABEL_PADDING, PORT_MIN_WIDTH, PORT_LABEL_HIDDEN_WIDTH, PORT_FONT +) +from .Element import Element +from ..python.base.Constants import DEFAULT_DOMAIN, GR_MESSAGE_DOMAIN + +from ..python.Port import Port as _Port + PORT_MARKUP_TMPL="""\ <span foreground="black" font_desc="$font">$encode($port.get_name())</span>""" -class Port(Element): +class Port(_Port, Element): """The graphical port.""" - def __init__(self): + def __init__(self, block, n, dir): """ Port contructor. Create list of connector coordinates. """ + _Port.__init__(self, block, n, dir) Element.__init__(self) self.W = self.H = self.w = self.h = 0 self._connector_coordinate = (0, 0) diff --git a/grc/python/Block.py b/grc/python/Block.py index f43b006e5f..aaf65fbddf 100644 --- a/grc/python/Block.py +++ b/grc/python/Block.py @@ -17,20 +17,18 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ -import itertools import collections +import itertools -from .. base.Constants import BLOCK_FLAG_NEED_QT_GUI, BLOCK_FLAG_NEED_WX_GUI -from .. base.odict import odict - -from .. base.Block import Block as _Block -from .. gui.Block import Block as _GUIBlock +from .base.Constants import BLOCK_FLAG_NEED_QT_GUI, BLOCK_FLAG_NEED_WX_GUI +from .base.odict import odict +from .base.Block import Block as _Block -from . FlowGraph import _variable_matcher from . import epy_block_io +from .FlowGraph import _variable_matcher -class Block(_Block, _GUIBlock): +class Block(_Block): def __init__(self, flow_graph, n): """ @@ -59,7 +57,6 @@ class Block(_Block, _GUIBlock): flow_graph=flow_graph, n=n, ) - _GUIBlock.__init__(self) self._epy_source_hash = -1 # for epy blocks self._epy_reload_error = None diff --git a/grc/python/Connection.py b/grc/python/Connection.py index 822876a0ae..e5b4c2563b 100644 --- a/grc/python/Connection.py +++ b/grc/python/Connection.py @@ -17,15 +17,15 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ -import Constants -from .. base.Connection import Connection as _Connection -from .. gui.Connection import Connection as _GUIConnection +from . import Constants -class Connection(_Connection, _GUIConnection): +from .base.Connection import Connection as _Connection - def __init__(self, **kwargs): - _Connection.__init__(self, **kwargs) - _GUIConnection.__init__(self) + +class Connection(_Connection): + + def __init__(self, flow_graph, porta, portb): + _Connection.__init__(self, flow_graph, porta, portb) def is_msg(self): return self.get_source().get_type() == self.get_sink().get_type() == 'msg' diff --git a/grc/python/FlowGraph.py b/grc/python/FlowGraph.py index b2a1d27859..002740ac9d 100644 --- a/grc/python/FlowGraph.py +++ b/grc/python/FlowGraph.py @@ -21,8 +21,7 @@ import imp from operator import methodcaller from . import expr_utils -from .. base.FlowGraph import FlowGraph as _FlowGraph -from .. gui.FlowGraph import FlowGraph as _GUIFlowGraph +from .base.FlowGraph import FlowGraph as _FlowGraph _variable_matcher = re.compile('^(variable\w*)$') _parameter_matcher = re.compile('^(parameter)$') @@ -33,12 +32,11 @@ _bus_struct_sink_searcher = re.compile('^(bus_structure_sink)$') _bus_struct_src_searcher = re.compile('^(bus_structure_source)$') -class FlowGraph(_FlowGraph, _GUIFlowGraph): +class FlowGraph(_FlowGraph): def __init__(self, **kwargs): self.grc_file_path = '' _FlowGraph.__init__(self, **kwargs) - _GUIFlowGraph.__init__(self) self.n = {} self.n_hash = -1 self._renew_eval_ns = True diff --git a/grc/python/Generator.py b/grc/python/Generator.py index 56e3a6e78f..5d6de35077 100644 --- a/grc/python/Generator.py +++ b/grc/python/Generator.py @@ -27,15 +27,14 @@ import re # for shlex_quote from distutils.spawn import find_executable from Cheetah.Template import Template +from .base import odict +from .base.Constants import BLOCK_FLAG_NEED_QT_GUI -from .. gui import Messages -from .. base import ParseXML -from .. base import odict -from .. base.Constants import BLOCK_FLAG_NEED_QT_GUI - +from .base import ParseXML +from . import expr_utils from . Constants import TOP_BLOCK_FILE_MODE, FLOW_GRAPH_TEMPLATE, \ XTERM_EXECUTABLE, HIER_BLOCK_FILE_MODE, HIER_BLOCKS_LIB_DIR, BLOCK_DTD -from . import expr_utils +from .. gui import Messages class Generator(object): diff --git a/grc/python/Param.py b/grc/python/Param.py index e60f613f00..b627e5eec8 100644 --- a/grc/python/Param.py +++ b/grc/python/Param.py @@ -18,17 +18,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ import ast -import re +import re +from gnuradio import eng_notation from gnuradio import gr -from .. base.Param import Param as _Param -from .. gui.Param import Param as _GUIParam - import Constants from Constants import VECTOR_TYPES, COMPLEX_TYPES, REAL_TYPES, INT_TYPES - -from gnuradio import eng_notation +from .base.Param import Param as _Param _check_id_matcher = re.compile('^[a-z|A-Z]\w*$') _show_id_matcher = re.compile('^(variable\w*|parameter|options|notebook|epy_module)$') @@ -52,11 +49,10 @@ def num_to_str(num): else: return str(num) -class Param(_Param, _GUIParam): +class Param(_Param): def __init__(self, **kwargs): _Param.__init__(self, **kwargs) - _GUIParam.__init__(self) self._init = False self._hostage_cells = list() diff --git a/grc/python/Platform.py b/grc/python/Platform.py index 5932818c1e..e6b17fe3f7 100644 --- a/grc/python/Platform.py +++ b/grc/python/Platform.py @@ -19,27 +19,20 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA import os import sys - from gnuradio import gr -from .. base.Platform import Platform as _Platform -from .. gui.Platform import Platform as _GUIPlatform -from .. gui import Messages +from .base.Platform import Platform as _Platform from . import extract_docs -from .FlowGraph import FlowGraph as _FlowGraph -from .Connection import Connection as _Connection -from .Block import Block as _Block -from .Port import Port as _Port -from .Param import Param as _Param -from .Generator import Generator from .Constants import ( HIER_BLOCKS_LIB_DIR, BLOCK_DTD, DEFAULT_FLOW_GRAPH, BLOCKS_DIRS, - PREFS_FILE, PREFS_FILE_OLD, CORE_TYPES + PREFS_FILE, CORE_TYPES, PREFS_FILE_OLD, ) +from .Generator import Generator +from .. gui import Messages -class Platform(_Platform, _GUIPlatform): +class Platform(_Platform): def __init__(self): """ Make a platform for gnuradio. @@ -72,11 +65,7 @@ class Platform(_Platform, _GUIPlatform): generator=Generator, colors=[(name, color) for name, key, sizeof, color in CORE_TYPES], ) - self._move_old_pref_file() - _GUIPlatform.__init__( - self, - prefs_file=PREFS_FILE - ) + self._auto_hier_block_generate_chain = set() def _save_docstring_extraction_result(self, key, docstrings): @@ -164,12 +153,3 @@ class Platform(_Platform, _GUIPlatform): self.load_block_xml(generator.get_file_path_xml()) return True - - ############################################## - # Constructors - ############################################## - FlowGraph = _FlowGraph - Connection = _Connection - Block = _Block - Port = _Port - Param = _Param diff --git a/grc/python/Port.py b/grc/python/Port.py index 249d7aed71..8466f4f97c 100644 --- a/grc/python/Port.py +++ b/grc/python/Port.py @@ -17,10 +17,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ -from .. base.Port import Port as _Port -from .. base.Constants import DEFAULT_DOMAIN, GR_MESSAGE_DOMAIN -from .. gui.Port import Port as _GUIPort -import Constants +from .base.Constants import DEFAULT_DOMAIN, GR_MESSAGE_DOMAIN +from .base.Port import Port as _Port + +from . import Constants def _get_source_from_virtual_sink_port(vsp): @@ -32,6 +32,7 @@ def _get_source_from_virtual_sink_port(vsp): vsp.get_enabled_connections()[0].get_source()) except: raise Exception, 'Could not resolve source for virtual sink port %s'%vsp + def _get_source_from_virtual_source_port(vsp, traversed=[]): """ Recursively resolve source ports over the virtual connections. @@ -52,6 +53,7 @@ def _get_source_from_virtual_source_port(vsp, traversed=[]): ) except: raise Exception, 'Could not resolve source for virtual source port %s'%vsp + def _get_sink_from_virtual_source_port(vsp): """ Resolve the sink port that is connected to the given virtual source port. @@ -61,6 +63,7 @@ def _get_sink_from_virtual_source_port(vsp): vsp.get_enabled_connections()[0].get_sink()) # Could have many connections, but use first except: raise Exception, 'Could not resolve source for virtual source port %s'%vsp + def _get_sink_from_virtual_sink_port(vsp, traversed=[]): """ Recursively resolve sink ports over the virtual connections. @@ -81,7 +84,8 @@ def _get_sink_from_virtual_sink_port(vsp, traversed=[]): ) except: raise Exception, 'Could not resolve source for virtual sink port %s'%vsp -class Port(_Port, _GUIPort): + +class Port(_Port): def __init__(self, block, n, dir): """ @@ -111,7 +115,6 @@ class Port(_Port, _GUIPort): n=n, dir=dir, ) - _GUIPort.__init__(self) self._nports = n.find('nports') or '' self._vlen = n.find('vlen') or '' self._optional = bool(n.find('optional')) diff --git a/grc/base/Block.py b/grc/python/base/Block.py index 77c3145173..77c3145173 100644 --- a/grc/base/Block.py +++ b/grc/python/base/Block.py diff --git a/grc/base/CMakeLists.txt b/grc/python/base/CMakeLists.txt index bdc8a5006f..bdc8a5006f 100644 --- a/grc/base/CMakeLists.txt +++ b/grc/python/base/CMakeLists.txt diff --git a/grc/base/Connection.py b/grc/python/base/Connection.py index bf3c75277c..8df0f5ad53 100644 --- a/grc/base/Connection.py +++ b/grc/python/base/Connection.py @@ -17,9 +17,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ -from Element import Element +from .Element import Element from . import odict + class Connection(Element): def __init__(self, flow_graph, porta, portb): diff --git a/grc/base/Constants.py b/grc/python/base/Constants.py index 1e83de63b5..1e83de63b5 100644 --- a/grc/base/Constants.py +++ b/grc/python/base/Constants.py diff --git a/grc/base/Element.py b/grc/python/base/Element.py index 04a3690282..3b604a5340 100644 --- a/grc/base/Element.py +++ b/grc/python/base/Element.py @@ -17,6 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ + class Element(object): def __init__(self, parent=None): diff --git a/grc/base/FlowGraph.py b/grc/python/base/FlowGraph.py index 072414aa90..42faab6a16 100644 --- a/grc/base/FlowGraph.py +++ b/grc/python/base/FlowGraph.py @@ -21,7 +21,7 @@ import time from operator import methodcaller from itertools import ifilter -from .. gui import Messages +from grc.gui import Messages from . import odict from .Element import Element diff --git a/grc/base/Param.py b/grc/python/base/Param.py index b246d9f759..b246d9f759 100644 --- a/grc/base/Param.py +++ b/grc/python/base/Param.py diff --git a/grc/base/ParseXML.py b/grc/python/base/ParseXML.py index 2d5fed0862..2d5fed0862 100644 --- a/grc/base/ParseXML.py +++ b/grc/python/base/ParseXML.py diff --git a/grc/base/Platform.py b/grc/python/base/Platform.py index 0cc3fcf1dd..367140f8ae 100644 --- a/grc/base/Platform.py +++ b/grc/python/base/Platform.py @@ -17,16 +17,18 @@ 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 import sys -from .. base import ParseXML, odict -from Element import Element as _Element -from FlowGraph import FlowGraph as _FlowGraph -from Connection import Connection as _Connection -from Block import Block as _Block -from Port import Port as _Port -from Param import Param as _Param -from Constants import BLOCK_TREE_DTD, FLOW_GRAPH_DTD, DOMAIN_DTD + +import os + +from .Block import Block as _Block +from .Connection import Connection as _Connection +from .Constants import BLOCK_TREE_DTD, FLOW_GRAPH_DTD, DOMAIN_DTD +from .Element import Element as _Element +from .FlowGraph import FlowGraph as _FlowGraph +from .Param import Param as _Param +from .Port import Port as _Port +from . import ParseXML, odict class Platform(_Element): @@ -100,7 +102,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: - print >> sys.stderr, 'Warning: XML parsing failed:\n\t%s\n\tIgnoring: %s' % (e, xml_file) + print >> sys.stderr, 'Warning: XML parsing failed:\n\t%r\n\tIgnoring: %s' % (e, xml_file) def iter_xml_files(self): """Iterator for block descriptions and category trees""" @@ -242,7 +244,8 @@ class Platform(_Element): def get_block_keys(self): return self._blocks.keys() def get_block(self, key): return self._blocks[key] def get_blocks(self): return self._blocks.values() - def get_new_block(self, flow_graph, key): return self.Block(flow_graph, n=self._blocks_n[key]) + def get_new_block(self, flow_graph, key): + return self.Block(flow_graph, n=self._blocks_n[key]) def get_domains(self): return self._domains def get_domain(self, key): return self._domains.get(key) diff --git a/grc/base/Port.py b/grc/python/base/Port.py index 39166d18f7..39166d18f7 100644 --- a/grc/base/Port.py +++ b/grc/python/base/Port.py diff --git a/grc/base/__init__.py b/grc/python/base/__init__.py index 2682db8125..2682db8125 100644 --- a/grc/base/__init__.py +++ b/grc/python/base/__init__.py diff --git a/grc/base/block_tree.dtd b/grc/python/base/block_tree.dtd index 9e23576477..9e23576477 100644 --- a/grc/base/block_tree.dtd +++ b/grc/python/base/block_tree.dtd diff --git a/grc/base/domain.dtd b/grc/python/base/domain.dtd index b5b0b8bf39..b5b0b8bf39 100644 --- a/grc/base/domain.dtd +++ b/grc/python/base/domain.dtd diff --git a/grc/base/flow_graph.dtd b/grc/python/base/flow_graph.dtd index bdfe1dc059..bdfe1dc059 100644 --- a/grc/base/flow_graph.dtd +++ b/grc/python/base/flow_graph.dtd diff --git a/grc/base/odict.py b/grc/python/base/odict.py index 70ab67d053..70ab67d053 100644 --- a/grc/base/odict.py +++ b/grc/python/base/odict.py diff --git a/grc/scripts/gnuradio-companion b/grc/scripts/gnuradio-companion index 203a8c773d..9eee8df7dd 100755 --- a/grc/scripts/gnuradio-companion +++ b/grc/scripts/gnuradio-companion @@ -108,13 +108,13 @@ def main(): source_tree_root = get_source_tree_root() if not source_tree_root: # run the installed version - from gnuradio.grc.python.Platform import Platform + from gnuradio.grc.gui.Platform import Platform from gnuradio.grc.gui.ActionHandler import ActionHandler else: print("Running from source tree") sys.path.insert(1, source_tree_root) - from grc.python.Platform import Platform + from grc.gui.Platform import Platform from grc.gui.ActionHandler import ActionHandler try: |