[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 09/16: grc: flowgraph template: split arg p
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 09/16: grc: flowgraph template: split arg parser from main() |
Date: |
Sat, 3 Oct 2015 19:14:11 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit 7983bfda035153495bb6b01451484593ecfcf8d3
Author: Sebastian Koslowski <address@hidden>
Date: Mon Sep 28 20:19:04 2015 +0200
grc: flowgraph template: split arg parser from main()
---
grc/python/flow_graph.tmpl | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl
index 4e4e945..52f4902 100644
--- a/grc/python/flow_graph.tmpl
+++ b/grc/python/flow_graph.tmpl
@@ -312,11 +312,11 @@ $param.get_make()#slurp
$short_id#slurp
#end def
#if not $generate_options.startswith('hb')
+#set $params_eq_list = list()
+#if $parameters
-def main(top_block_cls=$(class_name)):
- #set $params_eq_list = list()
- #if $parameters
+def argument_parser():
parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
#for $param in $parameters
#set $type = $param.get_param('type').get_value()
@@ -327,12 +327,20 @@ def main(top_block_cls=$(class_name)):
help="Set $($param.get_param('label').get_evaluated() or
$param.get_id()) [default=%default]")
#end if
#end for
- (options, args) = parser.parse_args()
+ return parser
+#end if
+
+
+def main(top_block_cls=$(class_name), options=None):
+ #if $parameters
+ if options is None:
+ options, _ = argument_parser().parse_args()
#end if
#if $flow_graph.get_option('realtime_scheduling')
if gr.enable_realtime_scheduling() != gr.RT_OK:
print "Error: failed to enable real-time scheduling."
#end if
+
#if $generate_options == 'wx_gui'
tb = top_block_cls($(', '.join($params_eq_list)))
#if $flow_graph.get_option('max_nouts')
@@ -347,8 +355,10 @@ def main(top_block_cls=$(class_name)):
#elif $generate_options == 'qt_gui'
from distutils.version import StrictVersion
if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"):
- Qt.QApplication.setGraphicsSystem(gr.prefs().get_string('qtgui',
'style', 'raster'))
+ style = gr.prefs().get_string('qtgui', 'style', 'raster')
+ Qt.QApplication.setGraphicsSystem(style)
qapp = Qt.QApplication(sys.argv)
+
tb = top_block_cls($(', '.join($params_eq_list)))
#if $flow_graph.get_option('run')
#if $flow_graph.get_option('max_nouts')
- [Commit-gnuradio] [gnuradio] 07/16: grc: per-flowgraph custom run commands, (continued)
- [Commit-gnuradio] [gnuradio] 07/16: grc: per-flowgraph custom run commands, git, 2015/10/08
- [Commit-gnuradio] [gnuradio] 03/16: uhd: uhd_fft now uses UHDApp, some bugfixes, git, 2015/10/08
- [Commit-gnuradio] [gnuradio] 10/16: grc: simple dialog for selecting QSS theme for QT GUI apps, git, 2015/10/08
- [Commit-gnuradio] [gnuradio] 16/16: Merge remote-tracking branch 'gnuradio-wg-grc/master_grcwg', git, 2015/10/08
- [Commit-gnuradio] [gnuradio] 11/16: grc: added param to set per-flow-graph QT-theme file, git, 2015/10/08
- [Commit-gnuradio] [gnuradio] 01/16: grc: Flowgraph complexity. Shows under options block when enabled., git, 2015/10/08
- [Commit-gnuradio] [gnuradio] 02/16: grc: pad comment boxes like blocks, git, 2015/10/08
- [Commit-gnuradio] [gnuradio] 06/16: grc: add File->New submenu with generate modes preset, Bar.py refactoring, git, 2015/10/08
- [Commit-gnuradio] [gnuradio] 08/16: grc: move generated start-up code into main(), whitespace fixes in generated code, git, 2015/10/08
- [Commit-gnuradio] [gnuradio] 13/16: Merge branch 'maint', git, 2015/10/08
- [Commit-gnuradio] [gnuradio] 09/16: grc: flowgraph template: split arg parser from main(),
git <=
- [Commit-gnuradio] [gnuradio] 05/16: grc: fixup Actions*.py, git, 2015/10/08
- [Commit-gnuradio] [gnuradio] 15/16: Merge remote-tracking branch 'pinkavaj/no-x86-dtv-fix-00', git, 2015/10/08