[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r8740 - gnuradio/branches/developers/jblum/gr-wxglgui/
From: |
jblum |
Subject: |
[Commit-gnuradio] r8740 - gnuradio/branches/developers/jblum/gr-wxglgui/src/python |
Date: |
Fri, 27 Jun 2008 12:53:13 -0600 (MDT) |
Author: jblum
Date: 2008-06-27 12:53:10 -0600 (Fri, 27 Jun 2008)
New Revision: 8740
Modified:
gnuradio/branches/developers/jblum/gr-wxglgui/src/python/fftsink.py
gnuradio/branches/developers/jblum/gr-wxglgui/src/python/plotter.py
Log:
fixed resize issue
Modified: gnuradio/branches/developers/jblum/gr-wxglgui/src/python/fftsink.py
===================================================================
--- gnuradio/branches/developers/jblum/gr-wxglgui/src/python/fftsink.py
2008-06-27 17:52:46 UTC (rev 8739)
+++ gnuradio/branches/developers/jblum/gr-wxglgui/src/python/fftsink.py
2008-06-27 18:53:10 UTC (rev 8740)
@@ -33,7 +33,7 @@
# Constants
##################################################
DEFAULT_FFT_RATE = gr.prefs().get_long('wxgui', 'fft_rate', 15)
-DIV_LEVELS = (1, 2, 5, 10, 20, 50)
+DIV_LEVELS = (1, 2, 5, 10, 20)
##################################################
# FFT window control panel
@@ -186,7 +186,7 @@
def plot(self, samples):
#peak hold calculation
if self.peak_hold and len(self.peak_vals) != len(samples):
self.peak_vals = samples
- if self.peak_hold: self.peak_hold = numpy.maximum(samples,
self.peak_vals)
+ if self.peak_hold: self.peak_vals = numpy.maximum(samples,
self.peak_vals)
#plot the fft
self.plotter.set_waveform(
channel=1,
@@ -306,7 +306,7 @@
self.keep_running = True
self.start()
- def run(self):
+ def run(self):
while self.keep_running:
msg = self.msgq.delete_head() #blocking read of message
queue
itemsize = int(msg.arg1())
@@ -385,7 +385,7 @@
peak_hold=peak_hold,
set_average=fft.set_average,
)
- #setup x grid and setup the input watcher
+ #setup the input watcher
input_watcher(fft.msgq, self._handle_samples)
def _handle_samples(self, samples):
@@ -452,4 +452,13 @@
if __name__ == '__main__':
main ()
+ #tb = gr.top_block()
+ #src1 = gr.sig_source_f (23e3, gr.GR_CONST_WAVE, 5.75e3, 1)
+ #def handle_samples(samp):
+ # print len(samp)
+ #fft = fft_block(4, 23e3, 256, 1., 1., 1.)
+ #tb.connect(src1, fft)
+ #tb.start()
+ #input_watcher(fft.msgq, handle_samples)
+ #raw_input()
Modified: gnuradio/branches/developers/jblum/gr-wxglgui/src/python/plotter.py
===================================================================
--- gnuradio/branches/developers/jblum/gr-wxglgui/src/python/plotter.py
2008-06-27 17:52:46 UTC (rev 8739)
+++ gnuradio/branches/developers/jblum/gr-wxglgui/src/python/plotter.py
2008-06-27 18:53:10 UTC (rev 8740)
@@ -43,8 +43,6 @@
UNITS_TEXT_COLOR_SPEC = (0, 0, 0) #black
UNITS_TEXT_FONT_SIZE = 9
-GRID_COMPILED_LIST_ID = wx.NewId()
-
class _plotter_base(wx.glcanvas.GLCanvas):
"""!
Plotter base class for all plot types.
@@ -57,23 +55,17 @@
@param parent the parent widgit
"""
wx.glcanvas.GLCanvas.__init__(self, parent, -1)
- self._gl_init = False
+ self._gl_init_flag = False
+ self._resized_flag = True
wx.EVT_PAINT(self, self.OnPaint)
wx.EVT_SIZE(self, self.OnSize)
-
+
def OnSize(self, event):
"""!
- When the window is resized, update the view.
+ Flag the resize event.
+ The paint event will handle the actual resizing.
"""
- self.width, self.height = self.GetSize()
- if self._gl_init:
- glViewport(0, 0, self.width, self.height)
- glMatrixMode(GL_PROJECTION)
- glLoadIdentity()
- glOrtho(0, self.width, self.height, 0, 1, 0)
- glMatrixMode(GL_MODELVIEW)
- glLoadIdentity()
- self._changed = True
+ self._resized_flag = True
def OnPaint(self, event):
"""!
@@ -81,13 +73,23 @@
Initialize GL if this is the first paint event.
"""
self.SetCurrent()
- if not self._gl_init:
+ #check if gl was initialized
+ if not self._gl_init_flag:
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB)
glClearColor(*BACKGROUND_COLOR_SPEC)
- self._gl_init = True
- self.OnSize(None)
+ self._gl_init_flag = True
+ #check for a change in window size
+ if self._resized_flag:
+ self.width, self.height = self.GetSize()
+ glViewport(0, 0, self.width, self.height)
+ glMatrixMode(GL_PROJECTION)
+ glLoadIdentity()
+ glOrtho(0, self.width, self.height, 0, 1, 0)
+ glMatrixMode(GL_MODELVIEW)
+ glLoadIdentity()
+ self._resized_flag = False
+ self._changed = True
self.draw()
- return
def update(self): wx.PostEvent(self, wx.PaintEvent())
@@ -99,6 +101,7 @@
"""!
Create a new grid plotter.
"""
+ self.grid_compiled_list_id = wx.NewId()
self.channels = dict()
#store title and unit strings
self.title = title
@@ -145,13 +148,13 @@
self.clear()
#store the grid drawing operations
if self._changed:
- glNewList(GRID_COMPILED_LIST_ID, GL_COMPILE)
+ glNewList(self.grid_compiled_list_id, GL_COMPILE)
self._draw_grid()
glEndList()
self._changed = False
self._draw_waveforms()
#draw the grid
- glCallList(GRID_COMPILED_LIST_ID)
+ glCallList(self.grid_compiled_list_id)
glFlush()
self.SwapBuffers()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r8740 - gnuradio/branches/developers/jblum/gr-wxglgui/src/python,
jblum <=