summaryrefslogtreecommitdiff
path: root/gr-utils/src
diff options
context:
space:
mode:
Diffstat (limited to 'gr-utils/src')
-rwxr-xr-xgr-utils/src/python/usrp_siggen.py19
-rwxr-xr-xgr-utils/src/python/usrp_siggen_gui.py9
2 files changed, 20 insertions, 8 deletions
diff --git a/gr-utils/src/python/usrp_siggen.py b/gr-utils/src/python/usrp_siggen.py
index 8ee8cfd2a..da83da770 100755
--- a/gr-utils/src/python/usrp_siggen.py
+++ b/gr-utils/src/python/usrp_siggen.py
@@ -305,7 +305,7 @@ def get_options():
return (options, args)
# If this script is executed, the following runs. If it is imported, the below does not run.
-if __name__ == "__main__":
+def main():
if gr.enable_realtime_scheduling() != gr.RT_OK:
print "Note: failed to enable realtime scheduling, continuing"
@@ -318,9 +318,14 @@ if __name__ == "__main__":
print e
sys.exit(1)
- # Run it
- try:
- tb.run()
-
- except KeyboardInterrupt:
- pass
+ tb.start()
+ raw_input('Press Enter to quit: ')
+ tb.stop()
+ tb.wait()
+
+# 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()
diff --git a/gr-utils/src/python/usrp_siggen_gui.py b/gr-utils/src/python/usrp_siggen_gui.py
index 40848fbee..47d47bdb3 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()