commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r7533 - in grc/branches: . grc_reloaded grc_reloaded/d


From: jblum
Subject: [Commit-gnuradio] r7533 - in grc/branches: . grc_reloaded grc_reloaded/data grc_reloaded/license grc_reloaded/notes grc_reloaded/src grc_reloaded/src/grc grc_reloaded/src/grc/elements grc_reloaded/src/grc/gui grc_reloaded/src/grc/gui/elements grc_reloaded/src/grc/platforms grc_reloaded/src/grc/platforms/common grc_reloaded/src/grc/platforms/common/blocks grc_reloaded/src/grc/platforms/gnuradio_python grc_reloaded/src/grc/platforms/gnuradio_python/blocks grc_reloaded/src/grc/platforms/gnuradio_python/blocks/misc grc_reloaded/src/grc/platforms/gnuradio_python/blocks/operators
Date: Thu, 31 Jan 2008 14:25:55 -0700 (MST)

Author: jblum
Date: 2008-01-31 14:25:54 -0700 (Thu, 31 Jan 2008)
New Revision: 7533

Added:
   grc/branches/grc_reloaded/
   grc/branches/grc_reloaded/data/
   grc/branches/grc_reloaded/data/flow_graph.grc.dtd
   grc/branches/grc_reloaded/data/grc-icon-256.png
   grc/branches/grc_reloaded/data/grc-icon-256.svg
   grc/branches/grc_reloaded/data/grc-icon-32.png
   grc/branches/grc_reloaded/data/initial_flow_graph.grc.xml
   grc/branches/grc_reloaded/data/preferences.grc.dtd
   grc/branches/grc_reloaded/examples/
   grc/branches/grc_reloaded/license/
   grc/branches/grc_reloaded/license/creative_commons_legal_code.txt
   grc/branches/grc_reloaded/license/free_software_message.txt
   grc/branches/grc_reloaded/license/gpl.txt
   grc/branches/grc_reloaded/notes/
   grc/branches/grc_reloaded/notes/clean.sh
   grc/branches/grc_reloaded/notes/programming_style.txt
   grc/branches/grc_reloaded/notes/release_notes.txt
   grc/branches/grc_reloaded/notes/todo.txt
   grc/branches/grc_reloaded/notes/todo_new.txt
   grc/branches/grc_reloaded/readme.txt
   grc/branches/grc_reloaded/src/
   grc/branches/grc_reloaded/src/grc/
   grc/branches/grc_reloaded/src/grc/ActionHandler.py
   grc/branches/grc_reloaded/src/grc/Actions.py
   grc/branches/grc_reloaded/src/grc/Colors.py
   grc/branches/grc_reloaded/src/grc/Constants.py
   grc/branches/grc_reloaded/src/grc/Messages.py
   grc/branches/grc_reloaded/src/grc/ParseXML.py
   grc/branches/grc_reloaded/src/grc/Preferences.py
   grc/branches/grc_reloaded/src/grc/StateCache.py
   grc/branches/grc_reloaded/src/grc/Utils.py
   grc/branches/grc_reloaded/src/grc/__init__.py
   grc/branches/grc_reloaded/src/grc/elements/
   grc/branches/grc_reloaded/src/grc/elements/Block.py
   grc/branches/grc_reloaded/src/grc/elements/Connection.py
   grc/branches/grc_reloaded/src/grc/elements/DataType.py
   grc/branches/grc_reloaded/src/grc/elements/Element.py
   grc/branches/grc_reloaded/src/grc/elements/FlowGraph.py
   grc/branches/grc_reloaded/src/grc/elements/Param.py
   grc/branches/grc_reloaded/src/grc/elements/Platform.py
   grc/branches/grc_reloaded/src/grc/elements/Port.py
   grc/branches/grc_reloaded/src/grc/elements/Range.py
   grc/branches/grc_reloaded/src/grc/elements/__init__.py
   grc/branches/grc_reloaded/src/grc/gui/
   grc/branches/grc_reloaded/src/grc/gui/Bars.py
   grc/branches/grc_reloaded/src/grc/gui/Dialogs.py
   grc/branches/grc_reloaded/src/grc/gui/FileDialogs.py
   grc/branches/grc_reloaded/src/grc/gui/FlowGraph.py
   grc/branches/grc_reloaded/src/grc/gui/MainWindow.py
   grc/branches/grc_reloaded/src/grc/gui/SignalBlockParamsDialog.py
   grc/branches/grc_reloaded/src/grc/gui/SignalBlockSelectionWindow.py
   grc/branches/grc_reloaded/src/grc/gui/USRPDiagnostics.py
   grc/branches/grc_reloaded/src/grc/gui/VariableModificationWindow.py
   grc/branches/grc_reloaded/src/grc/gui/__init__.py
   grc/branches/grc_reloaded/src/grc/gui/elements/
   grc/branches/grc_reloaded/src/grc/gui/elements/Block.py
   grc/branches/grc_reloaded/src/grc/gui/elements/Connection.py
   grc/branches/grc_reloaded/src/grc/gui/elements/Element.py
   grc/branches/grc_reloaded/src/grc/gui/elements/Param.py
   grc/branches/grc_reloaded/src/grc/gui/elements/Port.py
   grc/branches/grc_reloaded/src/grc/gui/elements/__init__.py
   grc/branches/grc_reloaded/src/grc/platforms/
   grc/branches/grc_reloaded/src/grc/platforms/__init__.py
   grc/branches/grc_reloaded/src/grc/platforms/common/
   grc/branches/grc_reloaded/src/grc/platforms/common/DataType.py
   grc/branches/grc_reloaded/src/grc/platforms/common/__init__.py
   grc/branches/grc_reloaded/src/grc/platforms/common/blocks/
   grc/branches/grc_reloaded/src/grc/platforms/common/blocks/about.xml
   grc/branches/grc_reloaded/src/grc/platforms/common/blocks/block.dtd
   grc/branches/grc_reloaded/src/grc/platforms/common/blocks/note.xml
   grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/
   grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/Block.py
   grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/DataType.py
   grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/FlowGraph.py
   grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/Platform.py
   grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/Port.py
   grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/__init__.py
   grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/
   grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/block.dtd
   grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/misc/
   
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/misc/variable.xml
   grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/operators/
   
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/operators/add.xml
   
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/operators/add_const.xml
Log:
work on grc reloaded, for generating flow graph code, sorry for the big commit

Added: grc/branches/grc_reloaded/data/flow_graph.grc.dtd
===================================================================
--- grc/branches/grc_reloaded/data/flow_graph.grc.dtd                           
(rev 0)
+++ grc/branches/grc_reloaded/data/flow_graph.grc.dtd   2008-01-31 21:25:54 UTC 
(rev 7533)
@@ -0,0 +1,73 @@
+<?xml version="1.0"?>
+<!-- 
+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 
+-->
+<!--
+       flow_graph.grc.dtd 
+       Josh Blum
+       The document type definitions for grc flow graphs.
+-->
+<!DOCTYPE flow_graph [
+       <!-- The flow graph contains:
+               identifying information: time stamp, host name, version, 
+               a validity check, graphical parameters: window with and height,
+               variables, signal blocks, and connections. Restrictions:
+               Both window width and height must be included or not at all.
+               If connections are included, there must be signal blocks.    -->
+       <!ELEMENT flow_graph    (timestamp?, hostname?, version?, valid?, 
(window_width, window_height)?, vars?, (signal_blocks, connections?)?)>
+               <!ELEMENT timestamp (#PCDATA)>  <!-- The time stamp for the 
modification date. (optional) -->
+               <!ELEMENT hostname (#PCDATA)>   <!-- The hostname of the 
computer. (optional) -->
+               <!ELEMENT version (#PCDATA)>    <!-- The program and program 
version.  (optional) -->
+               <!ELEMENT valid (#PCDATA)>      <!-- Did this flow graph pass 
the validation checks (True/False)? (optional) -->
+               <!ELEMENT window_width (#PCDATA)>       <!-- The width of the 
graphical flow graph in pixels. (optional) -->
+               <!ELEMENT window_height (#PCDATA)>      <!-- The height of the 
graphical flow graph in pixels. (optional) -->
+               <!-- This flow graph may have an optional vars tag (list of 
variables).
+                       The vars tag may have any number of var tags inside of 
it. 
+                       Each var tag must have a key and a value or
+                       a key, value, min, max, and step. -->
+               <!ELEMENT vars (var*)>  <!-- Flow graph variables. (optional) 
-->
+                       <!ELEMENT var (key, value, (min, max, step)?)>  <!-- A 
flow graph variable. (0 or more) -->
+                               <!ELEMENT key (#PCDATA)>        <!-- The 
identifier for this variable. -->
+                               <!ELEMENT value (#PCDATA)>      <!-- The value 
for this variable. -->
+                               <!ELEMENT min (#PCDATA)>        <!-- The 
minimum value for a ranged-variable. -->
+                               <!ELEMENT max (#PCDATA)>        <!-- The 
maximum value for a ranged-variable. -->
+                               <!ELEMENT step (#PCDATA)>       <!-- The 
step-size for a ranged-variable. -->
+               <!-- This flow graph may have an optional signal_blocks tag 
(list of signal blocks).
+                       The signal_blocks tag may have any number of 
signal_block tags inside of it. 
+                       Each signal block has a few graphical parameters 
(optional) and a list of parameters. 
+                       Restrictions: all graphical parameters must be included 
or none at all. -->
+               <!ELEMENT signal_blocks (signal_block*)>        <!-- Signal 
blocks. (optional) -->
+                       <!ELEMENT signal_block (tag, id, (x_coordinate, 
y_coordinate, rotation)?, params)>      <!-- A signal block. (0 or more) -->
+                               <!ELEMENT tag (#PCDATA)>        <!-- The 
identifier for this type of signal block. -->
+                               <!ELEMENT id (#PCDATA)> <!-- The unique 
identification for this signal block. -->
+                               <!ELEMENT x_coordinate (#PCDATA)>       <!-- 
The x coordinate for the graphical signal block. (optional) -->
+                               <!ELEMENT y_coordinate (#PCDATA)>       <!-- 
The y coordinate for the graphical signal block. (optional) -->
+                               <!ELEMENT rotation (#PCDATA)>   <!-- The 
rotation for the graphical signal block. (optional) -->
+                               <!ELEMENT params (param*)>      <!-- The list 
of parameters. (tag required) -->
+                                       <!ELEMENT param (#PCDATA)>      <!-- A 
parameter. (0 or more) -->
+               <!-- This flow graph may have an optional connections tag (list 
of connections).
+                       The connections tag may have any number of connection 
tags inside of it. 
+                       Each connection has an input and output signal block 
identified by the unique id,
+                       and an input and output socket index for the 
connections to each signal block. -->
+               <!ELEMENT connections (connection*)>    <!-- Connections. 
(optional) -->
+                       <!ELEMENT connection (input_signal_block_id, 
input_socket_index, output_signal_block_id, output_socket_index)>  <!-- A 
connection. (0 or more) -->
+                               <!ELEMENT input_signal_block_id (#PCDATA)>      
<!-- The input signal block id. -->
+                               <!ELEMENT input_socket_index (#PCDATA)> <!-- 
The input signal block socket index. -->
+                               <!ELEMENT output_signal_block_id (#PCDATA)>     
<!-- The output signal block id. -->
+                               <!ELEMENT output_socket_index (#PCDATA)>        
<!-- The output signal block socket index. -->
+]>

Added: grc/branches/grc_reloaded/data/grc-icon-256.png
===================================================================
(Binary files differ)


Property changes on: grc/branches/grc_reloaded/data/grc-icon-256.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: grc/branches/grc_reloaded/data/grc-icon-256.svg
===================================================================
--- grc/branches/grc_reloaded/data/grc-icon-256.svg                             
(rev 0)
+++ grc/branches/grc_reloaded/data/grc-icon-256.svg     2008-01-31 21:25:54 UTC 
(rev 7533)
@@ -0,0 +1,216 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/";
+   xmlns:cc="http://web.resource.org/cc/";
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+   xmlns:svg="http://www.w3.org/2000/svg";
+   xmlns="http://www.w3.org/2000/svg";
+   xmlns:xlink="http://www.w3.org/1999/xlink";
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd";
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape";
+   width="256"
+   height="256"
+   id="svg2"
+   sodipodi:version="0.32"
+   inkscape:version="0.44.1"
+   version="1.0"
+   sodipodi:docbase="/home/past/src"
+   sodipodi:docname="grc-icon-v3.svg"
+   inkscape:export-filename="/home/past/src/grc-icon-v3.png"
+   inkscape:export-xdpi="90"
+   inkscape:export-ydpi="90">
+  <defs
+     id="defs4">
+    <linearGradient
+       id="linearGradient3661">
+      <stop
+         style="stop-color:#0012dc;stop-opacity:1;"
+         offset="0"
+         id="stop3663" />
+      <stop
+         style="stop-color:#8b92ff;stop-opacity:0.55371898;"
+         offset="1"
+         id="stop3665" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3661"
+       id="linearGradient2801"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="translate(-162.6648,798.0997)"
+       x1="17.664845"
+       y1="132.0565"
+       x2="157.82524"
+       y2="132.0565" />
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="2.7382812"
+     inkscape:cx="126.48791"
+     inkscape:cy="128.00013"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="true"
+     gridoriginx="1px"
+     gridoriginy="1px"
+     gridspacingx="2px"
+     gridspacingy="2px"
+     guidecolor="#00ff0a"
+     guideopacity="0.49803922"
+     inkscape:grid-points="true"
+     inkscape:window-width="1098"
+     inkscape:window-height="904"
+     inkscape:window-x="149"
+     inkscape:window-y="42"
+     showguides="true"
+     inkscape:guide-bbox="true"
+     inkscape:object-points="true"
+     inkscape:object-nodes="true"
+     inkscape:object-bbox="true">
+    <sodipodi:guide
+       orientation="vertical"
+       position="224"
+       id="guide10639" />
+    <sodipodi:guide
+       orientation="vertical"
+       position="227.64729"
+       id="guide10641" />
+    <sodipodi:guide
+       orientation="vertical"
+       position="220"
+       id="guide10643" />
+    <sodipodi:guide
+       orientation="horizontal"
+       position="268.4015"
+       id="guide10645" />
+  </sodipodi:namedview>
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage"; />
+        <cc:license
+           rdf:resource="http://creativecommons.org/licenses/by-sa/3.0/"; />
+        <dc:creator>
+          <cc:Agent>
+            <dc:title>Patrick Strasser &lt;address@hidden&gt;</dc:title>
+          </cc:Agent>
+        </dc:creator>
+        <dc:description>Icon/Symbol for the GNURadio Companion</dc:description>
+        <dc:title>grc-icon.svg</dc:title>
+        <dc:date>2007-02-23</dc:date>
+      </cc:Work>
+      <cc:License
+         rdf:about="http://creativecommons.org/licenses/by-sa/2.5/";>
+        <cc:permits
+           rdf:resource="http://web.resource.org/cc/Reproduction"; />
+        <cc:permits
+           rdf:resource="http://web.resource.org/cc/Distribution"; />
+        <cc:requires
+           rdf:resource="http://web.resource.org/cc/Notice"; />
+        <cc:requires
+           rdf:resource="http://web.resource.org/cc/Attribution"; />
+        <cc:permits
+           rdf:resource="http://web.resource.org/cc/DerivativeWorks"; />
+        <cc:requires
+           rdf:resource="http://web.resource.org/cc/ShareAlike"; />
+      </cc:License>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Ebene 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-796.3622)">
+    <g
+       id="g7451"
+       transform="matrix(1.025628,0,0,1.030546,-0.101723,-32.00742)">
+      <path
+         id="rect2760"
+         d="M 4.1981031,916.37787 L 160.00074,916.37787 L 160.00074,1048.3467 
L 4.1981031,1048.3467 L 4.1981031,916.37787 z "
+         
style="fill:white;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:7.78145933;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
 />
+      <g
+         transform="matrix(0.995753,0,0,1.003897,164.8198,-8.972397)"
+         id="g2789"
+         style="stroke-width:8;stroke-miterlimit:4;stroke-dasharray:none">
+        <rect
+           
style="fill:url(#linearGradient2801);fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:7.78288651;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+           id="rect9020"
+           width="140.1604"
+           height="16.796082"
+           x="-145"
+           y="921.75818" />
+        <path
+           
style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:7.78288651;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+           d="M -161.50649,938.55428 L -4.8395996,938.55428"
+           id="path9005" />
+      </g>
+    </g>
+    <g
+       id="g5503"
+       transform="matrix(1.028571,0,0,1.172413,-5.14284,-137.9928)">
+      <rect
+         y="800.36212"
+         x="40"
+         height="116.00005"
+         width="140"
+         id="rect4562"
+         
style="fill:#f3c690;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:7.28504848;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
 />
+      <g
+         transform="matrix(0.921053,0,0,1,26.93956,1.859948)"
+         id="g3694">
+        <path
+           
style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:7.59084845;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+           d="M 44,820.3622 L 136.35974,820.3622"
+           id="path4564" />
+        <path
+           
style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:7.59084749;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+           d="M 80,811.74976 L 80,828.3622"
+           id="path5451" />
+      </g>
+      <g
+         id="g5499">
+        <rect
+           
style="fill:white;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:7.28504944;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+           id="rect7223"
+           width="140"
+           height="68.000015"
+           x="40"
+           y="848.36218" />
+        <path
+           
style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:7.28505039;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+           d="M 57.001362,905.90132 C 88.923615,905.8552 86.182775,867.89142 
95.399136,867.52563 C 104.60967,867.16008 113.73233,867.60291 
124.38688,868.00066 C 137.23411,868.48027 130.39915,906.48027 
162.99863,906.48027"
+           id="path7225"
+           sodipodi:nodetypes="czss" />
+      </g>
+    </g>
+    <rect
+       
style="fill:#b890f3;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:7.99999952;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect14319"
+       width="79.999992"
+       height="64.000023"
+       x="27.999992"
+       y="960.36249" />
+    <rect
+       
style="fill:#f3c690;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:7.99999905;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect15206"
+       width="24.000004"
+       height="24.000004"
+       x="108"
+       y="980.36218" />
+    <path
+       id="path13320"
+       
style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:7.99999666;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1"
+       d="M 220.97574,800.36203 L 220.97574,865.80513 C 236.42474,865.93437 
248.49884,861.19996 248.96304,854.45866 C 249.42721,847.71737 
237.26568,843.20829 221.81667,846.27676 C 206.36767,849.34522 
193.45938,858.02071 192.98843,867.61976 C 192.53101,876.94268 
204.68583,884.63729 220.13479,885.43882 C 235.58379,885.69443 
248.49884,880.72833 248.96304,873.98703 C 249.42721,867.24575 
237.26567,862.73666 221.81666,865.80513 C 206.36766,868.8736 
193.45939,877.54909 192.98843,887.14813 C 192.53101,896.47106 
204.68582,904.16566 220.13479,904.86701 C 235.5838,905.02246 
248.49885,900.05636 248.96305,893.31506 C 249.42722,886.57378 
237.26568,882.06469 221.81667,885.13316 C 206.36767,888.20162 
193.45939,896.87711 192.98844,906.47616 C 192.53102,915.79909 
204.68583,923.49369 220.13479,923.98015 C 235.58379,923.92069 
248.49884,918.95459 248.96304,912.21329 C 249.42721,905.47201 
237.26567,900.96293 221.81666,904.0314 C 206.36766,907.09986 
193.45939,915.77535 192.98843,925.37439 C 192.53101,934.69732 
207.20989,943.06708 221.81667,943.00644 L 221.81667,967.97713 C 
221.63716,982.45754 209.62079,992.36197 195.88792,992.36199 L 
132.42659,992.36199"
+       sodipodi:nodetypes="cccssscssscssscssccc" />
+  </g>
+</svg>

Added: grc/branches/grc_reloaded/data/grc-icon-32.png
===================================================================
(Binary files differ)


Property changes on: grc/branches/grc_reloaded/data/grc-icon-32.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: grc/branches/grc_reloaded/data/initial_flow_graph.grc.xml
===================================================================
--- grc/branches/grc_reloaded/data/initial_flow_graph.grc.xml                   
        (rev 0)
+++ grc/branches/grc_reloaded/data/initial_flow_graph.grc.xml   2008-01-31 
21:25:54 UTC (rev 7533)
@@ -0,0 +1,38 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<flow_graph>
+  <window_width>1600</window_width>
+  <window_height>1200</window_height>
+  <vars>
+    <var>
+      <key>samp_rate</key>
+      <value>100e3</value>
+      <min/>
+      <max/>
+      <step/>
+    </var>
+  </vars>
+  <signal_blocks>
+    <signal_block>
+      <tag>About</tag>
+      <id>About0</id>
+      <x_coordinate>20</x_coordinate>
+      <y_coordinate>20</y_coordinate>
+      <rotation>0</rotation>
+      <params>
+        <param>Default Flow Graph</param>
+        <param>Your Name</param>
+      </params>
+    </signal_block>
+    <signal_block>
+      <tag>Note</tag>
+      <id>Note0</id>
+      <x_coordinate>20</x_coordinate>
+      <y_coordinate>100</y_coordinate>
+      <rotation>0</rotation>
+      <params>
+        <param>Fill this flow graph</param>
+      </params>
+    </signal_block>
+  </signal_blocks>
+  <connections/>
+</flow_graph>

Added: grc/branches/grc_reloaded/data/preferences.grc.dtd
===================================================================
--- grc/branches/grc_reloaded/data/preferences.grc.dtd                          
(rev 0)
+++ grc/branches/grc_reloaded/data/preferences.grc.dtd  2008-01-31 21:25:54 UTC 
(rev 7533)
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<!-- 
+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 
+-->
+<!--
+       preferences.grc.dtd 
+       Josh Blum
+       The document type definitions for grc preferences.
+-->
+<!DOCTYPE preferences [
+       <!-- The preferences contains:
+               identifying information: time stamp, host name, version, 
+               and a list of preferences, each with their key/value pair.    
-->
+       <!ELEMENT preferences (timestamp?, hostname?, version?, prefs)>
+               <!ELEMENT timestamp (#PCDATA)>  <!-- The time stamp for the 
modification date. (optional) -->
+               <!ELEMENT hostname (#PCDATA)>   <!-- The hostname of the 
computer. (optional) -->
+               <!ELEMENT version (#PCDATA)>    <!-- The program and program 
version.  (optional) -->
+               <!ELEMENT prefs (pref*)>        <!-- The list of preferences. 
(tag required) -->
+                       <!ELEMENT pref (key, value)>    <!-- A pref. (0 or 
more) -->
+                               <!ELEMENT key (#PCDATA)>        <!-- The unique 
key of the preference. (tag required) -->
+                               <!ELEMENT value (#PCDATA)>      <!-- The value 
of the preference. (tag required) -->
+]>

Added: grc/branches/grc_reloaded/license/creative_commons_legal_code.txt
===================================================================
--- grc/branches/grc_reloaded/license/creative_commons_legal_code.txt           
                (rev 0)
+++ grc/branches/grc_reloaded/license/creative_commons_legal_code.txt   
2008-01-31 21:25:54 UTC (rev 7533)
@@ -0,0 +1,73 @@
+     CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL 
SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN ATTORNEY-CLIENT 
RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. 
CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE INFORMATION PROVIDED, AND 
DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM ITS USE. 
+
+License
+
+THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE 
COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY 
COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS 
AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
+
+BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE 
BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE 
CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE 
IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
+
+1. Definitions
+
+   1. "Adaptation" means a work based upon the Work, or upon the Work and 
other pre-existing works, such as a translation, adaptation, derivative work, 
arrangement of music or other alterations of a literary or artistic work, or 
phonogram or performance and includes cinematographic adaptations or any other 
form in which the Work may be recast, transformed, or adapted including in any 
form recognizably derived from the original, except that a work that 
constitutes a Collection will not be considered an Adaptation for the purpose 
of this License. For the avoidance of doubt, where the Work is a musical work, 
performance or phonogram, the synchronization of the Work in timed-relation 
with a moving image ("synching") will be considered an Adaptation for the 
purpose of this License.
+   2. "Collection" means a collection of literary or artistic works, such as 
encyclopedias and anthologies, or performances, phonograms or broadcasts, or 
other works or subject matter other than works listed in Section 1(f) below, 
which, by reason of the selection and arrangement of their contents, constitute 
intellectual creations, in which the Work is included in its entirety in 
unmodified form along with one or more other contributions, each constituting 
separate and independent works in themselves, which together are assembled into 
a collective whole. A work that constitutes a Collection will not be considered 
an Adaptation (as defined below) for the purposes of this License.
+   3. "Creative Commons Compatible License" means a license that is listed at 
http://creativecommons.org/compatiblelicenses that has been approved by 
Creative Commons as being essentially equivalent to this License, including, at 
a minimum, because that license: (i) contains terms that have the same purpose, 
meaning and effect as the License Elements of this License; and, (ii) 
explicitly permits the relicensing of adaptations of works made available under 
that license under this License or a Creative Commons jurisdiction license with 
the same License Elements as this License.
+   4. "Distribute" means to make available to the public the original and 
copies of the Work or Adaptation, as appropriate, through sale or other 
transfer of ownership.
+   5. "License Elements" means the following high-level license attributes as 
selected by Licensor and indicated in the title of this License: Attribution, 
ShareAlike.
+   6. "Licensor" means the individual, individuals, entity or entities that 
offer(s) the Work under the terms of this License.
+   7. "Original Author" means, in the case of a literary or artistic work, the 
individual, individuals, entity or entities who created the Work or if no 
individual or entity can be identified, the publisher; and in addition (i) in 
the case of a performance the actors, singers, musicians, dancers, and other 
persons who act, sing, deliver, declaim, play in, interpret or otherwise 
perform literary or artistic works or expressions of folklore; (ii) in the case 
of a phonogram the producer being the person or legal entity who first fixes 
the sounds of a performance or other sounds; and, (iii) in the case of 
broadcasts, the organization that transmits the broadcast.
+   8. "Work" means the literary and/or artistic work offered under the terms 
of this License including without limitation any production in the literary, 
scientific and artistic domain, whatever may be the mode or form of its 
expression including digital form, such as a book, pamphlet and other writing; 
a lecture, address, sermon or other work of the same nature; a dramatic or 
dramatico-musical work; a choreographic work or entertainment in dumb show; a 
musical composition with or without words; a cinematographic work to which are 
assimilated works expressed by a process analogous to cinematography; a work of 
drawing, painting, architecture, sculpture, engraving or lithography; a 
photographic work to which are assimilated works expressed by a process 
analogous to photography; a work of applied art; an illustration, map, plan, 
sketch or three-dimensional work relative to geography, topography, 
architecture or science; a performance; a broadcast; a phonogram; a compilation 
of data to the extent it is protected as a copyrightable work; or a work 
performed by a variety or circus performer to the extent it is not otherwise 
considered a literary or artistic work.
+   9. "You" means an individual or entity exercising rights under this License 
who has not previously violated the terms of this License with respect to the 
Work, or who has received express permission from the Licensor to exercise 
rights under this License despite a previous violation.
+  10. "Publicly Perform" means to perform public recitations of the Work and 
to communicate to the public those public recitations, by any means or process, 
including by wire or wireless means or public digital performances; to make 
available to the public Works in such a way that members of the public may 
access these Works from a place and at a place individually chosen by them; to 
perform the Work to the public by any means or process and the communication to 
the public of the performances of the Work, including by public digital 
performance; to broadcast and rebroadcast the Work by any means including 
signs, sounds or images.
+  11. "Reproduce" means to make copies of the Work by any means including 
without limitation by sound or visual recordings and the right of fixation and 
reproducing fixations of the Work, including storage of a protected performance 
or phonogram in digital form or other electronic medium.
+
+2. Fair Dealing Rights. Nothing in this License is intended to reduce, limit, 
or restrict any uses free from copyright or rights arising from limitations or 
exceptions that are provided for in connection with the copyright protection 
under copyright law or other applicable laws.
+
+3. License Grant. Subject to the terms and conditions of this License, 
Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual 
(for the duration of the applicable copyright) license to exercise the rights 
in the Work as stated below:
+
+   1. to Reproduce the Work, to incorporate the Work into one or more 
Collections, and to Reproduce the Work as incorporated in the Collections;
+   2. to create and Reproduce Adaptations provided that any such Adaptation, 
including any translation in any medium, takes reasonable steps to clearly 
label, demarcate or otherwise identify that changes were made to the original 
Work. For example, a translation could be marked "The original work was 
translated from English to Spanish," or a modification could indicate "The 
original work has been modified.";
+   3. to Distribute and Publicly Perform the Work including as incorporated in 
Collections; and,
+   4. to Distribute and Publicly Perform Adaptations.
+   5.
+
+      For the avoidance of doubt:
+         1. Non-waivable Compulsory License Schemes. In those jurisdictions in 
which the right to collect royalties through any statutory or compulsory 
licensing scheme cannot be waived, the Licensor reserves the exclusive right to 
collect such royalties for any exercise by You of the rights granted under this 
License;
+         2. Waivable Compulsory License Schemes. In those jurisdictions in 
which the right to collect royalties through any statutory or compulsory 
licensing scheme can be waived, the Licensor waives the exclusive right to 
collect such royalties for any exercise by You of the rights granted under this 
License; and,
+         3. Voluntary License Schemes. The Licensor waives the right to 
collect royalties, whether individually or, in the event that the Licensor is a 
member of a collecting society that administers voluntary licensing schemes, 
via that society, from any exercise by You of the rights granted under this 
License.
+
+The above rights may be exercised in all media and formats whether now known 
or hereafter devised. The above rights include the right to make such 
modifications as are technically necessary to exercise the rights in other 
media and formats. Subject to Section 8(f), all rights not expressly granted by 
Licensor are hereby reserved.
+
+4. Restrictions. The license granted in Section 3 above is expressly made 
subject to and limited by the following restrictions:
+
+   1. You may Distribute or Publicly Perform the Work only under the terms of 
this License. You must include a copy of, or the Uniform Resource Identifier 
(URI) for, this License with every copy of the Work You Distribute or Publicly 
Perform. You may not offer or impose any terms on the Work that restrict the 
terms of this License or the ability of the recipient of the Work to exercise 
the rights granted to that recipient under the terms of the License. You may 
not sublicense the Work. You must keep intact all notices that refer to this 
License and to the disclaimer of warranties with every copy of the Work You 
Distribute or Publicly Perform. When You Distribute or Publicly Perform the 
Work, You may not impose any effective technological measures on the Work that 
restrict the ability of a recipient of the Work from You to exercise the rights 
granted to that recipient under the terms of the License. This Section 4(a) 
applies to the Work as incorporated in a Collection, but this does not require 
the Collection apart from the Work itself to be made subject to the terms of 
this License. If You create a Collection, upon notice from any Licensor You 
must, to the extent practicable, remove from the Collection any credit as 
required by Section 4(c), as requested. If You create an Adaptation, upon 
notice from any Licensor You must, to the extent practicable, remove from the 
Adaptation any credit as required by Section 4(c), as requested.
+   2. You may Distribute or Publicly Perform an Adaptation only under the 
terms of: (i) this License; (ii) a later version of this License with the same 
License Elements as this License; (iii) a Creative Commons jurisdiction license 
(either this or a later license version) that contains the same License 
Elements as this License (e.g., Attribution-ShareAlike 3.0 US)); (iv) a 
Creative Commons Compatible License. If you license the Adaptation under one of 
the licenses mentioned in (iv), you must comply with the terms of that license. 
If you license the Adaptation under the terms of any of the licenses mentioned 
in (i), (ii) or (iii) (the "Applicable License"), you must comply with the 
terms of the Applicable License generally and the following provisions: (I) You 
must include a copy of, or the URI for, the Applicable License with every copy 
of each Adaptation You Distribute or Publicly Perform; (II) You may not offer 
or impose any terms on the Adaptation that restrict the terms of the Applicable 
License or the ability of the recipient of the Adaptation to exercise the 
rights granted to that recipient under the terms of the Applicable License; 
(III) You must keep intact all notices that refer to the Applicable License and 
to the disclaimer of warranties with every copy of the Work as included in the 
Adaptation You Distribute or Publicly Perform; (IV) when You Distribute or 
Publicly Perform the Adaptation, You may not impose any effective technological 
measures on the Adaptation that restrict the ability of a recipient of the 
Adaptation from You to exercise the rights granted to that recipient under the 
terms of the Applicable License. This Section 4(b) applies to the Adaptation as 
incorporated in a Collection, but this does not require the Collection apart 
from the Adaptation itself to be made subject to the terms of the Applicable 
License.
+   3. If You Distribute, or Publicly Perform the Work or any Adaptations or 
Collections, You must, unless a request has been made pursuant to Section 4(a), 
keep intact all copyright notices for the Work and provide, reasonable to the 
medium or means You are utilizing: (i) the name of the Original Author (or 
pseudonym, if applicable) if supplied, and/or if the Original Author and/or 
Licensor designate another party or parties (e.g., a sponsor institute, 
publishing entity, journal) for attribution ("Attribution Parties") in 
Licensor's copyright notice, terms of service or by other reasonable means, the 
name of such party or parties; (ii) the title of the Work if supplied; (iii) to 
the extent reasonably practicable, the URI, if any, that Licensor specifies to 
be associated with the Work, unless such URI does not refer to the copyright 
notice or licensing information for the Work; and (iv) , consistent with 
Ssection 3(b), in the case of an Adaptation, a credit identifying the use of 
the Work in the Adaptation (e.g., "French translation of the Work by Original 
Author," or "Screenplay based on original Work by Original Author"). The credit 
required by this Section 4(c) may be implemented in any reasonable manner; 
provided, however, that in the case of a Adaptation or Collection, at a minimum 
such credit will appear, if a credit for all contributing authors of the 
Adaptation or Collection appears, then as part of these credits and in a manner 
at least as prominent as the credits for the other contributing authors. For 
the avoidance of doubt, You may only use the credit required by this Section 
for the purpose of attribution in the manner set out above and, by exercising 
Your rights under this License, You may not implicitly or explicitly assert or 
imply any connection with, sponsorship or endorsement by the Original Author, 
Licensor and/or Attribution Parties, as appropriate, of You or Your use of the 
Work, without the separate, express prior written permission of the Original 
Author, Licensor and/or Attribution Parties.
+   4. Except as otherwise agreed in writing by the Licensor or as may be 
otherwise permitted by applicable law, if You Reproduce, Distribute or Publicly 
Perform the Work either by itself or as part of any Adaptations or Collections, 
You must not distort, mutilate, modify or take other derogatory action in 
relation to the Work which would be prejudicial to the Original Author's honor 
or reputation. Licensor agrees that in those jurisdictions (e.g. Japan), in 
which any exercise of the right granted in Section 3(b) of this License (the 
right to make Adaptations) would be deemed to be a distortion, mutilation, 
modification or other derogatory action prejudicial to the Original Author's 
honor and reputation, the Licensor will waive or not assert, as appropriate, 
this Section, to the fullest extent permitted by the applicable national law, 
to enable You to reasonably exercise Your right under Section 3(b) of this 
License (right to make Adaptations) but not otherwise.
+
+5. Representations, Warranties and Disclaimer
+
+UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS 
THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND 
CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, 
WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A 
PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, 
ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. 
SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH 
EXCLUSION MAY NOT APPLY TO YOU.
+
+6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, 
IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, 
INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS 
LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE 
POSSIBILITY OF SUCH DAMAGES.
+
+7. Termination
+
+   1. This License and the rights granted hereunder will terminate 
automatically upon any breach by You of the terms of this License. Individuals 
or entities who have received Adaptations or Collections from You under this 
License, however, will not have their licenses terminated provided such 
individuals or entities remain in full compliance with those licenses. Sections 
1, 2, 5, 6, 7, and 8 will survive any termination of this License.
+   2. Subject to the above terms and conditions, the license granted here is 
perpetual (for the duration of the applicable copyright in the Work). 
Notwithstanding the above, Licensor reserves the right to release the Work 
under different license terms or to stop distributing the Work at any time; 
provided, however that any such election will not serve to withdraw this 
License (or any other license that has been, or is required to be, granted 
under the terms of this License), and this License will continue in full force 
and effect unless terminated as stated above.
+
+8. Miscellaneous
+
+   1. Each time You Distribute or Publicly Perform the Work or a Collection, 
the Licensor offers to the recipient a license to the Work on the same terms 
and conditions as the license granted to You under this License.
+   2. Each time You Distribute or Publicly Perform an Adaptation, Licensor 
offers to the recipient a license to the original Work on the same terms and 
conditions as the license granted to You under this License.
+   3. If any provision of this License is invalid or unenforceable under 
applicable law, it shall not affect the validity or enforceability of the 
remainder of the terms of this License, and without further action by the 
parties to this agreement, such provision shall be reformed to the minimum 
extent necessary to make such provision valid and enforceable.
+   4. No term or provision of this License shall be deemed waived and no 
breach consented to unless such waiver or consent shall be in writing and 
signed by the party to be charged with such waiver or consent.
+   5. This License constitutes the entire agreement between the parties with 
respect to the Work licensed here. There are no understandings, agreements or 
representations with respect to the Work not specified here. Licensor shall not 
be bound by any additional provisions that may appear in any communication from 
You. This License may not be modified without the mutual written agreement of 
the Licensor and You.
+   6. The rights granted under, and the subject matter referenced, in this 
License were drafted utilizing the terminology of the Berne Convention for the 
Protection of Literary and Artistic Works (as amended on September 28, 1979), 
the Rome Convention of 1961, the WIPO Copyright Treaty of 1996, the WIPO 
Performances and Phonograms Treaty of 1996 and the Universal Copyright 
Convention (as revised on July 24, 1971). These rights and subject matter take 
effect in the relevant jurisdiction in which the License terms are sought to be 
enforced according to the corresponding provisions of the implementation of 
those treaty provisions in the applicable national law. If the standard suite 
of rights granted under applicable copyright law includes additional rights not 
granted under this License, such additional rights are deemed to be included in 
the License; this License is not intended to restrict the license of any rights 
under applicable law.
+
+    Creative Commons Notice
+
+    Creative Commons is not a party to this License, and makes no warranty 
whatsoever in connection with the Work. Creative Commons will not be liable to 
You or any party on any legal theory for any damages whatsoever, including 
without limitation any general, special, incidental or consequential damages 
arising in connection to this license. Notwithstanding the foregoing two (2) 
sentences, if Creative Commons has expressly identified itself as the Licensor 
hereunder, it shall have all rights and obligations of Licensor.
+
+    Except for the limited purpose of indicating to the public that the Work 
is licensed under the CCPL, Creative Commons does not authorize the use by 
either party of the trademark "Creative Commons" or any related trademark or 
logo of Creative Commons without the prior written consent of Creative Commons. 
Any permitted use will be in compliance with Creative Commons' then-current 
trademark usage guidelines, as may be published on its website or otherwise 
made available upon request from time to time. For the avoidance of doubt, this 
trademark restriction does not form part of the License.
+
+    Creative Commons may be contacted at http://creativecommons.org/.

Added: grc/branches/grc_reloaded/license/free_software_message.txt
===================================================================
--- grc/branches/grc_reloaded/license/free_software_message.txt                 
        (rev 0)
+++ grc/branches/grc_reloaded/license/free_software_message.txt 2008-01-31 
21:25:54 UTC (rev 7533)
@@ -0,0 +1,16 @@
+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
\ No newline at end of file

Added: grc/branches/grc_reloaded/license/gpl.txt
===================================================================
--- grc/branches/grc_reloaded/license/gpl.txt                           (rev 0)
+++ grc/branches/grc_reloaded/license/gpl.txt   2008-01-31 21:25:54 UTC (rev 
7533)
@@ -0,0 +1,340 @@
+                   GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                   GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                           NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
+
+           How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program 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.
+
+    This program 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
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.

Added: grc/branches/grc_reloaded/notes/clean.sh
===================================================================
--- grc/branches/grc_reloaded/notes/clean.sh                            (rev 0)
+++ grc/branches/grc_reloaded/notes/clean.sh    2008-01-31 21:25:54 UTC (rev 
7533)
@@ -0,0 +1,7 @@
+#!/bin/bash
+#clean up compliled python files, and temporary files from editing
+cd ..
+pwd
+rm -rf `find ./ -type f -name "*.pyc"`
+rm -rf `find ./ -type f -name "*.py~"`
+rm -rf `find ./ -type f -name "*.bak"`


Property changes on: grc/branches/grc_reloaded/notes/clean.sh
___________________________________________________________________
Name: svn:executable
   + *

Added: grc/branches/grc_reloaded/notes/programming_style.txt
===================================================================
--- grc/branches/grc_reloaded/notes/programming_style.txt                       
        (rev 0)
+++ grc/branches/grc_reloaded/notes/programming_style.txt       2008-01-31 
21:25:54 UTC (rev 7533)
@@ -0,0 +1,27 @@
+Programming Style
+
+1) Indentation:
+       Python dependends on correct indentation levels.
+       A tab character equals a single indentation level.
+       Most editors can display a tab as a user-defined width or number of 
spaces.
+       The expand command can convert a file with tab indentations to a file 
with space indentation. 
+       
+2) Naming Conventions:
+       CamelCaseNames for files and classes.   
+       UPPER_CASE_NAMES for constants.
+       lower_case_names for public methods and all variables.
+       _underscored_lower_case_names for private methods.
+
+3) Documentation:
+       Source code follows the doxygen/javadoc conventions (and will be parsed 
by doxygen).
+       Files begin with a ##comment block, a package name, brief description, 
and author.
+       Constants follow a ##comment line.
+       All methods and classes require docstrings.
+       Docstrings with javadoc style entries need a leading "!".   
+
+4) Blank Lines:
+       Separate all classes and methods with a blank line.
+       Group related constants and separate unrelated constants with a blank 
line.
+       Leave 2 blank lines at the end of every file.
+       
+       
\ No newline at end of file

Added: grc/branches/grc_reloaded/notes/release_notes.txt
===================================================================
--- grc/branches/grc_reloaded/notes/release_notes.txt                           
(rev 0)
+++ grc/branches/grc_reloaded/notes/release_notes.txt   2008-01-31 21:25:54 UTC 
(rev 7533)
@@ -0,0 +1,10 @@
+This release: PENDING
+
+Last release: GRC 0.69, September 19th 2007
+
+Compatibility: 
+       gnuradio trunk rxxxx and subsequent revisions within a reasonable 
time-period
+       gnuradio 3.1 branch
+
+Fixes and New Features:
+       -multilple scope channels

Added: grc/branches/grc_reloaded/notes/todo.txt
===================================================================
--- grc/branches/grc_reloaded/notes/todo.txt                            (rev 0)
+++ grc/branches/grc_reloaded/notes/todo.txt    2008-01-31 21:25:54 UTC (rev 
7533)
@@ -0,0 +1,55 @@
+############ Arbitration of Data Types: #############
+Variable bus widths with upper and lower to handle 
+       floats, vectored floats
+       integers, vectored integers
+       fixed point numbers, and vectored
+
+############   Blocks to Add:  ####################
+-ofdm (blks2)
+-cpm (blks2)
+-filterbank (blks2)
+-usrp quad souce, set z == 1 to ignore Q inputs 
+
+############   Known Problems: ####################
+-packet threads block on close
+-core abort with bad params to filter functions
+-blocks need to fix themselves when they go out of bounds, like in a resize
+-socket controllers should be intelligent on shrinkage
+-usrp transmit dies in lock/unlock
+-audio dies lock/unlock
+
+############   Features to Add:        ####################
+-startup tips
+-math expr from file
+-save working directory after close
+-create sub-flow graphs to be used in larger flow graphs
+-include dtd in saved flow graphs
+-fm demod example with expansion of wfm_recv block
+
+############   wxPython Features:      ####################
+-dump wx running graph to png?
+-scroll box for graphs
+-dropdowns in wx graphics, for variable settings
+                 self.scaling_chooser = wx.Choice(self, -1, choices=['Linear 
Hz', 'Logarithmic Hz', 'LogHz'])
+        self.scaling_chooser.SetSelection(0) #default is linear hz
+        self.Bind(wx.EVT_CHOICE, self.scale, self.scaling_chooser)
+        selection = event.GetSelection()
+
+############   User Prefs:     ####################
+--save scrollbar positions (hidden pref)
+
+############   Uninteresting Features: ####################
+-add the concept of a current working directory
+-auto param to usrp diagnose dialog
+-use popen3 once it works in cygwin
+-arrow like images for socket, to replace in/out strings
+-min/max in DataTypes can be other data types
+-press enter to close params
+
+############   Get GTK Stock IDs:      ####################
+gtk.stock_list_ids()
+
+############   connect packet mod to demod:    ####################    
+gr.packed_to_unpacked_bb(self.bits_per_symbol(), gr.GR_MSB_FIRST)
+gr.unpack_k_bits_bb(self.bits_per_symbol())
+       
\ No newline at end of file

Added: grc/branches/grc_reloaded/notes/todo_new.txt
===================================================================
--- grc/branches/grc_reloaded/notes/todo_new.txt                                
(rev 0)
+++ grc/branches/grc_reloaded/notes/todo_new.txt        2008-01-31 21:25:54 UTC 
(rev 7533)
@@ -0,0 +1,7 @@
+variable block in common with range and stuff
+move all to gui folder
+make graphical element for graphical elements to inherit
+
+---features for when things work---
+copy and paste blocks
+enter hotkey for params dialog

Added: grc/branches/grc_reloaded/readme.txt
===================================================================
--- grc/branches/grc_reloaded/readme.txt                                (rev 0)
+++ grc/branches/grc_reloaded/readme.txt        2008-01-31 21:25:54 UTC (rev 
7533)
@@ -0,0 +1,14 @@
+Hello!
+
+Thank you for downloading GNU Radio Companion.
+This program is free software. 
+A GPL license is distributed with this program.
+This license covers all the source code/python files. 
+You will also find a "creative common license" for the grc icon.
+
+Intructions for GRC are available at:
+http://gnuradio.org/trac/wiki/GNURadioCompanion
+
+If you have questions, problems, suggestions, or want to contribute,
+please email me at jblum at jhu dot edu
+

Added: grc/branches/grc_reloaded/src/grc/ActionHandler.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/ActionHandler.py                          
(rev 0)
+++ grc/branches/grc_reloaded/src/grc/ActionHandler.py  2008-01-31 21:25:54 UTC 
(rev 7533)
@@ -0,0 +1,386 @@
+"""
+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 ActionHandler
+#ActionHandler builds the interface and handles most of the user inputs.       
        
address@hidden Josh Blum
+
+import os, sys
+from Constants import *
+from Actions import *
+import pygtk
+pygtk.require('2.0')
+import gtk
+import Graphics
+import Preferences
+from threading import Thread
+import Messages
+import ParseXML
+import random
+
+class ActionHandler:
+       """
+       The action handler will setup all the major window components,
+       and handle button presses and flow graph operations from the GUI.
+       """
+       
+       def __init__(self, file_paths): 
+               """!
+               ActionHandler constructor.
+               Create the main window, setup the message handler, import the 
preferences, 
+               and connect all of the action handlers. Finally, enter the gtk 
main loop and block.
+               @param file_paths a list of flow graph file passed from command 
line            
+               """                             
+               if PY_GTK_ICON: 
gtk.window_set_default_icon_from_file(PY_GTK_ICON)
+               for action in ACTIONS_LIST: action.connect('activate', 
self._handle_actions)
+               #setup the main window
+               self.main_window = Graphics.MainWindow(self.handle_states)
+               self.main_window.connect('delete_event', self._quit)
+               self.main_window.connect('key_press_event', 
self._handle_key_press)
+               self.get_flow_graph = self.main_window.get_flow_graph
+               self.get_page = self.main_window.get_page
+               #setup the messages
+               Messages.register_messenger(self.main_window.add_report_line)
+               Messages.register_messenger(sys.stdout.write)
+               Messages.send_init()
+               #flow graph settings    
+               Preferences.load(self.main_window)      
+               self.init_file_paths = file_paths
+               self.handle_states(APPLICATION_INITIALIZE)
+               #enter the mainloop             
+               gtk.gdk.threads_init()
+               gtk.gdk.threads_enter()
+               gtk.main()
+               gtk.gdk.threads_leave()         
+               
+       def _handle_key_press(self, widget, event):
+               """
+               Handle key presses from the keyboard.           
+               Translate key combos into actions.      
+               Key combinations that do not include special keys, such as ctrl 
or Fcn*,
+               Also, require that the flow graph has mouse focus when choosing 
to handle keys.
+               @return true if the flow graph is in active use
+               """
+               keyname = gtk.gdk.keyval_name(event.keyval)
+               #print 'Key "%s" (%d) was pressed' % (keyname, event.keyval)
+               #if event.state & gtk.gdk.CONTROL_MASK: print "Control was 
being held down"
+               #if event.state & gtk.gdk.MOD1_MASK: print "Alt was being held 
down"
+               #if event.state & gtk.gdk.SHIFT_MASK: print "Shift was being 
held down"         
+               ####################    save/open/new/undo/redo 
############################### 
+               if event.state & gtk.gdk.CONTROL_MASK and keyname == 's':
+                       self.handle_states(FLOW_GRAPH_SAVE)
+               elif event.state & gtk.gdk.CONTROL_MASK and keyname == 'z':
+                       self.handle_states(FLOW_GRAPH_UNDO)
+               elif event.state & gtk.gdk.CONTROL_MASK and (keyname in ('y', 
'Z')):
+                       self.handle_states(FLOW_GRAPH_REDO)
+               elif event.state & gtk.gdk.CONTROL_MASK and keyname == 'o':
+                       self.handle_states(FLOW_GRAPH_OPEN)
+               elif event.state & gtk.gdk.CONTROL_MASK and keyname == 'n':
+                       self.handle_states(FLOW_GRAPH_NEW)
+               ####################    Delete  ###############################
+               elif self.get_flow_graph().get_focus_flag() and keyname == 
'Delete':    #mouse focus
+                       self.handle_states(ELEMENT_DELETE)
+               ####################    Rotate  ###############################
+               elif self.get_flow_graph().get_focus_flag() and keyname == 
'Right': #mouse focus
+                       self.handle_states(SIGNAL_BLOCK_ROTATE_RIGHT)
+               elif self.get_flow_graph().get_focus_flag() and keyname == 
'Left': #mouse focus
+                       self.handle_states(SIGNAL_BLOCK_ROTATE_LEFT)
+               ####################    Data Type       
###############################
+               elif self.get_flow_graph().get_focus_flag() and keyname == 
'Down': #mouse focus
+                       self.handle_states(SIGNAL_BLOCK_INC_TYPE)
+               elif self.get_flow_graph().get_focus_flag() and keyname == 
'Up': #mouse focus
+                       self.handle_states(SIGNAL_BLOCK_DEC_TYPE)
+               ####################    Socket Controllers      
###############################         
+               elif self.get_flow_graph().get_focus_flag() and keyname in 
('equal','plus', 'KP_Add'): #mouse focus
+                       self.handle_states(SOCKET_CONTROLLER_INC)
+               elif self.get_flow_graph().get_focus_flag() and keyname in 
('minus', 'KP_Subtract'): #mouse focus
+                       self.handle_states(SOCKET_CONTROLLER_DEC)               
+               ####################    Exec/Stop/Print 
###############################
+               elif keyname == 'F5':
+                       self.handle_states(FLOW_GRAPH_EXEC)
+               elif keyname == 'F7':
+                       self.handle_states(FLOW_GRAPH_STOP)
+               elif keyname == 'Print':
+                       self.handle_states(FLOW_GRAPH_SCREEN_CAPTURE)
+               #propagate this if the fg is not in focus or nothing is selected
+               return self.get_flow_graph().get_focus_flag() and 
self.get_flow_graph().is_selected()
+        
+       def _quit(self, window, event):
+               """!
+               Handle the delete event from the main window.
+               Generated by pressing X to close, alt+f4, or right click+close. 
+               This method in turns calls the state handler to quit.
+               @return true            
+               """
+               self.handle_states(APPLICATION_QUIT)
+               return True     
+       
+       def _handle_actions(self, event):               
+               """
+               Handle all of the activate signals from the gtk actions. 
+               The action signals derive from clicking on a    toolbar or menu 
bar button. 
+               Forward the action to the state handler.
+               """
+               self.handle_states(event.get_name())            
+               
+       def handle_states(self, state=''):
+               """!
+               Handle the state changes in the GUI.            
+               Handle all of the state changes that arise from the action 
handler or other Graphics and 
+               inputs in the application. The state passed to the 
handle_states method is a string descriping 
+               the change. A series of if/elif statements handle the state by 
greying out action buttons, causing 
+               changes in the flow graph, saving/opening files...      The 
handle_states method is passed to the
+               contructors of many of the classes used in this application 
enabling them to report any state change.
+               @param state a string describing the state change
+               """
+               
##############################################################################################
+               #       Initalize/Quit
+               
##############################################################################################
+               if state == APPLICATION_INITIALIZE:     
+                       for action in ACTIONS_LIST: action.set_sensitive(False) 
#set all actions disabled
+                       # enable a select few actions 
+                       Graphics.enable_usrp_diagnostics()      #try to enable 
usrp diagnostics
+                       for action in (
+                               APPLICATION_QUIT, FLOW_GRAPH_NEW, 
FLOW_GRAPH_OPEN, FLOW_GRAPH_SAVE_AS, FLOW_GRAPH_CLOSE,
+                               ABOUT_WINDOW_DISPLAY, 
DATA_TYPES_WINDOW_DISPLAY, HOTKEYS_WINDOW_DISPLAY, MATH_EXPR_WINDOW_DISPLAY,
+                               FLOW_GRAPH_WINDOW_RESIZE, PREFS_WINDOW_DISPLAY, 
FLOW_GRAPH_SCREEN_CAPTURE,
+                       ): get_action_from_name(action).set_sensitive(True)     
        
+                       if not self.init_file_paths and 
Preferences.restore_files(): self.init_file_paths = Preferences.files_open()
+                       if not self.init_file_paths: self.init_file_paths = ['']
+                       for file_path in self.init_file_paths: 
self.main_window.new_page(file_path) #load pages from file paths
+                       if not self.get_page(): self.main_window.new_page() 
#ensure that at least a blank page exists
+               elif state == APPLICATION_QUIT:
+                       if self.main_window.close_pages():
+                               Preferences.save(self.main_window)
+                               gtk.main_quit()
+                               exit(0)
+               
##############################################################################################
+               #       Selections
+               
##############################################################################################
+               elif state == SIGNAL_BLOCK_SELECT or state == SOCKET_SELECT:
+                       for action in (ELEMENT_DELETE, 
SIGNAL_BLOCK_PARAM_MODIFY, SIGNAL_BLOCK_ROTATE_RIGHT, 
SIGNAL_BLOCK_ROTATE_LEFT): 
+                               get_action_from_name(action).set_sensitive(True)
+               elif state == CONNECTION_SELECT:
+                       get_action_from_name(ELEMENT_DELETE).set_sensitive(True)
+                       for action in (SIGNAL_BLOCK_PARAM_MODIFY, 
SIGNAL_BLOCK_ROTATE_RIGHT, SIGNAL_BLOCK_ROTATE_LEFT): 
+                               
get_action_from_name(action).set_sensitive(False)
+               elif state == NOTHING_SELECT:
+                       for action in (ELEMENT_DELETE, 
SIGNAL_BLOCK_PARAM_MODIFY, SIGNAL_BLOCK_ROTATE_RIGHT, 
SIGNAL_BLOCK_ROTATE_LEFT): 
+                               
get_action_from_name(action).set_sensitive(False)
+                       self.get_flow_graph().unselect()
+               
##############################################################################################
+               #       Move/Rotate/Delete/Create
+               
##############################################################################################
          
+               elif state == SIGNAL_BLOCK_MOVE:                        
+                       
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().to_nested_data())
+                       self.get_page().set_saved(False)
+               elif state == SIGNAL_BLOCK_ROTATE_LEFT:
+                       if self.get_flow_graph().rotate_selected(DIR_LEFT):     
                        
+                               
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().to_nested_data())
        
+                               self.get_page().set_saved(False)                
+               elif state == SIGNAL_BLOCK_ROTATE_RIGHT:
+                       if self.get_flow_graph().rotate_selected(DIR_RIGHT):    
                        
+                               
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().to_nested_data())
        
+                               self.get_page().set_saved(False)                
+               elif state == ELEMENT_DELETE:
+                       if self.get_flow_graph().delete_selected():             
                
+                               
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().to_nested_data())
                                
+                               self.handle_states(NOTHING_SELECT)
+                               self.get_page().set_saved(False)
+               elif state == CONNECTION_CREATE or state == 
SIGNAL_BLOCK_CREATE:                        
+                       
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().to_nested_data())
+                       self.handle_states(NOTHING_SELECT)      
+                       self.get_page().set_saved(False)
+               elif state == SIGNAL_BLOCK_INC_TYPE:
+                       if 
self.get_flow_graph().type_controller_modify_selected(1):
+                               
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().to_nested_data())
        
+                               self.get_page().set_saved(False)
+               elif state == SIGNAL_BLOCK_DEC_TYPE:
+                       if 
self.get_flow_graph().type_controller_modify_selected(-1):
+                               
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().to_nested_data())
        
+                               self.get_page().set_saved(False)        
+               elif state == SOCKET_CONTROLLER_INC:
+                       if 
self.get_flow_graph().socket_controller_modify_selected(1):
+                               
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().to_nested_data())
        
+                               self.get_page().set_saved(False)
+               elif state == SOCKET_CONTROLLER_DEC:
+                       if 
self.get_flow_graph().socket_controller_modify_selected(-1):
+                               
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().to_nested_data())
        
+                               self.get_page().set_saved(False)                
+               
##############################################################################################
+               #       Window stuff
+               
##############################################################################################
+               elif state == USRP_DIAGNOSTICS_DISPLAY:
+                       Graphics.USRPDiagnosticsDialog()                
+               elif state == PREFS_WINDOW_DISPLAY:
+                       Graphics.PreferencesDialog()
+                       self.get_flow_graph().update()
+               elif state == ABOUT_WINDOW_DISPLAY:
+                       Graphics.AboutDialog()
+               elif state == DATA_TYPES_WINDOW_DISPLAY:
+                       Graphics.DataTypesDialog()
+               elif state == HOTKEYS_WINDOW_DISPLAY:
+                       Graphics.HotKeysDialog()
+               elif state == MATH_EXPR_WINDOW_DISPLAY:
+                       Graphics.MathExprDialog()
+               elif state == FLOW_GRAPH_WINDOW_RESIZE:
+                       dimensions = 
Graphics.FlowGraphWindowSizeDialog(self.get_flow_graph().get_size_request()).run()
+                       if dimensions:
+                               
self.get_flow_graph().set_size_request(*dimensions)
+                               
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().to_nested_data())
                                        
+                               self.get_page().set_saved(False)
+               
##############################################################################################
+               #       Variable and Param Modifications
+               
##############################################################################################
+               elif state == SIGNAL_BLOCK_PARAM_MODIFY:
+                       if self.get_flow_graph().param_modify_selected():
+                               
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().to_nested_data())
        
+                               self.get_page().set_saved(False)                
+               elif state == VARIABLE_MODIFY:
+                       
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().to_nested_data())
        
+                       self.get_page().set_saved(False)        
+                       self.get_flow_graph().update()
+               elif state == VARIABLE_REORDER:
+                       
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().to_nested_data())
        
+                       self.get_page().set_saved(False)        
+               
##############################################################################################
+               #       Undo/Redo
+               
##############################################################################################
+               elif state == FLOW_GRAPH_UNDO:          
+                       nested_data = 
self.get_page().get_state_cache().get_prev_state()
+                       if nested_data  != None:                
+                               self.handle_states(NOTHING_SELECT)
+                               
self.get_flow_graph().from_nested_data(nested_data)
+                               self.get_page().set_saved(False)
+               elif state == FLOW_GRAPH_REDO:                                  
        
+                       nested_data = 
self.get_page().get_state_cache().get_next_state()
+                       if nested_data  != None:                
+                               self.handle_states(NOTHING_SELECT)
+                               
self.get_flow_graph().from_nested_data(nested_data)
+                               self.get_page().set_saved(False)
+               
##############################################################################################
+               #       New/Open/Save/Close
+               
##############################################################################################
+               elif state == FLOW_GRAPH_NEW:
+                       self.main_window.new_page()
+               elif state == FLOW_GRAPH_OPEN:
+                       file_path = 
Graphics.OpenFlowGraphFileDialog(self.get_flow_graph() and 
self.get_page().get_file_path() or '').run()
+                       if file_path != None: 
self.main_window.new_page(file_path, manual_open=True)
+               elif state == FLOW_GRAPH_CLOSE:
+                       self.main_window.close_page()           
+               elif state == FLOW_GRAPH_SAVE:
+                       if not self.get_page().get_file_path(): 
self.handle_states(FLOW_GRAPH_SAVE_AS)
+                       else:
+                               try:
+                                       
ParseXML.to_file(ParseXML.to_xml(self.get_flow_graph().to_nested_data()), 
self.get_page().get_file_path())
+                                       self.get_page().set_saved(True)         
+                               except IOError: 
+                                       
Messages.send_fail_save(self.get_page().get_file_path())
+                                       self.get_page().set_saved(False)
+               elif state == FLOW_GRAPH_SAVE_AS:
+                       file_path = 
Graphics.SaveFlowGraphFileDialog(self.get_page().get_file_path()).run()
+                       if file_path != None:                   
+                               self.get_page().set_file_path(file_path)
+                               self.handle_states(FLOW_GRAPH_SAVE)     
+               elif state == FLOW_GRAPH_SCREEN_CAPTURE:
+                       file_path = 
Graphics.SaveImageFileDialog(self.get_page().get_file_path()).run()
+                       if file_path != None: 
+                               pixmap = self.get_flow_graph().pixmap
+                               width, height = pixmap.get_size()
+                               pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, 
0, 8, width, height)
+                               pixbuf.get_from_drawable(pixmap, 
pixmap.get_colormap(), 0, 0, 0, 0, width, height)
+                               pixbuf.save(file_path, 
IMAGE_FILE_EXTENSION[1:])                                                
+               
##############################################################################################
+               #       Run/Stop
+               
##############################################################################################
          
+               elif state == FLOW_GRAPH_EXEC:
+                       if not self.get_page().get_pid_file():
+                               if not self.get_page().get_saved() or not 
self.get_page().get_file_path(): 
+                                       self.handle_states(FLOW_GRAPH_SAVE) 
#only save if file path missing or not saved
+                               if self.get_page().get_saved() and 
self.get_page().get_file_path(): 
+                                       ExecFlowGraphThread(self)       #only 
exec if file path and saved
+               elif state == FLOW_GRAPH_STOP:
+                       if self.get_page().get_pid_file(): 
+                               try: 
os.kill(int(open(self.get_page().get_pid_file(), 'r').read()), 9)
+                               except: print "could not kill pid file: 
%s"%self.get_page().get_pid_file()
+               elif state == '': #pass and run the global actions
+                       pass
+               else: print '!!! State "%s" not handled !!!'%state
+               
##############################################################################################
+               #       Global Actions for all States
+               
##############################################################################################
+               #set the exec button if the flow graph is valid and is not 
already running
+               self.update_exec_stop()
+               #saved status           
+               get_action_from_name(FLOW_GRAPH_SAVE).set_sensitive(not 
self.get_page().get_saved())
+               self.main_window.update()                               
+
+       def update_exec_stop(self):
+               """
+               Update the exec and stop buttons.
+               Lock and unlock the mutex for race conditions with exec flow 
graph threads.
+               """
+               MUTEX.lock()
+               
get_action_from_name(FLOW_GRAPH_EXEC).set_sensitive(self.get_flow_graph().is_valid()
 and not self.get_page().get_pid_file())
+               
get_action_from_name(FLOW_GRAPH_STOP).set_sensitive(self.get_page().get_pid_file()
 != '')       
+               MUTEX.unlock()
+                       
+class ExecFlowGraphThread(Thread):
+       """Execute the flow graph as a new process and wait on it to finish."""
+       def __init__ (self, action_handler):
+               """!
+               ExecFlowGraphThread constructor.
+               @param action_handler an instance of an ActionHandler
+               """
+               Thread.__init__(self)
+               self.update_exec_stop = action_handler.update_exec_stop
+               self.flow_graph = action_handler.get_flow_graph()
+               #store page and dont use main window calls in run
+               self.page = action_handler.get_page()
+               #random id so multiple flow graphs can run w/o files 
intersecting
+               rand_id = random.randint(10000, 99999) 
+               #set files              
+               self.file_path = self.page.get_file_path()
+               self.report_file = '/tmp/grc-%d-%d.report'%(os.getpid(), 
rand_id)
+               self.pid_file = '/tmp/grc-%d-%d.pid'%(os.getpid(), rand_id)     
        
+               self.page.set_pid_file(self.pid_file)
+               self.update_exec_stop()
+               Messages.send_start_exec(self.page.get_file_path())
+               self.start()
+               
+       def run(self):  
+               """Execute the flow graph."""
+               cmd = '%s "%s" --pid_file="%s" 2> "%s"'%(
+                       DEFAULT_FLOW_GRAPH_EXEC, 
+                       self.file_path, 
+                       self.pid_file, 
+                       self.report_file,
+               )
+               os.system(cmd)  
+               try:                                            
+                       report = open(self.report_file, 'r')    
+                       #       read all the lines of the report file into a 
list       #
+                       Messages.send_end_exec(report.readlines())
+                       report.close()  
+                       os.remove(self.report_file)
+               except IOError: print "could not read report file: 
%s"%self.report_file
+               try: os.remove(self.pid_file)
+               except: print "could not remove pid file: %s"%self.pid_file
+               self.page.set_pid_file('')
+               self.update_exec_stop()
+               

Added: grc/branches/grc_reloaded/src/grc/Actions.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/Actions.py                                
(rev 0)
+++ grc/branches/grc_reloaded/src/grc/Actions.py        2008-01-31 21:25:54 UTC 
(rev 7533)
@@ -0,0 +1,120 @@
+"""
+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 Actions
+#Global actions for gui elements to communicate state changes to the action 
handler.           
address@hidden Josh Blum
+
+import pygtk
+pygtk.require('2.0')
+import gtk
+
+######################################################################################################
+#      states
+######################################################################################################
+
+APPLICATION_INITIALIZE = 'app init'
+APPLICATION_QUIT = 'app quit'
+
+SOCKET_SELECT = 'socket select'
+
+NOTHING_SELECT = 'nothing select'
+
+PARAM_MODIFY = 'param modify'
+
+SIGNAL_BLOCK_SELECT = 'signal block select'
+SIGNAL_BLOCK_MOVE = 'signal block move'
+SIGNAL_BLOCK_ROTATE_LEFT = 'signal block rotate left'
+SIGNAL_BLOCK_ROTATE_RIGHT = 'signal block rotate right'
+SIGNAL_BLOCK_CREATE = 'signal block create'
+SIGNAL_BLOCK_PARAM_MODIFY = 'signal block param modify'
+SIGNAL_BLOCK_INC_TYPE = 'signal block increment type'
+SIGNAL_BLOCK_DEC_TYPE = 'signal block decrement type'
+
+SOCKET_CONTROLLER_INC = 'socket controller increment'
+SOCKET_CONTROLLER_DEC = 'socket controller decrement'
+
+CONNECTION_SELECT = 'connection select'
+CONNECTION_CREATE = 'conection create'
+ELEMENT_DELETE = 'element delete'
+
+VARIABLE_MODIFY = 'variable modify'
+VARIABLE_REORDER = 'variable reorder'
+
+FLOW_GRAPH_OPEN = 'flow graph open'
+FLOW_GRAPH_UNDO = 'flow graph undo'
+FLOW_GRAPH_REDO = 'flow graph redo'
+FLOW_GRAPH_SAVE = 'flow graph save'
+FLOW_GRAPH_SAVE_AS = 'flow graph save as'
+FLOW_GRAPH_CLOSE = 'flow graph close'
+FLOW_GRAPH_NEW = 'flow graph new'
+FLOW_GRAPH_WINDOW_RESIZE = 'flow graph window resize'
+FLOW_GRAPH_EXEC = 'flow graph exec'
+FLOW_GRAPH_STOP = 'flow graph stop'
+FLOW_GRAPH_SCREEN_CAPTURE = 'flow graph screen capture'
+
+ABOUT_WINDOW_DISPLAY = 'about window display'
+DATA_TYPES_WINDOW_DISPLAY = 'data types window display'
+HOTKEYS_WINDOW_DISPLAY = 'hotkeys window display'
+USRP_DIAGNOSTICS_DISPLAY = 'usrp diagnostics display'
+PREFS_WINDOW_DISPLAY = 'prefs window display'
+MATH_EXPR_WINDOW_DISPLAY = 'expression window display'
+
+######################################################################################################
+#      actions
+######################################################################################################
+
+ACTIONS_LIST = (
+       gtk.Action(FLOW_GRAPH_NEW, '_New', 'Create a new flow graph', 
'gtk-new'),
+       gtk.Action(FLOW_GRAPH_OPEN, '_Open', 'Open a flow graph from file', 
'gtk-open'),
+       gtk.Action(FLOW_GRAPH_SAVE, '_Save', 'Save this flow graph', 
'gtk-save'),
+       gtk.Action(FLOW_GRAPH_SAVE_AS, 'Save _As', 'Save the open flow graph 
as...', 'gtk-save-as'),
+       gtk.Action(FLOW_GRAPH_CLOSE, '_Close', 'Close the open flow graph', 
'gtk-close'),
+       gtk.Action(APPLICATION_QUIT, '_Quit', 'Quit program', 'gtk-quit'),
+       gtk.Action(FLOW_GRAPH_UNDO, '_Undo', 'Undo a change to the flow graph', 
'gtk-undo'),
+       gtk.Action(FLOW_GRAPH_REDO, '_Redo', 'Redo a change to the flow graph', 
'gtk-redo'),
+       gtk.Action(ELEMENT_DELETE, '_Delete', 'Delete the selected signal 
block', 'gtk-delete'),
+       gtk.Action(SIGNAL_BLOCK_ROTATE_LEFT, 'Rotate _Left', 'Rotate the signal 
block 90 degrees', 'gtk-go-back'),
+       gtk.Action(SIGNAL_BLOCK_ROTATE_RIGHT, 'Rotate _Right', 'Rotate the 
signal block -90 degrees', 'gtk-go-forward'),
+       gtk.Action(SIGNAL_BLOCK_PARAM_MODIFY, '_Properties', 'Modify params for 
the selected signal block', 'gtk-properties'),
+       gtk.Action(FLOW_GRAPH_WINDOW_RESIZE, '_Window Size', 'Set the window 
size', 'gtk-edit'),
+       gtk.Action(USRP_DIAGNOSTICS_DISPLAY, '_USRP Diagnostics', 'Analyze the 
USRP', 'gtk-dialog-info'),
+       gtk.Action(PREFS_WINDOW_DISPLAY, '_Preferences', 'Configure 
Preferences', 'gtk-preferences'),
+       gtk.Action(ABOUT_WINDOW_DISPLAY, '_About', 'About this program', 
'gtk-about'),
+       gtk.Action(DATA_TYPES_WINDOW_DISPLAY, '_Data Types', 'Data Types', 
'gtk-connect'),
+       gtk.Action(HOTKEYS_WINDOW_DISPLAY, '_HotKeys', 'Hot Keys', 'gtk-info'),
+       gtk.Action(MATH_EXPR_WINDOW_DISPLAY, '_Math Expressions', 'Mathematical 
Expressions', 'gtk-convert'),
+       gtk.Action(FLOW_GRAPH_EXEC, '_Execute', 'Execute the flow graph', 
'gtk-execute'),
+       gtk.Action(FLOW_GRAPH_STOP, '_Stop', 'Stop the flow graph', 'gtk-stop'),
+       gtk.Action(FLOW_GRAPH_SCREEN_CAPTURE, 'S_creen Capture', 'Create a 
screen capture of the flow graph', 'gtk-print'),
+)
+
+ACTIONS_DICT = dict((action.get_name(), action) for action in ACTIONS_LIST)
+                                       
+def get_action_from_name(action_name): 
+       """!
+       Retrieve the action from the action list.
+       Search the list and find an action with said name.
+       @param action_name the action name(string)
+       @throw KeyError bad action name
+       @return a gtk action object
+       """     
+       if ACTIONS_DICT.has_key(action_name): return ACTIONS_DICT[action_name]
+       raise KeyError('Action Name: "%s" does not exist'%action_name)
+       
+       
\ No newline at end of file

Added: grc/branches/grc_reloaded/src/grc/Colors.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/Colors.py                         (rev 0)
+++ grc/branches/grc_reloaded/src/grc/Colors.py 2008-01-31 21:25:54 UTC (rev 
7533)
@@ -0,0 +1,61 @@
+"""
+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 Colors
+#Colors and color-specs used to identify a socket's data type. 
address@hidden Josh Blum
+
+import pygtk
+pygtk.require('2.0')
+import gtk
+
+######################################################################################################
+#      color codes for signal blocks
+######################################################################################################
+
+COMPLEX_COLOR_SPEC = '#3399FF'
+FLOAT_COLOR_SPEC = '#FF8C69'
+INT_COLOR_SPEC = '#00FF99'
+SHORT_COLOR_SPEC = '#FFFF66'
+BYTE_COLOR_SPEC = '#FF66FF'
+#      and for vectors #
+COMPLEX_VECTOR_COLOR_SPEC = '#3399AA'
+FLOAT_VECTOR_COLOR_SPEC = '#CC8C69'
+INT_VECTOR_COLOR_SPEC = '#00CC99'
+SHORT_VECTOR_COLOR_SPEC = '#CCCC33'
+BYTE_VECTOR_COLOR_SPEC = '#CC66CC'
+
+COLORMAP = gtk.gdk.colormap_get_system()       #create all of the colors
+BACKGROUND_COLOR = COLORMAP.alloc_color('#FFF9FF', True, True) #main window 
background
+FG_COLOR = COLORMAP.alloc_color('black', True, True)   #normal border color    
+BG_COLOR = COLORMAP.alloc_color('#F1ECFF', True, True) #default background     
        
+H_COLOR = COLORMAP.alloc_color('#00FFFF', True, True)  #Highlight border color
+TXT_COLOR = COLORMAP.alloc_color('black', True, True)  #text color
+ERROR_COLOR = COLORMAP.alloc_color('red', True, True)  #error color
+FLOAT_COLOR = COLORMAP.alloc_color(FLOAT_COLOR_SPEC, True, True)       
#background for floats (redish)
+COMPLEX_COLOR = COLORMAP.alloc_color(COMPLEX_COLOR_SPEC, True, True)   
#background for complex (blueish)
+SHORT_COLOR = COLORMAP.alloc_color(SHORT_COLOR_SPEC, True, True)       
#background for shorts (yellowish)
+INT_COLOR = COLORMAP.alloc_color(INT_COLOR_SPEC, True, True)   #background for 
ints (greenish)
+BYTE_COLOR = COLORMAP.alloc_color(BYTE_COLOR_SPEC, True, True) #background for 
bytes (purplish)
+#      and for vectors #
+FLOAT_VECTOR_COLOR = COLORMAP.alloc_color(FLOAT_VECTOR_COLOR_SPEC, True, True) 
#background for floats (redish)
+COMPLEX_VECTOR_COLOR = COLORMAP.alloc_color(COMPLEX_VECTOR_COLOR_SPEC, True, 
True)     #background for complex (blueish)
+SHORT_VECTOR_COLOR = COLORMAP.alloc_color(SHORT_VECTOR_COLOR_SPEC, True, True) 
#background for shorts (yellowish)
+INT_VECTOR_COLOR = COLORMAP.alloc_color(INT_VECTOR_COLOR_SPEC, True, True)     
#background for ints (greenish)
+BYTE_VECTOR_COLOR = COLORMAP.alloc_color(BYTE_VECTOR_COLOR_SPEC, True, True)   
#background for bytes (purplish)
+

Added: grc/branches/grc_reloaded/src/grc/Constants.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/Constants.py                              
(rev 0)
+++ grc/branches/grc_reloaded/src/grc/Constants.py      2008-01-31 21:25:54 UTC 
(rev 7533)
@@ -0,0 +1 @@
+

Added: grc/branches/grc_reloaded/src/grc/Messages.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/Messages.py                               
(rev 0)
+++ grc/branches/grc_reloaded/src/grc/Messages.py       2008-01-31 21:25:54 UTC 
(rev 7533)
@@ -0,0 +1,93 @@
+"""
+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 Messages
+#Handle all of the system messages and error reports.
address@hidden Josh Blum
+
+from Constants import VERSION,PREFERENCES_FILE_PATH
+import traceback
+
+##     A list of functions that can receive a message. 
+MESSENGERS_LIST = list()
+
+def register_messenger(messenger):
+       """!
+       Append the given messenger to the list of messengers.
+       @param messenger a method thats takes a string
+       """
+       MESSENGERS_LIST.append(messenger)
+       
+def send(message):
+       """!
+       Give the message to each of the messengers.
+       @param message a message string
+       """
+       for messenger in MESSENGERS_LIST: messenger(message)
+       
+###########################################################################
+#      Special functions for specific program functionalities
+###########################################################################
+def send_init():
+       send("""<<< Welcome to GRC %s >>>\n"""%VERSION)
+                                       
+def send_page_switch(file_path):
+       send('\nShowing: "%s"\n'%file_path)
+
+#################      functions for loading flow graphs       
########################################                                        
+def send_start_load(file_path):
+       send('\nLoading: "%s"'%file_path + '\n')
+                                                       
+def send_error_load(error):
+       send('>>> Error: %s\n'%error)
+       traceback.print_exc()
+
+def send_end_load():
+       send(">>> Done\n")
+       
+def send_fail_load(error):
+       send('Parser Error: %s\n'%error)
+       send(">>> Failue\n")            
+       traceback.print_exc()
+
+#################      functions for executing flow graphs     
########################################        
+def send_start_exec(file_path):
+       send('\nExecuting: "%s"'%file_path + '\n')
+
+def send_end_exec(verbose):
+       if verbose: 
+               send(">>> Verbose:      \n")            
+               for verb in verbose: send(verb)
+               send("\n")
+       send(">>> Done\n")
+       
+#################      functions for saving flow graphs        
########################################                
+def send_fail_save(file_path):
+       send('>>> Error: Cannot save: %s\n'%file_path)
+                                       
+#################      functions for connections       
########################################                                        
+def send_fail_connection():
+       send('>>> Warning: A connection can only be created between an output 
socket and an unconnected input socket.\n')                                     
  
+
+#################      functions for preferences       
########################################
+def send_fail_load_preferences():
+       send('>>> Error: Cannot load preferences file: 
"%s"\n'%PREFERENCES_FILE_PATH)
+       
+def send_fail_save_preferences():
+       send('>>> Error: Cannot save preferences file: 
"%s"\n'%PREFERENCES_FILE_PATH)
+

Added: grc/branches/grc_reloaded/src/grc/ParseXML.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/ParseXML.py                               
(rev 0)
+++ grc/branches/grc_reloaded/src/grc/ParseXML.py       2008-01-31 21:25:54 UTC 
(rev 7533)
@@ -0,0 +1,138 @@
+"""
+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.
address@hidden Josh Blum
+
+import xml.dom.minidom
+import xml.dom.ext
+from xml.parsers.xmlproc import xmlval
+from xml.parsers.xmlproc import xmlproc
+from Utils import odict
+
+class ValidationError(Exception):
+       
+       def __init__(self, type, message, location):
+               self.type = type
+               self.message = message
+               self.location = location
+       
+       def __str__(self):
+               return "Line: %s, Column: %s\n%s: %s"%(self.location[0], 
self.location[1], self.type, self.message)
+
+class ErrorHandler(xmlproc.ErrorHandler):
+       
+       def location(self):
+               return self.locator.get_line(), self.locator.get_column()
+       
+       def warning(self, msg):
+               raise ValidationError('Warning', msg, self.location())
+       
+       def error(self, msg):
+               raise ValidationError('Error', msg, self.location())
+       
+       def fatal(self, msg):
+               raise ValidationError('Fatal', msg, self.location())
+
+def validate_dtd(file_path):
+       """!
+       Validate an xml file against its dtd.
+       @param file_path the xml file
+       """
+       parser = xmlval.XMLValidator()
+       parser.set_error_handler(ErrorHandler(parser))
+       parser.parse_resource(file_path)
+
+def from_xml(doc):
+       """!
+       Create nested data from an xml doc using the from xml helper.
+       @param doc the xml doc
+       @return the nested data
+       """
+       return _from_xml(filter(lambda elem: elem.localName, doc.childNodes)[0])
+       
+def _from_xml(doc):
+       """!
+       Recursivly parse the xml doc into nested data format.   
+       @param doc the xml doc
+       @return the nested data
+       """
+       tag_name = str(doc.localName)
+       if len(doc.childNodes) == 0: 
+               return odict({tag_name: ''})
+       elif len(doc.childNodes) == 1 and doc.firstChild.nodeValue:
+               return odict({tag_name: str(doc.firstChild.nodeValue)}) 
+       nested_data = odict()
+       for elem in filter(lambda elem: elem.localName, doc.childNodes):
+               key, value = _from_xml(elem).items()[0]
+               if nested_data.has_key(key): nested_data[key].append(value)
+               else: nested_data[key] = [value]
+       for key, values in nested_data.iteritems():
+               if len(values) == 1: nested_data[key] = values[0]
+       return odict({tag_name: nested_data})
+       
+def to_xml(nested_data):
+       """!
+       Create an xml doc and use the to xml helper method to load it.
+       @param nested_data the nested data
+       @return the xml doc
+       """
+       doc = xml.dom.minidom.Document()
+       doc.appendChild(_to_xml(nested_data, doc))
+       return doc
+       
+def _to_xml(nested_data, doc):
+       """!
+       Recursivly parse the nested data into xml doc format.
+       @param nested_data the nested data
+       @param the xml document class for creating nodes
+       @return the xml doc filled with child nodes
+       """     
+       assert(len(nested_data) == 1)
+       tag_name, value = nested_data.items()[0]
+       child = doc.createElementNS(None, tag_name)
+       if type(value) == type(odict()):        
+               for key, elems in value.iteritems():
+                       if type(elems) != type(list()): elems = [elems]
+                       for elem in elems: 
child.appendChild(_to_xml(odict({key: elem}), doc))
+       elif value: child.appendChild(doc.createTextNode(value))
+       return child
+
+def to_file(doc, file_path):
+       """!
+       Save the xml doc to the file path.
+       @param doc the xml doc
+       @param file_path the destination xml-file
+       """ 
+       xml.dom.ext.PrettyPrint(doc, open(file_path, 'w'))
+       
+def from_file(file_path):
+       """!
+       Load an xml doc from the file path.
+       @param file_path the source xml-file
+       @return the xml doc
+       """
+       return xml.dom.minidom.parse(open(file_path, 'r'))
+
+if __name__ == '__main__':     
+       """Use the main method to test parse xml's functions."""
+       import sys
+       n = from_xml(from_file(sys.argv[1]))
+       to_file(to_xml(n), sys.argv[2])
+       pass    

Added: grc/branches/grc_reloaded/src/grc/Preferences.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/Preferences.py                            
(rev 0)
+++ grc/branches/grc_reloaded/src/grc/Preferences.py    2008-01-31 21:25:54 UTC 
(rev 7533)
@@ -0,0 +1,196 @@
+"""
+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 Preferences
+#Holds global preferences stored as GraphicalParams.
address@hidden Josh Blum
+
+from DataTypes import Bool,Enum,Int,String
+from Elements import GraphicalParam, Param
+import time,socket #for tagging saved files
+from Constants import *
+import ParseXML
+import Messages
+
+FILE_DELIMITER = '\n'
+
+PARAM_CHECKING_PREF = GraphicalParam('Parameter Checking', Bool(true='Verify 
Parameters', false='Ignore Invalid Params', default=True))
+CONNECTION_CHECKING_PREF = GraphicalParam('Connection Checking', 
Bool(true='Match Data Types', false='Ignore Data Types', default=True))
+SOCKET_CHECKING_PREF = GraphicalParam('Socket Checking', Bool(true='Require 
Connections', false='Allow Open Sockets', default=True))
+FILES_OPEN_PREF = Param('Files Open', String())
+RESTORE_FILES_PREF = GraphicalParam('Restore Files', Bool(true='Restore 
Previous Files', false='Restore Nothing', default=True))
+SNAP_TO_GRID_PREF = GraphicalParam('Snap to Grid', Bool(true='On', 
false='Off', default=False))
+GRID_SIZE_PREF = GraphicalParam('Grid Size (pixels)', Enum([
+       ('10 pixels', 10), 
+       ('20 pixels', 20), 
+       ('30 pixels', 30),
+       ('40 pixels', 40),
+       ('50 pixels', 50),
+       ('60 pixels', 60),
+       ('70 pixels', 70),
+       ('80 pixels', 80),
+       ('90 pixels', 90),
+       ('100 pixels', 100),], 2))
+SHOW_GRID_PREF = GraphicalParam('Grid Points', Bool(true='Show Grid', 
false='Hide Grid', default=False))
+REPORTS_WIN_SHOW_PREF = GraphicalParam('Reports Window', Bool(true='Show 
Reports Window', false='Hide Reports Window', default=True))
+MAIN_WINDOW_WIDTH_PREF = Param('Main Window Width', 
Int(DEFAULT_MAIN_WINDOW_WIDTH))
+MAIN_WINDOW_HEIGHT_PREF = Param('Main Window Height', 
Int(DEFAULT_MAIN_WINDOW_HEIGHT))
+
+###########################################################################
+#      List of Preferences
+###########################################################################
+
+PREFS_LIST = [ #(title, notes, list of preferences)
+       ("Verification", '''\
+Verification ensures that:
+       signal block parameters pass validation,
+       data types on either side of a connection match,
+       and input/output sockets connect.
+       
+You may disable any one of these validation checks. \
+However, the resulting flow graph may fail execution. \
+''', [ 
+                       (PARAM_CHECKING_PREF, 'param_check'),
+                       (CONNECTION_CHECKING_PREF, 'connection_check'),
+                       (SOCKET_CHECKING_PREF, 'socket_check'),
+               ]
+       ),
+       ("Grid Options", '''\
+Snap to Grid forces the upper right corner of the signal block to align with a 
grid point. \
+''', [
+                       (SNAP_TO_GRID_PREF, 'snap_to_grid'),
+                       (GRID_SIZE_PREF, 'grid_size'),
+                       (SHOW_GRID_PREF, 'show_grid'),
+               ]
+       ),
+       ("Misc Options", '', [
+                       (REPORTS_WIN_SHOW_PREF, 'show_reports_window'),
+                       (RESTORE_FILES_PREF, 'restore_files'),
+               ]
+       ),      
+       ('', '', [      #put hidden prefs here
+                       (FILES_OPEN_PREF, 'files_open'),
+                       (MAIN_WINDOW_WIDTH_PREF, 'window_width'),
+                       (MAIN_WINDOW_HEIGHT_PREF, 'window_height'),
+               ]
+       ),      
+]
+       
+PREFS_DICT = dict((key, param) for param, key in reduce(lambda l1, l2: l1 + 
l2, zip(*PREFS_LIST)[2]))
+
+###########################################################################
+#      Preference Access Methods
+###########################################################################
+
+def _get_value(param):
+       """!
+       Get the value of the given parameter.
+       If the param is valid, return the parsed value of the param, otherwise 
return a blank string.   
+       @param param the parameter
+       @return the value of the parameter
+       """
+       if param.get_data_type().is_valid(): return 
param.get_data_type().parse()
+       else: return ''
+       
+def _to_nested():
+       """!
+       Convert the param's data to nested format.
+       @return the nested format
+       """
+       prefs = [('pref', [('key', key), ('value', 
param.get_data_type().get_data())]) for key,param in PREFS_DICT.iteritems()]
+       nested_data = ('preferences', [
+                       ('timestamp', str(time.time())),
+                       ('hostname', socket.gethostname()),
+                       ('version', VERSION),                                   
                                                
+                       ('prefs', prefs),
+               ]
+       )       
+       return nested_data
+       
+def _from_nested(nested_data):
+       """!
+       Parse the nested data to retrieve each preference.
+       @param nested_data the nested data
+       """
+       find_data = ParseXML.find_data
+       preferences = find_data([nested_data], 'preferences')
+       prefs = find_data(preferences, 'prefs')
+       for pref in prefs:
+               pref = find_data([pref], 'pref')
+               key = find_data(pref, 'key')
+               value = find_data(pref, 'value')
+               try: PREFS_DICT[key].get_data_type().set_data(value)
+               except: pass
+               
+def load(window=None):
+       """!
+       Load the preferences from the preferences file.
+       @param window optional flow graph window
+       """
+       try: 
+               
_from_nested(ParseXML.from_xml(ParseXML.from_file(PREFERENCES_FILE_PATH)))
+               if window: window.resize(_get_value(MAIN_WINDOW_WIDTH_PREF), 
_get_value(MAIN_WINDOW_HEIGHT_PREF))
+       except: Messages.send_fail_load_preferences()           
+
+def save(window=None):
+       """!
+       Save the preferences to the preferences file.
+       @param window optional flow graph window
+       """
+       if window:
+               width,height = window.get_size()
+               MAIN_WINDOW_WIDTH_PREF.get_data_type().set_data(width)
+               MAIN_WINDOW_HEIGHT_PREF.get_data_type().set_data(height)
+       try: ParseXML.to_file(ParseXML.to_xml(_to_nested()), 
PREFERENCES_FILE_PATH)             
+       except IOError: Messages.send_fail_save_preferences()
+               
+###########################################################################
+#      Special methods for specific program functionalities
+###########################################################################
+       
+def restore_files():
+       return _get_value(RESTORE_FILES_PREF)   
+       
+def files_open():
+       return _get_value(FILES_OPEN_PREF).split(FILE_DELIMITER)
+       
+def save_files_open(files):
+       FILES_OPEN_PREF.get_data_type().set_data(FILE_DELIMITER.join(files))
+       
+def check_connections():
+       return _get_value(CONNECTION_CHECKING_PREF)
+       
+def check_sockets():
+       return _get_value(SOCKET_CHECKING_PREF)
+
+def check_params():
+       return _get_value(PARAM_CHECKING_PREF)
+       
+def show_reports_window():
+       return _get_value(REPORTS_WIN_SHOW_PREF)
+       
+def get_grid_size():
+       return _get_value(GRID_SIZE_PREF)       
+       
+def snap_to_grid():
+       return _get_value(SNAP_TO_GRID_PREF)
+       
+def show_grid():
+       return _get_value(SHOW_GRID_PREF)
+               
+       
\ No newline at end of file

Added: grc/branches/grc_reloaded/src/grc/StateCache.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/StateCache.py                             
(rev 0)
+++ grc/branches/grc_reloaded/src/grc/StateCache.py     2008-01-31 21:25:54 UTC 
(rev 7533)
@@ -0,0 +1,97 @@
+"""
+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 StateCache
+#Stores the flow graph states to drive the undo/redo and save interface.
address@hidden Josh Blum
+
+from Actions import FLOW_GRAPH_UNDO, FLOW_GRAPH_REDO, get_action_from_name
+from Constants import STATE_CACHE_SIZE
+
+class StateCache:
+       """
+       The state cache is an interface to a list to record data/states and to 
revert to previous states.
+       States are recorded into the list in a circular fassion by using an 
index for the current state,
+       and counters for the range where states are stored.
+       """     
+       
+       def __init__(self, initial_state):
+               """!
+               StateCache constructor.
+               @param initial_state the intial state (nested data)
+               """
+               self.states = [None for i in range(STATE_CACHE_SIZE)] #fill 
states
+               self.current_state_index = 0
+               self.num_prev_states = 0
+               self.num_next_states = 0
+               self.states[0] = initial_state
+               self.update_actions()
+                       
+       def save_new_state(self, state):
+               """!
+               Save a new state.
+               Place the new state at the next index and add one to the number 
of previous states.
+               @param state the new state
+               """
+               self.current_state_index = (self.current_state_index + 
1)%STATE_CACHE_SIZE
+               self.states[self.current_state_index] = state           
+               self.num_prev_states = self.num_prev_states + 1
+               if self.num_prev_states == STATE_CACHE_SIZE: 
self.num_prev_states = STATE_CACHE_SIZE - 1
+               self.num_next_states = 0
+               self.update_actions()
+                       
+       def get_current_state(self):
+               """!
+               Get the state at the current index.
+               @return the current state (nested data)
+               """
+               self.update_actions()
+               return self.states[self.current_state_index]            
+       
+       def get_prev_state(self):
+               """!
+               Get the previous state and decrement the current index.
+               @return the previous state or None
+               """
+               if self.num_prev_states > 0:
+                       self.current_state_index = (self.current_state_index + 
STATE_CACHE_SIZE -1)%STATE_CACHE_SIZE
+                       self.num_next_states = self.num_next_states + 1
+                       self.num_prev_states = self.num_prev_states - 1
+                       return self.get_current_state()
+               return None             
+       
+       def get_next_state(self):
+               """!
+               Get the nest state and increment the current index.
+               @return the next state or None
+               """
+               if self.num_next_states > 0:
+                       self.current_state_index = (self.current_state_index + 
1)%STATE_CACHE_SIZE
+                       self.num_next_states = self.num_next_states - 1
+                       self.num_prev_states = self.num_prev_states + 1
+                       return self.get_current_state()
+               return None
+               
+       def update_actions(self):
+               """
+               Update the undo and redo actions based on the number of next 
and prev states.
+               """
+               
get_action_from_name(FLOW_GRAPH_REDO).set_sensitive(self.num_next_states != 0)
+               
get_action_from_name(FLOW_GRAPH_UNDO).set_sensitive(self.num_prev_states != 0)
+               
+               
\ No newline at end of file

Added: grc/branches/grc_reloaded/src/grc/Utils.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/Utils.py                          (rev 0)
+++ grc/branches/grc_reloaded/src/grc/Utils.py  2008-01-31 21:25:54 UTC (rev 
7533)
@@ -0,0 +1,63 @@
+"""
+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.Utils
+#Utility methods and classes.
address@hidden Josh Blum
+
+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):
+        copyDict = odict()
+        copyDict._data = self._data.copy()
+        copyDict._keys = self._keys
+        return copyDict        
+
+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 type(obj) == type(list()): return obj
+       return [obj]
+       
+def is_key(key):
+       return len(key) and all(map(lambda k: k.isalnum() or k in ['_'], key))
+

Added: grc/branches/grc_reloaded/src/grc/__init__.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/__init__.py                               
(rev 0)
+++ grc/branches/grc_reloaded/src/grc/__init__.py       2008-01-31 21:25:54 UTC 
(rev 7533)
@@ -0,0 +1,26 @@
+"""
+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
+#grc gui package.
address@hidden Josh Blum
+
+from grc.platforms.gnuradio_python.Platform import Platform
+
+platform = Platform.make_platform()
+print platform.get_block_keys()

Added: grc/branches/grc_reloaded/src/grc/elements/Block.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/elements/Block.py                         
(rev 0)
+++ grc/branches/grc_reloaded/src/grc/elements/Block.py 2008-01-31 21:25:54 UTC 
(rev 7533)
@@ -0,0 +1,195 @@
+"""
+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.Block
+#Flow graph block.
address@hidden Josh Blum
+
+from grc import Utils
+from grc.Utils import odict
+from grc.elements.Element import Element
+from grc.elements.Param import Param
+from grc.elements.Port import Port
+
+class Block(Element):
+       
+       ##static constructor for param
+       Param = Param.make_param_from_n
+       ##static constructor for source
+       Source = Port.make_port_from_n
+       ##static constructor for sink
+       Sink = Port.make_port_from_n
+       
+       def __init__(self, flow_graph, doc, name, key, cat, params, sources, 
sinks):
+               Element.__init__(self, flow_graph)              
+               #store the data
+               self._doc = doc
+               self._name = name
+               self._key = key
+               self._cat = cat
+               #create the param objects
+               self._params = odict()
+               for param in map(self.Param, params):
+                       key = param.get_key()
+                       #test against repeated keys
+                       try: assert(key not in self.get_param_keys())
+                       except AssertionError: self._exit_with_error('Key "%s" 
already exists in params'%key)
+                       #store the param
+                       self._params[key] = param       
+               #create the source objects
+               self._sources = odict()
+               for source in map(self.Source, sources):
+                       key = source.get_key()
+                       #test against repeated keys
+                       try: assert(key not in self.get_source_keys())
+                       except AssertionError: self._exit_with_error('Key "%s" 
already exists in sources'%key)
+                       #store the port
+                       self._sources[key] = source     
+               #create the sink objects
+               self._sinks = odict()
+               for sink in map(self.Sink, sinks):
+                       key = sink.get_key()
+                       #test against repeated keys
+                       try: assert(key not in self.get_sink_keys())
+                       except AssertionError: self._exit_with_error('Key "%s" 
already exists in sinks'%key)
+                       #store the port
+                       self._sinks[key] = sink         
+               #begin the testing
+               self.test()
+               #work the enums
+               for param in filter(lambda p: p.get_type() == 'enum', 
self.get_params()):
+                       orig_value = param.get_value()
+                       #set each option key and run the build
+                       for option_key in param.get_option_keys():
+                               param.set_value(option_key)
+                               self.test()
+                       param.set_value(orig_value)             
+
+       def test(self):
+               """!
+               Call test on all children.
+               """
+               map(lambda c: c.test(), self.get_params() + self.get_sinks() + 
self.get_sources())
+       
+       def __str__(self): return 'Block: %s(%s)'%(self.get_name(), 
self.get_key())
+       
+       def get_doc(self): return self._doc
+       
+       def get_name(self): return self._name
+       
+       def get_key(self): return self._key
+       
+       def get_category(self): return self._cat
+       
+       ##############################################
+       # Access Params
+       ##############################################
+       def get_param_keys(self): return self._params.keys()    
+       def get_param(self, key): return self._params[key]
+       def get_params(self): return self._params.values()
+       
+       ##############################################
+       # Access Sinks
+       ##############################################
+       def get_sink_keys(self): return self._sinks.keys()      
+       def get_sink(self, key): return self._sinks[key]
+       def get_sinks(self): return self._sinks.values()
+       
+       ##############################################
+       # Access Sources
+       ##############################################
+       def get_source_keys(self): return self._sources.keys()  
+       def get_source(self, key): return self._sources[key]
+       def get_sources(self): return self._sources.values()
+       
+       def resolve_dependency(self, dep):
+               """
+               Resolve a paramater dependency.
+               Dependencies are simple strings. 
+               A dependency begining with $ is evaluated by extracting the 
value from the matching param.
+               Without the $, dependencies are evaluated as is.
+               Dependencies are specified as $param_key where param_key is an 
existing parameter.
+               For enumerated parameters, dependencies are $param_key:opt_key 
where opt_key is an existing opt key.
+               @param dep the dependency string
+               @return the resolved value
+               """
+               dep = str(dep).strip()
+               if dep.startswith('$'):
+                       dep = dep[1:]
+                       keys = dep.split(':')
+                       try: assert(keys[0] in self.get_param_keys())
+                       except AssertionError: self._exit_with_error('Cannot 
find param for dependency "%s".'%dep)
+                       param = self.get_param(keys[0])
+                       if len(keys) == 1:
+                               return param.get_value()
+                       elif len(keys) == 2:
+                               try: assert(keys[1] in param.get_opt_keys())
+                               except AssertionError: 
self._exit_with_error('Cannot find opt for dependency "%s".'%dep)
+                               return param.get_opt(keys[1])
+                       else: self._exit_with_error('Dependency "%s" cannot be 
resolved.'%dep)
+               else: return dep
+       
+       ##############################################
+       ## Import/Export Methods
+       ##############################################          
+       def export_data(self):
+               """
+               Export this block's params to nested data.
+               @return a nested data odict
+               """
+               
+       def import_data(self, n):
+               """
+               Import this block's params from nested data.
+               Any param keys that do not exist will be ignored.
+               @param n the nested data odict
+               """
+       
+       ##############################################
+       ## Static Make Methods
+       ##############################################
+       def make_block_from_n(flow_graph, n):
+               """
+               Make a new block from nested data.
+               @param flow graph the parent element
+               @param n the nested odict
+               @return block a new block
+               """
+               #grab the data
+               doc = Utils.exists_or_else(n, 'doc', '')
+               name = n['name']
+               key = n['key']
+               cat = n['cat']
+               params = Utils.listify(n, 'param')
+               sources = Utils.listify(n, 'source')
+               sinks = Utils.listify(n, 'sink')
+               #build the block
+               return Block(
+                       flow_graph=flow_graph, 
+                       doc=doc, 
+                       name=name, 
+                       key=key, 
+                       cat=cat, 
+                       params=params, 
+                       sources=sources, 
+                       sinks=sinks,
+               )
+       make_block_from_n = staticmethod(make_block_from_n)
+       
+       
+

Added: grc/branches/grc_reloaded/src/grc/elements/Connection.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/elements/Connection.py                    
        (rev 0)
+++ grc/branches/grc_reloaded/src/grc/elements/Connection.py    2008-01-31 
21:25:54 UTC (rev 7533)
@@ -0,0 +1,95 @@
+"""
+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.Connection
+#Flow graph connection.
+#A connection exists between 2 ports.
+#One port must be input, one output.
+#The port decided whether it can have the connection.
address@hidden Josh Blum
+
+from grc.elements.Element import Element
+
+class Connection(Element):
+       
+       def __str__(self): return 'Connection: %s -> %s'%(self.get_source(), 
self.get_sink())
+       
+       #############################
+       # Access Ports
+       #############################
+       def get_sink(self): return self._sink
+       def get_source(self): return self._source
+       
+       def _load(self, n):
+               self._sink = n['sink']
+               self._source = n['source']
+               
+       def make_connection_from_n(flow_graph, n):
+               """!
+               Make a new connection given the parent and nested data. 
+               @param flow_graph the parent of this element
+               @param n nested data
+               @throws Error cannot make connection
+               @return a new connection
+               """
+               #get the block ids
+               source_block_id = n['source_block_id']
+               sink_block_id = n['sink_block_id']
+               #verify the blocks
+               assert(source_block_id in flow_graph.get_block_ids())
+               assert(sink_block_id in flow_graph.get_block_ids())
+               #get the blocks
+               source_block = flow_graph.get_block(source_block_id)
+               sink_block = flow_graph.get_block(sink_block_id)
+               #get the port keys
+               source_key = n['source_key']
+               sink_key = n['sink_key']
+               #verify the ports
+               assert(source_key in source_block.get_source_keys())
+               assert(sink_key in source_block.get_sink_keys())
+               #get the ports
+               source = source_block.get_source(source_key)
+               sink = sink_block.get_sink(sink_key)
+               #build the connection
+               return make_connection_from_ports(flow_graph, source, sink)
+       make_connection_from_n = staticmethod(make_connection_from_n)
+               
+       def make_connection_from_ports(flow_graph, porta, portb):
+               """!
+               Make a new connection given the parent and 2 ports.     
+               @param flow_graph the parent of this element
+               @param porta a port (any direction)
+               @param portb a port (any direction)
+               @throws Error cannot make connection
+               @return a new connection
+               """
+               source = sink = None
+               #separate the source and sink
+               for port in (porta, portb):
+                       if hasattr(port, 'is_source') and port.is_source(): 
source = port
+                       if hasattr(port, 'is_sink') and port.is_sink(): sink = 
port
+               #verify the source and sink
+               assert(source and sink)
+               #TODO how many connections allowed?
+               n = {
+                       'source': source,
+                       'sink': sink,
+               }
+               return Connection(parent=flow_graph, n=n)
+       make_connection_from_ports = staticmethod(make_connection_from_ports)
+               

Added: grc/branches/grc_reloaded/src/grc/elements/DataType.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/elements/DataType.py                      
        (rev 0)
+++ grc/branches/grc_reloaded/src/grc/elements/DataType.py      2008-01-31 
21:25:54 UTC (rev 7533)
@@ -0,0 +1,144 @@
+"""
+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.DataType
+#Data type provides evaluating capabilties for parameter values.
address@hidden Josh Blum
+
+class DataType(object):
+
+       ##possible data types that this class can handle
+       _TYPES = []
+
+       def __init__(self, flow_graph, type, value, range):
+               """
+               Initialize the datatype object.
+               @param flow_graph the flow graph object
+               @param type a type string or param containing the type
+               @param value the default value of this data type
+               @param range the range of values for this type
+               The range only applies to numeric types or 
+               the length of the type if a list or string.
+               """
+               self._flow_graph = flow_graph
+               self._type = type
+               assert(self._type in self._TYPES)
+               self._value = value
+               self._range = range
+               #evaluate
+               self._error = ''
+               self._evaluated = ''
+               try: self._evaluated = self._get_eval()
+               except Exception, e: self._error_msg = str(e)
+               
+       def get_type(self): return self._type
+       
+       def get_value(self): return self._value
+       
+       def get_range(self): return self._range
+       
+       def get_eval(self): return self._evaluated
+               
+       def check_range(self, value):
+               """
+               Is the value in the range of this data type?
+               @param value the value to test
+               @throw Exception value is out of range
+               """
+               if self.get_range().in_range(value): return
+               raise Exception, 'Value "%s" is not in range "%s".'%(value, 
range)
+                       
+       def _get_eval(self):
+               """
+               Evaluate the value by according to its type.
+               Overload this method in sub-classes.
+               @throw NotImplementedError
+               """
+               raise NotImplementedError
+               
+       def get_abbr(self):
+               """
+               Get an abbreviated version of the representation for display 
purposes.
+               If there was an error evaluating, return an error string.
+               @return the abbreviated string or error string
+               """
+               if self.get_error_message(): return "Error"
+               else: return str(self._get_abbr())
+       
+       def _get_abbr(self):
+               """
+               Get an abbreviated version of the representation for display 
purposes.
+               Overload this method in sub-classes.
+               @throw NotImplementedError
+               """
+               raise NotImplementedError
+                                       
+       def get_repr(self):
+               """
+               Get the representation of the evaluated value.
+               This representation can be used in generated code.
+               @throw AssertionError when the evaluation fails
+               @return the representation string
+               """
+               assert(not self.get_error_message())
+               return str(self._get_repr())
+               
+       def _get_repr(self):
+               """
+               Get the representation of the evaluated value.
+               Overload this method in sub-classes.
+               @throw NotImplementedError
+               """
+               raise NotImplementedError
+
+       def get_error_message(self):
+               """
+               Get the error message for the evaluation.
+               Blank if no error occured.
+               @return a message string
+               """
+               return self._error_msg
+
+       def is_valid(self):
+               """
+               Is this data type valid?
+               @return true if the error message is blank
+               """
+               return not self.get_error_message()
+               
+       
###########################################################################
+       #       display logic for numbers
+       
###########################################################################
+       def num_to_str(var): 
+               def float_to_str(var):
+                       if var-int(var) == 0: return '%d'%int(var)              
                        
+                       if var*10-int(var*10) == 0: return '%.1f'%var
+                       if var*100-int(var*100) == 0: return '%.2f'%var
+                       if var*1000-int(var*1000) == 0: return '%.3f'%var
+                       else: return '%.3g'%var 
+               if type(var) == type(complex()): 
+                       if var.imag == var.real == 0: return '0'        #value 
is zero
+                       elif var.imag == 0: return '%s'%float_to_str(var.real)  
#value is real
+                       elif var.real == 0: return '%sj'%float_to_str(var.imag) 
#value is imaginary
+                       elif var.imag < 0: return 
'%s-%sj'%(float_to_str(var.real), float_to_str(var.imag*-1))
+                       else: return '%s+%sj'%(float_to_str(var.real), 
float_to_str(var.imag))
+               elif type(var) == type(float()): return float_to_str(var)       
                        
+               elif type(var) == type(int()): return '%d'%var
+               else: return var
+       num_to_str = staticmethod(num_to_str)
+               

Added: grc/branches/grc_reloaded/src/grc/elements/Element.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/elements/Element.py                       
        (rev 0)
+++ grc/branches/grc_reloaded/src/grc/elements/Element.py       2008-01-31 
21:25:54 UTC (rev 7533)
@@ -0,0 +1,51 @@
+"""
+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.Element
+#The base class for all elements.
address@hidden Josh Blum
+
+class Element(object):
+       
+       def __init__(self, parent=None):
+               self._parent = parent
+               
+       def test(self):
+               """
+               Test the element against failures.
+               Overload this method in sub-classes.
+               """
+               pass
+               
+       def get_parent(self):
+               return self._parent
+               
+       def _exit_with_error(self, error):
+               parent = self
+               #build hier list of elements
+               elements = list()
+               while(parent):
+                       elements.insert(0, parent)
+                       parent = parent.get_parent()
+               #build error string
+               err_str = ">>> Error:"
+               for i, element in enumerate(elements + [error]):
+                       err_str = err_str + '\n' + ''.join('   '*(i+2)) + 
str(element)
+               err_str = err_str + '\n'
+               exit(err_str)                   
+               

Added: grc/branches/grc_reloaded/src/grc/elements/FlowGraph.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/elements/FlowGraph.py                     
        (rev 0)
+++ grc/branches/grc_reloaded/src/grc/elements/FlowGraph.py     2008-01-31 
21:25:54 UTC (rev 7533)
@@ -0,0 +1,90 @@
+"""
+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.FlowGraph
+#Primative flow graph.
address@hidden Josh Blum
+
+from grc import Utils
+from grc.Utils import odict
+from grc.elements.Element import Element
+from grc.elements.Block import Block
+from grc.elements.Connection import Connection
+
+class FlowGraph(Element):
+       
+       ##static constructor for block
+       Block = Block.make_block_from_n
+       ##static constructor for connection
+       Connection = Connection.make_connection_from_n
+       
+       def __init__(self, platforms):
+               Element.__init__(self)
+               #load the platform modules
+               self._platforms = odict()
+               for key in platforms:
+                       try: 
+                               platform_module = __import__(
+                                       'grc.platforms', 
+                                       globals=globals(), 
+                                       locals=locals(),
+                                       fromlist=[key],
+                                       level=-1,
+                               )
+                               platform = getattr(platform_module, 
key).get_platform()
+                               self._platforms[platform.get_key()] = platform
+                       except ImportError, e: self._exit_with_error('Error 
importing platform "%s": "%s"'%(key, e))
+       
+       def __str__(self): return 'FlowGraph: %s'%self.get_platform_keys()
+       
+       ##############################################
+       # Access Platforms
+       ##############################################
+       def get_platform_keys(self): return self._platforms.keys()      
+       def get_platform(self, key): return self._platforms[key]
+       
+       ##############################################
+       ## Import/Export Methods
+       ##############################################                          
+       def export_data(self):
+               """
+               Export this flow graph to nested data.
+               Export all block and connection data.
+               @return a nested data odict
+               """
+               
+       def import_data(self, n):
+               """
+               Import blocks and connections into this flow graph.
+               Clear this flowgraph of all previous blocks and connections.
+               Any blocks or connections in error will be ignored.
+               @param n the nested data odict
+               """
+       
+       ##############################################
+       ## Static Make Methods
+       ##############################################
+       def make_flow_graph(platforms):
+               """!
+               Make a flow graph from the arguments.
+               @param platforms a list of platforms to load
+               @return the flow graph object
+               """
+               return FlowGraph(platforms)
+       make_flow_graph = staticmethod(make_flow_graph)
+       

Added: grc/branches/grc_reloaded/src/grc/elements/Param.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/elements/Param.py                         
(rev 0)
+++ grc/branches/grc_reloaded/src/grc/elements/Param.py 2008-01-31 21:25:54 UTC 
(rev 7533)
@@ -0,0 +1,187 @@
+"""
+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.Param
+#Flow graph block parameters.
+#And options for enum type paramater.
address@hidden Josh Blum
+
+from grc import Utils
+from grc.Utils import odict
+from grc.elements.Element import Element
+from grc.elements.Range import Range
+
+class Option(Element):
+       
+       def __init__(self, param, name, key, opts):
+               Element.__init__(self, param)
+               self._name = name
+               self._key = key
+               self._opts = dict()
+               for opt in opts:
+                       #separate the key:value
+                       try: key, value = opt.split(':')
+                       except: self._exit_with_error('Error separating "%s" 
into key:value'%opt)
+                       #test against repeated keys
+                       try: assert(not self._opts.has_key(key))
+                       except AssertionError: self._exit_with_error('Key "%s" 
already exists in option'%key)
+                       #store the option
+                       self._opts[key] = value
+       
+       def __str__(self): return 'Option: %s(%s)'%(self.get_name(), 
self.get_key())
+       
+       def get_name(self): return self._name
+       
+       def get_key(self): return self._key
+       
+       ##############################################
+       # Access Opts
+       ##############################################
+       def get_opt_keys(self): return self._opts.keys()        
+       def get_opt(self, key): return self._opts[key]
+       def get_opts(self): return self._opts.values()
+                       
+       ##############################################
+       ## Static Make Methods
+       ##############################################
+       def make_option_from_n(param, n):
+               """
+               Make a new option from nested data.
+               @param param the parent element
+               @param n the nested odict
+               @return a new option
+               """
+               #grab the data
+               name = n['name']
+               key = n['key']
+               opts = Utils.listify(n, 'opt')
+               #build the option
+               return Option(
+                       param=param,
+                       name=name,
+                       key=key,
+                       opts=opts,
+               )
+       make_option_from_n = staticmethod(make_option_from_n)
+
+class Param(Element):
+       
+       def __init__(self, block, name, key, value, type, range, options):
+               Element.__init__(self, block)
+               self._name = name
+               self._key = key
+               self._type = type
+               self._range = Range(self, range)
+               #create the Option objects from the n data
+               self._options = odict()
+               for option in map(lambda o: Option.make_option_from_n(self, o), 
options): 
+                       key = option.get_key()
+                       #test against repeated keys
+                       try: assert(key not in self.get_option_keys())
+                       except AssertionError: self._exit_with_error('Key "%s" 
already exists in options'%key)
+                       #store the option
+                       self._options[key] = option
+               #test the enum options                  
+               if self._options or self._type == 'enum':
+                       #test against bad combos of type and enum
+                       try: assert(self._options)
+                       except AssertionError: self._exit_with_error('At least 
one option must exist when type "enum" is set.')
+                       try: assert(self._type == 'enum')
+                       except AssertionError: self._exit_with_error('Type 
"enum" must be set when options are present.')
+                       #test against options with identical keys
+                       try: assert(len(set(self.get_option_keys())) == 
len(self._options))
+                       except AssertionError: self._exit_with_error('Options 
keys "%s" are not unique.'%self.get_option_keys())
+                       #test against inconsistent keys in options
+                       opt_keys = self._options.values()[0].get_opt_keys()
+                       for option in self._options.values():
+                               try: assert(set(opt_keys) == 
set(option.get_opt_keys()))
+                               except AssertionError: 
self._exit_with_error('Opt keys "%s" are not identical across all 
options.'%opt_keys)
+                       #if a value is specified, it must be in the options keys
+                       self._value = value or self.get_option_keys()[0]
+                       try: assert(self.get_value() in self.get_option_keys())
+                       except AssertionError: self._exit_with_error('The value 
"%s" is not in the possible values of "%s".'%(self.get_value(), 
self.get_option_keys()))
+               else: self._value = value or '0'                
+               
+       def test(self):
+               """
+               call test on all children
+               """
+               map(lambda c: c.test(), [self.get_range()] + self.get_options())
+               #test get type
+               self.get_type()         
+               #TODO: assert type in enum or allowed in datatype
+       
+       def __str__(self): return 'Param: %s(%s)'%(self.get_name(), 
self.get_key())
+       
+       def get_name(self): return self._name
+       
+       def get_key(self): return self._key
+
+       def get_value(self): return self._value
+       
+       def set_value(self, value): self._value = value
+       
+       def get_type(self): return 
self.get_parent().resolve_dependency(self._type)
+       
+       def get_range(self): return self._range
+       
+       ##############################################
+       # Access Options
+       ##############################################
+       def get_option_keys(self): return self._options.keys()
+       def get_option(self, key): return self._options[key]
+       def get_options(self): return self._options.values()
+       
+       ##############################################
+       # Access Opts
+       ##############################################
+       def get_opt_keys(self): return 
self._options[self.get_value()].get_opt_keys()
+       def get_opt(self, key): return 
self._options[self.get_value()].get_opt(key)
+       def get_opts(self): return self._options[self.get_value()].get_opts()
+               
+       ##############################################
+       ## Static Make Methods
+       ##############################################
+       def make_param_from_n(block, n):
+               """
+               Make a new param from nested data.
+               @param block the parent element
+               @param n the nested odict
+               @return a new param
+               """
+               #grab the data
+               name = n['name']
+               key = n['key']
+               value = Utils.exists_or_else(n, 'value', None)
+               type = n['type']
+               range = Utils.exists_or_else(n, 'range', '(inf, -inf)')
+               options = Utils.listify(n, 'option')
+               #build the param
+               return Param(
+                       block=block,
+                       name=name,
+                       key=key,
+                       value=value,
+                       type=type,
+                       range=range,
+                       options=options,
+               )
+       make_param_from_n = staticmethod(make_param_from_n)
+               
+               
+       

Added: grc/branches/grc_reloaded/src/grc/elements/Platform.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/elements/Platform.py                      
        (rev 0)
+++ grc/branches/grc_reloaded/src/grc/elements/Platform.py      2008-01-31 
21:25:54 UTC (rev 7533)
@@ -0,0 +1,79 @@
+"""
+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.Platform
+#A Platform contains all blocks in platform.
address@hidden Josh Blum
+
+import os
+from grc import ParseXML
+from grc.elements.Element import Element
+from grc.elements.Block import Block
+
+class Platform(Element):
+       
+       ##static constructor for block
+       Block = Block.make_block_from_n
+       
+       def __init__(self, name, key, path):
+               Element.__init__(self)
+               self._name = name
+               self._key = key 
+               self._path = path
+               #load the blocks
+               self._blocks = dict()
+               for dirpath,dirnames,filenames in os.walk(self._path + 
'/blocks/'):
+                       for filename in filter(lambda f: f.endswith('.xml'), 
filenames):
+                               f = dirpath + '/' + filename
+                               try: ParseXML.validate_dtd(f)
+                               except ParseXML.ValidationError, e: 
self._exit_with_error('Block definition "%s" failed: \n\t%s'%(f, e))
+                               x = ParseXML.from_file(f)
+                               n = ParseXML.from_xml(x)['block']
+                               block = self.Block(n)
+                               key = block.get_key()
+                               #test against repeated keys
+                               try: assert(key not in self.get_block_keys())
+                               except AssertionError: 
self._exit_with_error('Key "%s" already exists in blocks'%key)
+                               #store the block
+                               self._blocks[key] = block
+       
+       def __str__(self): return 'Platform: %s(%s)'%(self.get_name(), 
self.get_key())
+       
+       ##############################################
+       # Access Blocks
+       ##############################################
+       def get_block_keys(self): return self._blocks.keys()
+       def get_block(self, block): return self._blocks[key]
+       
+       def get_name(self): return self._name
+       
+       def get_key(self): return self._key
+
+       ##############################################
+       ## Static Make Methods
+       ##############################################
+       def make_platform(name, key, path):
+               """!
+               Make a platform from the arguments.
+               @param name the platform name
+               @param key the unique platform key
+               @param path the file path to this platform
+               @return a platform object
+               """
+               return Platform(name=name, key=key, path=path)
+       make_platform = staticmethod(make_platform)

Added: grc/branches/grc_reloaded/src/grc/elements/Port.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/elements/Port.py                          
(rev 0)
+++ grc/branches/grc_reloaded/src/grc/elements/Port.py  2008-01-31 21:25:54 UTC 
(rev 7533)
@@ -0,0 +1,98 @@
+"""
+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.Port
+#Flow graph block port (source or sink).
address@hidden Josh Blum
+
+from grc import Utils
+from grc.elements.Element import Element
+
+class Port(Element):
+       
+       def __init__(self, block, name, key, type):     
+               Element.__init__(self, block)
+               self._name = name
+               self._key = key
+               self._type = type
+
+       def test(self):
+               self.get_type()
+       
+       def __str__(self): return 'Port: %s(%s)'%(self.get_name(), 
self.get_key())
+       
+       def get_name(self): return self._name
+       
+       def get_key(self): return self._key
+       
+       def is_sink(self): return self in self.get_parent().get_sinks()
+               
+       def is_source(self): return self in self.get_parent().get_sources()
+       
+       def get_type(self): return 
self.get_parent().resolve_dependency(self._type)
+       
+       def get_connections(self):
+               """!
+               Get all connections that use this port.
+               @return a list of connection objects
+               """
+               connections = self.get_parent().get_parent().get_connections()
+               connections = filter(lambda c: c.get_source() is self or 
c.get_sink() is self, connections)
+               return connections
+               
+       def is_full(self):
+               """!
+               Is this port full of connections?
+               Generally a sink can handle one connection and a source can 
handle many.
+               Some sinks can be optionally connected. TODO: optional 
connections
+               @return true if the port is full
+               """
+               if self.is_source(): return False
+               if self.is_sink(): return bool(self.get_connections())
+               
+       def is_empty(self):
+               """!
+               Is this port empty?
+               An empty port has no connections.
+               @return true if empty
+               """
+               return not self.get_connections()
+               
+       ##############################################
+       ## Static Make Methods
+       ##############################################
+       def make_port_from_n(block, n):
+               """
+               Make a new port from nested data.
+               @param block the parent element
+               @param n the nested odict
+               @return a new port
+               """
+               #grab the data
+               name = n['name']
+               key = n['key']
+               type = n['type']
+               #build the port
+               return Port(
+                       block=block,
+                       name=name,
+                       key=key,
+                       type=type,
+               )
+       make_port_from_n = staticmethod(make_port_from_n)
+

Added: grc/branches/grc_reloaded/src/grc/elements/Range.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/elements/Range.py                         
(rev 0)
+++ grc/branches/grc_reloaded/src/grc/elements/Range.py 2008-01-31 21:25:54 UTC 
(rev 7533)
@@ -0,0 +1,82 @@
+"""
+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.Range
+#Flow graph range.
address@hidden Josh Blum
+
+from grc import Utils
+from grc.elements.Element import Element
+
+class Range(Element):
+       
+       def __init__(self, param, range):
+               Element.__init__(self, param)
+               #remove whitespace
+               range = range.strip()
+               self._range = range     
+               #extract brackets
+               try: assert(len(range) > 5)
+               except AssertionError: self._exit_with_error('Range "%s" must 
be in form "(min, max)"'%range)
+               self._min_bracket = range[0]
+               self._max_bracket = range[-1]
+               try: 
+                       assert(self._min_bracket in ['(', '['])
+                       assert(self._max_bracket in [')', ']'])
+               except AssertionError: self._exit_with_error('Range "%s" must 
start with ( or [ and end with ] or )"'%range)
+               #strip brackets
+               range = range[1:-1]
+               #extract min/max
+               try: self._min, self._max = range.split(',')
+               except: self._exit_with_error('Range "%s" cannot be parsed to 
"min, max"'%range)
+                       
+       def __str__(self): return 'Range: %s'%self._range               
+                               
+       def test(self):
+               #test get min and get max
+               self.get_min()
+               self.get_max()
+               
+       def get_min(self):
+               return 
float(self.get_parent().get_parent().resolve_dependency(self._min))
+               
+       def get_max(self):
+               return 
float(self.get_parent().get_parent().resolve_dependency(self._max))
+               
+       def in_range(self, num):
+               """
+               Is the number in this range?
+               @param num the number, integer or float
+               @return true if in range
+               """
+               try:
+                       #test min
+                       min = self.get_min()                    
+                       if self._min_bracket == '(': 
+                               assert(min > num)
+                       elif self._min_bracket == '[':
+                               assert(min >= num)
+                       #test max
+                       max = self.get_max()
+                       if self._max_bracket == ')': 
+                               assert(num < max)
+                       elif self._max_bracket == '[':
+                               assert(num <= max)
+                       return True
+               except AssertionError: return False             
+

Added: grc/branches/grc_reloaded/src/grc/elements/__init__.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/elements/__init__.py                      
        (rev 0)
+++ grc/branches/grc_reloaded/src/grc/elements/__init__.py      2008-01-31 
21:25:54 UTC (rev 7533)
@@ -0,0 +1,22 @@
+"""
+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.
address@hidden Josh Blum
+

Added: grc/branches/grc_reloaded/src/grc/gui/Bars.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/Bars.py                               
(rev 0)
+++ grc/branches/grc_reloaded/src/grc/gui/Bars.py       2008-01-31 21:25:54 UTC 
(rev 7533)
@@ -0,0 +1,130 @@
+"""
+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 Graphics.Bars
+#Create the GUI's toolbar and menubar
address@hidden Josh Blum
+
+from Actions import *
+import pygtk
+pygtk.require('2.0')
+import gtk
+                                       
+##The list of actions for the toolbar.
+TOOLBAR_LIST = (
+       FLOW_GRAPH_NEW,
+       FLOW_GRAPH_OPEN,
+       FLOW_GRAPH_SAVE,
+       None,
+       FLOW_GRAPH_SCREEN_CAPTURE,
+       None,
+       FLOW_GRAPH_UNDO,
+       FLOW_GRAPH_REDO,
+       None,
+       FLOW_GRAPH_EXEC,
+       FLOW_GRAPH_STOP,
+       None,
+       ELEMENT_DELETE,
+       SIGNAL_BLOCK_ROTATE_LEFT,
+       SIGNAL_BLOCK_ROTATE_RIGHT,                                              
+)
+
+##The list of actions and categories for the menu bar.                         
        
+MENU_BAR_LIST = (
+       (gtk.Action('File', '_File', None, None), [
+               FLOW_GRAPH_NEW,
+               FLOW_GRAPH_OPEN,
+               None,
+               FLOW_GRAPH_SAVE,
+               FLOW_GRAPH_SAVE_AS,
+               None,
+               FLOW_GRAPH_SCREEN_CAPTURE,
+               None,
+               FLOW_GRAPH_CLOSE,
+               APPLICATION_QUIT,
+       ]),
+       (gtk.Action('Edit', '_Edit', None, None), [
+               FLOW_GRAPH_UNDO,
+               FLOW_GRAPH_REDO,
+               None,
+               ELEMENT_DELETE,
+               SIGNAL_BLOCK_ROTATE_LEFT,
+               SIGNAL_BLOCK_ROTATE_RIGHT,
+               SIGNAL_BLOCK_PARAM_MODIFY,
+       ]),
+       (gtk.Action('Execute', '_Execute', None, None), [
+               FLOW_GRAPH_EXEC,
+               FLOW_GRAPH_STOP,
+       ]),
+       (gtk.Action('Options', '_Options', None, None), [
+               FLOW_GRAPH_WINDOW_RESIZE,       
+               PREFS_WINDOW_DISPLAY,                                   
+       ]),
+       (gtk.Action('Help', '_Help', None, None), [
+               ABOUT_WINDOW_DISPLAY,
+               HOTKEYS_WINDOW_DISPLAY,
+               DATA_TYPES_WINDOW_DISPLAY,              
+               MATH_EXPR_WINDOW_DISPLAY,
+               USRP_DIAGNOSTICS_DISPLAY,
+       ]),                                                                     
                        
+)
+
+class Toolbar(gtk.Toolbar):
+       """The gtk toolbar with actions added from the toolbar list.""" 
+       
+       def __init__(self):
+               """
+               Parse the list of action names in the toolbar list. 
+               Look up the action for each name        in the action list and 
add it to the toolbar.
+               """     
+               gtk.Toolbar.__init__(self)              
+               self.set_style(gtk.TOOLBAR_ICONS) 
+               for action_name in TOOLBAR_LIST:
+                       if action_name: #add a tool item
+                               action = get_action_from_name(action_name)
+                               self.add(action.create_tool_item())             
        
+                               #this reset of the tooltip property is required 
(after creating the tool item) for the tooltip to show
+                               action.set_property('tooltip', 
action.get_property('tooltip'))  
+                       else: self.add(gtk.SeparatorToolItem())
+       
+class MenuBar(gtk.MenuBar):
+       """The gtk menu bar with actions added from the menu bar list."""       
                
+               
+       def __init__(self):
+               """
+               Parse the list of submenus from the menubar list. 
+               For each submenu, get a list of action names.
+               Look up the action for each name in the action list and add it 
to the submenu. 
+               Add the submenu to the menu bar.
+               """
+               gtk.MenuBar.__init__(self)
+               for main_action,action_names in MENU_BAR_LIST:
+                       #create the main menu item
+                       main_menu_item = main_action.create_menu_item()
+                       self.append(main_menu_item)                     
+                       #create the menu
+                       main_menu = gtk.Menu()
+                       main_menu_item.set_submenu(main_menu)                   
        
+                       for action_name in action_names:
+                               if action_name: #append a menu item             
                        
+                                       action = 
get_action_from_name(action_name)
+                                       
main_menu.append(action.create_menu_item())
+                               else: main_menu.append(gtk.SeparatorMenuItem())
+                       main_menu.show_all() #this show all is required for the 
separators to show
+                               
+                               
\ No newline at end of file

Added: grc/branches/grc_reloaded/src/grc/gui/Dialogs.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/Dialogs.py                            
(rev 0)
+++ grc/branches/grc_reloaded/src/grc/gui/Dialogs.py    2008-01-31 21:25:54 UTC 
(rev 7533)
@@ -0,0 +1,286 @@
+"""
+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 Graphics.Dialogs
+#Misc dialogs.
address@hidden Josh Blum
+
+import Colors
+import pygtk
+pygtk.require('2.0')
+import gtk
+from DataTypes import *
+from Constants import *
+from Elements import GraphicalParam
+import Preferences
+
+class TextDisplay(gtk.TextView):
+       """A non editable gtk text view."""
+       
+       def __init__(self, text=''):
+               """!
+               TextDisplay constructor.
+               @param text the text to display (string)
+               """
+               text_buffer = gtk.TextBuffer()
+               text_buffer.set_text(text)      
+               self.set_text = text_buffer.set_text            
+               self.insert = lambda line: 
text_buffer.insert(text_buffer.get_end_iter(), line)
+               gtk.TextView.__init__(self, text_buffer)
+               self.set_editable(False)
+               self.set_cursor_visible(False)
+               self.set_wrap_mode(gtk.WRAP_WORD)
+
+######################################################################################################
+class PreferencesDialog(gtk.Dialog):
+       """A dialog box to display the preferences."""
+       
+       def __init__(self):
+               """PreferencesDialog constructor."""
+               gtk.Dialog.__init__(self, buttons=('gtk-close', 
gtk.RESPONSE_CLOSE))
+               self.set_title("Preferences")   
+               self.set_size_request(MIN_DIALOG_WIDTH, MIN_DIALOG_HEIGHT)
+               notebook = gtk.Notebook()
+               for title,notes,params in Preferences.PREFS_LIST:               
        
+                       if title:                               
+                               vbox = gtk.VBox()
+                               vbox.pack_start(gtk.Label(), False)     #blank 
label for spacing
+                               for param, key in params: 
vbox.pack_start(param.get_input_object(), False)              
+                               if notes: vbox.pack_start(TextDisplay(notes), 
False, padding=5)
+                               notebook.append_page(vbox, gtk.Label(title))    
        
+               self.vbox.pack_start(notebook, True)
+               self.show_all()
+               self.run()
+               self.destroy()
+
+######################################################################################################
+class FlowGraphWindowSizeDialog(gtk.Dialog):
+       """A dialog box to set the window size, width and heigh in pixels."""
+       
+       def __init__(self, dimensions):
+               """!
+               FlowGraphWindowSizeDialog constructor.
+               @param dimensions the (width,height) tuple from the flow graph
+               """
+               gtk.Dialog.__init__(self, buttons=('gtk-close', 
gtk.RESPONSE_CLOSE))
+               self.set_title("Set the Window Size")           
+               #       the helpful dimension constraints label #
+               window_size_label = gtk.Label()
+               window_size_label.set_markup("""<i>
+Minimum window (width/height) in pixels is (%d/%d).
+Maximum window (width/height) in pixels is (%d/%d).
+</i>"""%(MIN_WINDOW_WIDTH, MIN_WINDOW_HEIGHT, MAX_WINDOW_WIDTH, 
MAX_WINDOW_HEIGHT))
+               self.vbox.pack_end(window_size_label, False)                    
                
+               self.original_dimensions = width,height = dimensions    
+               self.width = Int(width, min=MIN_WINDOW_WIDTH, 
max=MAX_WINDOW_WIDTH)
+               self.height = Int(height, min=MIN_WINDOW_HEIGHT, 
max=MAX_WINDOW_HEIGHT)
+               self.vbox.pack_start(GraphicalParam('width (pixels)', 
self.width).get_input_object(), False)
+               self.vbox.pack_start(GraphicalParam('height (pixels)', 
self.height).get_input_object(), False)  
+               self.show_all()
+               
+       def run(self):
+               """!
+               Get the new dimensions.
+               @return the new dimensions (width,height) or None if invalid.
+               """
+               self.dimensions = None                  
+               gtk.Dialog.run(self)
+               if self.width.is_valid() and self.height.is_valid():
+                       self.dimensions = (self.width.parse(), 
self.height.parse())
+               self.destroy()
+               if self.original_dimensions == self.dimensions: return None     
# do not return dimensions if no change
+               return self.dimensions          
+
+######################################################################################################
+def MessageDialogHelper(type, buttons, title=None, markup=None):
+       """!
+       Create a modal message dialog and run it.
+       @param type the type of message: gtk.MESSAGE_INFO, gtk.MESSAGE_WARNING, 
gtk.MESSAGE_QUESTION or gtk.MESSAGE_ERROR
+       @param buttons the predefined set of buttons to use: gtk.BUTTONS_NONE, 
gtk.BUTTONS_OK, gtk.BUTTONS_CLOSE, gtk.BUTTONS_CANCEL, gtk.BUTTONS_YES_NO, 
gtk.BUTTONS_OK_CANCEL
+       @param tittle the title of the window (string)
+       @param markup the message text with pango markup
+       @return the gtk response from run()
+       """
+       message_dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL, type, 
buttons)
+       if title != None: message_dialog.set_title(title)
+       if markup != None: message_dialog.set_markup(markup)
+       response = message_dialog.run()
+       message_dialog.destroy()
+       return response
+               
+######################################################################################################
+class AboutDialog(gtk.AboutDialog):
+       """A cute little about dialog."""
+       
+       def __init__(self):
+               """AboutDialog constructor."""
+               gtk.AboutDialog.__init__(self)
+               self.set_version(VERSION)
+               self.set_name(MAIN_WINDOW_PREFIX)       
+               self.set_license(__doc__)
+               self.set_copyright('Copyright 2007 Free Software Foundation, 
Inc.')
+               
self.set_website('http://gnuradio.org/trac/wiki/GNURadioCompanion')
+               self.set_comments("""\
+Thank you to all those from the mailing list who tested GNU Radio Companion 
and offered advice.
+--
+Special Thanks:
+A. Brinton Cooper -> starting the project
+CER Technology Fellowship Grant -> initial funding
+William R. Kenan Jr. Fund -> usrp & computers
+Patrick Strasser -> the GRC icon
+Achilleas Anastasopoulos -> trellis support
+--""")
+               self.run()
+               self.destroy()
+                                       
+######################################################################################################
                 
+class DataTypesDialog(gtk.Dialog):
+       """Display each data type with its associated color."""
+       
+       def __init__(self):
+               """DataTypesDialog constructor."""
+               gtk.Dialog.__init__(self, buttons=('gtk-close', 
gtk.RESPONSE_CLOSE))
+               self.set_title('Data Types')
+               self.set_size_request(170, -1)
+               markup = ''
+               for color_spec in (
+                       'Regular Types:',
+                       ('Complex', Colors.COMPLEX_COLOR_SPEC),
+                       ('Float', Colors.FLOAT_COLOR_SPEC),
+                       ('Int', Colors.INT_COLOR_SPEC),
+                       ('Short', Colors.SHORT_COLOR_SPEC),                     
                                                        
+                       ('Byte', Colors.BYTE_COLOR_SPEC),
+                       'Vector Types:',
+                       ('Complex Vector', Colors.COMPLEX_VECTOR_COLOR_SPEC),
+                       ('Float Vector', Colors.FLOAT_VECTOR_COLOR_SPEC),
+                       ('Int Vector', Colors.INT_VECTOR_COLOR_SPEC),
+                       ('Short Vector', Colors.SHORT_VECTOR_COLOR_SPEC),       
                                                                        
+                       ('Byte Vector', Colors.BYTE_VECTOR_COLOR_SPEC),
+               ):
+                       width = 20 #width in monospace characters
+                       if type(color_spec) == type(str()): markup = 
'%s\n\n<b>%s</b>'%(markup, color_spec.center(width, ' '))
+                       else:   
+                               tag,spec = color_spec                           
        
+                               markup = '%s\n<span 
background="%s">%s</span>'%(markup, spec, tag.center(width, ' '))
+               label = gtk.Label()
+               label.set_markup('<tt>%s</tt>\n'%markup[1:])    #strip 1st 
newline, append newline
+               self.vbox.pack_start(label, False)
+               self.show_all()
+               self.run()
+               self.destroy()                  
+                       
+######################################################################################################
                 
+class HotKeysDialog(gtk.Dialog):
+       """Display each action with the associated hotkey."""
+       
+       def __init__(self):
+               """HotKeysDialog constructor."""
+               gtk.Dialog.__init__(self, buttons=('gtk-close', 
gtk.RESPONSE_CLOSE))
+               self.set_title('Hot Keys')
+               markup = ''
+               for action, hotkey in (
+                       ('New Flow Graph', 'Ctrl + n'),
+                       ('Open Flow Graph', 'Ctrl + o'),
+                       ('Save Flow Graph', 'Ctrl + s'),
+                       ('Undo Change', 'Ctrl + z'),
+                       ('Redo Change', 'Ctrl + y'),
+                       ('Redo Change', 'Ctrl + Z'),
+                       ('Delete Block', 'Delete'),
+                       ('Rotate Block', 'Right'),
+                       ('Rotate Block', 'Left'),
+                       ('Modify Data Type', 'Up'),
+                       ('Modify Data Type', 'Down'),
+                       ('Add a Socket', '+'),
+                       ('Remove a Socket', '-'),
+                       ('Close Dialog', 'Esc'),
+                       ('Flow Graph Run', 'F5'),
+                       ('Flow Graph Stop', 'F7'),
+                       ('Screen Shot', 'PrintScreen'),
+               ): markup = '%s\n<b>%s:</b>%s'%(markup, action, 
hotkey.rjust(25-len(action),' '))
+               label = gtk.Label()
+               label.set_markup('<tt>%s</tt>\n'%markup)        #append newline
+               self.vbox.pack_start(label, False)
+               self.show_all()
+               self.run()
+               self.destroy()          
+               
+######################################################################################################
                 
+class MathExprDialog(gtk.Dialog):
+       """A dialog to test math expressions for the parser."""
+       
+       ##the help message
+       HELP_MSG = """\
+<b>Operators - Complex   <i>(complex arguments)</i></b> 
+       + - * / ^       
+<b>Trigonometric Functions   <i>(complex arguments, radians)</i></b> 
+       sin(z) cos(z) tan(z) asin(z) acos(z) atan(z) 
+       sinh(z) cosh(z) tanh(z) asinh(z) acosh(z) atanh(z)      
+<b>Complex Components   <i>(complex arguments)</i></b>
+       mag(z*) real(z*) imag(z*) conj(z*) arg(z)
+<b>Misc Functions   <i>(complex arguments)</i></b> 
+       abs(z*) pow(b, p) sqrt(z) log10(z) log(z, [b=e]) ln(z) exp(z) 
+<b>Misc Functions   <i>(floating point arguments)</i></b> 
+       floor(f) ceil(f) radians(deg) degrees(rad) mod(f1, f2) atan2(y, x) 
sgn(f) min(f*) max(f*)
+<b>Filter Taps Generators   <i>(floating point arguments, rates and 
frequencies in Hz)</i></b> 
+       low_pass(gain, samp_rate, cutoff_freq, width, [window=hamming], 
[beta=6.76])
+       high_pass(gain, samp_rate, cutoff_freq, width, [window=hamming], 
[beta=6.76])   
+       band_pass(gain, samp_rate, low_cutoff_freq, high_cutoff_freq, width, 
[window=hamming], [beta=6.76])
+       complex_band_pass(gain, samp_rate, low_cutoff_freq, high_cutoff_freq, 
width, [window=hamming], [beta=6.76])
+       band_reject(gain, samp_rate, low_cutoff_freq, high_cutoff_freq, width, 
[window=hamming], [beta=6.76])   
+       gaussian(gain, spb, bt, int ntaps)
+       hilbert(int ntaps, [window=rectangular], [beta=6.76])
+       root_raised_cosine(gain, samp_rate, symbol_rate, alpha, int ntaps) 
+       window(window, int ntaps, beta) 
+<b>Window Types for Filters</b>
+       hamming hann blackman rectangular kaiser
+<b>Other Constants</b>
+       pi e j  
+<b>Using Vectors</b>
+       () (num1,) (num2, num2, ...)    
+<b>Test Your Expressions Below:</b>\
+"""
+
+       def __init__(self):
+               """MathExprDialog constrcutor. Create a new gtk Dialog with a 
close button, an extry box, and an output text box."""            
+               gtk.Dialog.__init__(self, buttons=('gtk-close', 
gtk.RESPONSE_CLOSE))
+               #       Create the title and label      #
+               self.set_title('Mathematical Expressions')
+               label = gtk.Label()
+               label.set_markup(self.HELP_MSG)
+               self.vbox.pack_start(label, False)              
+               self.set_size_request(800, 600)
+               #       create a text box for parser output     #
+               self.text_box = TextDisplay()
+               self.text_box.set_text('')                      
+               # create the entry box and give it the change handler #
+               self.param = GraphicalParam('Expression', RawExpr(''))
+               self.input_obj = 
self.param.get_input_object(self._handle_changed)
+               self.vbox.pack_start(self.input_obj, False)                     
+               # add the scrolled window for the text box #
+               scrolled_window = gtk.ScrolledWindow()
+               scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, 
gtk.POLICY_AUTOMATIC)
+               scrolled_window.add_with_viewport(self.text_box)
+               self.vbox.pack_start(scrolled_window, True)     
+               self.show_all()
+               self.run()
+               self.destroy()
+               
+       def _handle_changed(self, param=None):
+               """Handle changed in the param's entry box by updating the text 
box."""
+               self.text_box.set_text(str(self.param.get_data_type())) 
+               
\ No newline at end of file

Added: grc/branches/grc_reloaded/src/grc/gui/FileDialogs.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/FileDialogs.py                        
        (rev 0)
+++ grc/branches/grc_reloaded/src/grc/gui/FileDialogs.py        2008-01-31 
21:25:54 UTC (rev 7533)
@@ -0,0 +1,160 @@
+"""
+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 Graphics.FileDialogs
+#The open/save dialog for flow graph fFileDialogiles and screen shots.
address@hidden Josh Blum
+
+import pygtk
+pygtk.require('2.0')
+import gtk
+from Dialogs import MessageDialogHelper
+from Constants import 
DEFAULT_FILE_PATH,FLOW_GRAPH_FILE_EXTENSION,IMAGE_FILE_EXTENSION,NEW_FLOGRAPH_TITLE
+from os import path
+
+OPEN_FLOW_GRAPH = 'open flow graph'
+SAVE_FLOW_GRAPH = 'save flow graph'
+SAVE_IMAGE = 'save image'
+
+##the filter for flow graph files
+FLOW_GRAPH_FILE_FILTER = gtk.FileFilter()
+FLOW_GRAPH_FILE_FILTER.set_name('FG Files')
+FLOW_GRAPH_FILE_FILTER.add_pattern('*'+FLOW_GRAPH_FILE_EXTENSION)
+
+##the filter for image files
+IMAGE_FILE_FILTER = gtk.FileFilter()
+IMAGE_FILE_FILTER.set_name('Image Files')
+IMAGE_FILE_FILTER.add_pattern('*'+IMAGE_FILE_EXTENSION)
+
+##the filter for all files
+ALL_FILE_FILTER = gtk.FileFilter()
+ALL_FILE_FILTER.set_name('All Files')
+ALL_FILE_FILTER.add_pattern('*')       
+
+class FileDialogHelper(gtk.FileChooserDialog):
+       """
+       A wrapper class for the gtk file chooser dialog. 
+       Implement a file chooser dialog with only necessary parameters.
+       """
+       
+       def __init__(self, action, title):
+               """!
+               FileDialogHelper contructor.
+               Create a save or open dialog with cancel and ok buttons.
+               Use standard settings: no multiple selection, local files only, 
and the * filter.
+               @param action gtk.FILE_CHOOSER_ACTION_OPEN or 
gtk.FILE_CHOOSER_ACTION_SAVE
+               @param title the title of the dialog (string)
+               """
+               ok_stock = {gtk.FILE_CHOOSER_ACTION_OPEN : 'gtk-open', 
gtk.FILE_CHOOSER_ACTION_SAVE : 'gtk-save'}[action]
+               gtk.FileChooserDialog.__init__(self, title, None, action, 
('gtk-cancel', gtk.RESPONSE_CANCEL, ok_stock, gtk.RESPONSE_OK))               
+               self.set_select_multiple(False)
+               self.set_local_only(True)
+               self.add_filter(ALL_FILE_FILTER)
+               self.connect('key_press_event', self._handle_key_press)
+
+       def _handle_key_press(self, widget, event):
+               """
+               Handle key presses from the keyboard.
+               Call the ok response when enter is pressed.     
+               @return false to forward the keypress
+               """
+               keyname = gtk.gdk.keyval_name(event.keyval)
+               if keyname == 'Return': self.response(gtk.RESPONSE_OK)          
        
+               return False #forward the keypress
+
+class FileDialog(FileDialogHelper):
+       """A dialog box to save or open flow graph files. This is a base class, 
do not use."""
+               
+       def __init__(self, current_file_path=''):
+               """!
+               FileDialog constructor. 
+               @param current_file_path the current directory or path to the 
open flow graph
+               """
+               if not current_file_path: current_file_path = 
DEFAULT_FILE_PATH+NEW_FLOGRAPH_TITLE+FLOW_GRAPH_FILE_EXTENSION
+               if self.type == OPEN_FLOW_GRAPH:
+                       FileDialogHelper.__init__(self, 
gtk.FILE_CHOOSER_ACTION_OPEN, 'Open a Flow Graph from a File...')
+                       self.add_and_set_filter(FLOW_GRAPH_FILE_FILTER)
+               elif self.type == SAVE_FLOW_GRAPH:
+                       FileDialogHelper.__init__(self, 
gtk.FILE_CHOOSER_ACTION_SAVE, 'Save a Flow Graph to a File...') 
+                       self.add_and_set_filter(FLOW_GRAPH_FILE_FILTER)
+                       self.set_current_name(path.basename(current_file_path)) 
#show the current filename
+               elif self.type == SAVE_IMAGE:
+                       FileDialogHelper.__init__(self, 
gtk.FILE_CHOOSER_ACTION_SAVE, 'Save a Flow Graph Screen Shot...')
+                       self.add_and_set_filter(IMAGE_FILE_FILTER)
+                       current_file_path = current_file_path + 
IMAGE_FILE_EXTENSION    
+                       self.set_current_name(path.basename(current_file_path)) 
#show the current filename              
+               self.set_current_folder(path.dirname(current_file_path))        
#current directory      
+               
+       def add_and_set_filter(self, filter):
+               """!
+               Add the gtk file filter to the list of filters and set it as 
the default file filter.
+               @param filter a gtk file filter.
+               """
+               self.add_filter(filter)
+               self.set_filter(filter)
+
+       def get_rectified_filename(self):
+               """!
+               Run the dialog and get the filename. 
+               If this is a save dialog and the file name is missing the 
extension, append the file extension.
+               If the file name with the extension already exists, show a 
overwrite dialog.
+               @return the complete file path 
+               """
+               if gtk.FileChooserDialog.run(self) == gtk.RESPONSE_OK: 
+                       filename = self.get_filename()
+                       #############################################
+                       # Handle Save Dialogs
+                       #############################################
+                       if self.type in (SAVE_FLOW_GRAPH, SAVE_IMAGE):          
                        
+                               for extension,filter in (
+                                       (FLOW_GRAPH_FILE_EXTENSION, 
FLOW_GRAPH_FILE_FILTER), 
+                                       (IMAGE_FILE_EXTENSION, 
IMAGE_FILE_FILTER)
+                               ): #append the missing file extension if the 
filter matches
+                                       if      
filename[len(filename)-len(extension):] != extension and filter == 
self.get_filter(): filename = filename + extension                   
+                               self.set_current_name(path.basename(filename))  
#show the filename with extension                               
+                               if path.exists(filename): #ask the user to 
confirm overwrite                                            
+                                       if MessageDialogHelper(
+                                               gtk.MESSAGE_QUESTION, 
gtk.BUTTONS_YES_NO, 'Confirm Overwrite!',
+                                               'File <b>"%s"</b> 
Exists!\nWould you like to overwrite the existing file?'%filename,
+                                       ) == gtk.RESPONSE_NO: filename = 
self.get_rectified_filename()                  
+                       #############################################
+                       # Handle Open Dialogs
+                       #############################################
+                       elif self.type in (OPEN_FLOW_GRAPH,):
+                               if not path.exists(filename): #show a warning 
and re-run
+                                       MessageDialogHelper(
+                                               gtk.MESSAGE_WARNING, 
gtk.BUTTONS_CLOSE, 'Cannot Open!',
+                                               'File <b>"%s"</b> Does not 
Exist!'%filename,
+                                       )       
+                                       filename = self.get_rectified_filename()
+                       return filename 
+               return None     #response was cancel
+
+       def run(self):
+               """!
+               Get the filename and destroy the dialog.
+               @return the filename or None if a close/cancel occured.
+               """             
+               filename = self.get_rectified_filename()
+               self.destroy()
+               return filename 
+               
+class OpenFlowGraphFileDialog(FileDialog): type = OPEN_FLOW_GRAPH      
+class SaveFlowGraphFileDialog(FileDialog): type = SAVE_FLOW_GRAPH      
+class SaveImageFileDialog(FileDialog): type = SAVE_IMAGE       
+

Added: grc/branches/grc_reloaded/src/grc/gui/FlowGraph.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/FlowGraph.py                          
(rev 0)
+++ grc/branches/grc_reloaded/src/grc/gui/FlowGraph.py  2008-01-31 21:25:54 UTC 
(rev 7533)
@@ -0,0 +1,502 @@
+"""
+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 Graphics.FlowGraph
+#A flow graph structure for storing signal blocks and their connections.
address@hidden Josh Blum
+
+from Constants import *
+from Actions import *
+from Colors import BACKGROUND_COLOR, TXT_COLOR
+from Elements import GraphicalSignalBlock,GraphicalConnection
+from Elements import Utils
+from Elements.Connection import ConnectionException
+import Variables
+import pygtk
+pygtk.require('2.0')
+import gtk
+import time,socket #for tagging saved files
+import SignalBlockDefs
+from SignalBlockParamsDialog import SignalBlockParamsDialog
+import random
+import Messages
+import Preferences
+import ParseXML
+import Messages
+
+class FlowGraph(gtk.DrawingArea):
+       """
+       FlowGraph is the data structure to store graphical signal blocks, 
+       graphical inputs and outputs, 
+       and the connections between inputs and outputs.
+       """     
+               
+       def __init__(self, handle_states, variable_modification_window):
+               """!
+               FlowGraph contructor.
+               Create a list for signal blocks and connections. Connect mouse 
handlers.
+               @param handle_states the callback function
+               @param variable_modification_window var mod window also for 
callbacks
+               """     
+               #setup
+               self.elements = list()
+               self.remove_element = lambda e: self.elements.remove(e)
+               self.gc = None
+               self.handle_states = handle_states
+               self.variable_modification_window = variable_modification_window
+               gtk.DrawingArea.__init__(self)
+               self.connect('expose-event', self._handle_window_expose)
+               self.connect('motion-notify-event', self._handle_mouse_motion)
+               self.connect('button-press-event', 
self._handle_mouse_button_press)  
+               self.connect('button-release-event', 
self._handle_mouse_button_release)         
+               self.set_events(
+                       gtk.gdk.BUTTON_PRESS_MASK | \
+                       gtk.gdk.POINTER_MOTION_MASK | \
+                       gtk.gdk.BUTTON_RELEASE_MASK | \
+                       gtk.gdk.LEAVE_NOTIFY_MASK | \
+                       gtk.gdk.ENTER_NOTIFY_MASK
+               )       
+               #       setup the focus flag    #               
+               self.focus_flag = False
+               self.get_focus_flag = lambda: self.focus_flag           
+               self.connect("leave-notify-event", self._handle_focus_event, 
False)
+               self.connect("enter-notify-event", self._handle_focus_event, 
True)              
+               #       important vars dealing with mouse event tracking        
#       
+               self.has_moved = False
+               self.mouse_pressed = False
+               self.coordinate = (0,0)
+               self.selected_element = None
+               self.is_selected = lambda: self.selected_element != None
+               self.count = 0
+               self.pixmap = None
+               
+###########################################################################
+#      Flow Graph Access Methods
+###########################################################################    
+       
+       def _handle_focus_event(self, widget, event, focus_flag):
+               """Record the focus state of the flow graph window."""
+               self.focus_flag = focus_flag
+                               
+       def add_signal_block(self, tag):        
+               """!
+               Add a signal block of the given tag to this flow graph.
+               @param tag the signal block tag
+               """
+               index = 0
+               while True:
+                       id = tag+str(index)
+                       index = index + 1       
+                       if not [
+                               None for element in self.elements if 
Utils.is_signal_block(element) and id == element.get_id()
+                       ]:              #make sure that the id is not used by 
another signal block
+                               rot = 0
+                               vAdj = 
self.get_parent().get_vadjustment().get_value()
+                               hAdj = 
self.get_parent().get_hadjustment().get_value()
+                               x = random.randint(100,400)+int(hAdj)   
+                               y = random.randint(100,400)+int(vAdj)   
+                               self.elements.append(
+                                       SignalBlockDefs.get_signal_block(self, 
(x, y), rot, tag, id, GraphicalSignalBlock)[0]
+                               )
+                               self.handle_states(SIGNAL_BLOCK_CREATE) 
+                               self.update()
+                               return          
+       
+       def type_controller_modify_selected(self, direction):
+               """
+               !Change the registered type controller for the selected signal 
block.
+               @param direction +1 or -1
+               @return true for success
+               """
+               if Utils.is_socket(self.selected_element): 
self.selected_element = self.selected_element.get_parent()
+               if Utils.is_signal_block(self.selected_element): return 
self.selected_element.modify_type_controller(direction)
+               return False
+               
+       def socket_controller_modify_selected(self, direction):
+               """!
+               Change socket controller for the selected signal block.
+               @param direction +1 or -1
+               @return true for success
+               """
+               if Utils.is_socket(self.selected_element): 
self.selected_element = self.selected_element.get_parent()
+               if Utils.is_signal_block(self.selected_element): return 
self.selected_element.modify_socket_controller(direction)
+               return False
+
+       def param_modify_selected(self):
+               """!
+               Create and show a param modification dialog for the selected 
element (socket and signal block only).
+               @return true if parameters were changed
+               """
+               if Utils.is_socket(self.selected_element): 
self.selected_element = self.selected_element.get_parent()
+               if Utils.is_signal_block(self.selected_element):
+                       signal_block_params_dialog = 
SignalBlockParamsDialog(self.selected_element)
+                       changed = signal_block_params_dialog.run()      
+                       self.update()   
+                       return changed #changes were made?
+               return False    
+               
+       def connect_sockets(self, s1, s2):
+               """!
+               Connect input and output sockets. Ignore state change if 
creation of connection fails.
+               @param s1 a socket
+               @param s2 another socket
+               """
+               try:            
+                       connection = GraphicalConnection(self, s1, s2)
+                       self.elements.append(connection)
+                       self.selected_element = None
+                       self.handle_states(CONNECTION_CREATE)   
+                       self.update()   
+               except ConnectionException: 
+                       Messages.send_fail_connection() 
+                       self.handle_states(NOTHING_SELECT)      
+       
+       def move_selected(self, delta_coordinate):
+               """!
+               Move the element and by the change in coordinates.
+               @param delta_coordinate the change in coordinates
+               """
+               if self.selected_element != None:                               
        
+                       self.selected_element.move(delta_coordinate)    
+                       self.has_moved = True   
+                       self.draw()
+                       
+       def rotate_selected(self, direction):
+               """!
+               Rotate the selected element by 90 degrees. Only rotate 
SignalBlocks and Sockets.
+               @param direction DIR_LEFT or DIR_RIGHT
+               @return         true if rotated, otherwise false. 
+               """
+               if self.selected_element != None and 
(Utils.is_signal_block(self.selected_element) or 
Utils.is_socket(self.selected_element)):                                  
+                       self.selected_element.rotate(direction) 
+                       self.draw()
+                       return True
+               return False    
+       
+       def delete_selected(self):
+               """!
+               If an element is selected, remove it and its attached parts 
from the element list.
+               @return true if the element was deleted, otherwise false.
+               """
+               if self.selected_element != None:
+                       if Utils.is_socket(self.selected_element):      # found 
a socket, set to parent signal block
+                               self.selected_element = 
self.selected_element.get_parent()                                              
+                       if Utils.is_signal_block(self.selected_element):        
# delete a signal block
+                               connections = 
self.selected_element.get_connections()
+                               for connection in connections: 
connection.disconnect()
+                               self.remove_element(self.selected_element)
+                       elif Utils.is_connection(self.selected_element):        
# delete a connection
+                               self.selected_element.disconnect()              
                        
+                       self.selected_element = None                            
+                       self.update()   
+                       return True
+               return False
+               
+       def unselect(self):
+               """If an element is selected, un-highlight it and set selected 
to None."""
+               if self.selected_element != None: 
+                       self.selected_element.set_highlighted(False)            
        
+                       self.selected_element = None    
+                       self.update()   
+                                       
+       def what_is_selected(self, coor):               
+               """!
+               What is selected?
+               At the given coordinate, return the first element found to be 
selected  
+               - iterate though the elements backwards since top elements are 
at the end of the list   
+               - if an element is selected, place it at the end of the list so 
that is is drawn last, 
+                       and hence on top.
+               @param coor the coordinate of the mouse click
+               @return the selected element or None
+               """              
+               #       check the elements      #                       
+               for element in reversed(self.elements):
+                       if element.what_is_selected(coor) != None:
+                               self.elements.remove(element)
+                               self.elements.append(element)
+                               return element.what_is_selected(coor)           
+               return None
+               
+       def draw(self, drawable=None):          
+               """Draw the background and then all of the Elements in this 
FlowGraph on the pixmap, 
+               then draw the pixmap to the drawable window of this 
FlowGraph."""
+               if self.gc != None:                             
+                       #       draw the background     #               
+                       W,H = self.get_size_request()
+                       self.gc.foreground = BACKGROUND_COLOR
+                       self.pixmap.draw_rectangle(self.gc, True, 0, 0, W, H)   
+                       if Preferences.show_grid():                             
+                               grid_size = Preferences.get_grid_size()         
                
+                               points = list()
+                               for i in range(W/grid_size):
+                                       for j in range(H/grid_size): 
+                                               
points.append((i*grid_size,j*grid_size))                                        
+                               self.gc.foreground = TXT_COLOR                  
                
+                               self.pixmap.draw_points(self.gc, points)        
+                       #       draw the foreground     #
+                       for element in filter(Utils.is_signal_block, 
self.elements) + filter(Utils.is_connection, self.elements): 
+                               element.draw(self.pixmap)       # draw signal 
blocks first, then connections on the top                 
+                       if self.mouse_pressed and self.selected_element != None:
+                               self.selected_element.draw(self.pixmap)
+                       self.window.draw_drawable(self.gc, self.pixmap, 0, 0, 
0, 0, -1, -1)      
+                       
+       def is_valid(self):
+               """!
+               Is the flow graph valid, ie: are all elements valid?
+               @return true if flow graph is valid
+               """             
+               for element in self.elements: 
+                       if not element.is_valid(): return False
+               return True
+               #return all([element.is_valid() for element in self.elements])  
#python 2.5 and higher
+               
+       def update(self):
+               """Call update on all elements."""      
+               for element in self.elements: element.update()  
+               self.draw()
+               
+       
##########################################################################
+       ##      Handlers
+       
##########################################################################      
+               
+       def _handle_mouse_button_press(self, widget, event):
+               """ A mouse button is pressed. Record the state of the mouse, 
find the selected element,
+               set the Element highlighted, handle the state change, and 
redraw the FlowGraph."""              
+               #       unselect anything in the vars mod window        #
+               self.variable_modification_window.unselect_all()
+               if event.button == 1:
+                       if self.selected_element != None: 
self.selected_element.set_highlighted(False)
+                       self.count = 0
+                       self.mouse_pressed = True
+                       self.coordinate = (event.x, event.y)
+                       old_selection = self.selected_element
+                       self.selected_element = self.what_is_selected((event.x, 
event.y))
+                       #       handle the state change with the new selection  
#
+                       if Utils.is_connection(self.selected_element): 
self.handle_states(CONNECTION_SELECT)    
+                       elif Utils.is_socket(self.selected_element): 
self.handle_states(SOCKET_SELECT)  
+                       elif Utils.is_signal_block(self.selected_element): 
self.handle_states(SIGNAL_BLOCK_SELECT)      
+                       elif self.selected_element == None: 
self.handle_states(NOTHING_SELECT)                                          
+                       #       this selection and the last were Sockets, try 
to connect them   #
+                       if Utils.is_socket(old_selection) and 
Utils.is_socket(self.selected_element) and\
+                               old_selection is not self.selected_element: 
#cannot be the same socket
+                               self.connect_sockets(old_selection, 
self.selected_element)                                              
+                       if self.selected_element != None: 
self.selected_element.set_highlighted(True)                                     
                              
+                       #       double click detected, bring up params dialog 
if possible       #
+                       if event.type == gtk.gdk._2BUTTON_PRESS and 
Utils.is_signal_block(self.selected_element):
+                               self.mouse_pressed = False
+                               self.handle_states(SIGNAL_BLOCK_PARAM_MODIFY)   
                        
+                       self.draw()
+               return True
+               
+       def _handle_mouse_button_release(self, widget, event):
+               """A mouse button is released, record the state."""
+               if event.button == 1:
+                       self.mouse_pressed = False
+                       if self.has_moved:
+                               if Preferences.snap_to_grid():
+                                       grid_size = Preferences.get_grid_size()
+                                       X,Y = 
self.selected_element.get_coordinate()
+                                       deltaX = X%grid_size
+                                       if deltaX < grid_size/2: deltaX = -1 * 
deltaX
+                                       else: deltaX = grid_size - deltaX
+                                       deltaY = Y%grid_size
+                                       if deltaY < grid_size/2: deltaY = -1 * 
deltaY
+                                       else: deltaY = grid_size - deltaY
+                                       self.move_selected((deltaX,deltaY))
+                               self.handle_states(SIGNAL_BLOCK_MOVE)
+                               self.has_moved = False
+               return True
+               
+       def _handle_mouse_motion(self, widget, event):          
+               """The mouse has moved. If mouse_pressed is true, react to the 
motions: 
+               -       if an Element is highlighted, this will move the 
Element by redrawing it at the new position."""
+               fgW,fgH = self.get_size_request()
+               self.count = (1 + 
self.count)%MOTION_DETECT_REDRAWING_SENSITIVITY
+               #       to perform a movement, the mouse must be pressed, an 
element selected, count of zero.   #
+               if self.mouse_pressed and\
+                       self.count == 0 and\
+                       self.selected_element != None:
+                       #       The event coordinates must be within 10 pixels 
away from the bounds of the flow graph.  #
+                       x = event.x
+                       if x <= BORDER_PROXIMITY_SENSITIVITY:
+                               x = BORDER_PROXIMITY_SENSITIVITY
+                       if      x >= fgW - BORDER_PROXIMITY_SENSITIVITY:
+                               x = fgW - BORDER_PROXIMITY_SENSITIVITY          
                        
+                       y = event.y
+                       if y <= BORDER_PROXIMITY_SENSITIVITY:
+                               y = BORDER_PROXIMITY_SENSITIVITY
+                       if      y >= fgH - BORDER_PROXIMITY_SENSITIVITY:        
+                               y = fgH - BORDER_PROXIMITY_SENSITIVITY  
+                       #       get the change in coordinates   #               
+                       X,Y = self.coordinate
+                       deltaX = int(x - X)
+                       deltaY = int(y - Y)                                     
                                                
+                       vAdj = self.get_parent().get_vadjustment().get_value()
+                       hAdj = self.get_parent().get_hadjustment().get_value()
+                       width = self.get_parent().get_hadjustment().page_size
+                       height = self.get_parent().get_vadjustment().page_size
+                       # scroll horizontal if we moved near the border #
+                       if x-hAdj > width-SCROLL_PROXIMITY_SENSITIVITY and\
+                               hAdj+SCROLL_DISTANCE < fgW - width:
+                               
self.get_parent().get_hadjustment().set_value(hAdj+SCROLL_DISTANCE)
+                       elif x-hAdj < SCROLL_PROXIMITY_SENSITIVITY:
+                               
self.get_parent().get_hadjustment().set_value(hAdj-SCROLL_DISTANCE)
+                       # scroll vertical if we moved near the border   #
+                       if y-vAdj > height-SCROLL_PROXIMITY_SENSITIVITY and\
+                               vAdj+SCROLL_DISTANCE < fgH - height:
+                               
self.get_parent().get_vadjustment().set_value(vAdj+SCROLL_DISTANCE)
+                       elif y-vAdj < SCROLL_PROXIMITY_SENSITIVITY:
+                               
self.get_parent().get_vadjustment().set_value(vAdj-SCROLL_DISTANCE)
+                       # move the selected element and record the new 
coordinate       #                       
+                       self.move_selected((deltaX, deltaY))    
+                       self.coordinate = (x, y)        
+                                       
+       def _handle_window_expose(self, widget, event): 
+               """Called when the window initially appears or is resized: 
create a new pixmap, draw the flow graph."""
+               self.gc = self.window.new_gc()
+               width, height = self.get_size_request()
+               if self.pixmap == None or (width, height) != 
self.pixmap.get_size():            
+                       self.pixmap = gtk.gdk.Pixmap(self.window, width, 
height, -1)
+               self.draw()
+
+##########################################################################
+##
+##                     Export the Flow Graph
+##
+##########################################################################     
                                        
+       def to_nested_data(self):
+               """!
+               Dump all the values in this flow graph into a nested data 
format.
+               @return nested data representing a flow graph
+               """
+               vars_list = list()
+               signal_blocks_list = list()
+               connections_list = list()
+               W,H = self.get_size_request()
+               nested_data = ('flow_graph', [
+                       ('timestamp', str(time.time())),
+                       ('hostname', socket.gethostname()),
+                       ('version', VERSION),
+                       ('valid', str(self.is_valid())),
+                       ('window_width', str(W)),
+                       ('window_height', str(H)),
+                       ('vars', vars_list),
+                       ('signal_blocks', signal_blocks_list),
+                       ('connections', connections_list)
+               ])      
+       
##########################################################################
+       ##      Export the Variables
+       
##########################################################################      
+               for key in self.variable_modification_window.to_key_list():
+                       row = (key,) + Variables.get_values(key)
+                       vars_list.append(('var', [
+                               ('key', row[0]), 
+                               ('value', row[1]),
+                               ('min', row[2]),
+                               ('max', row[3]),
+                               ('step', row[4]),
+                       ]))
+       
##########################################################################
+       ##      Export the Signal Blocks
+       
##########################################################################
+               for element in filter(Utils.is_signal_block, self.elements):
+                       params_list = list()
+                       signal_blocks_list.append(('signal_block', [
+                               ('tag', element.get_tag()), 
+                               ('id', element.get_id()),
+                               ('x_coordinate', 
str(element.get_coordinate()[0])),
+                               ('y_coordinate', 
str(element.get_coordinate()[1])),
+                               ('rotation', str(element.get_rotation())),
+                               ('params', params_list)
+                       ]))
+                       for param in element.get_params():
+                               params_list.append(('param', 
str(param.get_data_type().get_data()))     )       
+       
##########################################################################
+       ##      Export the Connections
+       
##########################################################################
+               for element in filter(Utils.is_connection, self.elements):
+                       connections_list.append(('connection', [
+                               ('input_signal_block_id', 
str(element.get_input_socket().get_parent().get_id())), 
+                               ('input_socket_index', 
str(element.get_input_socket().get_index())),
+                               ('output_signal_block_id', 
str(element.get_output_socket().get_parent().get_id())), 
+                               ('output_socket_index', 
str(element.get_output_socket().get_index()))
+                       ]))
+               #print 'To',nested_data
+               return nested_data
+
+##########################################################################
+##     
+##                     Import the Flow Graph
+##
+##########################################################################     
        
+       def from_nested_data(self, nested_data):
+               """!
+               Set all the values in this flow graph using the nested data.
+               @param nested_data nested data representing a flow graph
+               """
+               #print 'From',nested_data
+               #TODO: use a non-destructive method to clear the elements list
+               self.elements = list()  #clear the elements
+               find_data = ParseXML.find_data
+               flow_graph = find_data([nested_data], 'flow_graph')
+               #       window width and height are optional    #
+               window_width = find_data(flow_graph, 'window_width')
+               if window_width == None: window_width = MAX_WINDOW_WIDTH
+               window_height = find_data(flow_graph, 'window_height')
+               if window_height == None: window_height = MAX_WINDOW_HEIGHT
+               self.set_size_request(int(window_width),int(window_height))
+               vars = find_data(flow_graph, 'vars')
+               signal_blocks = find_data(flow_graph, 'signal_blocks')
+               connections = find_data(flow_graph, 'connections')
+       
##########################################################################
+       ##      Import the Variables
+       
##########################################################################
+               keys = Variables.from_nested_data(vars)
+               self.variable_modification_window.from_key_list(keys)
+       
##########################################################################
+       ##      Import the Signal Blocks
+       
##########################################################################
+               for signal_block in signal_blocks:
+                       signal_block = 
GraphicalSignalBlock.from_nested_data(self, signal_block, 
GraphicalSignalBlock)[0]       #index 0 for just signal block  
+                       if signal_block: self.elements.append(signal_block)     
                
+       
##########################################################################
+       ##      Import the Connections
+       
##########################################################################
+               for connection in connections:
+                       connection = find_data([connection], 'connection')
+                       input_signal_block_id = find_data(connection, 
'input_signal_block_id')
+                       input_socket_index = int(find_data(connection, 
'input_socket_index'))
+                       output_signal_block_id = find_data(connection, 
'output_signal_block_id')
+                       output_socket_index = int(find_data(connection, 
'output_socket_index'))
+                       input_socket = output_socket = None                     
                                                        
+                       for element in filter(Utils.is_signal_block, 
self.elements):
+                               if element.get_id() == input_signal_block_id: 
input_socket = element.get_input_socket(input_socket_index)
+                               if element.get_id() == output_signal_block_id: 
output_socket = element.get_output_socket(output_socket_index)
+                       try: self.elements.append(GraphicalConnection(self, 
input_socket, output_socket))
+                       except ConnectionException: 
+                               Messages.send_error_load('Could not connect 
"%s" input[%d] and "%s" output[%d].'%(
+                                               input_signal_block_id, 
+                                               input_socket_index, 
+                                               output_signal_block_id, 
+                                               output_socket_index,
+                                       )
+                               )       
+               self.selected_element = None            
+               self.update()
+               # done importing the flow graph #
+

Added: grc/branches/grc_reloaded/src/grc/gui/MainWindow.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/MainWindow.py                         
(rev 0)
+++ grc/branches/grc_reloaded/src/grc/gui/MainWindow.py 2008-01-31 21:25:54 UTC 
(rev 7533)
@@ -0,0 +1,419 @@
+"""
+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 Graphics.MainWindow
+#The main window, containing all windows, tool bars, and menu bars.
address@hidden Josh Blum
+
+from Constants import *
+from Actions import *
+import pygtk
+pygtk.require('2.0')
+import gtk
+import Bars
+from FlowGraph import FlowGraph
+from SignalBlockSelectionWindow import SignalBlockSelectionWindow
+from VariableModificationWindow import VariableModificationWindow
+from Dialogs import TextDisplay,MessageDialogHelper
+from StateCache import StateCache
+import Preferences
+import Messages
+import ParseXML
+import os
+
+############################################################
+##     Notebook Page
+############################################################
+
+class Page(gtk.HBox):
+       """A page in the notebook."""
+       
+       def __init__(self, main_window, file_path=''):
+               """
+               Page constructor.
+               @param main_window main window
+               @param file_path path to a flow graph file
+               """             
+               #import the file
+               self.main_window = main_window
+               initial_state = ParseXML.from_xml(ParseXML.from_file(file_path 
or INITIAL_FLOW_GRAPH_FILE))
+               self.state_cache = StateCache(initial_state)
+               self.set_pid_file('')
+               self.set_file_path(file_path)           
+               self.set_saved(True)    
+               #parse xml success, initialize page             
+               gtk.HBox.__init__(self, False, 0)
+               self.show()             
+               #tab box to hold label and close button
+               self.tab = gtk.HBox(False, 0)                   
+               #setup tab label
+               self.label = gtk.Label()
+               self.tab.pack_start(self.label, False)
+               #setup button image
+               image = gtk.Image()
+               image.set_from_stock('gtk-close', gtk.ICON_SIZE_MENU)
+               #setup image box
+               image_box = gtk.HBox(False, 0)
+               image_box.pack_start(image, True, False, 0)
+               #setup the button
+               button = gtk.Button()
+               button.connect("clicked", self._handle_button)
+               button.set_relief(gtk.RELIEF_NONE)
+               button.add(image_box)
+               #button size            
+               w, h = gtk.icon_size_lookup_for_settings(button.get_settings(), 
gtk.ICON_SIZE_MENU)
+               button.set_size_request(w+6, h+6)
+               self.tab.pack_start(button, False)              
+               self.tab.show_all()
+               
+       def _handle_button(self, button):
+               """
+               The button was clicked.
+               Make the current page selected, then close.
+               @param the button
+               """
+               self.main_window.page_to_be_closed = self
+               self.main_window.handle_states(FLOW_GRAPH_CLOSE)
+               
+       def set_text(self, text):
+               """
+               Set the text in this label.
+               @param text the new text
+               """
+               self.label.set_text(text)
+               
+       def get_tab(self):
+               """
+               Get the gtk widget for this page's tab.
+               @return gtk widget 
+               """
+               return self.tab
+               
+       def get_pid_file(self):
+               """!
+               Get the pid file for the flow graph.
+               @return the pid file or ''
+               """
+               return self.pid_file
+       
+       def set_pid_file(self, pid_file=''):
+               """!
+               Set the pid file, '' for no pid file.
+               @param pid_file file path string
+               """
+               self.pid_file = pid_file
+       
+       def get_file_path(self):
+               """!
+               Get the file path for the flow graph.
+               @return the file path or ''
+               """
+               return self.file_path
+       
+       def set_file_path(self, file_path=''):
+               """!
+               Set the file path, '' for no file path.
+               @param file_path file path string
+               """
+               if file_path: self.file_path = os.path.abspath(file_path)
+               else: self.file_path = ''
+       
+       def get_saved(self):
+               """!
+               Get the saved status for the flow graph.
+               @return true if saved
+               """
+               return self.saved
+       
+       def set_saved(self, saved=True):
+               """!
+               Set the saved status.
+               @param saved boolean status
+               """
+               self.saved = saved 
+       
+       def get_state_cache(self):
+               """!
+               Get the state cache for the flow graph.
+               @return the state cache
+               """
+               return self.state_cache
+               
+############################################################
+##     Main window
+############################################################           
+               
+class MainWindow(gtk.Window):
+       """The topmost window with menus, the tool bar, and other major 
windows."""
+       
+       def __init__(self, handle_states):
+               """!
+               MainWindow contructor.
+               @param handle_states the callback function
+               """     
+               #setup window
+               self.handle_states = handle_states
+               gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)          
+               vbox = gtk.VBox()
+               hbox = gtk.HBox()
+               self.add(vbox)
+               #create the menu bar    and toolbar     
+               vbox.pack_start(Bars.MenuBar(), False)  
+               vbox.pack_start(Bars.Toolbar(), False)                  
+               # create variable modification window   #
+               self.variable_modification_window = 
VariableModificationWindow(self.handle_states)
+               self.flow_graph = FlowGraph(self.handle_states, 
self.variable_modification_window)              
+               #setup scrolled window
+               self.scrolled_window = gtk.ScrolledWindow()
+               self.scrolled_window.set_size_request(MIN_WINDOW_WIDTH, 
MIN_WINDOW_HEIGHT)      
+               self.scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, 
gtk.POLICY_AUTOMATIC)
+               self.scrolled_window.add_with_viewport(self.flow_graph)
+               # create the notebook #         
+               self.notebook = gtk.Notebook()
+               self.page_to_be_closed = None
+               self.current_page = None
+               self.notebook.set_show_border(False)
+               self.notebook.set_scrollable(True)      #scroll arrows for page 
tabs
+               self.notebook.connect("switch-page", self._handle_page_change)
+               fg_and_report_box = gtk.VBox(False, 0)
+               fg_and_report_box.pack_start(self.notebook, False, False, 0)
+               fg_and_report_box.pack_start(self.scrolled_window)
+               hbox.pack_start(fg_and_report_box)
+               vbox.pack_start(hbox)           
+               #create the side windows
+               side_box = gtk.VBox()
+               hbox.pack_start(side_box, False)
+               side_box.pack_start(self.variable_modification_window, False)   
        #dont allow resize
+               
side_box.pack_start(SignalBlockSelectionWindow(self.get_flow_graph)) #all 
resize, selection window can have more space
+               #create the reports window              
+               self.text_display = TextDisplay()
+               #house the reports in a scrolled window
+               self.reports_scrolled_window = gtk.ScrolledWindow()
+               self.reports_scrolled_window.set_size_request(-1, 
REPORTS_WINDOW_HEIGHT)
+               self.reports_scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, 
gtk.POLICY_AUTOMATIC)
+               
self.reports_scrolled_window.add_with_viewport(self.text_display)       
+               fg_and_report_box.pack_end(self.reports_scrolled_window, False) 
#dont allow resize, fg should get all the space
+               # show all but the main window container and the reports window 
+               vbox.show_all()                 
+               self._show_reports_window(False) 
+               # load preferences and show the main window 
+               Preferences.load(self)
+               self.show()#show after resize in preferences
+
+       ############################################################
+       ##      Event Handlers
+       ############################################################
+               
+       def _quit(self, window, event):
+               """!
+               Handle the delete event from the main window.
+               Generated by pressing X to close, alt+f4, or right click+close. 
+               This method in turns calls the state handler to quit.
+               @return true            
+               """
+               self.handle_states(APPLICATION_QUIT)
+               return True     
+               
+       def _handle_page_change(self, notebook, page, page_num):
+               """!
+               Handle a page change. When the user clicks on a new tab,
+               reload the flow graph to update the vars window and 
+               call handle states (select nothing) to update the buttons.
+               @param notebook the notebook
+               @param page new page
+               @param page_num new page number
+               """             
+               self.current_page = self.notebook.get_nth_page(page_num)
+               Messages.send_page_switch(self.current_page.get_file_path())
+               state = self.get_page().get_state_cache().get_current_state()
+               self.get_flow_graph().from_nested_data(state)
+               self.handle_states(NOTHING_SELECT) 
+               
+       ############################################################
+       ##      Report Window
+       ############################################################
+       
+       def add_report_line(self, line):
+               """!
+               Place line at the end of the text buffer, then scroll its 
window all the way down.
+               @param line the new text
+               """
+               self.text_display.insert(line)          
+               vadj = self.reports_scrolled_window.get_vadjustment()
+               vadj.set_value(vadj.upper)
+                                               
+       def _show_reports_window(self, show):
+               """!
+               Show the reports window when show is True.
+               Hide the reports window when show is False.
+               @param show boolean flag
+               """
+               if show: self.reports_scrolled_window.show()
+               else: self.reports_scrolled_window.hide()
+               
+       ############################################################
+       ##      Pages: create and close
+       ############################################################
+       
+       def new_page(self, file_path='', manual_open=False):
+               """!
+               Create a new notebook page.
+               Set the tab to be selected.
+               @param file_path optional file to load into the flow graph
+               @param manual_open true if the user initiated this open from 
dialog
+               """
+               #if the file is already open, show the open page and return
+               if file_path and file_path in self._get_files(): #already open
+                       page = 
self.notebook.get_nth_page(self._get_files().index(file_path))
+                       self._set_page(page)
+                       return          
+               try: #try to load from file
+                       if file_path: Messages.send_start_load(file_path)
+                       page = Page(self, file_path)
+                       if file_path: Messages.send_end_load()
+               except Exception, e: #return on failure
+                       Messages.send_fail_load(e)
+                       return  
+               #add this page to the notebook
+               self.notebook.append_page(page, page.get_tab())
+               try: self.notebook.set_tab_reorderable(page, True)
+               except: pass #gtk too old
+               self.notebook.set_tab_label_packing(page, False, False, 
gtk.PACK_START)
+               #only show if blank or manual 
+               if not file_path or manual_open: self._set_page(page) 
+               
+       def close_pages(self):
+               """
+               Close all the pages in this notebook.           
+               @return true if all closed
+               """
+               files = filter(lambda file: file, self._get_files()) #filter 
blank files
+               
self._set_page(self.notebook.get_nth_page(self.notebook.get_n_pages()-1)) #show 
last page
+               for page in self._get_pages():
+                       self.page_to_be_closed = page
+                       self.close_page(False)
+               if self.notebook.get_n_pages(): return False
+               Preferences.save_files_open(files)
+               return True
+                       
+       def close_page(self, ensure=True):
+               """
+               Close the current page.
+               If the notebook becomes empty, and ensure is true,
+               call new page upon exit to ensure that at least one page exists.
+               @param ensure boolean
+               """
+               if not self.page_to_be_closed: self.page_to_be_closed = 
self.get_page()
+               #show the page if it has an executing flow graph or is unsaved
+               if self.page_to_be_closed.get_pid_file() or not 
self.page_to_be_closed.get_saved():
+                       self._set_page(self.page_to_be_closed)
+               #unsaved? ask the user
+               if not self.page_to_be_closed.get_saved() and 
self._save_changes(): 
+                       self.handle_states(FLOW_GRAPH_SAVE) #try to save
+                       if not self.page_to_be_closed.get_saved(): #still 
unsaved?
+                               self.page_to_be_closed = None   #set the page 
to be closed back to None
+                               return
+               #stop the flow graph if executing
+               if self.page_to_be_closed.get_pid_file(): 
self.handle_states(FLOW_GRAPH_STOP)
+               #remove the page
+               
self.notebook.remove_page(self.notebook.page_num(self.page_to_be_closed))
+               if ensure and self.notebook.get_n_pages() == 0: self.new_page() 
#no pages, make a new one
+               self.page_to_be_closed = None   #set the page to be closed back 
to None
+       
+       ############################################################
+       ##      Misc
+       ############################################################
+
+       def update(self):
+               """!
+               Set the title of the main window.
+               Set the titles on the page tabs.
+               Show/hide the reports window.
+               @param title the window title
+               """     
+               if self.get_page():
+                       title = ''.join((
+                                       MAIN_WINDOW_PREFIX,
+                                       ' - Editing: ',
+                                       (self.get_page().get_file_path() or 
NEW_FLOGRAPH_TITLE),
+                                       (self.get_page().get_saved() and ' ' or 
'*'), #blank must be non empty
+                               )
+                       )
+               else: title = MAIN_WINDOW_PREFIX + ' - Editor '
+               gtk.Window.set_title(self, title)       
+               #set tab titles
+               for page in self._get_pages():
+                       page.set_text(''.join((
+                                               
(os.path.split(page.get_file_path())[1] or NEW_FLOGRAPH_TITLE),
+                                               (page.get_saved() and ' ' or 
'*'), #blank must be non empty
+                                       )
+                               )
+                       )
+               #reports window
+               self._show_reports_window(Preferences.show_reports_window())
+                       
+       def get_flow_graph(self):
+               """
+               Get the flow graph in this main window.
+               @return the flow graph
+               """
+               return self.flow_graph
+               
+       def get_page(self):
+               """!
+               Get the selected page.
+               @return the selected page
+               """
+               return self.current_page
+
+       ############################################################
+       ##      Helpers
+       ############################################################
+
+       def _set_page(self, page):
+               """!
+               Set the current page.
+               @param page the page widget
+               """
+               self.current_page = page
+               
self.notebook.set_current_page(self.notebook.page_num(self.current_page))       
                
+
+       def _save_changes(self):
+               """!
+               Save changes to flow graph?             
+               @return true if yes
+               """
+               return MessageDialogHelper(
+                       gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, 'Unsaved 
Changes!', 
+                       'Would you like to save changes before closing?'
+               ) == gtk.RESPONSE_YES
+               
+       def _get_files(self):
+               """
+               Get the file names for all the pages, in order.
+               @return list of file paths
+               """
+               return map(lambda page: page.get_file_path(), self._get_pages())
+
+       def _get_pages(self):
+               """
+               Get a list of all pages in the notebook.
+               @return list of pages
+               """
+               return [self.notebook.get_nth_page(page_num) for page_num in 
range(self.notebook.get_n_pages())]        
+

Added: grc/branches/grc_reloaded/src/grc/gui/SignalBlockParamsDialog.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/SignalBlockParamsDialog.py            
                (rev 0)
+++ grc/branches/grc_reloaded/src/grc/gui/SignalBlockParamsDialog.py    
2008-01-31 21:25:54 UTC (rev 7533)
@@ -0,0 +1,88 @@
+"""
+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 Graphics.SignalBlockParamsDialog
+#A dialog for editing a signal block's parameters.
address@hidden Josh Blum
+
+import pygtk
+pygtk.require('2.0')
+import gtk
+from Dialogs import TextDisplay
+from Constants import MIN_DIALOG_WIDTH,MIN_DIALOG_HEIGHT
+
+class SignalBlockParamsDialog(gtk.Dialog):
+       """A dialog box to set signal block parameters."""
+       
+       def __init__(self, signal_block):
+               """!
+               SignalBlockParamsDialog contructor.
+               @param signal_block the signal block
+               """
+               gtk.Dialog.__init__(self, buttons=('gtk-close', 
gtk.RESPONSE_CLOSE))
+               self.signal_block = signal_block
+               self.set_title('Properties: %s'%signal_block.get_id())
+               self.set_size_request(MIN_DIALOG_WIDTH, MIN_DIALOG_HEIGHT)
+               vbox = gtk.VBox()
+               #       Create the title label  #
+               label = gtk.Label()
+               label.set_markup('\n<b>Parameters: 
%s</b>\n'%self.signal_block.get_id())
+               vbox.pack_start(label, False)
+               # Create the scrolled window to hold all the parameters #
+               scrolled_window = gtk.ScrolledWindow()
+               scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, 
gtk.POLICY_AUTOMATIC)
+               scrolled_window.add_with_viewport(vbox)
+               self.vbox.pack_start(scrolled_window, True)
+               self.original_data = list()
+               #       Add all the parameters  #
+               for param in self.signal_block.get_params(): 
+                       
self.original_data.append(param.get_data_type().get_data())
+                       
vbox.pack_start(param.get_input_object(self._handle_changed), False)    
+               # Done adding parameters        #                               
                                
+               if self.signal_block.get_docs():        
+                       #       Create the title label  #
+                       label = gtk.Label()
+                       label.set_markup('\n\n<b>Documentation: 
%s</b>\n'%self.signal_block.get_cname())
+                       vbox.pack_start(label, False)   
+                       #       Create the text box to display notes about the 
block    #       
+                       
vbox.pack_start(TextDisplay(self.signal_block.get_docs()), False)
+               self.show_all()
+                       
+       def _handle_changed(self, param):
+               """!
+               A change occured, update any dependent parameters:
+               The enum inside the variable type may have changed and, 
+               the variable param will need an external update.
+               @param param the graphical parameter that initiated the 
callback                
+               """
+               for p in self.signal_block.get_params():
+                       if hasattr(p.get_data_type(), 'enum_data_type') and \
+                               param.get_data_type() == 
getattr(p.get_data_type(), 'enum_data_type'): p.update()
+               
+       def run(self):
+               """!
+               Call run().
+               @return true if a change occured.
+               """
+               gtk.Dialog.run(self)            
+               self.destroy()
+               self.data = list()
+               for param in self.signal_block.get_params():
+                       self.data.append(param.get_data_type().get_data())
+               return self.original_data != self.data
+                       
\ No newline at end of file

Added: grc/branches/grc_reloaded/src/grc/gui/SignalBlockSelectionWindow.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/SignalBlockSelectionWindow.py         
                (rev 0)
+++ grc/branches/grc_reloaded/src/grc/gui/SignalBlockSelectionWindow.py 
2008-01-31 21:25:54 UTC (rev 7533)
@@ -0,0 +1,104 @@
+"""
+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 Graphics.SignalBlockSelectionWindow
+#The signal block selection window gives the user a tree selection to choose a 
signal block.
address@hidden Josh Blum
+
+from Constants import *
+import pygtk
+pygtk.require('2.0')
+import gtk
+import gobject
+from SignalBlockDefs import SB_TREE
+
+class SignalBlockSelectionWindow(gtk.VBox):
+       """The signal block selection window."""
+       
+       def __init__(self, get_flow_graph):
+               """!
+               SignalBlockSelectionWindow constructor.
+               Show all possible signal blocks in this dialog. 
+               Each signal block is represented by a gtk label of its tag and 
an add button. 
+               The add button tells the flow graph to create the selected 
block. and add it to the flow graph.
+               @param get_flow_graph get the selected flow graph
+               """     
+               gtk.VBox.__init__(self)
+               self.get_flow_graph = get_flow_graph
+               #title label
+               label = gtk.Label()
+               label.set_markup('<b>Signal Blocks</b>')
+               self.pack_start(label, False)           
+               #make the tree model for holding blocks 
+               self.model = gtk.TreeStore(gobject.TYPE_STRING)
+               self.treeview = gtk.TreeView(self.model)                
+               self.treeview.set_enable_search(False) #disable pop up search 
box
+               self.treeview.add_events(gtk.gdk.BUTTON_PRESS_MASK)
+               self.treeview.connect('button_press_event', 
self._handle_mouse_button_press)
+               selection = self.treeview.get_selection()
+               selection.set_mode('single')
+               selection.connect('changed', self._handle_selection_change)     
+               renderer = gtk.CellRendererText()
+               column = gtk.TreeViewColumn("Category", renderer, text=0)
+               self.treeview.append_column(column)
+               #make the scrolled window to hold the tree view 
+               scrolled_window = gtk.ScrolledWindow()
+               scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, 
gtk.POLICY_AUTOMATIC)
+               scrolled_window.add_with_viewport(self.treeview)
+               scrolled_window.set_size_request(
+                       SIGNAL_BLOCK_SELECTION_WINDOW_WIDTH,
+                       SIGNAL_BLOCK_SELECTION_WINDOW_HEIGHT,
+               )
+               self.pack_start(scrolled_window)
+               #add button
+               self.add_button = gtk.Button(None, 'gtk-add')           
+               self.add_button.connect('clicked', self._handle_add_button)
+               self.pack_start(self.add_button, False)
+               #add blocks and categories      
+               for category, tags in SB_TREE:
+                       iter = self.model.insert_before(None, None)
+                       self.model.set_value(iter, 0, category)
+                       for tag in tags:
+                               new_iter = self.model.insert_before(iter, None) 
                                                
+                               self.model.set_value(new_iter, 0, tag[0])
+               #initialize
+               self._handle_selection_change()
+               
+       def _handle_mouse_button_press(self, widget, event):
+               """Handle the mouse button press.
+               If a left double click is detected, 
+               let the handler for the add button decide to add a block."""
+               if event.button == 1 and event.type == gtk.gdk._2BUTTON_PRESS: 
self._handle_add_button(widget)
+               
+       def _handle_selection_change(self, selection=None):
+               """Handle a selection change in the tree view.
+               If a selection changes, set the add button sensitive."""
+               selection = self.treeview.get_selection()
+               model, iter = selection.get_selected()
+               if iter != None and not model.iter_has_child(iter): 
self.add_button.set_sensitive(True)
+               else: self.add_button.set_sensitive(False)
+       
+       def _handle_add_button(self, widget):
+               """Handle the add button clicked signal.
+               Add the signal block to the flow graph."""
+               if self.get_flow_graph():               
+                       selection = self.treeview.get_selection()
+                       model, iter = selection.get_selected()
+                       if iter != None and not model.iter_has_child(iter): 
self.get_flow_graph().add_signal_block(model.get_value(iter, 0))
+               
+               
\ No newline at end of file

Added: grc/branches/grc_reloaded/src/grc/gui/USRPDiagnostics.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/USRPDiagnostics.py                    
        (rev 0)
+++ grc/branches/grc_reloaded/src/grc/gui/USRPDiagnostics.py    2008-01-31 
21:25:54 UTC (rev 7533)
@@ -0,0 +1,105 @@
+"""
+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 Graphics.USRPDiagnostics
+#A dialog for querying USRP subdevices. USRP interfacing methods encapsulated 
here.
address@hidden Josh Blum
+
+import pygtk
+pygtk.require('2.0')
+import gtk
+from Actions import USRP_DIAGNOSTICS_DISPLAY,get_action_from_name
+from Elements import GraphicalParam
+from DataTypes import *
+from Dialogs import TextDisplay
+
+def enable_usrp_diagnostics():
+       """Enable the action for USRP diganostics if gnuradio.usrp can be 
imported."""
+       try: 
+               from gnuradio import usrp
+               
get_action_from_name(USRP_DIAGNOSTICS_DISPLAY).set_sensitive(True)
+       except ImportError: print "USRP support missing -> USRP diagnostics 
disabled..."        
+
+class USRPDiagnosticsDialog(gtk.Dialog):
+       """
+       The main dialog window for USRP Dignostics. 
+       The USRP parameters and feedback will be located inside this dialog.
+       """
+       
+       def __init__(self):
+               """USRPDiagnosticsDialog contructor.
+               Create a new gtk Dialog with a close button, USRP input 
paramaters, and output labels."""               
+               gtk.Dialog.__init__(self, buttons=('gtk-close', 
gtk.RESPONSE_CLOSE))
+               #       Create the title label  #
+               self.set_title('USRP Diagnostics')
+               self.USRP_number = Int(0, min=0)
+               self.USRP_type = Enum([('Receive', 'rx'), ('Transmit', 'tx'),])
+               self.USRP_subdev = Enum([
+                               ('Side A:0', (0, 0)), 
+                               ('Side B:0', (1, 0)),
+                               ('Side A:1', (0, 1)), 
+                               ('Side B:1', (1, 1)),
+                       ]
+               )
+               self.vbox.pack_start(GraphicalParam('Unit Number', 
self.USRP_number).get_input_object(), False)
+               self.vbox.pack_start(GraphicalParam('Transmit/Receive', 
self.USRP_type).get_input_object(), False)
+               self.vbox.pack_start(GraphicalParam('Side:Subdevice', 
self.USRP_subdev).get_input_object(), False)
+               self.diagnose_button = gtk.Button('Query')
+               self.diagnose_button.connect('clicked', self._diagnose_usrp)
+               self.vbox.pack_start(self.diagnose_button, False)               
+               #       Create a text box for USRP queries      #
+               self.query_buffer = TextDisplay()
+               self.query_buffer.set_text('Press "Query" to retrieve USRP 
information...')                     
+               self.vbox.pack_start(self.query_buffer) 
+               self.show_all() 
+               self.run()
+               self.destroy()
+               
+       def _diagnose_usrp(self, widget=None):
+               """Query the USRP device and copy the results into the query 
text box."""
+               from gnuradio import usrp
+               type = self.USRP_type.parse()
+               if type == 'rx':        #for the rx query, use the source and 
rx methods
+                       make = usrp.source_c
+                       get_mux = usrp.determine_rx_mux_value
+               elif type == 'tx':      #for the tx query, use the sink and tx 
methods
+                       make = usrp.sink_c
+                       get_mux = usrp.determine_tx_mux_value
+               try:            
+                       u = make(self.USRP_number.parse())
+                       subdev_spec = self.USRP_subdev.parse()  
+                       subdev = usrp.selected_subdev(u, subdev_spec)#get the 
subdev
+                       msg = ">>> USRP Query\n"
+                       msg = "%s\nName:\n\t%s\n"%(msg,str(subdev.name()))
+                       msg = "%s\nAutomated Mux:\n\t0x%08x\n"%(msg, 
0xFFFFFFFFL & long(get_mux(u, subdev_spec))) #ensure that the value is 
displayed as: 8 nibbles, unsigned, hex
+                       msg = "%s\nConverter 
Rate:\n\t%s\n"%(msg,u.converter_rate())
+                       msg = "%s\nUses Quadrature:\n\t%s\n"%(msg, 
str(subdev.is_quadrature()))
+                       gain_min, gain_max, gain_step = subdev.gain_range()
+                       msg = "%s\nGain Range (min, max, step 
size):\n\t%s\n\t%s\n\t%s\n"%(msg, gain_min, gain_max, gain_step)
+                       freq_min, freq_max, freq_step = subdev.freq_range()
+                       msg = "%s\nFreq Range (min, max, step 
size):\n\t%s\n\t%s\n\t%s\n"%(msg, freq_min, freq_max, freq_step)
+                       self.query_buffer.set_text(msg)
+               except Exception, e:    #display the error message
+                       self.query_buffer.set_text('''\
+>>> Error\n%s
+
+If the USRP cannot be found, make sure that the USRP is plugged-in and restart 
this program. \
+If the problem persists, there may be a problem with you gnuradio installation 
or USB 2.0.
+'''%str(e))            
+               
+               
\ No newline at end of file

Added: grc/branches/grc_reloaded/src/grc/gui/VariableModificationWindow.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/VariableModificationWindow.py         
                (rev 0)
+++ grc/branches/grc_reloaded/src/grc/gui/VariableModificationWindow.py 
2008-01-31 21:25:54 UTC (rev 7533)
@@ -0,0 +1,221 @@
+"""
+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 Graphics.VariableModificationWindow
+#The variable modification window allows the user to enter variables (keys, 
values, ranges).
address@hidden Josh Blum
+
+from Constants import *
+from Actions import VARIABLE_MODIFY,VARIABLE_REORDER,NOTHING_SELECT
+import pygtk
+pygtk.require('2.0')
+import gtk
+import gobject
+import Variables
+
+class VariableModificationWindow(gtk.VBox):
+       """A scrollable window to add/remove variables in the variable 
registry."""
+       
+       def __init__(self, handle_states):
+               """!
+               VariableModificationWindow constructor.Create a scrolled 
window, and add buttons and lists.
+               @param handle_states callback function to handle the variable 
changes
+               """
+               gtk.VBox.__init__(self) 
+               self.handle_states = handle_states                      
+               #title label
+               label = gtk.Label()
+               label.set_markup('<b>Variables</b>')
+               self.pack_start(label, False)           
+               #create a srolled window to hold the tree view
+               scrolled_window = gtk.ScrolledWindow()
+               scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, 
gtk.POLICY_AUTOMATIC)
+               scrolled_window.set_size_request(
+                       VARIABLE_MODIFICATION_WINDOW_WIDTH, 
+                       VARIABLE_MODIFICATION_WINDOW_HEIGHT
+               )
+               self.pack_start(scrolled_window)                
+               #liststore holds the graphical list
+               self.liststore = gtk.ListStore(
+                       gobject.TYPE_STRING,    #key
+                       gobject.TYPE_STRING,    #value
+                       gobject.TYPE_STRING,    #min
+                       gobject.TYPE_STRING,            #max
+                       gobject.TYPE_STRING,            #step
+               )               
+               self.treeview = gtk.TreeView(self.liststore)    
+               self.treeview.set_enable_search(False) #disable pop up search 
box
+               self.renderers = list()
+               for i,title in enumerate(['Variable', 'Default', 'Min', 'Max', 
'Step']):        #create each data column
+                       #renderer for column i          
+                       renderer = gtk.CellRendererText()
+                       renderer.set_property('editable', True)
+                       self.renderers.append(renderer)
+                       #connect signal handlers
+                       renderer.connect('edited', self._handle_renderer_edited)
+                       renderer.connect('editing-started', 
self._handle_start_editing)
+                       renderer.connect('editing-canceled', 
self._handle_cancel_editing)
+                       #tree view for column i
+                       tree_view_column = gtk.TreeViewColumn(title, renderer, 
text=i)
+                       
tree_view_column.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE) #allow the column to 
shrink
+                       self.treeview.append_column(tree_view_column)
+               self.treeview.set_reorderable(True)     
+               selection = self.treeview.get_selection()
+               selection.set_mode('single')
+               selection.connect('changed', self._handle_selection_change)
+               scrolled_window.add_with_viewport(self.treeview)
+               #buttons add and remove
+               buttons_hbox = gtk.HBox()
+               self.pack_start(buttons_hbox, False)    
+               add_button = gtk.Button(None, 'gtk-add')                
+               add_button.connect('clicked', self._handle_add_button)
+               buttons_hbox.pack_start(add_button, False)
+               self.remove_button = gtk.Button(None, 'gtk-remove')
+               self.remove_button.connect('clicked', 
self._handle_remove_button)
+               buttons_hbox.pack_start(self.remove_button, False)
+               #connect signal handlers
+               self.treeview.connect("cursor-changed", 
self._handle_cursor_changed)    
+               self.treeview.connect("drag_begin", self._handle_drag_begin)    
+               self.treeview.connect("drag_end", self._handle_drag_end)
+               #initialize
+               self._handle_cancel_editing()
+               self._handle_selection_change() 
+               
+       
#############################################################################################
   
+       #       Access Methods
+       
#############################################################################################
   
+               
+       def to_key_list(self):
+               """!
+               Get a list of the keys in the current order. 
+               @return a list of ordered variable keys
+               """
+               key_list = list()
+               for row in self.liststore: key_list.append(row[0])
+               return key_list
+       
+       def from_key_list(self, key_list):
+               """!
+               Clear the rows and refill the list with keys from the key list.
+               @param key_list a list of ordered keys
+               """             
+               self.liststore.clear()
+               for key in key_list: 
self.liststore.append((key,)+Variables.get_values(key))
+                                                       
+       def unselect_all(self):         
+               """Stop any editing and unselect every row in the tree view."""
+               if self.editable: self.editable.remove_widget()
+               self.treeview.get_selection().unselect_all()    
+
+       
#############################################################################################
   
+       #       Row Manipulation Handlers
+       
#############################################################################################
   
+               
+       def _handle_drag_begin(self, drag_context, data):
+               """A drag event has begun, make a backup of the key list."""
+               self.backup_key_list = self.to_key_list()
+               
+       def _handle_drag_end(self, drag_context, data):
+               """A drag event has ended. 
+               If the backup key list does not match the current key list, 
+               handle the variable state change."""
+               if self.backup_key_list != self.to_key_list(): 
self.handle_states(VARIABLE_REORDER)     
+               
+       def _handle_cursor_changed(self, treeview):
+               """Called when the cursor is placed on a row or in a cell.
+               Unselect any selected element in the flow graph."""
+               self.handle_states(NOTHING_SELECT)
+                               
+       def _handle_selection_change(self, selection=None):
+               """If a selection changes, set the edit and remove buttons 
sensitive."""
+               selection = self.treeview.get_selection()
+               model, iter = selection.get_selected()
+               if iter != None: self.remove_button.set_sensitive(True)
+               else: self.remove_button.set_sensitive(False)
+                       
+       
#############################################################################################
   
+       #       Cell Editing Handlers
+       
#############################################################################################
                           
+                       
+       def _handle_start_editing(self, cellrenderer, editable, path):
+               """Editing of a cell has begun, record the editable object."""
+               self.editable = editable
+               
+       def _handle_cancel_editing(self, cellrenderer=None):
+               """Editing of a cell has been canceled."""
+               self.editable = None                                    
+                       
+       def _handle_renderer_edited(self, renderer, row_index, new_text):
+               """!
+               A cell was edited, determine what was edited and how to handle 
it.
+               @param renderer the renderer
+               @param row_index the index of the row that changes
+               @param new_text the new text in the cell
+               """
+               self._handle_cancel_editing()
+               column_index = self.renderers.index(renderer)
+               if new_text == self.liststore[row_index][column_index]: return 
#no change
+               old_list = self.liststore[row_index]
+               new_list = list()
+               for i,var in enumerate(old_list):       #fill the new list
+                       if i == column_index: new_list.append(new_text)
+                       #       blank the step to regenerate it, only if 
min/max was changed to a non-blank     #
+                       elif new_text != '' and i == 4 and column_index in 
(2,3): new_list.append('') 
+                       else: new_list.append(var)      
+               Variables.unregister(old_list[0]) #use the key to remove the 
entry              
+               try: Variables.register(*new_list)
+               except Exception, e:    #register failed, restore values and end
+                       Variables.register(*old_list)
+                       print e
+                       return
+               #register succeeded, reload the values in the window    
+               values = list(Variables.get_values(new_list[0]))
+               for i,value in enumerate([new_list[0]]+values):         
+                       self.liststore[row_index][i] = value    
+               self.handle_states(VARIABLE_MODIFY)     
+                       
+       
#############################################################################################
   
+       #       Button Handlers
+       
#############################################################################################
                           
+                               
+       def _handle_remove_button(self, widget):
+               """Handle the remove button by removing the selected element 
from the list and from the variables registry."""
+               selection = self.treeview.get_selection()
+               model, iter = selection.get_selected()
+               if iter != None: 
+                       Variables.unregister(model.get_value(iter, 0))
+                       model.remove(iter)                      
+                       self.handle_states(VARIABLE_MODIFY)
+                       
+       def _handle_add_button(self, widget):   
+               """Handle the add button by adding a variable with key and 
value. 
+               The key will be unique in the form 'new_var' + index."""
+               new_key_index = 0
+               while True:
+                       new_key_name = 'new_var'+str(new_key_index)
+                       if Variables.has_key(new_key_name):
+                               new_key_index = new_key_index + 1
+                       else:
+                               var_info = (new_key_name, '0', '', '', '')
+                               Variables.register(*var_info)
+                               
self.liststore.append((new_key_name,)+Variables.get_values(new_key_name))
+                               self.handle_states(VARIABLE_MODIFY)
+                               return  #leave the while loop
+                               
+                               
+                               
\ No newline at end of file

Added: grc/branches/grc_reloaded/src/grc/gui/__init__.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/__init__.py                           
(rev 0)
+++ grc/branches/grc_reloaded/src/grc/gui/__init__.py   2008-01-31 21:25:54 UTC 
(rev 7533)
@@ -0,0 +1,27 @@
+"""
+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 Graphics.__init__
+#GTK based classes go into this package.
address@hidden Josh Blum
+
+#only import the modules that need external access
+from MainWindow import MainWindow
+from FileDialogs import 
OpenFlowGraphFileDialog,SaveFlowGraphFileDialog,SaveImageFileDialog
+from Dialogs import 
PreferencesDialog,FlowGraphWindowSizeDialog,MessageDialogHelper,AboutDialog,DataTypesDialog,HotKeysDialog,MathExprDialog
+from USRPDiagnostics import USRPDiagnosticsDialog,enable_usrp_diagnostics

Added: grc/branches/grc_reloaded/src/grc/gui/elements/Block.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/elements/Block.py                     
        (rev 0)
+++ grc/branches/grc_reloaded/src/grc/gui/elements/Block.py     2008-01-31 
21:25:54 UTC (rev 7533)
@@ -0,0 +1,157 @@
+"""
+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 Elements.GraphicalSignalBlock
+#The graphical signal block.
address@hidden Josh Blum
+
+import SignalBlock
+import Utils
+import Colors
+from GraphicalParam import GraphicalParam
+import GraphicalElement
+from GraphicalSocket import GraphicalInputSocket,GraphicalOutputSocket
+from Constants import *
+from DataTypes import Enum,Int
+import pygtk
+pygtk.require('2.0')
+import gtk
+import pango
+
+class GraphicalSignalBlock(SignalBlock.SignalBlock, 
GraphicalElement.GraphicalElement):
+       """The graphical signal block."""               
+       
+       param_constructor = GraphicalParam
+       input_socket_constructor = GraphicalInputSocket
+       output_socket_constructor = GraphicalOutputSocket
+       
+       def update(self):
+               """Update the block, parameters, and sockets when a change 
occurs."""
+               self.clear()
+               self._adjust_sockets()          
+               self._create_labels()                           
+               self.W = self.label_width + 2*LABEL_PADDING_WIDTH
+               max_sockets = max(self.get_num_input_sockets(), 
self.get_num_output_sockets(), 1)
+               self.H = max(self.label_height+2*LABEL_PADDING_HEIGHT, 
2*SOCKET_BORDER_SEPARATION + max_sockets*SOCKET_HEIGHT + 
(max_sockets-1)*SOCKET_SEPARATION)              
+               if Utils.is_horizontal(self.get_rotation()): 
self.add_area((0,0),(self.W,self.H))
+               elif Utils.is_vertical(self.get_rotation()): 
self.add_area((0,0),(self.H,self.W))                                       
+               for socket in self.get_sockets(): socket.update()               
        
+       
+       def _create_labels(self):
+               """Create the labels for the signal block."""
+               layouts = list()
+               #       create the main layout  #
+               layout = gtk.DrawingArea().create_pango_layout(self.cname)
+               desc = pango.FontDescription(SIGNAL_BLOCK_FONT)
+               layout.set_font_description(desc) 
+               layouts.append(layout)
+               if not self.is_valid(): layout.set_markup('<span 
foreground="red"><b>'+self.cname+'</b></span>')                        
+               self.label_width,self.label_height = layout.get_pixel_size()    
+               # handle each of the displayable params #               
+               for param in self.displayed_params:
+                       layout = param.get_layout()
+                       layouts.append(layout)
+                       w,h = layout.get_pixel_size()
+                       self.label_width = max(w, self.label_width)
+                       self.label_height = self.label_height + h + 
LABEL_SEPARATION
+               width = self.label_width
+               height = self.label_height
+               #       setup the pixmap        #
+               pixmap = gtk.gdk.Pixmap(self.get_parent().window, width, 
height, -1)
+               gc = pixmap.new_gc()
+               gc.foreground = Colors.BG_COLOR
+               pixmap.draw_rectangle(gc, True, 0, 0, width, height)
+               gc.foreground = Colors.TXT_COLOR
+               #       draw the layouts        #               
+               h_off = 0
+               for i,layout in enumerate(layouts):
+                       w,h = layout.get_pixel_size()
+                       if i == 0: w_off = (width-w)/2
+                       else: w_off = 0
+                       pixmap.draw_layout(gc, w_off, h_off, layout)
+                       h_off = h + h_off + LABEL_SEPARATION
+               #       create vertical and horizontal images   #               
        
+               self.horizontal_label = image = pixmap.get_image(0, 0, width, 
height)
+               if Utils.is_vertical(self.get_rotation()):
+                       self.vertical_label = vimage = 
gtk.gdk.Image(gtk.gdk.IMAGE_NORMAL, pixmap.get_visual(), height, width)
+                       for i in range(width):
+                               for j in range(height): vimage.put_pixel(j, 
width-i-1, image.get_pixel(i, j))
+               
+       def draw(self, window):
+               """!
+               Draw the signal block with label and inputs/outputs.
+               @param window the gtk window to draw on
+               """
+               GraphicalElement.GraphicalElement.draw(self, window)            
+               gc = self.gc            
+               gc.foreground = Colors.TXT_COLOR
+               X,Y = self.get_coordinate()             
+               if Utils.is_horizontal(self.get_rotation()):
+                       window.draw_image(gc, self.horizontal_label, 0, 0, 
X+LABEL_PADDING_WIDTH, Y+(self.H-self.label_height)/2, -1, -1)
+               elif Utils.is_vertical(self.get_rotation()):
+                       window.draw_image(gc, self.vertical_label, 0, 0, 
X+(self.H-self.label_height)/2, Y+LABEL_PADDING_WIDTH, -1, -1)
+               for socket in self.get_sockets(): socket.draw(window)
+               
+       def is_valid(self):             
+               """!
+               Is this block is valid/are all the params valid and all sockets 
connected?
+               User preferences can override certain validity checks.
+               @return true if valid
+               """
+               import Preferences
+               if Preferences.check_params():  #preferences
+                       for param in self.params:
+                               if not param.get_data_type().is_valid(): return 
False
+               if Preferences.check_sockets(): #preferences
+                       for socket in self.get_sockets():
+                               if not socket.is_valid(): return False
+               return True
+               
+       def modify_type_controller(self, direction):
+               """!
+               If a type controller was set, increment/decrement its index by 
1, use a % to stay in bounds.    
+               @param direction +1 or -1
+               """
+               if self.type_controller != None and 
self.type_controller.get_type() == Enum().get_type():
+                       num_choices = 
len(self.type_controller.get_cnames_list())
+                       index = int(self.type_controller.get_data())
+                       
self.type_controller.set_data((index+direction+num_choices)%num_choices)
+                       self.get_parent().update()
+                       return True
+               return False
+               
+       def modify_socket_controller(self, direction):
+               """!
+               If a socket controller was set, increment/decrement its data 
type by 1, DO NOT go out of bounds.
+               If there is a controller on input and outputs, show preference 
to the output controller. 
+               @param direction +1 or -1
+               @return true if operation was done, false if operation could 
not be completed.
+               """
+               # Get the socket controller, if there is an input and output 
controller, use output     #
+               socket_controller = None                
+               if self.input_sockets_controller != None: socket_controller = 
self.input_sockets_controller
+               elif self.output_sockets_controller != None: socket_controller 
= self.output_sockets_controller
+               if socket_controller != None and socket_controller.is_valid() 
and socket_controller.get_type() == Int().get_type():
+                       old_data = socket_controller.get_data()
+                       socket_controller.set_data(socket_controller.parse() + 
direction)
+                       if socket_controller.is_valid(): #modification was 
successful
+                               self.get_parent().update()
+                               return True
+                       else: socket_controller.set_data(old_data)      
#restore previous value
+               return False
+

Added: grc/branches/grc_reloaded/src/grc/gui/elements/Connection.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/elements/Connection.py                
                (rev 0)
+++ grc/branches/grc_reloaded/src/grc/gui/elements/Connection.py        
2008-01-31 21:25:54 UTC (rev 7533)
@@ -0,0 +1,98 @@
+"""
+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 Elements.GraphicalConnection
+#The graphical connection for input/output sockets.
address@hidden Josh Blum
+
+import DataTypes
+import Utils
+import Connection
+import GraphicalElement
+import Colors
+
+class GraphicalConnection(Connection.Connection, 
GraphicalElement.GraphicalElement):
+       """A graphical connection for sockets."""                       
+       
+       def update(self):
+               """Add the horizontal and vertical lines that will connect the 
two parameters."""
+               self.clear()            
+               input_socket = self.get_input_socket()
+               output_socket = self.get_output_socket()
+               deltaAngle = abs(output_socket.get_connector_direction() - 
input_socket.get_connector_direction())
+               (x1, y1) = output_socket.get_connector_coordinates()[1]
+               self.add_line(*output_socket.get_connector_coordinates())
+               (x2, y2) = input_socket.get_connector_coordinates()[1]
+               self.add_line(*input_socket.get_connector_coordinates())
+               if deltaAngle == 180:
+                       W = abs(x1 - x2)
+                       H = abs(y1 - y2)
+                       midX = (x1+x2)/2
+                       midY = (y1+y2)/2
+                       sW = x1 - x2
+                       if output_socket.get_connector_direction() == 0: sW = 
sW * -1
+                       sH = y1 - y2
+                       if output_socket.get_connector_direction() == 270: sH = 
sH * -1
+                       if ((W>H or sW<0) and 
Utils.is_horizontal(output_socket.get_connector_direction())) or\
+                               (W>=H and sH>=0 and 
Utils.is_vertical(output_socket.get_connector_direction())):
+                               self.add_line((x1,y1),(x1,midY))
+                               self.add_line((x1,midY),(x2,midY))
+                               self.add_line((x2,y2),(x2,midY))
+                       elif (H>=W and sW>=0 and 
Utils.is_horizontal(output_socket.get_connector_direction())) or\
+                               ((H>W or sH<0) and 
Utils.is_vertical(output_socket.get_connector_direction())):
+                               self.add_line((x1,y1),(midX,y1))
+                               self.add_line((midX,y1),(midX,y2))
+                               self.add_line((x2,y2),(midX,y2))
+               else:
+                       p1 = (x1, y2)
+                       p2 = (x2, y1)
+                       if Utils.get_angle_from_coordinates((x1,y1),p1) == 
(output_socket.get_connector_direction()+180)%360 or\
+                               Utils.get_angle_from_coordinates((x2,y2),p1) == 
(input_socket.get_connector_direction()+180)%360: p = p2
+                       else: p = p1
+                       self.add_line((x1,y1),p)
+                       self.add_line((x2,y2),p)        
+               
+       def draw(self, window):
+               """!
+               Draw the connection.
+               @param window the gtk window to draw on
+               """
+               self.update()   
+               GraphicalElement.GraphicalElement.draw(self, window)    
+               gc = self.gc                                    
+               '''     draw error lines around the existing lines when data 
types do not match '''
+               if not self.is_valid():
+                       gc.foreground = Colors.ERROR_COLOR      
+                       for (x1, y1),(x2, y2) in 
self.lines_dict[self.get_rotation()]:
+                               if x1 == x2 and x1 > 0 and x2 > 0: #vertical
+                                       window.draw_line(gc, x1-1, y1, x2-1, y2)
+                                       window.draw_line(gc, x1+1, y1, x2+1, y2)
+                               elif y1 == y2 and y1 > 0 and y2 > 0: #horizontal
+                                       window.draw_line(gc, x1, y1-1, x2, y2-1)
+                                       window.draw_line(gc, x1, y1+1, x2, y2+1)
+               
+       def is_valid(self):
+               """!
+               Is this connection valid, ie: do the input and output data 
types match?
+               User preferences can override this validity check.
+               @return true if the data types match or if check connections is 
off
+               """
+               import Preferences      #preferences
+               return not Preferences.check_connections() or\
+                       DataTypes.can_connect(self.sockets[0].get_data_type(), 
self.sockets[1].get_data_type()) 
+                                                       

Added: grc/branches/grc_reloaded/src/grc/gui/elements/Element.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/elements/Element.py                   
        (rev 0)
+++ grc/branches/grc_reloaded/src/grc/gui/elements/Element.py   2008-01-31 
21:25:54 UTC (rev 7533)
@@ -0,0 +1,60 @@
+"""
+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 Elements.GraphicalElement
+#Base class for graphical elements such as:
+#signal blocks, input sockets, output sockets and connections.
address@hidden Josh Blum
+
+from Constants import *
+import Element
+import Colors
+import pygtk
+pygtk.require('2.0')
+import gtk
+import pango
+
+class GraphicalElement(Element.Element):
+       """
+       GraphicalElement is the base class for all graphical elements. 
+       It contains an X,Y coordinate, a list of rectangular areas that the 
element occupies, 
+       and methods to detect selection of those areas.
+       """             
+       
+       def draw(self, window, BG_color=Colors.BG_COLOR, 
FG_color=Colors.FG_COLOR):
+               """!
+               Draw in the given window.
+               @param window the gtk window to draw on
+               @param BG_color the background color
+               @param FG_color the foreground color
+               """
+               gc = self.get_parent().gc       
+               self.gc = gc
+               X,Y = self.get_coordinate()
+               for (rX,rY),(W,H) in self.areas_dict[self.get_rotation()]:
+                       aX = X + rX
+                       aY = Y + rY 
+                       gc.foreground = BG_color
+                       window.draw_rectangle(gc, True, aX, aY, W, H)
+                       gc.foreground = self.is_highlighted() and 
Colors.H_COLOR or FG_color
+                       window.draw_rectangle(gc, False, aX, aY, W, H)
+               for (x1, y1),(x2, y2) in self.lines_dict[self.get_rotation()]:
+                       gc.foreground = self.is_highlighted() and 
Colors.H_COLOR or FG_color
+                       window.draw_line(gc, X+x1, Y+y1, X+x2, Y+y2)
+
+       
\ No newline at end of file

Added: grc/branches/grc_reloaded/src/grc/gui/elements/Param.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/elements/Param.py                     
        (rev 0)
+++ grc/branches/grc_reloaded/src/grc/gui/elements/Param.py     2008-01-31 
21:25:54 UTC (rev 7533)
@@ -0,0 +1,222 @@
+"""
+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 Elements.GraphicalParam
+#GTK objects for handling input and the signal block parameter class.
address@hidden Josh Blum
+
+import Param
+from DataTypes import *
+import pygtk
+pygtk.require('2.0')
+import gtk
+import pango
+import gobject
+from Constants import *
+from os import path
+
+######################################################################################################
+#      gtk objects for handling input
+######################################################################################################
+
+class InputParam(gtk.HBox):
+       """The base class for an input parameter inside the input parameters 
dialog."""
+       
+       def __init__(self, data_type, _handle_changed):
+               gtk.HBox.__init__(self)
+               self.data_type = data_type
+               self._handle_changed = _handle_changed
+               self.label = gtk.Label()        #no label, markup is added by 
set_markup
+               self.label.set_size_request(140,-1)
+               self.pack_start(self.label, False)
+               self.set_markup = lambda m: self.label.set_markup(m)    
+               self.tp = None          
+               
+class EntryParam(InputParam):
+       """Provide an entry box for strings and numbers."""
+       
+       def __init__(self, *args):
+               InputParam.__init__(self, *args)
+               self.entry = input = gtk.Entry()                
+               input.set_text(self.data_type.get_data())
+               input.connect("changed", self._handle_changed)
+               self.pack_start(input, True)
+               self.get_text = input.get_text
+               # tool tip fun #
+               self.tp = gtk.Tooltips()
+               self.tp.set_tip(self.entry, "")
+               self.tp.enable()
+               
+class FileParam(EntryParam):
+       """Provide an entry box for filename and a button to browse for a 
file."""
+       
+       def __init__(self, *args):
+               EntryParam.__init__(self, *args)                
+               input = gtk.Button('...')
+               input.connect('clicked', self.handle_clicked)
+               self.pack_start(input, False)
+       
+       def handle_clicked(self, widget=None):
+               """ If the button was clicked, open a file dialog in open/save 
format.
+               Replace the text in the entry with the new filename from the 
file dialog.       """
+               file_path = self.data_type.parse()
+               #       bad file paths will be redirected to default    #
+               if not path.exists(path.dirname(file_path)): file_path = 
DEFAULT_FILE_PATH      
+               if self.data_type.get_type() == FileOpen().get_type(): 
+                       file_dialog = gtk.FileChooserDialog('Open a Data 
File...', None,
+                               gtk.FILE_CHOOSER_ACTION_OPEN, 
('gtk-cancel',gtk.RESPONSE_CANCEL,'gtk-open',gtk.RESPONSE_OK))
+               elif self.data_type.get_type() == FileSave().get_type(): 
+                       file_dialog = gtk.FileChooserDialog('Save a Data 
File...', None,
+                               gtk.FILE_CHOOSER_ACTION_SAVE, 
('gtk-cancel',gtk.RESPONSE_CANCEL, 'gtk-save',gtk.RESPONSE_OK))
+                       file_dialog.set_do_overwrite_confirmation(True)
+                       file_dialog.set_current_name(path.basename(file_path))  
#show the current filename
+               file_dialog.set_current_folder(path.dirname(file_path)) 
#current directory
+               file_dialog.set_select_multiple(False)
+               file_dialog.set_local_only(True)
+               if gtk.RESPONSE_OK == file_dialog.run():        #run the dialog
+                       file_path = file_dialog.get_filename()  #get the file 
path
+                       self.entry.set_text(file_path)
+                       self._handle_changed()
+               file_dialog.destroy()   #destroy the dialog                     
                        
+               
+class EnumParam(InputParam):
+       """Provide an entry box for Enum types with a drop down menu."""
+       
+       def __init__(self, *args):
+               InputParam.__init__(self, *args)
+               input = gtk.ComboBox(gtk.ListStore(gobject.TYPE_STRING))        
                        
+               cell = gtk.CellRendererText()
+               input.pack_start(cell, True)
+               input.add_attribute(cell, 'text', 0)
+               for cname in self.data_type.get_cnames_list(): 
input.append_text(cname)
+               input.set_active(int(self.data_type.get_data()))
+               input.connect("changed", self._handle_changed)
+               self.pack_start(input, False)
+               self.get_text = lambda: str(input.get_active()) #the get text 
parses the selected index to a string
+
+######################################################################################################
+#      A Parameter, hold a data type and a cname
+######################################################################################################
+
+class GraphicalParam(Param.Param):
+       """The graphical parameter."""  
+
+       def update(self):
+               """Called when an external change occurs.
+               Update the graphical input by calling the change handler."""
+               if self.input: self._handle_changed()   
+               
+       def get_input_object(self, callback=None):
+               """!
+               Get the graphical gtk class to represent this parameter.        
+               Create the input object with this data type and the handle 
changed method.
+               @param callback a function of one argument(this param) to be 
called from the change handler
+               @return gtk input object
+               """
+               self.callback=callback
+               if self.get_data_type().get_base_type() == 
Enum().get_base_type(): input = EnumParam
+               elif self.get_data_type().get_base_type() == 
File().get_base_type(): input = FileParam
+               else: input = EntryParam
+               self.input = input(self.get_data_type(), self._handle_changed)
+               self._handle_changed()
+               return self.input
+               
+       def _handle_changed(self, widget=None):
+               """When the input changes, write the inputs to the data type.
+               Finish by calling the exteral callback."""
+               data_type = self.get_data_type()
+               new_data = self.input.get_text()
+               old_data = data_type.get_data()
+               if old_data != new_data: data_type.set_data(new_data)
+               #set the markup on the label, red for errors in corresponding 
data type.
+               cname = self.get_cname()
+               if self.variable: cname = '<span 
underline="low">%s</span>'%cname #alter format if the param is variable
+               if not data_type.is_valid(): self.input.set_markup('<span 
foreground="red"><b>%s</b></span>'%cname)
+               else: self.input.set_markup(cname)
+               #set the tooltip                
+               if self.input.tp: self.input.tp.set_tip(self.input.entry, 
str(data_type))       
+               #execute the external callback 
+               if self.callback: self.callback(self)
+
+       def get_markup(self):
+               """!
+               Create a markup to display the Param as a label on the 
SignalBlock.     
+               If the data type is an Enum type, use the cname of the Enum's 
current choice.   
+               Otherwise, use parsed the data type and use its string 
representation.
+               If the data type is not valid, use a red foreground color.
+               @return pango markup string
+               """
+               
###########################################################################
+               #       display logic for numbers
+               
###########################################################################
+               def float_to_str(var):
+                       if var-int(var) == 0: return '%d'%int(var)              
                        
+                       if var*10-int(var*10) == 0: return '%.1f'%var
+                       if var*100-int(var*100) == 0: return '%.2f'%var
+                       if var*1000-int(var*1000) == 0: return '%.3f'%var
+                       else: return '%.3g'%var                         
+               def to_str(var): 
+                       if type(var) == type(str()): return var
+                       elif type(var) == type(complex()): 
+                               if var.imag == var.real == 0: return '0'        
#value is zero
+                               elif var.imag == 0: return 
'%s'%float_to_str(var.real)  #value is real
+                               elif var.real == 0: return 
'%sj'%float_to_str(var.imag) #value is imaginary
+                               elif var.imag < 0: return 
'%s-%sj'%(float_to_str(var.real), float_to_str(var.imag*-1))
+                               else: return '%s+%sj'%(float_to_str(var.real), 
float_to_str(var.imag))
+                       elif type(var) == type(float()): return 
float_to_str(var)                               
+                       elif type(var) == type(int()): return '%d'%var
+                       else: return var        
+               
###########################################################################
+               if self.get_data_type().is_valid():
+                       data = self.get_data_type().parse()
+                       if self.get_data_type().get_base_type() == 
Enum().get_base_type(): #enum types
+                               dt_str = self.get_data_type().get_cname()
+                       elif self.get_data_type().get_base_type() == 
File().get_base_type():    #file types
+                               suggested_length = 30
+                               if len(data) <= suggested_length: dt_str = data
+                               else:   #truncate the tail if there is not 
enough space
+                                       tail,head = path.split(data)
+                                       if len(head) >= suggested_length: 
dt_str = head
+                                       else: dt_str = 
tail[0:suggested_length-len(head)] + '...' + head
+                       elif self.get_data_type().get_base_type() == 
Vector().get_base_type(): #vector types
+                               for i,e in enumerate(data): data[i] = to_str(e)
+                               #       only keep the first X elements of the 
list:                     
+                               X = (100/len(str(data))) + 1    #display more 
for non complex vectors                                   
+                               dt_str = '['            #       replace the 
removed elements with a '...' 
+                               for i,f in enumerate(data):
+                                       if i < X or i+1 == len(data):   #leave 
one on the end 
+                                               dt_str = dt_str + f
+                                               if i < len(data)-1 and (i+1 != 
X or X+1 == len(data)): dt_str = dt_str + ', '
+                                       elif i == X: dt_str = dt_str + ' ... '
+                               dt_str = dt_str + ']'
+                       elif self.get_data_type().get_type() == 
Hex().get_type(): dt_str = hex(data) #hex, base 16
+                       else: dt_str = to_str(data)     #other types
+                       return '<b>%s:</b> %s'%(self.cname, dt_str)
+               else:   return '<span foreground="red"><b>%s:</b> 
error</span>'%self.cname
+                       
+       def get_layout(self):
+               """!
+               Create a layout based on the current markup.
+               @return the pango layout
+               """
+               layout = gtk.DrawingArea().create_pango_layout('')
+               layout.set_markup(self.get_markup())
+               desc = pango.FontDescription(PARAM_FONT)
+               layout.set_font_description(desc) 
+               return layout
+

Added: grc/branches/grc_reloaded/src/grc/gui/elements/Port.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/elements/Port.py                      
        (rev 0)
+++ grc/branches/grc_reloaded/src/grc/gui/elements/Port.py      2008-01-31 
21:25:54 UTC (rev 7533)
@@ -0,0 +1,159 @@
+"""
+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 Elements.GraphicalSocket
+#The graphical input/output sockets of the signal block.
address@hidden Josh Blum
+
+import Utils
+import Socket
+import GraphicalElement
+from DataTypes import *
+from Constants import *
+import Colors
+import pygtk
+pygtk.require('2.0')
+import gtk
+import pango
+
+class GraphicalSocket(Socket.Socket, GraphicalElement.GraphicalElement):
+       """The graphical socket."""     
+                               
+       def update(self):
+               """Create new areas and labels for the socket."""
+               self.clear()
+               self.BG_color = {
+                       Complex().get_type():Colors.COMPLEX_COLOR,
+                       Float().get_type():Colors.FLOAT_COLOR,
+                       Int().get_type():Colors.INT_COLOR,
+                       Short().get_type():Colors.SHORT_COLOR,                  
+                       Byte().get_type():Colors.BYTE_COLOR,    
+                       # and for the vectors   #       
+                       ComplexVector().get_type():Colors.COMPLEX_VECTOR_COLOR,
+                       FloatVector().get_type():Colors.FLOAT_VECTOR_COLOR,
+                       IntVector().get_type():Colors.INT_VECTOR_COLOR,
+                       ShortVector().get_type():Colors.SHORT_VECTOR_COLOR,     
                
+                       ByteVector().get_type():Colors.BYTE_VECTOR_COLOR,
+               }[self.get_data_type().get_type()]
+               self._create_labels()           
+               #       add the input/output area for each rotation angle       
#       
+               rotation = self.get_rotation()          
+               conExtLen = CONNECTOR_EXTENSION_LENGTH
+               conExtInitLen = CONNECTOR_EXTENSION_INITIAL_LENGTH
+               conOff = SOCKET_HEIGHT/2
+               index = self.get_index()
+               if Utils.is_input_socket(self): length = 
self.get_parent().get_num_input_sockets()
+               elif Utils.is_output_socket(self): length = 
self.get_parent().get_num_output_sockets()
+               offset = (self.get_parent().H - length*SOCKET_HEIGHT - 
(length-1)*SOCKET_SEPARATION)/2                  
+               if rotation == 180 or rotation == 270: index = length-index-1   
#reverse the order                              
+               if (Utils.is_input_socket(self) and rotation == 0) or 
(Utils.is_output_socket(self) and rotation == 180):               
+                       x = -1*SOCKET_WIDTH
+                       y = (SOCKET_SEPARATION+SOCKET_HEIGHT)*index+offset
+                       self.add_area((x, y), (SOCKET_WIDTH, SOCKET_HEIGHT))
+                       if self.is_connected(): 
self.__set_connector_coordinates((x-1, 
y+conOff),(x-conExtInitLen-conExtLen*index, y+conOff))
+               elif (Utils.is_output_socket(self) and rotation == 0) or 
(Utils.is_input_socket(self) and rotation == 180):     
+                       x = self.parent.W
+                       y = (SOCKET_SEPARATION+SOCKET_HEIGHT)*index+offset
+                       self.add_area((x, y), (SOCKET_WIDTH, SOCKET_HEIGHT))
+                       if self.is_connected(): 
self.__set_connector_coordinates((x+1+SOCKET_WIDTH, 
y+conOff),(x+conExtInitLen+SOCKET_WIDTH+conExtLen*index, y+conOff))
+               elif (Utils.is_output_socket(self) and rotation == 90) or 
(Utils.is_input_socket(self) and rotation == 270):            
+                       y = -1*SOCKET_WIDTH
+                       x = (SOCKET_SEPARATION+SOCKET_HEIGHT)*index+offset
+                       self.add_area((x, y), (SOCKET_HEIGHT, SOCKET_WIDTH))
+                       if self.is_connected(): 
self.__set_connector_coordinates((x+conOff, y-1),(x+conOff, 
y-conExtInitLen-conExtLen*index))
+               elif (Utils.is_input_socket(self) and rotation == 90) or 
(Utils.is_output_socket(self) and rotation == 270):    
+                       y = self.parent.W
+                       x = (SOCKET_SEPARATION+SOCKET_HEIGHT)*index+offset
+                       self.add_area((x, y), (SOCKET_HEIGHT, SOCKET_WIDTH))
+                       if self.is_connected(): 
self.__set_connector_coordinates((x+conOff, y+1+SOCKET_WIDTH),(x+conOff, 
y+SOCKET_WIDTH+conExtInitLen+conExtLen*index))
+                       
+       def _create_labels(self):
+               """Create the labels for the socket."""
+               #       create the layout       #
+               layout = gtk.DrawingArea().create_pango_layout(self.cname)
+               desc = pango.FontDescription(SOCKET_FONT)
+               layout.set_font_description(desc) 
+               w,h = self.w,self.h = layout.get_pixel_size()   
+               #       create the pixmap       #                       
+               pixmap = gtk.gdk.Pixmap(self.get_parent().get_parent().window, 
w, h, -1)
+               gc = pixmap.new_gc()
+               gc.foreground = self.BG_color
+               pixmap.draw_rectangle(gc, True, 0, 0, w, h)
+               gc.foreground = Colors.TXT_COLOR
+               pixmap.draw_layout(gc, 0, 0, layout)
+               #       create the images       #
+               self.horizontal_label = image = pixmap.get_image(0, 0, w, h)    
+               if Utils.is_vertical(self.get_rotation()):      
+                       self.vertical_label = vimage = 
gtk.gdk.Image(gtk.gdk.IMAGE_NORMAL, pixmap.get_visual(), h, w)
+                       for i in range(w):
+                               for j in range(h): vimage.put_pixel(j, w-i-1, 
image.get_pixel(i, j))
+                               
+       def draw(self, window):
+               """!
+               Draw the socket with a label.
+               @param window the gtk window to draw on
+               """
+               GraphicalElement.GraphicalElement.draw(self, window, 
BG_color=self.BG_color)                            
+               gc = self.gc                            
+               gc.foreground = Colors.TXT_COLOR
+               X,Y = self.get_coordinate()
+               (x,y),(w,h) = self.areas_dict[self.get_rotation()][0] #use the 
first area's sizes to place the labels
+               if Utils.is_horizontal(self.get_rotation()): 
window.draw_image(gc, self.horizontal_label, 0, 0, x+X+(SOCKET_WIDTH-self.w)/2, 
y+Y+(SOCKET_HEIGHT-self.h)/2, -1, -1)
+               elif Utils.is_vertical(self.get_rotation()): 
window.draw_image(gc, self.vertical_label, 0, 0, x+X+(SOCKET_HEIGHT-self.h)/2, 
y+Y+(SOCKET_WIDTH-self.w)/2, -1, -1)
+       
+       def __set_connector_coordinates(self, coor_inner, coor_outer, 
rotation=None):
+               """!
+               Set the coordinates that connectors may attach to.
+               The connector coordinates are associated with a rotation. If 
rotation is not specified, the element's current rotation is used.
+               @param coor_inner the corrdinate on the socket
+               @param coor_outer the coordinate out of the socket
+               @param rotation rotation in degrees
+               """
+               if rotation == None: rotation = self.get_rotation()     
+               self.connector_coordinates[rotation] = coor_inner, coor_outer   
+       
+       def get_connector_coordinates(self, rotation=None):
+               """!
+               Get the coordinates that Connections may attach to.
+               @param rotation rotation in degrees
+               @return the connector coordinates ((xin, yin), (xout, yout)) 
tuple
+               """
+               if rotation == None: rotation = self.get_rotation()     
+               X,Y = self.get_coordinate()     
+               (x1,y1),(x2,y2)= self.connector_coordinates[rotation]
+               return (x1+X, y1+Y), (x2+X, y2+Y)
+                       
+       def get_connector_direction(self):
+               """!
+               Get the direction that the socket points: 0,90,180,270.
+               This is the rotation degree if the socket is an output or
+               the rotation degree + 180 if the socket is an input.
+               @return the direction in degrees
+               """     
+               if Utils.is_output_socket(self): return self.get_rotation()
+               elif Utils.is_input_socket(self): return (self.get_rotation() + 
180)%360                                
+       
+class GraphicalInputSocket(GraphicalSocket):
+       """ The socket for input        """
+       type = Socket.InputSocket.type
+
+class GraphicalOutputSocket(GraphicalSocket):
+       """ The socket for output       """
+       type = Socket.OutputSocket.type
+               
+               
\ No newline at end of file

Added: grc/branches/grc_reloaded/src/grc/gui/elements/__init__.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/elements/__init__.py                  
        (rev 0)
+++ grc/branches/grc_reloaded/src/grc/gui/elements/__init__.py  2008-01-31 
21:25:54 UTC (rev 7533)
@@ -0,0 +1,21 @@
+"""
+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.elements
+#All elements used in a flow graph.
address@hidden Josh Blum

Added: grc/branches/grc_reloaded/src/grc/platforms/__init__.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/platforms/__init__.py                     
        (rev 0)
+++ grc/branches/grc_reloaded/src/grc/platforms/__init__.py     2008-01-31 
21:25:54 UTC (rev 7533)
@@ -0,0 +1 @@
+

Added: grc/branches/grc_reloaded/src/grc/platforms/common/DataType.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/platforms/common/DataType.py              
                (rev 0)
+++ grc/branches/grc_reloaded/src/grc/platforms/common/DataType.py      
2008-01-31 21:25:54 UTC (rev 7533)
@@ -0,0 +1,55 @@
+"""
+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.platforms.common.DataType
+#Holds a data type with a value and range and 
+#provides parsing capabilities.
address@hidden Josh Blum
+
+from grc.gui.elements.DataType import DataType as _DataType
+
+class DataType(_DataType):
+
+       ##possible data types that this class can handle
+       _TYPES = ['raw', 'string', 'int', 'real']
+
+       def _get_eval(self):
+               """
+               Parse the value according to the type.
+               @return the parsed value
+               """
+               type = self.get_type()
+               value = self.get_value()
+               if type == 'raw':
+                       e = eval(value)
+               elif type == 'string':
+                       e = str(value)
+                       self.check_range(e)
+               elif type == 'int': 
+                       e = int(eval(value))
+                       self.check_range(e)
+               elif type == 'real':
+                       e = float(eval(value))
+                       self.check_range(e)
+               return e
+               
+       def _get_abbr(self):
+               """
+               """
+
+       

Added: grc/branches/grc_reloaded/src/grc/platforms/common/__init__.py
===================================================================

Added: grc/branches/grc_reloaded/src/grc/platforms/common/blocks/about.xml
===================================================================
--- grc/branches/grc_reloaded/src/grc/platforms/common/blocks/about.xml         
                (rev 0)
+++ grc/branches/grc_reloaded/src/grc/platforms/common/blocks/about.xml 
2008-01-31 21:25:54 UTC (rev 7533)
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!DOCTYPE block SYSTEM "../../block.dtd">
+<!-- 
+###################################################
+##About block: misc info
+###################################################
+ -->
+<block>
+       <name>About</name>
+       <key>about</key>
+       <cat>Misc</cat>
+       <fcn />
+       <param>
+               <name>Name</name>
+               <key>name</key>
+               <value>Your name here.</value>
+               <type>string</type>
+       </param>
+       <param>
+               <name>Title</name>
+               <key>title</key>
+               <value>Title of this flow graph.</value>
+               <type>string</type>
+       </param>
+</block>

Added: grc/branches/grc_reloaded/src/grc/platforms/common/blocks/block.dtd
===================================================================
--- grc/branches/grc_reloaded/src/grc/platforms/common/blocks/block.dtd         
                (rev 0)
+++ grc/branches/grc_reloaded/src/grc/platforms/common/blocks/block.dtd 
2008-01-31 21:25:54 UTC (rev 7533)
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<!-- 
+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 
+-->
+<!--
+       common.blocks.dtd 
+       Josh Blum
+       The document type definitions for block definitions.
+ -->
+<!-- 
+       Top level element.
+       A common block contains a name, key, and parameters list.
+ -->
+<!ELEMENT block (doc?, name, key, cat, param*)>
+<!-- 
+       Sub level elements. 
+ --> 
+<!ELEMENT param (name, key, value?, type, range?, option*)>
+<!ELEMENT option (name, key, opt*)>
+<!-- 
+       Bottom level elements.
+       Character data only. 
+ -->
+<!ELEMENT doc (#PCDATA)>
+<!ELEMENT cat (#PCDATA)>
+<!ELEMENT name (#PCDATA)>
+<!ELEMENT key (#PCDATA)>
+<!ELEMENT range (#PCDATA)>
+<!ELEMENT opt (#PCDATA)>       
+<!ELEMENT type (#PCDATA)>
+<!ELEMENT value (#PCDATA)>

Added: grc/branches/grc_reloaded/src/grc/platforms/common/blocks/note.xml
===================================================================
--- grc/branches/grc_reloaded/src/grc/platforms/common/blocks/note.xml          
                (rev 0)
+++ grc/branches/grc_reloaded/src/grc/platforms/common/blocks/note.xml  
2008-01-31 21:25:54 UTC (rev 7533)
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<!DOCTYPE block SYSTEM "../../block.dtd">
+<!-- 
+###################################################
+##Note block: misc info
+###################################################
+ -->
+<block>
+       <name>Note</name>
+       <key>note</key>
+       <cat>Misc</cat>
+       <fcn />
+       <param>
+               <name>Note</name>
+               <key>note</key>
+               <value>A note about this flow graph.</value>
+               <type>string</type>
+       </param>
+</block>

Added: grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/Block.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/Block.py        
                        (rev 0)
+++ grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/Block.py        
2008-01-31 21:25:54 UTC (rev 7533)
@@ -0,0 +1,92 @@
+"""
+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.platforms.gnuradio_python.Block
+#Flow graph block.
address@hidden Josh Blum
+
+from grc.elements.Block import Block as _Block
+from Port import Port
+from grc import Utils
+
+class Block(_Block):
+       
+       ##override static constructor for source
+       Source = Port.make_source_from_n
+       ##override static constructor for sink
+       Sink = Port.make_sink_from_n
+       
+       def __init__(self, flow_graph, doc, name, key, cat, deps, fcn, 
callbacks, params, sources, sinks):
+               _Block.__init__(
+                       self,                   
+                       flow_graph=flow_graph, 
+                       doc=doc, 
+                       name=name, 
+                       key=key, 
+                       cat=cat, 
+                       params=params, 
+                       sources=sources, 
+                       sinks=sinks,
+               )
+               self._deps = deps
+               self._fcn = fcn
+               self._callbacks = callbacks
+       
+       def get_deps(self): return self._deps
+       
+       def get_fcn(self): return self._fcn
+       
+       def get_callbacks(self): return self._callbacks
+       
+       ##############################################
+       ## Static Make Methods
+       ##############################################
+       def make_block_from_n(flow_graph, n):
+               """
+               Make a new block from nested data.
+               @param flow graph the parent element
+               @param n the nested odict
+               @return block a new block
+               """
+               #grab the data
+               doc = Utils.exists_or_else(n, 'doc', '')
+               name = n['name']
+               key = n['key']
+               cat = n['cat']          
+               deps = Utils.listify(n, 'dep')
+               fcn = n['fcn']
+               callbacks = Utils.listify(n, 'callback')                        
+               params = Utils.listify(n, 'param')
+               sources = Utils.listify(n, 'source')
+               sinks = Utils.listify(n, 'sink')
+               #build the block
+               return Block(
+                       flow_graph=flow_graph, 
+                       doc=doc, 
+                       name=name, 
+                       key=key, 
+                       cat=cat, 
+                       deps=deps,
+                       fcn=fcn,
+                       callbacks=callbacks,
+                       params=params, 
+                       sources=sources, 
+                       sinks=sinks,
+               )
+       make_block_from_n = staticmethod(make_block_from_n)             
+       
\ No newline at end of file

Added: grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/DataType.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/DataType.py     
                        (rev 0)
+++ grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/DataType.py     
2008-01-31 21:25:54 UTC (rev 7533)
@@ -0,0 +1,158 @@
+"""
+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.platforms.gnuradio_python.DataType
+#Holds a data type with a value and range and 
+#provides parsing capabilities.
address@hidden Josh Blum
+
+from grc.elements.DataType import DataType as _DataType
+import os
+
+class DataType(_DataType):
+
+       ##possible data types that this class can handle
+       _TYPES = [
+               'var_key',
+               'string', 
+               'file_open', 'file_save',
+               'hex',
+               'complex', 'real', 'int', 
+               'complex_vector', 'real_vector', 'int_vector'
+       ]
+
+       def check_range_len(self, value):
+               """
+               Is the len(value) in the range of this data type?
+               @param value a list to test
+               @throw Exception length is out of range
+               """
+               if self.get_range().in_range(len(value)): return
+               raise Exception, 'Length of "%s" is not in range "%s".'%(value, 
range)
+
+       def _get_eval(self):
+               """
+               Evaluate the value according to the type.
+               @throw Exception when evaluation fails
+               @return the evaluated value
+               """
+               #bring in gnuradio modules
+               from gnuradio import gr
+               from gnuradio.gr import firdes
+               import math
+               import cmath
+               eval = lambda exp: eval(exp, {
+                               '__builtins__': __builtins__,
+                               'gr': gr,
+                               'firdes': firdes,
+                               'math': math,
+                               'cmath': cmath,
+                               #add varables here
+                       }
+               )               
+               t = self.get_type()
+               v = self.get_value()
+               if t == 'var_key':
+                       #TODO v must be unique among all variable blocks
+                       pass
+                       
+               elif t == 'string':
+                       e = str(v)
+               elif t == 'file_open': 
+                       e = str(v)                
+                       assert(os.path.isfile(e))
+               elif t == 'file_save':
+                       e = str(v)  
+                       assert(os.path.exists(os.path.dirname(e)))
+                       assert(not os.path.isdir(e))
+                       assert(path.basename(e))                
+               elif t == 'hex':
+                       e = int(v, 16)
+                       self.check_range(e)
+               elif t == 'complex':
+                       e = complex(eval(v))
+               elif t == 'real':
+                       e = float(eval(v))
+                       self.check_range(e)
+               elif t == 'int':
+                       e = int(eval(v))
+                       self.check_range(e)
+               elif t == 'complex_vector':
+                       e = list(eval(v))
+                       e = map(complex, e)
+                       self.check_range_len(e)
+               elif t == 'real_vector':
+                       e = list(eval(v))
+                       e = map(float, e)
+                       self.check_range_len(e)
+               elif t == 'int_vector':
+                       e = list(eval(v))
+                       e = map(int, e)
+                       self.check_range_len(e) 
+               return e
+               
+       def _get_repr(self):
+               """
+               Get the representation for the evaluated value.
+               Since this platform is for native python, just use the value.
+               @return the representation string
+               """
+               t = self.get_type()
+               e = self.get_eval()
+               if t in ('string', 'file_open', 'file_save'):
+                       return '"%s"'%e
+               elif t == 'hex':
+                       return hex(e)
+               return self.get_value()
+               
+       def _get_abbr(self):
+               """
+               Get the abbreviation for the evaluated value.
+               @return the abbreviation string
+               """
+               t = self.get_type()
+               e = self.get_eval()
+               suggested_length = 30
+               if t == 'string':
+                       if len(e) >= suggested_length + 3: 
+                               return e[:suggested_length/2] + '...' + 
e[-suggested_length/2:]
+                       return e
+               elif t in ('file_open', 'file_save'):                   
+                       if len(e) <= suggested_length: e_str = e
+                       else:   #truncate the tail if there is not enough space
+                               tail,head = os.path.split(e)
+                               if len(head) >= suggested_length: e_str = head
+                               else: e_str = 
tail[0:suggested_length-len(head)] + '...' + head
+                       return e_str
+               elif t == 'hex':
+                       return hex(e)
+               elif t in ('complex', 'real', 'int'):
+                       return DataType.num_to_str(e)
+               elif t in ('complex_vector', 'real_vector', 'int_vector'):
+                       e_lst = map(DataType.num_to_str, e)
+                       #       only keep the first X elements of the list:     
                
+                       X = (100/len(str(e_lst))) + 1   #display more for non 
complex vectors   
+                       e_str = '['             #       replace the removed 
elements with a '...' 
+                       for i,f in enumerate(e_lst):
+                               if i < X or i+1 == len(e_lst):  #leave one on 
the end 
+                                       e_str = e_str + f
+                                       if i < len(e_lst)-1 and (i+1 != X or 
X+1 == len(e_lst)): e_str = e_str + ', '
+                               elif i == X: e_str = e_str + ' ... '
+                       e_str = e_str + ']'
+                       return e_str
+               return ''

Added: grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/FlowGraph.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/FlowGraph.py    
                        (rev 0)
+++ grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/FlowGraph.py    
2008-01-31 21:25:54 UTC (rev 7533)
@@ -0,0 +1,30 @@
+"""
+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.platforms.gnuradio_python.FlowGraph
+#Primative flow graph.
address@hidden Josh Blum
+
+from grc.elements.FlowGraph import FlowGraph as _FlowGraph
+from Block import Block
+
+class FlowGraph(_FlowGraph):
+       
+       ##override static constructor for block
+       Block = Block.make_block_from_n
+       
\ No newline at end of file

Added: grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/Platform.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/Platform.py     
                        (rev 0)
+++ grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/Platform.py     
2008-01-31 21:25:54 UTC (rev 7533)
@@ -0,0 +1,49 @@
+"""
+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.platforms.gnuradio_python.Platform
+#Gnuradio python specific platform.
address@hidden Josh Blum
+
+import os
+from grc.elements.Platform import Platform as _Platform
+from Block import Block
+
+class Platform(_Platform):
+       
+       ##override static constructor for block
+       Block = Block.make_block_from_n
+       
+       ##############################################
+       ## Static Make Methods
+       ##############################################
+       def make_platform():
+               """!
+               Make a platform from the arguments.
+               @param name the platform name
+               @param key the unique platform key
+               @param path the file path to this platform
+               @return a platform object
+               """
+               return Platform(
+                       name='GNURadio Python', 
+                       key='gnuradio_python',  
+                       path=os.path.dirname(__file__),
+               )
+       make_platform = staticmethod(make_platform)
+       

Added: grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/Port.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/Port.py         
                (rev 0)
+++ grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/Port.py 
2008-01-31 21:25:54 UTC (rev 7533)
@@ -0,0 +1,114 @@
+"""
+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.platforms.gnuradio_python.Port
+#Flow graph block port (source or sink).
address@hidden Josh Blum
+
+from grc.elements.Port import Port as _Port
+from grc import Utils
+
+class Port(_Port):
+
+       def __init__(self, block, name, key, type, vec_len, num_ports, 
optional):       
+               _Port.__init__(
+                       self, 
+                       block=block,
+                       name=name,
+                       key=key,
+                       type=type,
+               )
+               self._num_ports = num_ports
+               self._vec_len = vec_len
+               self._optional = bool(optional)
+               
+       def test(self):
+               _Port.test(self)
+               if self.get_num_ports():
+                       try: assert(int(self.get_key()) == 0)
+                       except (AssertionError,ValueError): 
self._exit_with_error('Port key must be "0" when num ports is specified.')
+                       try:
+                               if self.is_sink(): 
assert(len(self.get_parent().get_sinks()) == 1)
+                               elif self.is_source(): 
assert(len(self.get_parent().get_sources()) == 1)
+                       except AssertionError: self._exit_with_error('Other 
ports not allowed when num ports is specified.')
+               self.get_vec_len()
+       
+       def get_vec_len(self): return 
self.get_parent().resolve_dependency(self._vec_len)
+       
+       def get_num_ports(self): return 
self.get_parent().resolve_dependency(self._num_ports)
+       
+       def get_optional(self): return 
self.get_parent().resolve_dependency(self._optional)
+               
+       ##############################################
+       ## Static Make Methods
+       ##############################################
+       def make_source_from_n(block, n):
+               """
+               Make a new port from nested data.
+               @param block the parent element
+               @param n the nested odict
+               @return a new source port
+               """
+               #grab the data
+               name = n['name']
+               type = n['type']
+               vec_len = Utils.exists_or_else(n, 'vec_len', '')
+               num_ports = Utils.exists_or_else(n, 'num_ports', '')
+               optional = Utils.exists_or_else(n, 'optional', '')              
+               #key is port index
+               key = str(len(block.get_sources()))             
+               #build the port
+               return Port(
+                       block=block,
+                       name=name,
+                       key=key,
+                       type=type,
+                       vec_len=vec_len,
+                       num_ports=num_ports,
+                       optional=optional,
+               )
+       make_source_from_n = staticmethod(make_source_from_n)
+       
+       def make_sink_from_n(block, n):
+               """
+               Make a new port from nested data.
+               @param block the parent element
+               @param n the nested odict
+               @return a new sink port
+               """
+               #grab the data
+               name = n['name']
+               type = n['type']
+               vec_len = Utils.exists_or_else(n, 'vec_len', '')
+               num_ports = Utils.exists_or_else(n, 'num_ports', '')
+               optional = Utils.exists_or_else(n, 'optional', '')              
+               #key is port index
+               key = str(len(block.get_sinks()))               
+               #build the port
+               return Port(
+                       block=block,
+                       name=name,
+                       key=key,
+                       type=type,
+                       vec_len=vec_len,
+                       num_ports=num_ports,
+                       optional=optional,
+               )
+       make_sink_from_n = staticmethod(make_sink_from_n)
+               
+               
\ No newline at end of file

Added: grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/__init__.py
===================================================================

Added: 
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/block.dtd
===================================================================
--- 
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/block.dtd    
                            (rev 0)
+++ 
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/block.dtd    
    2008-01-31 21:25:54 UTC (rev 7533)
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<!-- 
+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 
+-->
+<!--
+       gnuradio_python.blocks.dtd 
+       Josh Blum
+       The document type definitions for block definitions.
+ -->
+<!-- 
+       Top level element.
+       A block contains a name, ...parameters list, and list of IO ports.
+ -->
+<!ELEMENT block (doc?, name, key, cat, dep*, fcn, callback*, param*, sink*, 
source*)>
+<!-- 
+       Sub level elements. 
+ --> 
+<!ELEMENT param (name, key, value?, type, range?, option*)>
+<!ELEMENT option (name, key, opt*)>
+<!ELEMENT sink (name, type, vec_len?, num_ports?, optional?)>
+<!ELEMENT source (name, type, vec_len?, num_ports?, optional?)>
+<!-- 
+       Bottom level elements.
+       Character data only. 
+ -->
+<!ELEMENT dep (#PCDATA)>
+<!ELEMENT doc (#PCDATA)>
+<!ELEMENT cat (#PCDATA)>
+<!ELEMENT name (#PCDATA)>
+<!ELEMENT key (#PCDATA)>
+<!ELEMENT range (#PCDATA)>
+<!ELEMENT opt (#PCDATA)>       
+<!ELEMENT type (#PCDATA)>
+<!ELEMENT vec_len (#PCDATA)>
+<!ELEMENT num_ports (#PCDATA)>
+<!ELEMENT fcn (#PCDATA)>
+<!ELEMENT value (#PCDATA)>
+<!ELEMENT callback (#PCDATA)>
+<!ELEMENT optional (#PCDATA)>

Added: 
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/misc/variable.xml
===================================================================
--- 
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/misc/variable.xml
                                (rev 0)
+++ 
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/misc/variable.xml
        2008-01-31 21:25:54 UTC (rev 7533)
@@ -0,0 +1,55 @@
+<?xml version="1.0"?>
+<!DOCTYPE block SYSTEM "../block.dtd">
+<!-- 
+###################################################
+##Variable block: a grc variable with key, value, min, max, step
+###################################################
+ -->
+<block>
+       <name>Variable</name>
+       <key>variable</key>
+       <cat>Main</cat>
+       <fcn />
+       <param>
+               <name>Key</name>
+               <key>key</key>
+               <type>var_key</type>
+       </param>
+       <param>
+               <name>Value</name>
+               <key>value</key>
+               <type>$type:type</type>
+               <range>[$min, $max]</range>
+       </param>
+       <param>
+               <name>Type</name>
+               <key>type</key>
+               <value>constant</value>
+               <type>enum</type>
+               <option>
+                       <name>Constant</name>
+                       <key>constant</key>
+                       <opt>type:string</opt>                                  
+               </option>
+               <option>
+                       <name>Range</name>
+                       <key>range</key>
+                       <opt>type:real</opt>                                    
+               </option>
+       </param>
+       <param>
+               <name>Minimum</name>
+               <key>min</key>
+               <type>real</type>
+       </param>
+       <param>
+               <name>Maximum</name>
+               <key>max</key>
+               <type>real</type>
+       </param>
+       <param>
+               <name>Step Size</name>
+               <key>step</key>
+               <type>real</type>
+       </param>
+</block>

Added: 
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/operators/add.xml
===================================================================
--- 
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/operators/add.xml
                                (rev 0)
+++ 
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/operators/add.xml
        2008-01-31 21:25:54 UTC (rev 7533)
@@ -0,0 +1,69 @@
+<?xml version="1.0"?>
+<!DOCTYPE block SYSTEM "../block.dtd">
+<!-- 
+###################################################
+##Add Block:
+##     all types, 1 output, 2 to inf inputs
+###################################################
+ -->
+<block>
+       <name>Add</name>
+       <key>add</key>
+       <cat>Operators</cat>
+       <dep>gr</dep>
+       <fcn>$type:fcn($vec_len)</fcn>
+       <param>
+               <name>Num Inputs</name>
+               <key>num_inputs</key>
+               <value>2</value>
+               <type>int</type>                
+               <range>[2, inf)</range>
+       </param>
+       <param>
+               <name>Vec Length</name>
+               <key>vec_len</key>
+               <value>1</value>
+               <type>int</type>                
+               <range>[1, inf)</range>
+       </param>
+       <param>
+               <name>IO Type</name>
+               <key>type</key>
+               <type>enum</type>
+               <option>
+                       <name>Complex</name>
+                       <key>complex</key>
+                       <opt>type:complex</opt>
+                       <opt>fcn:gr.add_vcc</opt>                               
                
+               </option>
+               <option>
+                       <name>Float</name>
+                       <key>float</key>
+                       <opt>type:float</opt>
+                       <opt>fcn:gr.add_vff</opt>                               
                
+               </option>
+               <option>
+                       <name>Int</name>
+                       <key>int</key>
+                       <opt>type:int</opt>
+                       <opt>fcn:gr.add_vii</opt>                               
                
+               </option>
+               <option>
+                       <name>Short</name>
+                       <key>short</key>
+                       <opt>type:short</opt>
+                       <opt>fcn:gr.add_vss</opt>                               
                
+               </option>
+       </param>        
+       <sink>
+               <name>in</name>
+               <type>$type:type</type>
+               <vec_len>$vec_len</vec_len>
+               <num_ports>$num_inputs</num_ports>
+       </sink> 
+       <source>
+               <name>out</name>
+               <type>$type:type</type>
+               <vec_len>$vec_len</vec_len>
+       </source>               
+</block>

Added: 
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/operators/add_const.xml
===================================================================
--- 
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/operators/add_const.xml
                          (rev 0)
+++ 
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/operators/add_const.xml
  2008-01-31 21:25:54 UTC (rev 7533)
@@ -0,0 +1,73 @@
+<?xml version="1.0"?>
+<!DOCTYPE block SYSTEM "../block.dtd">
+<!-- 
+###################################################
+##Add Const Block:
+##     all types, 1 output, 1 input & const
+###################################################
+ -->
+<block>
+       <name>Add Const</name>
+       <key>add_const</key>
+       <cat>Operators</cat>
+       <dep>gnuradio.gr</dep>
+       <fcn>$type:fcn($const)</fcn>
+       <callback>set_k($const)</callback>
+       <param>
+               <name>Constant</name>
+               <key>const</key>
+               <value>0</value>
+               <type>$type:const_type</type>
+               <range>[$vec_len, $vec_len]</range>
+       </param>
+       <param>
+               <name>Vec Length</name>
+               <key>vec_len</key>
+               <value>1</value>
+               <type>int</type>                
+               <range>[1, inf)</range>
+       </param>
+       <param>
+               <name>IO Type</name>
+               <key>type</key>
+               <type>enum</type>
+               <option>
+                       <name>Complex</name>
+                       <key>complex</key>
+                       <opt>const_type:complex_vector</opt>
+                       <opt>type:complex</opt>
+                       <opt>fcn:gr.add_const_vcc</opt>                         
                
+               </option>
+               <option>
+                       <name>Float</name>
+                       <key>float</key>
+                       <opt>const_type:real_vector</opt>
+                       <opt>type:float</opt>
+                       <opt>fcn:gr.add_const_vff</opt>                         
                
+               </option>
+               <option>
+                       <name>Int</name>
+                       <key>int</key>
+                       <opt>const_type:int_vector</opt>
+                       <opt>type:int</opt>
+                       <opt>fcn:gr.add_const_vii</opt>                         
                
+               </option>
+               <option>
+                       <name>Short</name>
+                       <key>short</key>
+                       <opt>const_type:int_vector</opt>
+                       <opt>type:short</opt>
+                       <opt>fcn:gr.add_const_vss</opt>                         
                
+               </option>
+       </param>        
+       <sink>
+               <name>in</name>
+               <type>$type:type</type>
+               <vec_len>$vec_len</vec_len>
+       </sink> 
+       <source>
+               <name>out</name>
+               <type>$type:type</type>
+               <vec_len>$vec_len</vec_len>
+       </source>               
+</block>





reply via email to

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