From: Josh Blum Date: Fri, 9 Oct 2009 20:26:30 +0000 (-0700) Subject: Added window size param to all wxgui wrappers. X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=5c00e226ffa3a083be770c1564a1098f83c28e9f;hp=28d198f8d5f7f88130282d138b35f6b96fd404c3;p=debian%2Fgnuradio Added window size param to all wxgui wrappers. Modified type parser to allow blank values in vector types as empty vectors. --- diff --git a/grc/blocks/wxgui_constellationsink2.xml b/grc/blocks/wxgui_constellationsink2.xml index 5969d840..598b5506 100644 --- a/grc/blocks/wxgui_constellationsink2.xml +++ b/grc/blocks/wxgui_constellationsink2.xml @@ -23,6 +23,9 @@ constsink_gl.const_sink_c( gain_mu=$gain_mu, symbol_rate=$symbol_rate, omega_limit=$omega_limit, +#if $win_size() + size=$win_size, +#end if ) #if not $grid_pos() $(parent).Add(self.$(id).win) @@ -102,6 +105,13 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) 0.005 real + + Window Size + win_size + + int_vector + #if $win_size() then 'none' else 'part'# + Grid Position grid_pos @@ -114,11 +124,14 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) notebook + not $win_size or len($win_size) == 2 in complex +Leave the window blank for the default size, otherwise enter a tuple of (width, height) pixels. + Use the Grid Position (row, column, row span, column span) to position the graphical element in the window. Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page. diff --git a/grc/blocks/wxgui_fftsink2.xml b/grc/blocks/wxgui_fftsink2.xml index 6f19f1aa..42bca5cc 100644 --- a/grc/blocks/wxgui_fftsink2.xml +++ b/grc/blocks/wxgui_fftsink2.xml @@ -23,6 +23,9 @@ fftsink2.$(type.fcn)( avg_alpha=#if $avg_alpha() then $avg_alpha else 'None'#, title=$title, peak_hold=$peak_hold, +#if $win_size() + size=$win_size, +#end if ) #if not $grid_pos() $(parent).Add(self.$(id).win) @@ -158,6 +161,13 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) real #if $average() == 'True' then 'none' else 'all'# + + Window Size + win_size + + int_vector + #if $win_size() then 'none' else 'part'# + Grid Position grid_pos @@ -170,6 +180,7 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) notebook + not $win_size or len($win_size) == 2 in $type @@ -177,6 +188,8 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) Set Average Alpha to 0 for automatic setting. +Leave the window blank for the default size, otherwise enter a tuple of (width, height) pixels. + Use the Grid Position (row, column, row span, column span) to position the graphical element in the window. Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page. diff --git a/grc/blocks/wxgui_histosink2.xml b/grc/blocks/wxgui_histosink2.xml index 454a4932..9edf9650 100644 --- a/grc/blocks/wxgui_histosink2.xml +++ b/grc/blocks/wxgui_histosink2.xml @@ -14,6 +14,9 @@ histosink_gl.histo_sink_f( title=$title, num_bins=$num_bins, frame_size=$frame_size, +#if $win_size() + size=$win_size, +#end if ) #if not $grid_pos() $(parent).Add(self.$(id).win) @@ -40,6 +43,13 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) 1000 int + + Window Size + win_size + + int_vector + #if $win_size() then 'none' else 'part'# + Grid Position grid_pos @@ -52,11 +62,14 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) notebook + not $win_size or len($win_size) == 2 in float +Leave the window blank for the default size, otherwise enter a tuple of (width, height) pixels. + Use the Grid Position (row, column, row span, column span) to position the graphical element in the window. Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page. diff --git a/grc/blocks/wxgui_numbersink2.xml b/grc/blocks/wxgui_numbersink2.xml index cc66cdcb..5289db8a 100644 --- a/grc/blocks/wxgui_numbersink2.xml +++ b/grc/blocks/wxgui_numbersink2.xml @@ -24,6 +24,9 @@ numbersink2.$(type.fcn)( label=$title, peak_hold=$peak_hold, show_gauge=$show_gauge, +#if $win_size() + size=$win_size, +#end if ) #if not $grid_pos() $(parent).Add(self.$(id).win) @@ -151,6 +154,13 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) False + + Window Size + win_size + + int_vector + #if $win_size() then 'none' else 'part'# + Grid Position grid_pos @@ -163,6 +173,7 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) notebook + not $win_size or len($win_size) == 2 in $type @@ -170,6 +181,8 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) Set Average Alpha to 0 for automatic setting. +Leave the window blank for the default size, otherwise enter a tuple of (width, height) pixels. + Use the Grid Position (row, column, row span, column span) to position the graphical element in the window. Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page. diff --git a/grc/blocks/wxgui_scopesink2.xml b/grc/blocks/wxgui_scopesink2.xml index 503d5297..07d29ce8 100644 --- a/grc/blocks/wxgui_scopesink2.xml +++ b/grc/blocks/wxgui_scopesink2.xml @@ -19,6 +19,9 @@ scopesink2.$(type.fcn)( ac_couple=$ac_couple, xy_mode=$xy_mode, num_inputs=$num_inputs, +#if $win_size() + size=$win_size, +#end if ) #if not $grid_pos() $(parent).Add(self.$(id).win) @@ -102,6 +105,13 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) 1 int + + Window Size + win_size + + int_vector + #if $win_size() then 'none' else 'part'# + Grid Position grid_pos @@ -114,6 +124,7 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) notebook + not $win_size or len($win_size) == 2 not $xy_mode or '$type' == 'complex' or $num_inputs != 1 in @@ -127,6 +138,8 @@ Set the T Scale to 0 for automatic setting. XY Mode allows the scope to initialize as an XY plotter. +Leave the window blank for the default size, otherwise enter a tuple of (width, height) pixels. + Use the Grid Position (row, column, row span, column span) to position the graphical element in the window. Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page. diff --git a/grc/blocks/wxgui_waterfallsink2.xml b/grc/blocks/wxgui_waterfallsink2.xml index 35790f82..cee59899 100644 --- a/grc/blocks/wxgui_waterfallsink2.xml +++ b/grc/blocks/wxgui_waterfallsink2.xml @@ -21,6 +21,9 @@ waterfallsink2.$(type.fcn)( average=$options.average, avg_alpha=#if $avg_alpha() then $avg_alpha else 'None'#, title=$title, +#if $win_size() + size=$win_size, +#end if ) #if not $grid_pos() $(parent).Add(self.$(id).win) @@ -115,6 +118,13 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) average:True + + Window Size + win_size + + int_vector + #if $win_size() then 'none' else 'part'# + Grid Position grid_pos @@ -127,6 +137,7 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) notebook + not $win_size or len($win_size) == 2 in $type @@ -134,6 +145,8 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) Set Average Alpha to 0 for automatic setting. +Leave the window blank for the default size, otherwise enter a tuple of (width, height) pixels. + Use the Grid Position (row, column, row span, column span) to position the graphical element in the window. Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page. diff --git a/grc/python/Param.py b/grc/python/Param.py index 34d5ab11..81fb6ba7 100644 --- a/grc/python/Param.py +++ b/grc/python/Param.py @@ -251,7 +251,7 @@ class Param(_Param, _GUIParam): ######################### # Numeric Types ######################### - elif t in ('raw', 'complex', 'real', 'int', 'complex_vector', 'real_vector', 'int_vector', 'hex', 'bool'): + elif t in ('raw', 'complex', 'real', 'int', 'hex', 'bool'): #raise exception if python cannot evaluate this value try: e = self.get_parent().get_parent().evaluate(v) except Exception, e: raise Exception, 'Value "%s" cannot be evaluated:\n%s'%(v, e) @@ -269,10 +269,22 @@ class Param(_Param, _GUIParam): try: assert isinstance(e, INT_TYPES) except AssertionError: raise Exception, 'Expression "%s" is invalid for type integer.'%str(e) return e - ######################### - # Numeric Vector Types - ######################### - elif t == 'complex_vector': + elif t == 'hex': return hex(e) + elif t == 'bool': + try: assert isinstance(e, bool) + except AssertionError: raise Exception, 'Expression "%s" is invalid for type bool.'%str(e) + return e + else: raise TypeError, 'Type "%s" not handled'%t + ######################### + # Numeric Vector Types + ######################### + elif t in ('complex_vector', 'real_vector', 'int_vector'): + if not v: v = '()' #turn a blank string into an empty list, so it will eval + #raise exception if python cannot evaluate this value + try: e = self.get_parent().get_parent().evaluate(v) + except Exception, e: raise Exception, 'Value "%s" cannot be evaluated:\n%s'%(v, e) + #raise an exception if the data is invalid + if t == 'complex_vector': if not isinstance(e, VECTOR_TYPES): self._lisitify_flag = True e = [e] @@ -296,12 +308,6 @@ class Param(_Param, _GUIParam): for ei in e: assert isinstance(ei, INT_TYPES) except AssertionError: raise Exception, 'Expression "%s" is invalid for type integer vector.'%str(e) return e - elif t == 'hex': return hex(e) - elif t == 'bool': - try: assert isinstance(e, bool) - except AssertionError: raise Exception, 'Expression "%s" is invalid for type bool.'%str(e) - return e - else: raise TypeError, 'Type "%s" not handled'%t ######################### # String Types #########################