[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r9184 - in gnuradio/branches/features/experimental-gui
From: |
jblum |
Subject: |
[Commit-gnuradio] r9184 - in gnuradio/branches/features/experimental-gui: . plotter |
Date: |
Wed, 6 Aug 2008 00:06:24 -0600 (MDT) |
Author: jblum
Date: 2008-08-06 00:06:20 -0600 (Wed, 06 Aug 2008)
New Revision: 9184
Modified:
gnuradio/branches/features/experimental-gui/common.py
gnuradio/branches/features/experimental-gui/plotter/waterfall_plotter.py
gnuradio/branches/features/experimental-gui/waterfall_window.py
gnuradio/branches/features/experimental-gui/waterfallsink.py
Log:
waterfall: clear, adjust decim
Modified: gnuradio/branches/features/experimental-gui/common.py
===================================================================
--- gnuradio/branches/features/experimental-gui/common.py 2008-08-06
05:23:48 UTC (rev 9183)
+++ gnuradio/branches/features/experimental-gui/common.py 2008-08-06
06:06:20 UTC (rev 9184)
@@ -100,8 +100,8 @@
controller.subscribe(control_key, lambda x: self.SetLabel(x and
'Stop' or 'Run'))
def _evt_button(self, e):
- self._controller[self._control_key] = not
self._controller[self._control_key]
-
+ self._controller[self._control_key] = not
self._controller[self._control_key]
+
class CheckBoxController(wx.CheckBox):
def __init__(self, parent, label, controller, control_key):
self._controller = controller
@@ -111,7 +111,7 @@
controller.subscribe(control_key, lambda x:
self.SetValue(bool(x)))
def _evt_checkbox(self, e):
- self._controller[self._control_key] = bool(e.IsChecked())
+ self._controller[self._control_key] = bool(e.IsChecked())
class LogSliderController(wx.BoxSizer):
"""!
@@ -171,7 +171,7 @@
for i, choice in enumerate(choices):
if value == choice[1]:
self._chooser.SetSelection(i)
controller.subscribe(control_key, _on_controller_set)
-
+
def Disable(self, disable=True): self.Enable(not disable)
def Enable(self, enable=True):
if enable:
Modified:
gnuradio/branches/features/experimental-gui/plotter/waterfall_plotter.py
===================================================================
--- gnuradio/branches/features/experimental-gui/plotter/waterfall_plotter.py
2008-08-06 05:23:48 UTC (rev 9183)
+++ gnuradio/branches/features/experimental-gui/plotter/waterfall_plotter.py
2008-08-06 06:06:20 UTC (rev 9184)
@@ -89,7 +89,7 @@
"""
#init
grid_plotter_base.__init__(self, parent, PADDING)
- self._resize_buffer_flag = True
+ self._resize_texture(False)
self._minimum = 0
self._maximum = 0
self._fft_size = 0
@@ -111,8 +111,8 @@
Draw the grid and waveforms.
"""
self.semaphore.acquire(True)
- #resize buffer
- if self._resize_buffer_flag: self._resize_buffer()
+ #resize texture
+ self._resize_texture()
#store the grid drawing operations
if self.changed():
glNewList(self._grid_compiled_list_id, GL_COMPILE)
@@ -197,18 +197,22 @@
txt = gltext.Text('%ddB'%int(dB),
font_size=LEGEND_FONT_SIZE, centered=True)
txt.draw_text(wx.Point(x, y))
- def _resize_buffer(self):
+ def _resize_texture(self, flag=None):
"""!
- Resize the buffer to fit the fft_size X num_lines.
- If the buffer is too large, set samples will auto shrink.
+ Create the texture to fit the fft_size X num_lines.
+ @param flag the set/unset or update flag
"""
+ if flag is not None:
+ self._resize_texture_flag = flag
+ return
+ if not self._resize_texture_flag: return
self._buffer = list()
self._pointer = 0
if self._num_lines and self._fft_size:
glBindTexture(GL_TEXTURE_2D, self._waterfall_texture)
data = numpy.zeros(self._num_lines*self._fft_size*4,
numpy.uint8).tostring()
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, self._fft_size,
self._num_lines, 0, GL_RGBA, GL_UNSIGNED_BYTE, data)
- self._resize_buffer_flag = False
+ self._resize_texture_flag = False
def set_color_mode(self, color_mode):
"""!
@@ -221,17 +225,19 @@
if color_mode in COLORS.keys():
self._color_mode = color_mode
self.changed(True)
+ self.update()
self.semaphore.release()
def set_num_lines(self, num_lines):
"""!
Set number of lines.
- The buffer will be resized accordingly.
+ Powers of two only.
@param num_lines the new number of lines
"""
self.semaphore.acquire(True)
self._num_lines = num_lines
- self._resize_buffer_flag = True
+ self._resize_texture(True)
+ self.update()
self.semaphore.release()
def set_samples(self, samples, minimum, maximum):
@@ -250,8 +256,7 @@
self.changed(True)
if self._fft_size != len(samples):
self._fft_size = len(samples)
- self._buffer = list() #empty buffer before resize
- self._resize_buffer_flag = True
+ self._resize_texture(True)
#normalize the samples to min/max
samples = (samples - minimum)*float(255/(maximum-minimum))
samples = numpy.clip(samples, 0, 255) #clip
Modified: gnuradio/branches/features/experimental-gui/waterfall_window.py
===================================================================
--- gnuradio/branches/features/experimental-gui/waterfall_window.py
2008-08-06 05:23:48 UTC (rev 9183)
+++ gnuradio/branches/features/experimental-gui/waterfall_window.py
2008-08-06 06:06:20 UTC (rev 9184)
@@ -37,7 +37,6 @@
DEFAULT_FRAME_RATE = 30
DEFAULT_WIN_SIZE = (600, 400)
DIV_LEVELS = (1, 2, 5, 10, 20)
-MIN_NUM_LINES, MAX_NUM_LINES = 10, 1000
MIN_DYNAMIC_RANGE, MAX_DYNAMIC_RANGE = 10, 200
COLOR_MODES = (
('RGB1', 'rgb1'),
@@ -70,9 +69,14 @@
self.parent = parent
wx.Panel.__init__(self, parent, -1, style=wx.SUNKEN_BORDER)
control_box = wx.BoxSizer(wx.VERTICAL)
- #checkboxes for average
control_box.AddStretchSpacer()
control_box.Add(common.LabelText(self, 'Options'), 0,
wx.ALIGN_CENTER)
+ #color mode
+ control_box.AddStretchSpacer()
+ self.color_mode_chooser = common.DropDownController(self,
'Color', COLOR_MODES, parent, COLOR_MODE_KEY)
+ control_box.Add(self.color_mode_chooser, 0, wx.EXPAND)
+ #average
+ control_box.AddStretchSpacer()
self.average_check_box = common.CheckBoxController(self,
'Average', parent.ext_controller, parent.average_key)
control_box.Add(self.average_check_box, 0, wx.EXPAND)
control_box.AddSpacer(2)
@@ -83,10 +87,6 @@
)
parent.ext_controller.subscribe(parent.average_key,
self.avg_alpha_slider.Enable)
control_box.Add(self.avg_alpha_slider, 0, wx.EXPAND)
- #color mode
- control_box.AddStretchSpacer()
- self.color_mode_chooser = common.DropDownController(self,
'Color', COLOR_MODES, parent, COLOR_MODE_KEY)
- control_box.Add(self.color_mode_chooser, 0, wx.EXPAND)
#dyanmic range buttons
control_box.AddStretchSpacer()
control_box.Add(common.LabelText(self, 'Dynamic Range'), 0,
wx.ALIGN_CENTER)
@@ -105,8 +105,13 @@
control_box.AddSpacer(2)
self._num_lines_buttons = common.IncrDecrButtons(self,
self._on_incr_num_lines, self._on_decr_num_lines)
control_box.Add(self._num_lines_buttons, 0, wx.ALIGN_CENTER)
+ #clear
+ control_box.AddStretchSpacer()
+ self.clear_button = wx.Button(self, label='Clear',
style=wx.BU_EXACTFIT)
+ self.clear_button.Bind(wx.EVT_BUTTON, self._on_clear_button)
+ control_box.Add(self.clear_button, 0, wx.EXPAND)
#run/stop
- control_box.AddStretchSpacer()
+ #control_box.AddStretchSpacer()
self.run_button = common.RunStopButtonController(self, parent,
RUNNING_KEY)
control_box.Add(self.run_button, 0, wx.EXPAND)
#set sizer
@@ -115,6 +120,8 @@
##################################################
# Event handlers
##################################################
+ def _on_clear_button(self, event):
+ self.parent.set_num_lines(self.parent[NUM_LINES_KEY])
def _on_incr_dynamic_range(self, event):
self.parent.set_dynamic_range(common.get_clean_incr(
min(self.parent[DYNAMIC_RANGE_KEY], MAX_DYNAMIC_RANGE)))
@@ -128,11 +135,9 @@
self.parent.set_ref_level(
self.parent[REF_LEVEL_KEY] -
self.parent[DYNAMIC_RANGE_KEY]/10)
def _on_incr_num_lines(self, event):
- self.parent.set_num_lines(
-
min(self.parent[NUM_LINES_KEY]+self.parent[NUM_LINES_KEY]/10, MAX_NUM_LINES))
+ self.parent.ext_controller[self.parent.frame_rate_key] /= 2.0
def _on_decr_num_lines(self, event):
- self.parent.set_num_lines(
-
max(self.parent[NUM_LINES_KEY]-self.parent[NUM_LINES_KEY]/10, MIN_NUM_LINES))
+ self.parent.ext_controller[self.parent.frame_rate_key] *= 2.0
##################################################
# Waterfall window with plotter and control panel
Modified: gnuradio/branches/features/experimental-gui/waterfallsink.py
===================================================================
--- gnuradio/branches/features/experimental-gui/waterfallsink.py
2008-08-06 05:23:48 UTC (rev 9183)
+++ gnuradio/branches/features/experimental-gui/waterfallsink.py
2008-08-06 06:06:20 UTC (rev 9184)
@@ -90,6 +90,7 @@
self.controller.publish(AVG_ALPHA_KEY, fft.avg_alpha)
self.controller.subscribe(SAMPLE_RATE_KEY, fft.set_sample_rate)
self.controller.publish(SAMPLE_RATE_KEY, fft.sample_rate)
+ self.controller.subscribe(FRAME_RATE_KEY, fft._sd.set_vec_rate)
#FIXME
self.controller.publish(FRAME_RATE_KEY, fft._sd.frame_rate)
#FIXME
#start input watcher
def setter(p, k, x): # lambdas can't have assignments :(
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r9184 - in gnuradio/branches/features/experimental-gui: . plotter,
jblum <=