summaryrefslogtreecommitdiff
path: root/grc
diff options
context:
space:
mode:
Diffstat (limited to 'grc')
-rw-r--r--grc/blocks/Makefile.am1
-rw-r--r--grc/blocks/block_tree.xml1
-rw-r--r--grc/blocks/gr_agc2_xx.xml5
-rw-r--r--grc/blocks/gr_and_const_xx.xml48
-rw-r--r--grc/blocks/gr_file_sink.xml19
-rw-r--r--grc/blocks/wxgui_scopesink2.xml22
-rw-r--r--grc/freedesktop/Makefile.am12
-rw-r--r--grc/freedesktop/gnuradio-grc.desktop (renamed from grc/freedesktop/gnuradio-gnuradio-companion.desktop)0
-rw-r--r--grc/freedesktop/grc_setup_freedesktop.in31
-rw-r--r--grc/python/Block.py74
-rw-r--r--grc/python/Port.py2
11 files changed, 168 insertions, 47 deletions
diff --git a/grc/blocks/Makefile.am b/grc/blocks/Makefile.am
index 2596eae45..18420a013 100644
--- a/grc/blocks/Makefile.am
+++ b/grc/blocks/Makefile.am
@@ -71,6 +71,7 @@ dist_ourdata_DATA = \
gr_agc2_xx.xml \
gr_agc_xx.xml \
gr_and_xx.xml \
+ gr_and_const_xx.xml \
gr_argmax_xx.xml \
gr_binary_slicer_fb.xml \
gr_channel_model.xml \
diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml
index 8d91258e5..610a88102 100644
--- a/grc/blocks/block_tree.xml
+++ b/grc/blocks/block_tree.xml
@@ -58,6 +58,7 @@
<block>gr_add_const_vxx</block>
<block>gr_multiply_const_vxx</block>
+ <block>gr_and_const_xx</block>
<block>gr_not_xx</block>
<block>gr_and_xx</block>
diff --git a/grc/blocks/gr_agc2_xx.xml b/grc/blocks/gr_agc2_xx.xml
index fb3ae5704..55b20d4e8 100644
--- a/grc/blocks/gr_agc2_xx.xml
+++ b/grc/blocks/gr_agc2_xx.xml
@@ -9,6 +9,11 @@
<key>gr_agc2_xx</key>
<import>from gnuradio import gr</import>
<make>gr.agc2_$(type.fcn)($attack_rate, $decay_rate, $reference, $gain, $max_gain)</make>
+ <callback>set_attack_rate($attack_rate)</callback>
+ <callback>set_decay_rate($decay_rate)</callback>
+ <callback>set_reference($reference)</callback>
+ <callback>set_gain($gain)</callback>
+ <callback>set_max_gain($max_gain)</callback>
<param>
<name>Type</name>
<key>type</key>
diff --git a/grc/blocks/gr_and_const_xx.xml b/grc/blocks/gr_and_const_xx.xml
new file mode 100644
index 000000000..dc9649311
--- /dev/null
+++ b/grc/blocks/gr_and_const_xx.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+## And Const Block:
+## all types, 1 output, 1 input & const
+###################################################
+ -->
+<block>
+ <name>And Const</name>
+ <key>gr_and_const_xx</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.and_const_$(type.fcn)($const)</make>
+ <callback>set_k($const)</callback>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:ss</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>fcn:bb</opt>
+ </option>
+ </param>
+ <param>
+ <name>Constant</name>
+ <key>const</key>
+ <value>0</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_file_sink.xml b/grc/blocks/gr_file_sink.xml
index 880dc2759..0081c93f8 100644
--- a/grc/blocks/gr_file_sink.xml
+++ b/grc/blocks/gr_file_sink.xml
@@ -8,7 +8,9 @@
<name>File Sink</name>
<key>gr_file_sink</key>
<import>from gnuradio import gr</import>
- <make>gr.file_sink($type.size*$vlen, $file)</make>
+ <make>gr.file_sink($type.size*$vlen, $file)
+self.$(id).set_unbuffered($unbuffered)</make>
+ <callback>set_unbuffered($unbuffered)</callback>
<param>
<name>File</name>
<key>file</key>
@@ -51,6 +53,21 @@
<value>1</value>
<type>int</type>
</param>
+ <param>
+ <name>Unbuffered</name>
+ <key>unbuffered</key>
+ <value>False</value>
+ <type>bool</type>
+ <option>
+ <name>Off</name>
+ <key>False</key>
+ </option>
+ <option>
+ <name>On</name>
+ <key>True</key>
+ </option>
+ </param>
+
<check>$vlen &gt; 0</check>
<sink>
<name>in</name>
diff --git a/grc/blocks/wxgui_scopesink2.xml b/grc/blocks/wxgui_scopesink2.xml
index eba45f489..50cd977be 100644
--- a/grc/blocks/wxgui_scopesink2.xml
+++ b/grc/blocks/wxgui_scopesink2.xml
@@ -20,6 +20,7 @@ scopesink2.$(type.fcn)(
ac_couple=$ac_couple,
xy_mode=$xy_mode,
num_inputs=$num_inputs,
+ trig_mode=$trig_mode,
#if $win_size()
size=$win_size,
#end if
@@ -134,6 +135,27 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
<value></value>
<type>notebook</type>
</param>
+ <param>
+ <name>Trigger Mode</name>
+ <key>trig_mode</key>
+ <type>enum</type>
+ <option>
+ <name>Auto</name>
+ <key>gr.gr_TRIG_MODE_AUTO</key>
+ </option>
+ <option>
+ <name>Normal</name>
+ <key>gr.gr_TRIG_MODE_NORM</key>
+ </option>
+ <option>
+ <name>Freerun</name>
+ <key>gr.gr_TRIG_MODE_FREE</key>
+ </option>
+ <option>
+ <name>Stripchart</name>
+ <key>gr.gr_TRIG_MODE_STRIPCHART</key>
+ </option>
+ </param>
<check>not $win_size or len($win_size) == 2</check>
<check>not $xy_mode or '$type' == 'complex' or $num_inputs != 1</check>
<sink>
diff --git a/grc/freedesktop/Makefile.am b/grc/freedesktop/Makefile.am
index 23bb70bf5..f6aa97a93 100644
--- a/grc/freedesktop/Makefile.am
+++ b/grc/freedesktop/Makefile.am
@@ -1,5 +1,5 @@
#
-# Copyright 2008,2009 Free Software Foundation, Inc.
+# Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -22,7 +22,6 @@
include $(top_srcdir)/Makefile.common
ourdatadir = $(pkgdatadir)/grc/freedesktop
-
dist_ourdata_DATA = \
grc-icon-256.png \
grc-icon-128.png \
@@ -30,11 +29,12 @@ dist_ourdata_DATA = \
grc-icon-48.png \
grc-icon-32.png \
gnuradio-grc.xml \
- gnuradio-gnuradio-companion.desktop \
+ gnuradio-grc.desktop \
gnuradio-usrp2_probe.desktop \
gnuradio-usrp_probe.desktop
-dist_bin_SCRIPTS = grc_setup_freedesktop
+pkglibexecdir = $(libexecdir)/$(PACKAGE)
+dist_pkglibexec_SCRIPTS = grc_setup_freedesktop
grc_setup_freedesktop: $(srcdir)/grc_setup_freedesktop.in Makefile
sed -e 's|@SRCDIR[@]|$(ourdatadir)|g' $< > $@
@@ -46,10 +46,10 @@ install-data-hook:
@printf "\n*** GRC Post-Install Message ***\
\nTo install icons, mime type, and menu items\
\nfor a freedesktop.org system (Gnome/KDE/Xfce):\
- \n >>> sudo grc_setup_freedesktop install\n\n"
+ \n >>> sudo $(pkglibexecdir)/grc_setup_freedesktop install\n\n"
uninstall-hook:
@printf "\n*** GRC Post-Uninstall Message ***\
\nTo uninstall icons, mime type, and menu items\
\nfor a freedesktop.org system (Gnome/KDE/Xfce):\
- \n >>> sudo grc_setup_freedesktop uninstall\n\n"
+ \n >>> sudo $(pkglibexecdir)/grc_setup_freedesktop uninstall\n\n"
diff --git a/grc/freedesktop/gnuradio-gnuradio-companion.desktop b/grc/freedesktop/gnuradio-grc.desktop
index 5fd049780..5fd049780 100644
--- a/grc/freedesktop/gnuradio-gnuradio-companion.desktop
+++ b/grc/freedesktop/gnuradio-grc.desktop
diff --git a/grc/freedesktop/grc_setup_freedesktop.in b/grc/freedesktop/grc_setup_freedesktop.in
index a0c5ac193..ab4ce82ef 100644
--- a/grc/freedesktop/grc_setup_freedesktop.in
+++ b/grc/freedesktop/grc_setup_freedesktop.in
@@ -1,4 +1,24 @@
#!/bin/bash
+#
+# Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
##################################################
# setup grc on a freedesktop platform
# $1 should be install or uninstall
@@ -8,7 +28,7 @@
##################################################
ICON_SIZES="32 48 64 128 256"
-MENU_ITEMS="gnuradio-companion usrp2_probe usrp_probe"
+MENU_ITEMS="grc usrp2_probe usrp_probe"
if [ -n "$2" ]; then
SRCDIR="$2"
else
@@ -39,11 +59,12 @@ case "$1" in
echo "Begin freedesktop uninstall..."
for size in ${ICON_SIZES}; do \
echo "Uninstall icon: ${size}x${size}"
- xdg-icon-resource uninstall --context mimetypes --theme gnome --size ${size} application-gnuradio-grc; \
- xdg-icon-resource uninstall --context mimetypes --size ${size} application-gnuradio-grc; \
- xdg-icon-resource uninstall --context apps --theme gnome --size ${size} gnuradio-grc; \
- xdg-icon-resource uninstall --context apps --size ${size} gnuradio-grc; \
+ xdg-icon-resource uninstall --noupdate --context mimetypes --theme gnome --size ${size} application-gnuradio-grc; \
+ xdg-icon-resource uninstall --noupdate --context mimetypes --size ${size} application-gnuradio-grc; \
+ xdg-icon-resource uninstall --noupdate --context apps --theme gnome --size ${size} gnuradio-grc; \
+ xdg-icon-resource uninstall --noupdate --context apps --size ${size} gnuradio-grc; \
done
+ xdg-icon-resource forceupdate
echo "Uninstall mime type"
xdg-mime uninstall ${SRCDIR}/gnuradio-grc.xml
echo "Uninstall menu items"
diff --git a/grc/python/Block.py b/grc/python/Block.py
index dd39b095d..bd03eb5cd 100644
--- a/grc/python/Block.py
+++ b/grc/python/Block.py
@@ -75,42 +75,48 @@ class Block(_Block, _GUIBlock):
Add and remove ports to adjust for the nports.
"""
_Block.rewrite(self)
+
+ def insert_port(get_ports, get_port, key):
+ prev_port = get_port(str(int(key)-1))
+ get_ports().insert(
+ get_ports().index(prev_port)+1,
+ prev_port.copy(new_key=key),
+ )
+ #restore integer contiguity after insertion
+ for i, port in enumerate(get_ports()): port._key = str(i)
+
+ def remove_port(get_ports, get_port, key):
+ port = get_port(key)
+ for connection in port.get_connections():
+ self.get_parent().remove_element(connection)
+ get_ports().remove(port)
+ #restore integer contiguity after insertion
+ for i, port in enumerate(get_ports()): port._key = str(i)
+
#adjust nports
for get_ports, get_port in (
(self.get_sources, self.get_source),
(self.get_sinks, self.get_sink),
):
- #how many streaming (non-message) ports?
- num_ports = len(filter(lambda p: p.get_type() != 'msg', get_ports()))
- #do nothing for 0 ports
- if not num_ports: continue
- #get the nports setting
- port0 = get_port(str(0))
- nports = port0.get_nports()
- #do nothing for no nports
- if not nports: continue
- #do nothing if nports is already num ports
- if nports == num_ports: continue
- #remove excess ports and connections
- if nports < num_ports:
- #remove the connections
- for key in map(str, range(nports, num_ports)):
- port = get_port(key)
- for connection in port.get_connections():
- self.get_parent().remove_element(connection)
- #remove the ports
- for key in map(str, range(nports, num_ports)):
- get_ports().remove(get_port(key))
- continue
- #add more ports
- if nports > num_ports:
- for key in map(str, range(num_ports, nports)):
- prev_port = get_port(str(int(key)-1))
- get_ports().insert(
- get_ports().index(prev_port)+1,
- prev_port.copy(new_key=key),
- )
- continue
+ master_ports = filter(lambda p: p.get_nports(), get_ports())
+ for i, master_port in enumerate(master_ports):
+ nports = master_port.get_nports()
+ index_first = get_ports().index(master_port)
+ try: index_last = get_ports().index(master_ports[i+1])
+ except IndexError: index_last = len(get_ports())
+ num_ports = index_last - index_first
+ #do nothing if nports is already num ports
+ if nports == num_ports: continue
+ #remove excess ports and connections
+ if nports < num_ports:
+ for key in map(str, range(index_first+nports, index_first+num_ports)):
+ remove_port(get_ports, get_port, key)
+ continue
+ #add more ports
+ if nports > num_ports:
+ for key in map(str, range(index_first+num_ports, index_first+nports)):
+ insert_port(get_ports, get_port, key)
+ continue
def port_controller_modify(self, direction):
"""
@@ -119,10 +125,8 @@ class Block(_Block, _GUIBlock):
@return true for change
"""
changed = False
- #concat the nports string from the private nports settings of both port0
- nports_str = \
- (self.get_sinks() and self.get_sinks()[0]._nports or '') + \
- (self.get_sources() and self.get_sources()[0]._nports or '')
+ #concat the nports string from the private nports settings of all ports
+ nports_str = ' '.join([port._nports for port in self.get_ports()])
#modify all params whose keys appear in the nports string
for param in self.get_params():
if param.is_enum() or param.get_key() not in nports_str: continue
diff --git a/grc/python/Port.py b/grc/python/Port.py
index 6965371df..6e5a5c59f 100644
--- a/grc/python/Port.py
+++ b/grc/python/Port.py
@@ -167,5 +167,7 @@ class Port(_Port, _GUIPort):
def copy(self, new_key=None):
n = self._n.copy()
+ #remove nports from the key so the copy cannot be a duplicator
+ if n.has_key('nports'): n.pop('nports')
if new_key: n['key'] = new_key
return self.__class__(self.get_parent(), n, self._dir)