summaryrefslogtreecommitdiff
path: root/gr-wxgui
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2009-10-07 01:47:38 -0700
committerJosh Blum <josh@joshknows.com>2009-10-07 01:47:38 -0700
commitbbecdd8372f57d49ad0046d9d096f322059005cb (patch)
treefc95d9f710951fb2a6f5e4232da284e9d5040eaa /gr-wxgui
parent645ab0cfa4ab46e057ab4df74066ab434ad5b90a (diff)
working special connect for fftsink
Diffstat (limited to 'gr-wxgui')
-rw-r--r--gr-wxgui/src/python/common.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/gr-wxgui/src/python/common.py b/gr-wxgui/src/python/common.py
index 09ce447194..fe080aa4ad 100644
--- a/gr-wxgui/src/python/common.py
+++ b/gr-wxgui/src/python/common.py
@@ -39,12 +39,7 @@ def bind_to_visible_event(win, callback):
my_win = parent
#call the callback, the arg is shown or not
def callback_factory(my_win, my_callback):
- cache = [None]
- def the_callback(*args):
- visible = is_wx_window_visible(my_win)
- if cache[0] != visible: my_callback(visible)
- cache[0] = visible
- return the_callback
+ return lambda *args: my_callback(is_wx_window_visible(my_win))
handler = callback_factory(win, callback)
#bind the handler to all the parent notebooks
while win:
@@ -57,19 +52,25 @@ def bind_to_visible_event(win, callback):
from gnuradio import gr
def special_connect(source, sink, hb, win, size):
- nulls = [gr.null_sink(size), gr.null_source(size)]
+ nulls = list()
+ cache = [None]
def callback(visible, init=False):
+ if visible == cache[0]: return
+ cache[0] = visible
if not init: hb.lock()
+ print 'visible', visible
if visible:
- if not init: hb.disconnect(source, nulls[0])
- if not init: hb.disconnect(nulls[1], sink)
+ if not init:
+ hb.disconnect(source, nulls[0])
+ hb.disconnect(nulls[1], nulls[2])
+ hb.disconnect(nulls[2], sink)
+ while nulls: nulls.pop()
hb.connect(source, sink)
- #hb.connect(nulls[1], nulls[0])
else:
if not init: hb.disconnect(source, sink)
- #if not init: hb.disconnect(nulls[1], nulls[0])
+ nulls.extend([gr.null_sink(size), gr.null_source(size), gr.head(size, 0)])
hb.connect(source, nulls[0])
- hb.connect(nulls[1], sink)
+ hb.connect(nulls[1], nulls[2], sink)
if not init: hb.unlock()
callback(False, init=True) #initially connect
bind_to_visible_event(win, callback)