commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r9495 - in gnuradio/branches/developers/jblum/grc_reor


From: jblum
Subject: [Commit-gnuradio] r9495 - in gnuradio/branches/developers/jblum/grc_reorganize: config grc grc/data grc/data/platforms grc/data/platforms/base grc/data/platforms/python grc/data/platforms/python/blocks grc/scripts grc/src grc/src/grc_gnuradio grc/src/grc_gnuradio/blks2 grc/src/grc_gnuradio/usrp grc/src/grc_gnuradio/wxgui grc/src/gui grc/src/platforms grc/src/platforms/base grc/src/platforms/gui grc/src/platforms/python grc/src/platforms/python/utils grc/src/utils
Date: Wed, 3 Sep 2008 23:05:00 -0600 (MDT)

Author: jblum
Date: 2008-09-03 23:04:58 -0600 (Wed, 03 Sep 2008)
New Revision: 9495

Added:
   gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Constants.py
   
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/base/Constants.py.in
   gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/
   gnuradio/branches/developers/jblum/grc_reorganize/grc/src/utils/ParseXML.py
   gnuradio/branches/developers/jblum/grc_reorganize/grc/src/utils/converter.py
Removed:
   gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Constants.py.in
   gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/ParseXML.py
   gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Utils.py
   gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/converter.py
   gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/elements/
   
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/blks2/
   
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/usrp/
   
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/wxgui/
Modified:
   gnuradio/branches/developers/jblum/grc_reorganize/config/grc_grc.m4
   gnuradio/branches/developers/jblum/grc_reorganize/grc/Makefile.inc
   gnuradio/branches/developers/jblum/grc_reorganize/grc/data/Makefile.am
   
gnuradio/branches/developers/jblum/grc_reorganize/grc/data/platforms/Makefile.am
   
gnuradio/branches/developers/jblum/grc_reorganize/grc/data/platforms/base/Makefile.am
   
gnuradio/branches/developers/jblum/grc_reorganize/grc/data/platforms/python/Makefile.am
   
gnuradio/branches/developers/jblum/grc_reorganize/grc/data/platforms/python/blocks/Makefile.am
   gnuradio/branches/developers/jblum/grc_reorganize/grc/scripts/Makefile.am
   gnuradio/branches/developers/jblum/grc_reorganize/grc/src/Makefile.am
   gnuradio/branches/developers/jblum/grc_reorganize/grc/src/__init__.py
   
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/grc_gnuradio/Makefile.am
   
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/grc_gnuradio/__init__.py
   
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/grc_gnuradio/blks2/Makefile.am
   
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/grc_gnuradio/usrp/Makefile.am
   
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/grc_gnuradio/wxgui/Makefile.am
   gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Makefile.am
   gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/__init__.py
   
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/Makefile.am
   
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/__init__.py
   
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/base/Makefile.am
   
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/base/__init__.py
   
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Makefile.am
   
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/__init__.py
   
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/Makefile.am
   
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/__init__.py
   
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/utils/Makefile.am
   
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/utils/__init__.py
   gnuradio/branches/developers/jblum/grc_reorganize/grc/src/utils/Makefile.am
   gnuradio/branches/developers/jblum/grc_reorganize/grc/src/utils/__init__.py
Log:
Makefile.ams and __init__.pys

Modified: gnuradio/branches/developers/jblum/grc_reorganize/config/grc_grc.m4
===================================================================
--- gnuradio/branches/developers/jblum/grc_reorganize/config/grc_grc.m4 
2008-09-03 23:10:15 UTC (rev 9494)
+++ gnuradio/branches/developers/jblum/grc_reorganize/config/grc_grc.m4 
2008-09-04 05:04:58 UTC (rev 9495)
@@ -52,27 +52,30 @@
     AC_SUBST(PYTHONW)
 
     AC_CONFIG_FILES([ \
-        grc/Makefile \
-        grc/data/Makefile \
-        grc/data/grc/Makefile \
-        grc/data/grc_gnuradio/Makefile \
-        grc/data/grc_gnuradio/blocks/Makefile \
-        grc/src/Makefile \
-        grc/src/grc/Makefile \
-        grc/src/grc/gui/Makefile \
-        grc/src/grc/gui/elements/Makefile \
-        grc/src/grc/elements/Makefile \
         grc/src/grc_gnuradio/Makefile \
+        grc/src/grc_gnuradio/wxgui/Makefile \
         grc/src/grc_gnuradio/blks2/Makefile \
         grc/src/grc_gnuradio/usrp/Makefile \
-        grc/src/grc_gnuradio/utils/Makefile \
-        grc/src/grc_gnuradio/wxgui/Makefile \
-        grc/scripts/Makefile \
+        grc/src/Makefile \
+        grc/src/platforms/Makefile \
+        grc/src/platforms/base/Makefile \
+        grc/src/platforms/python/Makefile \
+        grc/src/platforms/python/utils/Makefile \
+        grc/src/platforms/gui/Makefile \
+        grc/src/utils/Makefile \
+        grc/src/gui/Makefile \
         grc/examples/Makefile \
+        grc/examples/xmlrpc/Makefile \
+        grc/examples/usrp/Makefile \
         grc/examples/audio/Makefile \
         grc/examples/simple/Makefile \
-        grc/examples/usrp/Makefile \
-        grc/examples/xmlrpc/Makefile \
+        grc/Makefile \
+        grc/data/Makefile \
+        grc/data/platforms/Makefile \
+        grc/data/platforms/base/Makefile \
+        grc/data/platforms/python/Makefile \
+        grc/data/platforms/python/blocks/Makefile \
+        grc/scripts/Makefile \
     ])
 
     GRC_BUILD_CONDITIONAL(grc)

Modified: gnuradio/branches/developers/jblum/grc_reorganize/grc/Makefile.inc
===================================================================
--- gnuradio/branches/developers/jblum/grc_reorganize/grc/Makefile.inc  
2008-09-03 23:10:15 UTC (rev 9494)
+++ gnuradio/branches/developers/jblum/grc_reorganize/grc/Makefile.inc  
2008-09-04 05:04:58 UTC (rev 9495)
@@ -20,7 +20,7 @@
 #
 
 include $(top_srcdir)/Makefile.common
-
+grc_gnuradio_prefix = $(pythondir)/grc_gnuradio
 grc_src_prefix = $(pythondir)/gnuradio/grc
 grc_data_prefix = @datadir@/${PACKAGE}/grc
 grc_examples_prefix = @datadir@/${PACKAGE}/examples/grc

Modified: gnuradio/branches/developers/jblum/grc_reorganize/grc/data/Makefile.am
===================================================================
--- gnuradio/branches/developers/jblum/grc_reorganize/grc/data/Makefile.am      
2008-09-03 23:10:15 UTC (rev 9494)
+++ gnuradio/branches/developers/jblum/grc_reorganize/grc/data/Makefile.am      
2008-09-04 05:04:58 UTC (rev 9495)
@@ -21,4 +21,4 @@
 
 include $(top_srcdir)/grc/Makefile.inc
 
-SUBDIRS = grc grc_gnuradio
+SUBDIRS = platforms

Modified: 
gnuradio/branches/developers/jblum/grc_reorganize/grc/data/platforms/Makefile.am
===================================================================
--- 
gnuradio/branches/developers/jblum/grc_reorganize/grc/data/platforms/Makefile.am
    2008-09-03 23:10:15 UTC (rev 9494)
+++ 
gnuradio/branches/developers/jblum/grc_reorganize/grc/data/platforms/Makefile.am
    2008-09-04 05:04:58 UTC (rev 9495)
@@ -21,4 +21,4 @@
 
 include $(top_srcdir)/grc/Makefile.inc
 
-SUBDIRS = grc grc_gnuradio
+SUBDIRS = base python

Modified: 
gnuradio/branches/developers/jblum/grc_reorganize/grc/data/platforms/base/Makefile.am
===================================================================
--- 
gnuradio/branches/developers/jblum/grc_reorganize/grc/data/platforms/base/Makefile.am
       2008-09-03 23:10:15 UTC (rev 9494)
+++ 
gnuradio/branches/developers/jblum/grc_reorganize/grc/data/platforms/base/Makefile.am
       2008-09-04 05:04:58 UTC (rev 9495)
@@ -21,7 +21,7 @@
 
 include $(top_srcdir)/grc/Makefile.inc
 
-ourdatadir = $(grc_data_dir)
+ourdatadir = $(grc_base_data_dir)
 
 DATA_FILES = \
        block_tree.dtd \

Modified: 
gnuradio/branches/developers/jblum/grc_reorganize/grc/data/platforms/python/Makefile.am
===================================================================
--- 
gnuradio/branches/developers/jblum/grc_reorganize/grc/data/platforms/python/Makefile.am
     2008-09-03 23:10:15 UTC (rev 9494)
+++ 
gnuradio/branches/developers/jblum/grc_reorganize/grc/data/platforms/python/Makefile.am
     2008-09-04 05:04:58 UTC (rev 9495)
@@ -23,7 +23,7 @@
 
 SUBDIRS = blocks
 
-ourdatadir = $(grc_gnuradio_data_dir)
+ourdatadir = $(grc_python_data_dir)
 
 DATA_FILES = \
        block.dtd \

Modified: 
gnuradio/branches/developers/jblum/grc_reorganize/grc/data/platforms/python/blocks/Makefile.am
===================================================================
--- 
gnuradio/branches/developers/jblum/grc_reorganize/grc/data/platforms/python/blocks/Makefile.am
      2008-09-03 23:10:15 UTC (rev 9494)
+++ 
gnuradio/branches/developers/jblum/grc_reorganize/grc/data/platforms/python/blocks/Makefile.am
      2008-09-04 05:04:58 UTC (rev 9495)
@@ -21,7 +21,7 @@
 
 include $(top_srcdir)/grc/Makefile.inc
 
-ourdatadir = $(grc_gnuradio_blocks_dir)
+ourdatadir = $(grc_python_blocks_dir)
 
 DATA_FILES = \
        audio_sink.xml \

Modified: 
gnuradio/branches/developers/jblum/grc_reorganize/grc/scripts/Makefile.am
===================================================================
--- gnuradio/branches/developers/jblum/grc_reorganize/grc/scripts/Makefile.am   
2008-09-03 23:10:15 UTC (rev 9494)
+++ gnuradio/branches/developers/jblum/grc_reorganize/grc/scripts/Makefile.am   
2008-09-04 05:04:58 UTC (rev 9495)
@@ -19,7 +19,7 @@
 # Boston, MA 02110-1301, USA.
 # 
 
-include $(top_srcdir)/Makefile.common
+include $(top_srcdir)/grc/Makefile.inc
 
 EXTRA_DIST = $(bin_SCRIPTS)
 

Modified: gnuradio/branches/developers/jblum/grc_reorganize/grc/src/Makefile.am
===================================================================
--- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/Makefile.am       
2008-09-03 23:10:15 UTC (rev 9494)
+++ gnuradio/branches/developers/jblum/grc_reorganize/grc/src/Makefile.am       
2008-09-04 05:04:58 UTC (rev 9495)
@@ -19,6 +19,14 @@
 # Boston, MA 02110-1301, USA.
 # 
 
-include $(top_srcdir)/Makefile.common
+include $(top_srcdir)/grc/Makefile.inc
 
-SUBDIRS = grc grc_gnuradio
+SUBDIRS = \
+       platforms \
+       grc_gnuradio \
+       gui \
+       utils
+
+ourpythondir = $(grc_src_prefix)
+
+ourpython_PYTHON = __init__.py

Modified: gnuradio/branches/developers/jblum/grc_reorganize/grc/src/__init__.py
===================================================================
--- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/__init__.py       
2008-09-03 23:10:15 UTC (rev 9494)
+++ gnuradio/branches/developers/jblum/grc_reorganize/grc/src/__init__.py       
2008-09-04 05:04:58 UTC (rev 9495)
@@ -0,0 +1 @@
+

Modified: 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/grc_gnuradio/Makefile.am
===================================================================
--- 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/grc_gnuradio/Makefile.am
  2008-09-03 23:10:15 UTC (rev 9494)
+++ 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/grc_gnuradio/Makefile.am
  2008-09-04 05:04:58 UTC (rev 9495)
@@ -21,33 +21,11 @@
 
 include $(top_srcdir)/grc/Makefile.inc
 
-SUBDIRS = blks2 usrp utils wxgui
+SUBDIRS = \
+       blks2 \
+       usrp \
+       wxgui
 
-ourpythondir = $(pythondir)/grc_gnuradio
+ourpythondir = $(grc_gnuradio_prefix)
 
-ourpython_PYTHON = \
-       __init__.py \
-       Constants.py \
-       Block.py \
-       Connection.py \
-       FlowGraph.py \
-       Generator.py \
-       Platform.py \
-       Param.py \
-       Port.py
-
-docdir = $(prefix)/share/doc/@address@hidden@VERSION@
-
-BUILT_SOURCES = Constants.py
-
-Constants.py: Makefile $(srcdir)/Constants.py.in
-       sed \
-               -e 's|@address@hidden|$(PYTHONW)|g' \
-               -e 's|@address@hidden|$(grc_gnuradio_data_dir)|g' \
-               -e 's|@address@hidden|$(grc_gnuradio_blocks_dir)|g' \
-               -e 's|@address@hidden|$(docdir)|g' \
-       $(srcdir)/Constants.py.in > $@
-
-EXTRA_DIST = Constants.py.in
-
-MOSTLYCLEANFILES = $(BUILT_SOURCES)
+ourpython_PYTHON = __init__.py

Modified: 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/grc_gnuradio/__init__.py
===================================================================
--- 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/grc_gnuradio/__init__.py
  2008-09-03 23:10:15 UTC (rev 9494)
+++ 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/grc_gnuradio/__init__.py
  2008-09-04 05:04:58 UTC (rev 9495)
@@ -1,20 +1 @@
-"""
-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
-"""
address@hidden grc_gnuradio 
-#gnuradio overloaded elements and supplemental python modules

Modified: 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/grc_gnuradio/blks2/Makefile.am
===================================================================
--- 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/grc_gnuradio/blks2/Makefile.am
    2008-09-03 23:10:15 UTC (rev 9494)
+++ 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/grc_gnuradio/blks2/Makefile.am
    2008-09-04 05:04:58 UTC (rev 9495)
@@ -19,9 +19,9 @@
 # Boston, MA 02110-1301, USA.
 # 
 
-include $(top_srcdir)/Makefile.common
+include $(top_srcdir)/grc/Makefile.inc
 
-ourpythondir = $(pythondir)/grc_gnuradio/blks2
+ourpythondir = $(grc_gnuradio_prefix)/blks2
 
 ourpython_PYTHON = \
        __init__.py \

Modified: 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/grc_gnuradio/usrp/Makefile.am
===================================================================
--- 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/grc_gnuradio/usrp/Makefile.am
     2008-09-03 23:10:15 UTC (rev 9494)
+++ 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/grc_gnuradio/usrp/Makefile.am
     2008-09-04 05:04:58 UTC (rev 9495)
@@ -19,9 +19,9 @@
 # Boston, MA 02110-1301, USA.
 # 
 
-include $(top_srcdir)/Makefile.common
+include $(top_srcdir)/grc/Makefile.inc
 
-ourpythondir = $(pythondir)/grc_gnuradio/usrp
+ourpythondir = $(grc_gnuradio_prefix)/usrp
 
 ourpython_PYTHON = \
        __init__.py \

Modified: 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/grc_gnuradio/wxgui/Makefile.am
===================================================================
--- 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/grc_gnuradio/wxgui/Makefile.am
    2008-09-03 23:10:15 UTC (rev 9494)
+++ 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/grc_gnuradio/wxgui/Makefile.am
    2008-09-04 05:04:58 UTC (rev 9495)
@@ -19,9 +19,9 @@
 # Boston, MA 02110-1301, USA.
 # 
 
-include $(top_srcdir)/Makefile.common
+include $(top_srcdir)/grc/Makefile.inc
 
-ourpythondir = $(pythondir)/grc_gnuradio/wxgui
+ourpythondir = $(grc_gnuradio_prefix)/wxgui
 
 ourpython_PYTHON = \
        __init__.py \

Copied: 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Constants.py 
(from rev 9487, 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Constants.py.in)
===================================================================
--- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Constants.py  
                        (rev 0)
+++ gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Constants.py  
2008-09-04 05:04:58 UTC (rev 9495)
@@ -0,0 +1,124 @@
+"""
+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
+"""
address@hidden grc.Constants
+#Global constants
address@hidden Josh Blum
+
+######################################################################################################
+## Global Titles
+######################################################################################################
+
+##The name to appear in the main window for a flow graph that has not been 
saved to file.
+NEW_FLOGRAPH_TITLE = 'untitled'
+
+##The prefix title on the main window.
+MAIN_WINDOW_PREFIX = "GRC"
+
+######################################################################################################
+## Signal block connector lengths
+######################################################################################################
+
+##The length that a connection must extend from the port until the length 
depends on the index of the port.
+CONNECTOR_EXTENSION_INITIAL_LENGTH = 11
+
+##The length that a connection must extend from the initial length times the 
index of the port, after this length, the connection may have a bend.
+CONNECTOR_EXTENSION_LENGTH = 11
+
+##The length of the connector arrow base in pixels
+CONNECTOR_ARROW_BASE = 13
+
+##The length of the connector arrow height in pixels
+CONNECTOR_ARROW_HEIGHT = 17
+
+######################################################################################################
+## Signal block rotations
+######################################################################################################
+
+##List of possible angles (in degrees) that a block can be rotated to.
+POSSIBLE_ROTATIONS = (0, 90, 180, 270)
+
+##direction of rotation left.
+DIR_LEFT = 'left'
+
+##direction of rotation right.
+DIR_RIGHT = 'right'
+
+######################################################################################################
+## Dimension constraints for the various windows (in pixels)
+######################################################################################################
+
+##main window constraints
+MIN_WINDOW_WIDTH = 600
+MIN_WINDOW_HEIGHT = 400
+
+##dialog constraints
+MIN_DIALOG_WIDTH = 500
+MIN_DIALOG_HEIGHT = 500
+
+##static height of reports window
+REPORTS_WINDOW_HEIGHT = 100
+
+##static width of block selection window
+BLOCK_SELECTION_WINDOW_WIDTH = 200
+
+######################################################################################################
+## Constraints on displayable labels and ports
+######################################################################################################
+
+LABEL_SEPARATION = 3
+LABEL_PADDING_WIDTH = 9
+LABEL_PADDING_HEIGHT = 9
+
+PORT_SEPARATION = 17
+PORT_HEIGHT = 15
+PORT_WIDTH = 25
+PORT_BORDER_SEPARATION = 9
+MAX_NUM_PORTS = 7
+
+PARAM_LABEL_FONT = 'Sans 9.5'
+PARAM_FONT = 'Sans 7.5'
+BLOCK_FONT = 'Sans 8'
+PORT_FONT = 'Sans 7.5'
+
+######################################################################################################
+## Dragging, scrolling, and redrawing constants for the flow graph window in 
pixels
+######################################################################################################
+
+##How close can the mouse get to the window border before mouse events are 
ignored.
+BORDER_PROXIMITY_SENSITIVITY = 50
+
+##How close the mouse can get to the edge of the visible window before 
scrolling is invoked.
+SCROLL_PROXIMITY_SENSITIVITY = 30
+
+##When the window has to be scrolled, move it this distance in the required 
direction.
+SCROLL_DISTANCE = 15
+
+##The redrawing sensitivity, how many seconds must pass between motion events 
before a redraw?
+MOTION_DETECT_REDRAWING_SENSITIVITY = .02
+
+##How close the mouse click can be to a connection and register a connection 
select.
+CONNECTION_SELECT_SENSITIVITY = 5
+
+######################################################################################################
+# A state is recorded for each change to the flow graph, the size dictates how 
many states we can record
+######################################################################################################
+
+##The size of the state saving cache in the flow graph (for undo/redo 
functionality)
+STATE_CACHE_SIZE = 42
+

Deleted: 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Constants.py.in

Modified: 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Makefile.am
===================================================================
--- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Makefile.am   
2008-09-03 23:10:15 UTC (rev 9494)
+++ gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Makefile.am   
2008-09-04 05:04:58 UTC (rev 9495)
@@ -19,19 +19,23 @@
 # Boston, MA 02110-1301, USA.
 # 
 
-include $(top_srcdir)/Makefile.common
+include $(top_srcdir)/grc/Makefile.inc
 
-SUBDIRS = elements
+ourpythondir = $(grc_src_prefix)/gui
 
-ourpythondir = $(pythondir)/grc/gui
-
 ourpython_PYTHON = \
-       __init__.py \
+       ActionHandler.py \
+       Actions.py \
        Bars.py \
        BlockTreeWindow.py \
+       Constants.py \
        Dialogs.py \
        DrawingArea.py \
        FileDialogs.py \
        MainWindow.py \
+       Messages.py \
        NotebookPage.py \
-       ParamsDialog.py
+       ParamsDialog.py \
+       Preferences.py \
+       StateCache.py \
+       __init__.py

Deleted: 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/ParseXML.py

Deleted: gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Utils.py

Modified: 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/__init__.py
===================================================================
--- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/__init__.py   
2008-09-03 23:10:15 UTC (rev 9494)
+++ gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/__init__.py   
2008-09-04 05:04:58 UTC (rev 9495)
@@ -1,26 +1 @@
-"""
-Copyright 2007 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
-"""
address@hidden grc.gui
-#GTK based classes go into this package.
-
-#only import the modules that need external access
-from MainWindow import MainWindow
-from FileDialogs import 
OpenFlowGraphFileDialog,SaveFlowGraphFileDialog,SaveImageFileDialog
-from Dialogs import 
PreferencesDialog,MessageDialogHelper,AboutDialog,HotKeysDialog
-

Deleted: 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/converter.py

Modified: 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/Makefile.am
===================================================================
--- 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/Makefile.am 
    2008-09-03 23:10:15 UTC (rev 9494)
+++ 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/Makefile.am 
    2008-09-04 05:04:58 UTC (rev 9495)
@@ -19,6 +19,13 @@
 # Boston, MA 02110-1301, USA.
 # 
 
-include $(top_srcdir)/Makefile.common
+include $(top_srcdir)/grc/Makefile.inc
 
-SUBDIRS = grc grc_gnuradio
+SUBDIRS = \
+       base \
+       gui \
+       python \
+
+ourpythondir = $(grc_src_prefix)/platforms
+
+ourpython_PYTHON = __init__.py

Modified: 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/__init__.py
===================================================================
--- 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/__init__.py 
    2008-09-03 23:10:15 UTC (rev 9494)
+++ 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/__init__.py 
    2008-09-04 05:04:58 UTC (rev 9495)
@@ -0,0 +1 @@
+

Copied: 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/base/Constants.py.in
 (from rev 9487, 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Constants.py.in)
===================================================================
--- 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/base/Constants.py.in
                            (rev 0)
+++ 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/base/Constants.py.in
    2008-09-04 05:04:58 UTC (rev 9495)
@@ -0,0 +1,48 @@
+"""
+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
+"""
address@hidden grc.Constants
+#Global constants
address@hidden Josh Blum
+
+import os
+
+##The current version of this code
+VERSION = '@VERSION@'
+
+##Location of external data files.
+DATA_DIR = '@datadir@'
+
+##DTD validator for saved flow graphs.
+FLOW_GRAPH_DTD = os.path.join(DATA_DIR, 'flow_graph.dtd')
+
+##The default file extension for flow graphs.
+FLOW_GRAPH_FILE_EXTENSION = '.grc'
+
+##The default file extension for saving flow graph snap shots.
+IMAGE_FILE_EXTENSION = '.png'
+
+##The default path for the open/save dialogs.
+DEFAULT_FILE_PATH = os.getcwd()
+
+##The default icon for the gtk windows.
+PY_GTK_ICON = os.path.join(DATA_DIR, 'grc-icon-256.png')
+
+##The users home directory.
+HOME_DIR = os.path.expanduser('~')
+

Modified: 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/base/Makefile.am
===================================================================
--- 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/base/Makefile.am
        2008-09-03 23:10:15 UTC (rev 9494)
+++ 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/base/Makefile.am
        2008-09-04 05:04:58 UTC (rev 9495)
@@ -19,16 +19,29 @@
 # Boston, MA 02110-1301, USA.
 # 
 
-include $(top_srcdir)/Makefile.common
+include $(top_srcdir)/grc/Makefile.inc
 
-ourpythondir = $(pythondir)/grc/elements
+ourpythondir = $(grc_src_prefix)/platforms/base
 
 ourpython_PYTHON = \
-       __init__.py \
        Block.py \
        Connection.py \
+       Constants.py \
        Element.py \
        FlowGraph.py \
        Param.py \
        Platform.py \
-       Port.py
+       Port.py \
+       __init__.py
+
+BUILT_SOURCES = Constants.py
+
+Constants.py: Makefile $(srcdir)/Constants.py.in
+       sed \
+               -e 's|@address@hidden|$(VERSION)|g' \
+               -e 's|@address@hidden|$(grc_base_data_dir)|g' \
+       $(srcdir)/Constants.py.in > $@
+
+EXTRA_DIST = Constants.py.in
+
+MOSTLYCLEANFILES = $(BUILT_SOURCES)

Modified: 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/base/__init__.py
===================================================================
--- 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/base/__init__.py
        2008-09-03 23:10:15 UTC (rev 9494)
+++ 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/base/__init__.py
        2008-09-04 05:04:58 UTC (rev 9495)
@@ -1,21 +1 @@
-"""
-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
-"""
address@hidden grc.elements
-#Package for flow graph elements.
-

Copied: gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui 
(from rev 9486, 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/elements)

Modified: 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Makefile.am
===================================================================
--- 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/elements/Makefile.am
  2008-09-02 21:08:59 UTC (rev 9486)
+++ 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Makefile.am
 2008-09-04 05:04:58 UTC (rev 9495)
@@ -19,12 +19,11 @@
 # Boston, MA 02110-1301, USA.
 # 
 
-include $(top_srcdir)/Makefile.common
+include $(top_srcdir)/grc/Makefile.inc
 
-ourpythondir = $(pythondir)/grc/gui/elements
+ourpythondir = $(grc_src_prefix)/platforms/gui
 
 ourpython_PYTHON = \
-       __init__.py \
        Block.py \
        Colors.py \
        Connection.py \
@@ -33,4 +32,5 @@
        Param.py \
        Platform.py \
        Port.py \
-       Utils.py
+       Utils.py \
+       __init__.py

Modified: 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/__init__.py
===================================================================
--- 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/elements/__init__.py
  2008-09-02 21:08:59 UTC (rev 9486)
+++ 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/__init__.py
 2008-09-04 05:04:58 UTC (rev 9495)
@@ -1,22 +1 @@
-"""
-Copyright 2007 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
-"""
address@hidden grc.gui.elements
-#All graphical elements used in a flow graph.
-
-

Modified: 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/Makefile.am
===================================================================
--- 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/Makefile.am
      2008-09-03 23:10:15 UTC (rev 9494)
+++ 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/Makefile.am
      2008-09-04 05:04:58 UTC (rev 9495)
@@ -21,20 +21,20 @@
 
 include $(top_srcdir)/grc/Makefile.inc
 
-SUBDIRS = blks2 usrp utils wxgui
+SUBDIRS = utils
 
-ourpythondir = $(pythondir)/grc_gnuradio
+ourpythondir = $(grc_src_prefix)/platforms/python
 
 ourpython_PYTHON = \
-       __init__.py \
-       Constants.py \
        Block.py \
        Connection.py \
+       Constants.py \
        FlowGraph.py \
        Generator.py \
+       Param.py \
        Platform.py \
-       Param.py \
-       Port.py
+       Port.py \
+       __init__.py
 
 docdir = $(prefix)/share/doc/@address@hidden@VERSION@
 
@@ -43,7 +43,7 @@
 Constants.py: Makefile $(srcdir)/Constants.py.in
        sed \
                -e 's|@address@hidden|$(PYTHONW)|g' \
-               -e 's|@address@hidden|$(grc_gnuradio_data_dir)|g' \
+               -e 's|@address@hidden|$(grc_python_data_dir)|g' \
                -e 's|@address@hidden|$(grc_gnuradio_blocks_dir)|g' \
                -e 's|@address@hidden|$(docdir)|g' \
        $(srcdir)/Constants.py.in > $@

Modified: 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/__init__.py
===================================================================
--- 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/__init__.py
      2008-09-03 23:10:15 UTC (rev 9494)
+++ 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/__init__.py
      2008-09-04 05:04:58 UTC (rev 9495)
@@ -1,20 +1 @@
-"""
-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
-"""
address@hidden grc_gnuradio 
-#gnuradio overloaded elements and supplemental python modules

Modified: 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/utils/Makefile.am
===================================================================
--- 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/utils/Makefile.am
        2008-09-03 23:10:15 UTC (rev 9494)
+++ 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/utils/Makefile.am
        2008-09-04 05:04:58 UTC (rev 9495)
@@ -19,12 +19,12 @@
 # Boston, MA 02110-1301, USA.
 # 
 
-include $(top_srcdir)/Makefile.common
+include $(top_srcdir)/grc/Makefile.inc
 
-ourpythondir = $(pythondir)/grc_gnuradio/utils
+ourpythondir = $(grc_src_prefix)/platforms/python/utils
 
 ourpython_PYTHON = \
-       __init__.py \
        convert_hier.py \
        expr_utils.py \
-       extract_docs.py
+       extract_docs.py \
+       __init__.py

Modified: 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/utils/__init__.py
===================================================================
--- 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/utils/__init__.py
        2008-09-03 23:10:15 UTC (rev 9494)
+++ 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/utils/__init__.py
        2008-09-04 05:04:58 UTC (rev 9495)
@@ -1,21 +1 @@
-"""
-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
-"""
address@hidden grc_gnuradio.utils
-#utility functions and classes
-

Modified: 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/utils/Makefile.am
===================================================================
--- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/utils/Makefile.am 
2008-09-03 23:10:15 UTC (rev 9494)
+++ gnuradio/branches/developers/jblum/grc_reorganize/grc/src/utils/Makefile.am 
2008-09-04 05:04:58 UTC (rev 9495)
@@ -19,6 +19,11 @@
 # Boston, MA 02110-1301, USA.
 # 
 
-include $(top_srcdir)/Makefile.common
+include $(top_srcdir)/grc/Makefile.inc
 
-SUBDIRS = grc grc_gnuradio
+ourpythondir = $(grc_src_prefix)/utils
+
+ourpython_PYTHON = \
+       converter.py \
+       ParseXML.py \
+       __init__.py

Copied: 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/utils/ParseXML.py 
(from rev 9487, 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/ParseXML.py)
===================================================================
--- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/utils/ParseXML.py 
                        (rev 0)
+++ gnuradio/branches/developers/jblum/grc_reorganize/grc/src/utils/ParseXML.py 
2008-09-04 05:04:58 UTC (rev 9495)
@@ -0,0 +1,102 @@
+"""
+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
+"""
address@hidden grc.gui.ParseXML
+#Parse xml files to nested data and vice-versa.
+
+from lxml import etree
+from Utils import odict
+
+XMLSyntaxError = etree.XMLSyntaxError
+
+def validate_dtd(xml_file, dtd_file=None):
+       """!
+       Validate an xml file against its dtd.
+       @param xml_file the xml file
+       @param dtd_file the optional dtd file
+       @throws Exception validation fails
+       """
+       if dtd_file:
+               dtd = etree.DTD(dtd_file)
+               xml = etree.parse(xml_file)
+               if not dtd.validate(xml.getroot()):
+                       raise XMLSyntaxError, '\n'.join(map(str, 
dtd.error_log.filter_from_errors()))
+       else:
+               parser = etree.XMLParser(dtd_validation=True)
+               xml = etree.parse(xml_file, parser=parser)
+               if parser.error_log:
+                       raise XMLSyntaxError, '\n'.join(map(str, 
parser.error_log.filter_from_errors()))
+
+def from_file(xml_file):
+       """!
+       Create nested data from an xml file using the from xml helper.
+       @param xml_file the xml file path
+       @return the nested data
+       """
+       xml = etree.parse(xml_file).getroot()
+       return _from_file(xml)
+
+def _from_file(xml):
+       """!
+       Recursivly parse the xml tree into nested data format.
+       @param xml the xml tree
+       @return the nested data
+       """
+       tag = xml.tag
+       if not len(xml):
+               return odict({tag: xml.text or ''}) #store empty tags (text is 
None) as empty string
+       nested_data = odict()
+       for elem in xml:
+               key, value = _from_file(elem).items()[0]
+               if nested_data.has_key(key): nested_data[key].append(value)
+               else: nested_data[key] = [value]
+       #delistify if the length of values is 1
+       for key, values in nested_data.iteritems():
+               if len(values) == 1: nested_data[key] = values[0]
+       return odict({tag: nested_data})
+
+def to_file(nested_data, xml_file):
+       """!
+       Write an xml file and use the to xml helper method to load it.
+       @param nested_data the nested data
+       @param xml_file the xml file path
+       """
+       xml = _to_file(nested_data)[0]
+       open(xml_file, 'w').write(etree.tostring(xml, xml_declaration=True, 
pretty_print=True))
+
+def _to_file(nested_data):
+       """!
+       Recursivly parse the nested data into xml tree format.
+       @param nested_data the nested data
+       @return the xml tree filled with child nodes
+       """
+       nodes = list()
+       for key, values in nested_data.iteritems():
+               #listify the values if not a list
+               if not isinstance(values, (list, set, tuple)):
+                       values = [values]
+               for value in values:
+                       node = etree.Element(key)
+                       if isinstance(value, (str, unicode)): node.text = value
+                       else: node.extend(_to_file(value))
+                       nodes.append(node)
+       return nodes
+
+if __name__ == '__main__':
+       """Use the main method to test parse xml's functions."""
+       pass

Modified: 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/utils/__init__.py
===================================================================
--- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/utils/__init__.py 
2008-09-03 23:10:15 UTC (rev 9494)
+++ gnuradio/branches/developers/jblum/grc_reorganize/grc/src/utils/__init__.py 
2008-09-04 05:04:58 UTC (rev 9495)
@@ -0,0 +1,58 @@
+"""
+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
+"""
+
+from UserDict import DictMixin
+
+class odict(DictMixin):
+
+       def __init__(self, d={}):
+               self._keys = list(d.keys())
+               self._data = dict(d.copy())
+
+       def __setitem__(self, key, value):
+               if key not in self._data:
+                       self._keys.append(key)
+               self._data[key] = value
+
+       def __getitem__(self, key):
+               return self._data[key]
+
+       def __delitem__(self, key):
+               del self._data[key]
+               self._keys.remove(key)
+
+       def keys(self):
+               return list(self._keys)
+
+       def copy(self):
+               copy_dict = odict()
+               copy_dict._data = self._data.copy()
+               copy_dict._keys = list(self._keys)
+               return copy_dict
+
+def exists_or_else(d, key, alt):
+       if d.has_key(key): return d[key]
+       else: return alt
+
+def listify(d, key):
+       obj = exists_or_else(d, key, [])
+       if isinstance(obj, list): return obj
+       return [obj]
+
+

Copied: 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/utils/converter.py 
(from rev 9487, 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/converter.py)
===================================================================
--- 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/utils/converter.py    
                            (rev 0)
+++ 
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/utils/converter.py    
    2008-09-04 05:04:58 UTC (rev 9495)
@@ -0,0 +1,250 @@
+"""
+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
+"""
address@hidden grc.converter
+#convert old flow graph file format to new format
+
+from grc.Constants import FLOW_GRAPH_DTD
+from grc import ParseXML, Utils
+from grc.Utils import odict
+from lxml import etree
+import difflib
+import os
+
+def _make_param(key, value):
+       """!
+       Make a paramater dict from the key/value pair.
+       @param key the key
+       @param value the value
+       @return a dictionary object
+       """
+       param = odict()
+       param['key'] = key
+       param['value'] = value
+       return param
+
+def _get_blocks(blocks, tag):
+       """!
+       Get a list of blocks with the tag.
+       @param blocks the old block list
+       @param tag the tag name
+       @retun a list of matching blocks
+       """
+       return filter(lambda b: b['tag'] == tag, blocks)
+
+def _get_params(block):
+       """!
+       Get a list of params.
+       @param block the old block
+       @retun a list of params
+       """
+       params = Utils.exists_or_else(block, 'params', {}) or {}
+       params = Utils.listify(params, 'param')
+       return params
+
+def _convert_id(id):
+       """!
+       Convert an old id to a new safe id.
+       Replace spaces with underscores.
+       Lower case the odl id.
+       @return the reformatted id
+       """
+       return id.lower().replace(' ', '_')
+
+def convert(file_path, platform):
+       """!
+       Convert the flow graph to the new format.
+       Make a backup of the old file.
+       Save a reformated flow graph to the file path.
+       If this is a new format flow graph, do nothing.
+       @param file_path the path to the saved flow graph
+       @param platform the grc gnuradio platform
+       """
+       try: #return if file passes validation
+               ParseXML.validate_dtd(file_path, FLOW_GRAPH_DTD)
+               try:
+                       changed = False
+                       #convert instances of gui_coordinate and gui_rotation
+                       xml = etree.parse(file_path)
+                       for find, replace in (
+                               ('gui_coordinate', '_coordinate'),
+                               ('gui_rotation', '_rotation'),
+                       ):
+                               keys = 
xml.xpath('/flow_graph/block/param[key="%s"]/key'%find)
+                               for key in keys:
+                                       key.text = replace
+                                       changed = True
+                       if not changed: return
+                       #backup after successful conversion
+                       os.rename(file_path, file_path+'.bak')
+                       #save new flow graph to file path
+                       xml.write(file_path, xml_declaration=True, 
pretty_print=True)
+               except Exception, e: print e
+               return
+       except: pass #convert
+       ############################################################
+       # extract window size, variables, blocks, and connections
+       ############################################################
+       old_n = ParseXML.from_file(file_path)['flow_graph']
+       try: window_width = min(3*int(old_n['window_width'])/2, 2048)
+       except: window_width = 2048
+       try: window_height = min(3*int(old_n['window_height'])/2, 2048)
+       except: window_height = 2048
+       window_size = '%d, %d'%(window_width, window_height)
+       variables = Utils.exists_or_else(old_n, 'vars', {}) or {}
+       variables = Utils.listify(variables, 'var')
+       blocks = Utils.exists_or_else(old_n, 'signal_blocks', {}) or {}
+       blocks = Utils.listify(blocks, 'signal_block')
+       connections = Utils.exists_or_else(old_n, 'connections', {}) or {}
+       connections = Utils.listify(connections, 'connection')
+       #initialize new nested data
+       new_n = odict()
+       new_n['block'] = list()
+       new_n['connection'] = list()
+       ############################################################
+       # conversion - options block
+       ############################################################
+       #get name
+       about_blocks = _get_blocks(blocks, 'About')
+       if about_blocks: title = _get_params(about_blocks[0])[0]
+       else: title = 'Untitled'
+       #get author
+       if about_blocks: author = _get_params(about_blocks[0])[1]
+       else: author = ''
+       #get desc
+       note_blocks = _get_blocks(blocks, 'Note')
+       if note_blocks: desc = _get_params(note_blocks[0])[0]
+       else: desc = ''
+       #create options block
+       options_block = odict()
+       options_block['key'] = 'options'
+       options_block['param'] = [
+               _make_param('id', 'top_block'),
+               _make_param('title', title),
+               _make_param('author', author),
+               _make_param('description', desc),
+               _make_param('window_size', window_size),
+               _make_param('_coordinate', '(10, 10)'),
+       ]
+       #append options block
+       new_n['block'].append(options_block)
+       ############################################################
+       # conversion - variables
+       ############################################################
+       x = 100 
+       for variable in variables:
+               key = variable['key']
+               value = variable['value']
+               minimum = Utils.exists_or_else(variable, 'min', '')
+               maximum = Utils.exists_or_else(variable, 'max', '')
+               step = Utils.exists_or_else(variable, 'step', '')
+               x = x + 150
+               coor = '(%d, %d)'%(x, 10)
+               var_block = odict()
+               if minimum and maximum: #slider varible
+                       #determine num steps
+                       try: num_steps = str(int((float(maximum) - 
float(minimum))/float(step)))
+                       except: num_steps = '100'
+                       var_block['key'] = 'variable_slider'
+                       var_block['param'] = [
+                               _make_param('id', key),
+                               _make_param('value', value),
+                               _make_param('min', minimum),
+                               _make_param('max', maximum),
+                               _make_param('num_steps', num_steps),
+                               _make_param('_coordinate', coor),
+                       ]
+               else: #regular variable
+                       var_block['key'] = 'variable'
+                       var_block['param'] = [
+                               _make_param('id', key),
+                               _make_param('value', value),
+                               _make_param('_coordinate', coor),
+                       ]
+               #append variable block
+               new_n['block'].append(var_block)
+       ############################################################
+       # conversion - blocks
+       ############################################################
+       #create name to key map for all blocks in platform
+       name_to_key = dict((b.get_name(), b.get_key()) for b in 
platform.get_blocks())
+       for block in blocks:
+               #extract info
+               tag = block['tag']
+               #ignore list
+               if tag in ('Note', 'About'): continue
+               id = _convert_id(block['id'])
+               coor = '(%s, %s + 100)'%(
+                       Utils.exists_or_else(block, 'x_coordinate', '0'),
+                       Utils.exists_or_else(block, 'y_coordinate', '0'),
+               )
+               rot = Utils.exists_or_else(block, 'rotation', '0')
+               params = _get_params(block)
+               #new block
+               new_block = odict()
+               matches = difflib.get_close_matches(tag, name_to_key.keys(), 1)
+               if not matches: continue
+               #match found
+               key = name_to_key[matches[0]]
+               new_block['key'] = key
+               new_block['param'] = [
+                       _make_param('id', id),
+                       _make_param('_coordinate', coor),
+                       _make_param('_rotation', rot),
+               ]
+               #handle specific blocks
+               if key == 'wxgui_fftsink2':
+                       params = params[0:3] + ['0'] + params[3:4] + ['8'] + 
params[4:]
+               #append params
+               for i, param in enumerate(params):
+                       platform_block = platform.get_block(key)
+                       try: platform_param = platform_block.get_params()[i+2]
+                       except IndexError: break
+                       if platform_param.is_enum():
+                               try: param_value = 
platform_param.get_option_keys()[int(param)]
+                               except: param_value = 
platform_param.get_option_keys()[0]
+                       else:
+                               param_value = param.replace('$', 
'').replace('^', '**')
+                       
new_block['param'].append(_make_param(platform_param.get_key(), param_value))
+               #append block
+               new_n['block'].append(new_block)
+       ############################################################
+       # conversion - connections
+       ############################################################
+       for connection in connections:
+               #extract info
+               input_signal_block_id = connection['input_signal_block_id']
+               input_socket_index = connection['input_socket_index']
+               output_signal_block_id = connection['output_signal_block_id']
+               output_socket_index = connection['output_socket_index']
+               #new connection
+               new_conn = odict()
+               new_conn['source_block_id'] = 
_convert_id(output_signal_block_id)
+               new_conn['sink_block_id'] = _convert_id(input_signal_block_id)
+               new_conn['source_key'] = output_socket_index
+               new_conn['sink_key'] = input_socket_index
+               #append connection
+               new_n['connection'].append(new_conn)
+       ############################################################
+       # backup and replace
+       ############################################################
+       #backup after successful conversion
+       os.rename(file_path, file_path+'.bak')
+       #save new flow graph to file path
+       ParseXML.to_file({'flow_graph': new_n}, file_path)
+





reply via email to

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