summaryrefslogtreecommitdiff
path: root/gr-utils/src/python/usrp_siggen_gui.py
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2009-10-29 14:28:56 -0700
committerJosh Blum <josh@joshknows.com>2009-10-29 14:28:56 -0700
commita0ffbc6d5c39bf605cf6e9f3c09de9f95ee6c6e6 (patch)
tree10994d369bb9e38dc8e06c0255585f96057daf8a /gr-utils/src/python/usrp_siggen_gui.py
parentc6fe89eb039b13afb65a09980837063cdd61c810 (diff)
fixed issue where usrp siggen continued to transmit after program exit
Diffstat (limited to 'gr-utils/src/python/usrp_siggen_gui.py')
-rwxr-xr-xgr-utils/src/python/usrp_siggen_gui.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/gr-utils/src/python/usrp_siggen_gui.py b/gr-utils/src/python/usrp_siggen_gui.py
index 40848fbeee..47d47bdb3d 100755
--- a/gr-utils/src/python/usrp_siggen_gui.py
+++ b/gr-utils/src/python/usrp_siggen_gui.py
@@ -284,7 +284,7 @@ class app_gui(pubsub):
self.vbox.AddSpacer(5)
self.vbox.AddStretchSpacer()
-if __name__ == "__main__":
+def main():
try:
# Get command line parameters
(options, args) = usrp_siggen.get_options()
@@ -308,3 +308,10 @@ if __name__ == "__main__":
except RuntimeError, e:
print e
sys.exit(1)
+
+# Make sure to create the top block (tb) within a function:
+# That code in main will allow tb to go out of scope on return,
+# which will call the decontructor on usrp and stop transmit.
+# Whats odd is that grc works fine with tb in the __main__,
+# perhaps its because the try/except clauses around tb.
+if __name__ == "__main__": main()