commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 01/18: grc-refactor: move grc.base to grc.p


From: git
Subject: [Commit-gnuradio] [gnuradio] 01/18: grc-refactor: move grc.base to grc.python.base
Date: Sun, 24 Apr 2016 19:19:36 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

jcorgan pushed a commit to branch master
in repository gnuradio.

commit 9f5ef34ac05de070a99fae07eb1a8087ba60a653
Author: Sebastian Koslowski <address@hidden>
Date:   Fri Nov 20 17:28:17 2015 +0100

    grc-refactor: move grc.base to grc.python.base
---
 grc/gui/ActionHandler.py             |  9 +++++---
 grc/gui/Block.py                     | 25 ++++++++++++--------
 grc/gui/Connection.py                | 16 ++++++++-----
 grc/gui/Element.py                   | 16 ++++++-------
 grc/gui/FlowGraph.py                 |  7 ++++--
 grc/gui/Param.py                     |  9 +++++---
 grc/gui/Platform.py                  | 45 ++++++++++++++++++++++++++++++++----
 grc/gui/Port.py                      | 25 ++++++++++----------
 grc/python/Block.py                  | 15 +++++-------
 grc/python/Connection.py             | 14 +++++------
 grc/python/FlowGraph.py              |  6 ++---
 grc/python/Generator.py              | 11 ++++-----
 grc/python/Param.py                  | 12 ++++------
 grc/python/Platform.py               | 32 +++++--------------------
 grc/python/Port.py                   | 15 +++++++-----
 grc/{ => python}/base/Block.py       |  0
 grc/{ => python}/base/CMakeLists.txt |  0
 grc/{ => python}/base/Connection.py  |  3 ++-
 grc/{ => python}/base/Constants.py   |  0
 grc/{ => python}/base/Element.py     |  1 +
 grc/{ => python}/base/FlowGraph.py   |  2 +-
 grc/{ => python}/base/Param.py       |  0
 grc/{ => python}/base/ParseXML.py    |  0
 grc/{ => python}/base/Platform.py    | 25 +++++++++++---------
 grc/{ => python}/base/Port.py        |  0
 grc/{ => python}/base/__init__.py    |  0
 grc/{ => python}/base/block_tree.dtd |  0
 grc/{ => python}/base/domain.dtd     |  0
 grc/{ => python}/base/flow_graph.dtd |  0
 grc/{ => python}/base/odict.py       |  0
 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 0f227d0..726784f 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 67b8069..f961c22 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 badf8e8..9a77774 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 18fb321..9385424 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 867a7cd..9cd8067 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 6884d65..ddfbdcb 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 eda28a0..fa0bcf6 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 ae1a1d2..849465f 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 f43b006..aaf65fb 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 822876a..e5b4c25 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 b2a1d27..002740a 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 56e3a6e..5d6de35 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 e60f613..b627e5e 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 5932818..e6b17fe 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 249d7ae..8466f4f 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
similarity index 100%
rename from grc/base/Block.py
rename to grc/python/base/Block.py
diff --git a/grc/base/CMakeLists.txt b/grc/python/base/CMakeLists.txt
similarity index 100%
rename from grc/base/CMakeLists.txt
rename to grc/python/base/CMakeLists.txt
diff --git a/grc/base/Connection.py b/grc/python/base/Connection.py
similarity index 99%
rename from grc/base/Connection.py
rename to grc/python/base/Connection.py
index bf3c752..8df0f5a 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
similarity index 100%
rename from grc/base/Constants.py
rename to grc/python/base/Constants.py
diff --git a/grc/base/Element.py b/grc/python/base/Element.py
similarity index 99%
rename from grc/base/Element.py
rename to grc/python/base/Element.py
index 04a3690..3b604a5 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
similarity index 99%
rename from grc/base/FlowGraph.py
rename to grc/python/base/FlowGraph.py
index 072414a..42faab6 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
similarity index 100%
rename from grc/base/Param.py
rename to grc/python/base/Param.py
diff --git a/grc/base/ParseXML.py b/grc/python/base/ParseXML.py
similarity index 100%
rename from grc/base/ParseXML.py
rename to grc/python/base/ParseXML.py
diff --git a/grc/base/Platform.py b/grc/python/base/Platform.py
similarity index 95%
rename from grc/base/Platform.py
rename to grc/python/base/Platform.py
index 0cc3fcf..367140f 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
similarity index 100%
rename from grc/base/Port.py
rename to grc/python/base/Port.py
diff --git a/grc/base/__init__.py b/grc/python/base/__init__.py
similarity index 100%
rename from grc/base/__init__.py
rename to grc/python/base/__init__.py
diff --git a/grc/base/block_tree.dtd b/grc/python/base/block_tree.dtd
similarity index 100%
rename from grc/base/block_tree.dtd
rename to grc/python/base/block_tree.dtd
diff --git a/grc/base/domain.dtd b/grc/python/base/domain.dtd
similarity index 100%
rename from grc/base/domain.dtd
rename to grc/python/base/domain.dtd
diff --git a/grc/base/flow_graph.dtd b/grc/python/base/flow_graph.dtd
similarity index 100%
rename from grc/base/flow_graph.dtd
rename to grc/python/base/flow_graph.dtd
diff --git a/grc/base/odict.py b/grc/python/base/odict.py
similarity index 100%
rename from grc/base/odict.py
rename to grc/python/base/odict.py
diff --git a/grc/scripts/gnuradio-companion b/grc/scripts/gnuradio-companion
index 203a8c7..9eee8df 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:



reply via email to

[Prev in Thread] Current Thread [Next in Thread]