commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r10580 - in gnuradio/branches/developers/jblum/gui_gut


From: jblum
Subject: [Commit-gnuradio] r10580 - in gnuradio/branches/developers/jblum/gui_guts: gr-wxgui/src/python grc/src/grc_gnuradio/wxgui grc/src/platforms/python
Date: Mon, 9 Mar 2009 23:42:32 -0600 (MDT)

Author: jblum
Date: 2009-03-09 23:42:32 -0600 (Mon, 09 Mar 2009)
New Revision: 10580

Modified:
   gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/common.py
   
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/const_window.py
   gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/fft_window.py
   
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/histo_window.py
   
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/number_window.py
   
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/scope_window.py
   
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/waterfall_window.py
   
gnuradio/branches/developers/jblum/gui_guts/grc/src/grc_gnuradio/wxgui/callback_controls.py
   gnuradio/branches/developers/jblum/gui_guts/grc/src/platforms/python/Param.py
Log:
WIP GRC: dont check disabled blocks IDs
WX: removed -1 auto id usage when not needed.



Modified: 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/common.py
===================================================================
--- gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/common.py   
2009-03-10 01:34:16 UTC (rev 10579)
+++ gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/common.py   
2009-03-10 05:42:32 UTC (rev 10580)
@@ -91,7 +91,7 @@
        Get the default label text and set the font bold.
        """
        def __init__(self, parent, label):
-               wx.StaticText.__init__(self, parent, -1, label)
+               wx.StaticText.__init__(self, parent, label=label)
                font = self.GetFont()
                font.SetWeight(wx.FONTWEIGHT_BOLD)
                self.SetFont(font)
@@ -113,10 +113,10 @@
                @param on_decr the event handler for decrement
                """
                wx.BoxSizer.__init__(self, wx.HORIZONTAL)
-               self._incr_button = wx.Button(parent, -1, '+', 
style=wx.BU_EXACTFIT)
+               self._incr_button = wx.Button(parent, label='+', 
style=wx.BU_EXACTFIT)
                self._incr_button.Bind(wx.EVT_BUTTON, on_incr)
                self.Add(self._incr_button, 0, wx.ALIGN_CENTER_VERTICAL)
-               self._decr_button = wx.Button(parent, -1, ' - ', 
style=wx.BU_EXACTFIT)
+               self._decr_button = wx.Button(parent, label=' - ', 
style=wx.BU_EXACTFIT)
                self._decr_button.Bind(wx.EVT_BUTTON, on_decr)
                self.Add(self._decr_button, 0, wx.ALIGN_CENTER_VERTICAL)
 
@@ -133,7 +133,7 @@
        def __init__(self, parent, controller, control_key, true_label, 
false_label):
                self._controller = controller
                self._control_key = control_key
-               wx.Button.__init__(self, parent, -1, '', style=wx.BU_EXACTFIT)
+               wx.Button.__init__(self, parent, style=wx.BU_EXACTFIT)
                self.Bind(wx.EVT_BUTTON, self._evt_button)
                controller.subscribe(control_key, lambda x: self.SetLabel(x and 
true_label or false_label))
 
@@ -173,9 +173,9 @@
        """
        def __init__(self, parent, label, min_exp, max_exp, slider_steps, 
controller, control_key, formatter=lambda x: ': %.6f'%x):
                wx.BoxSizer.__init__(self, wx.VERTICAL)
-               self._label = wx.StaticText(parent, -1, label + 
formatter(1/3.0))
+               self._label = wx.StaticText(parent, label=label + 
formatter(1/3.0))
                self.Add(self._label, 0, wx.EXPAND)
-               self._slider = wx.Slider(parent, -1, 0, 0, slider_steps, 
style=wx.SL_HORIZONTAL)
+               self._slider = wx.Slider(parent, maxValue=slider_steps, 
style=wx.SL_HORIZONTAL)
                self.Add(self._slider, 0, wx.EXPAND)
                def _on_slider_event(event):
                        controller[control_key] = \
@@ -212,9 +212,9 @@
                @param control_key the prop key for this control
                """
                wx.BoxSizer.__init__(self, wx.HORIZONTAL)
-               self._label = wx.StaticText(parent, -1, ' %s '%label)
+               self._label = wx.StaticText(parent, label=' %s '%label)
                self.Add(self._label, 1, wx.ALIGN_CENTER_VERTICAL)
-               self._chooser = wx.Choice(parent, -1, choices=[c[0] for c in 
choices], size=size)
+               self._chooser = wx.Choice(parent, choices=[c[0] for c in 
choices], size=size)
                def _on_chooser_event(event):
                        controller[control_key] = 
choices[self._chooser.GetSelection()][1]
                self._chooser.Bind(wx.EVT_CHOICE, _on_chooser_event)

Modified: 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/const_window.py
===================================================================
--- 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/const_window.py 
    2009-03-10 01:34:16 UTC (rev 10579)
+++ 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/const_window.py 
    2009-03-10 05:42:32 UTC (rev 10580)
@@ -123,7 +123,7 @@
                self.proxy(OMEGA_KEY, controller, omega_key)
                self.proxy(SAMPLE_RATE_KEY, controller, sample_rate_key)
                #init panel and plot
-               wx.Panel.__init__(self, parent, -1, style=wx.SIMPLE_BORDER)
+               wx.Panel.__init__(self, parent, style=wx.SIMPLE_BORDER)
                self.plotter = plotter.channel_plotter(self)
                self.plotter.SetSize(wx.Size(*size))
                self.plotter.set_title(title)

Modified: 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/fft_window.py
===================================================================
--- 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/fft_window.py   
    2009-03-10 01:34:16 UTC (rev 10579)
+++ 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/fft_window.py   
    2009-03-10 05:42:32 UTC (rev 10580)
@@ -162,7 +162,7 @@
                self.proxy(AVG_ALPHA_KEY, controller, avg_alpha_key)
                self.proxy(SAMPLE_RATE_KEY, controller, sample_rate_key)
                #init panel and plot
-               wx.Panel.__init__(self, parent, -1, style=wx.SIMPLE_BORDER)
+               wx.Panel.__init__(self, parent, style=wx.SIMPLE_BORDER)
                self.plotter = plotter.channel_plotter(self)
                self.plotter.SetSize(wx.Size(*size))
                self.plotter.set_title(title)

Modified: 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/histo_window.py
===================================================================
--- 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/histo_window.py 
    2009-03-10 01:34:16 UTC (rev 10579)
+++ 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/histo_window.py 
    2009-03-10 05:42:32 UTC (rev 10580)
@@ -99,7 +99,7 @@
                self.proxy(FRAME_SIZE_KEY, controller, frame_size_key)
                self.proxy(MSG_KEY, controller, msg_key)
                #init panel and plot
-               wx.Panel.__init__(self, parent, -1, style=wx.SIMPLE_BORDER)
+               wx.Panel.__init__(self, parent, style=wx.SIMPLE_BORDER)
                self.plotter = plotter.bar_plotter(self)
                self.plotter.SetSize(wx.Size(*size))
                self.plotter.set_title(title)

Modified: 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/number_window.py
===================================================================
--- 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/number_window.py
    2009-03-10 01:34:16 UTC (rev 10579)
+++ 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/number_window.py
    2009-03-10 05:42:32 UTC (rev 10580)
@@ -53,7 +53,7 @@
                @param parent the wx parent window
                """
                self.parent = parent
-               wx.Panel.__init__(self, parent, -1, style=wx.SUNKEN_BORDER)
+               wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
                control_box = wx.BoxSizer(wx.VERTICAL)
                #checkboxes for average and peak hold
                control_box.AddStretchSpacer()
@@ -101,7 +101,7 @@
                sample_rate_key,
        ):
                pubsub.pubsub.__init__(self)
-               wx.Panel.__init__(self, parent, -1, style=wx.SUNKEN_BORDER)
+               wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
                #setup
                self.peak_val_real = NEG_INF
                self.peak_val_imag = NEG_INF

Modified: 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/scope_window.py
===================================================================
--- 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/scope_window.py 
    2009-03-10 01:34:16 UTC (rev 10579)
+++ 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/scope_window.py 
    2009-03-10 05:42:32 UTC (rev 10580)
@@ -202,7 +202,7 @@
                #trigger level
                hbox = wx.BoxSizer(wx.HORIZONTAL)
                trigger_menu_box.Add(hbox, 0, wx.EXPAND)
-               hbox.Add(wx.StaticText(trigger_menu_panel, -1, ' Level '), 1, 
wx.ALIGN_CENTER_VERTICAL)
+               hbox.Add(wx.StaticText(trigger_menu_panel, label=' Level '), 1, 
wx.ALIGN_CENTER_VERTICAL)
                trigger_level_button = wx.Button(trigger_menu_panel, 
label='50%', style=wx.BU_EXACTFIT)
                def trigger_level_button_disable(x):
                        if x==gr.gr_TRIG_MODE_FREE: 
trigger_level_button.Disable()
@@ -305,7 +305,7 @@
                for i in range(num_inputs):
                        self.proxy(common.index_key(AC_COUPLE_KEY, i), 
controller, common.index_key(ac_couple_key, i))
                #init panel and plot
-               wx.Panel.__init__(self, parent, -1, style=wx.SIMPLE_BORDER)
+               wx.Panel.__init__(self, parent, style=wx.SIMPLE_BORDER)
                self.plotter = plotter.channel_plotter(self)
                self.plotter.SetSize(wx.Size(*size))
                self.plotter.set_title(title)

Modified: 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/waterfall_window.py
===================================================================
--- 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/waterfall_window.py
 2009-03-10 01:34:16 UTC (rev 10579)
+++ 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/waterfall_window.py
 2009-03-10 05:42:32 UTC (rev 10580)
@@ -16,7 +16,7 @@
 # You should have received a copy of the GNU General Public License
 # along with GNU Radio; see the file COPYING.  If not, write to
 # the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
+# Boston, MA 02110-1`301, USA.
 #
 
 ##################################################
@@ -175,7 +175,7 @@
                self.proxy(AVG_ALPHA_KEY, controller, avg_alpha_key)
                self.proxy(SAMPLE_RATE_KEY, controller, sample_rate_key)
                #init panel and plot
-               wx.Panel.__init__(self, parent, -1, style=wx.SIMPLE_BORDER)
+               wx.Panel.__init__(self, parent, style=wx.SIMPLE_BORDER)
                self.plotter = plotter.waterfall_plotter(self)
                self.plotter.SetSize(wx.Size(*size))
                self.plotter.set_title(title)

Modified: 
gnuradio/branches/developers/jblum/gui_guts/grc/src/grc_gnuradio/wxgui/callback_controls.py
===================================================================
--- 
gnuradio/branches/developers/jblum/gui_guts/grc/src/grc_gnuradio/wxgui/callback_controls.py
 2009-03-10 01:34:16 UTC (rev 10579)
+++ 
gnuradio/branches/developers/jblum/gui_guts/grc/src/grc_gnuradio/wxgui/callback_controls.py
 2009-03-10 05:42:32 UTC (rev 10580)
@@ -26,7 +26,7 @@
        """Label text class for uniform labels among all controls."""
 
        def __init__(self, window, label):
-               wx.StaticText.__init__(self, window, -1, str(label))
+               wx.StaticText.__init__(self, window, label=str(label))
                font = self.GetFont()
                font.SetWeight(wx.FONTWEIGHT_BOLD)
                self.SetFont(font)
@@ -92,7 +92,7 @@
        """House a button for variable control."""
 
        def _init(self):
-               self.button = wx.Button(self.get_window(), -1, 
self.labels[self.index])
+               self.button = wx.Button(self.get_window(), 
label=self.labels[self.index])
                self.button.Bind(wx.EVT_BUTTON, self._handle_changed)
                self.Add(self.button, 0, wx.ALIGN_CENTER)
 
@@ -107,7 +107,7 @@
        """House a drop down for variable control."""
 
        def _init(self):
-               self.drop_down = wx.Choice(self.get_window(), -1, 
choices=self.labels)
+               self.drop_down = wx.Choice(self.get_window(), 
choices=self.labels)
                self.Add(self.drop_down, 0, wx.ALIGN_CENTER)
                self.drop_down.Bind(wx.EVT_CHOICE, self._handle_changed)
                self.drop_down.SetSelection(self.index)
@@ -124,13 +124,13 @@
        def _init(self):
                #create box for radio buttons
                radio_box = wx.BoxSizer(self.radio_box_orientation)
-               panel = wx.Panel(self.get_window(), -1)
+               panel = wx.Panel(self.get_window())
                panel.SetSizer(radio_box)
                self.Add(panel, 0, wx.ALIGN_CENTER)
                #create radio buttons
                self.radio_buttons = list()
                for label in self.labels:
-                       radio_button = wx.RadioButton(panel, -1, label)
+                       radio_button = wx.RadioButton(panel, label=label)
                        radio_button.SetValue(False)
                        self.radio_buttons.append(radio_button)
                        radio_box.Add(radio_button, 0, self.radio_button_align)
@@ -177,13 +177,13 @@
                #create gui elements
                label_text_sizer = wx.BoxSizer(self.label_text_orientation) 
#label and text box container
                label_text = LabelText(self.get_window(), '%s: '%str(label))
-               self.text_box = text_box = wx.TextCtrl(self.get_window(), -1, 
str(value), style=wx.TE_PROCESS_ENTER)
+               self.text_box = text_box = wx.TextCtrl(self.get_window(), 
style=wx.TE_PROCESS_ENTER)
                text_box.Bind(wx.EVT_TEXT_ENTER, self._handle_enter) #bind this 
special enter hotkey event
                for obj in (label_text, text_box): #fill the container with 
label and text entry box
-                       label_text_sizer.Add(obj, 0, 
wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL)
+                       label_text_sizer.Add(obj, 0, wx.ALIGN_CENTER)
                self.Add(label_text_sizer, 0, wx.ALIGN_CENTER)
                #make the slider
-               self.slider = slider = wx.Slider(self.get_window(), -1, 
size=wx.Size(*self.get_slider_size()), style=self.slider_style)
+               self.slider = slider = wx.Slider(self.get_window(), 
size=wx.Size(*self.get_slider_size()), style=self.slider_style)
                try: slider.SetRange(0, num_steps)
                except Exception, e:
                        print >> sys.stderr, 'Error in set slider range: 
"%s".'%e
@@ -245,11 +245,11 @@
 class slider_horizontal_control(_slider_control_base):
        label_text_orientation = wx.HORIZONTAL
        slider_style = wx.SL_HORIZONTAL
-       def get_slider_size(self): return self.slider_length, 20
+       def get_slider_size(self): return self.slider_length, -1
 class slider_vertical_control(_slider_control_base):
        label_text_orientation = wx.VERTICAL
        slider_style = wx.SL_VERTICAL
-       def get_slider_size(self): return 20, self.slider_length
+       def get_slider_size(self): return -1, self.slider_length
 
 
##############################################################################################
 # Text Box Control
@@ -271,10 +271,10 @@
                #create gui elements
                label_text_sizer = wx.BoxSizer(wx.HORIZONTAL) #label and text 
box container
                label_text = LabelText(self.get_window(), '%s: '%str(label))
-               self.text_box = text_box = wx.TextCtrl(self.get_window(), -1, 
str(value), style=wx.TE_PROCESS_ENTER)
+               self.text_box = text_box = wx.TextCtrl(self.get_window(), 
value=str(value), style=wx.TE_PROCESS_ENTER)
                text_box.Bind(wx.EVT_TEXT_ENTER, self._handle_enter) #bind this 
special enter hotkey event
                for obj in (label_text, text_box): #fill the container with 
label and text entry box
-                       label_text_sizer.Add(obj, 0, 
wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL)
+                       label_text_sizer.Add(obj, 0, wx.ALIGN_CENTER)
                self.Add(label_text_sizer, 0, wx.ALIGN_CENTER)
                #detect string mode
                self._string_mode = isinstance(value, str)

Modified: 
gnuradio/branches/developers/jblum/gui_guts/grc/src/platforms/python/Param.py
===================================================================
--- 
gnuradio/branches/developers/jblum/gui_guts/grc/src/platforms/python/Param.py   
    2009-03-10 01:34:16 UTC (rev 10579)
+++ 
gnuradio/branches/developers/jblum/gui_guts/grc/src/platforms/python/Param.py   
    2009-03-10 05:42:32 UTC (rev 10580)
@@ -215,7 +215,7 @@
                #########################
                # Enum Type
                #########################
-               if self.is_enum(): return self.get_value()
+               if self.is_enum(): return v
                #########################
                # Numeric Types
                #########################
@@ -305,7 +305,7 @@
                                raise Exception
                        params = self.get_all_params('id')
                        keys = [param.get_value() for param in params]
-                       try: assert(len(keys) == len(set(keys)))
+                       try: assert keys.count(v) <= 1 #id should only appear 
once, or zero times if block is disabled
                        except:
                                self._add_error_message('ID "%s" is not 
unique.'%v)
                                raise Exception
@@ -392,4 +392,4 @@
                @param type the specified type
                @return a list of params
                """
-               return sum([filter(lambda p: p.get_type() == type, 
block.get_params()) for block in self.get_parent().get_parent().get_blocks()], 
[])
+               return sum([filter(lambda p: p.get_type() == type, 
block.get_params()) for block in 
self.get_parent().get_parent().get_enabled_blocks()], [])





reply via email to

[Prev in Thread] Current Thread [Next in Thread]