gr-fopshor: Remove WX support
This doesn't exist anymore in 3.8 Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
parent
6fd953942f
commit
d7c472ec47
|
@ -157,10 +157,6 @@ GR_REGISTER_COMPONENT("QT" ENABLE_QT
|
|||
Qt5_FOUND
|
||||
)
|
||||
|
||||
GR_REGISTER_COMPONENT("WX" ENABLE_WX
|
||||
PYTHONLIBS_FOUND SWIG_FOUND ENABLE_PYTHON
|
||||
)
|
||||
|
||||
macro(list_cond_append cond list_name)
|
||||
if(${cond})
|
||||
list(APPEND ${list_name} ${ARGN})
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
list_cond_append(ENABLE_GLFW fosphor_grc fosphor_glfw_sink_c.xml)
|
||||
list_cond_append(ENABLE_QT fosphor_grc fosphor_qt_sink_c.xml)
|
||||
list_cond_append(ENABLE_WX fosphor_grc fosphor_wx_sink_c.xml)
|
||||
|
||||
install(FILES
|
||||
${fosphor_grc}
|
||||
|
|
|
@ -1,105 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<block>
|
||||
<name>WX fosphor sink</name>
|
||||
<key>fosphor_wx_sink_c</key>
|
||||
<category>Instrumentation/WX</category>
|
||||
<import>from gnuradio import fosphor</import>
|
||||
<import>from gnuradio.fft import window</import>
|
||||
<make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
|
||||
fosphor.wx_sink_c(
|
||||
$(parent).GetWin()
|
||||
#if $win_size()
|
||||
size=$win_size,
|
||||
#end if
|
||||
)
|
||||
self.$(id).set_fft_window($wintype)
|
||||
self.$(id).set_frequency_range($freq_center, $freq_span)
|
||||
#if not $grid_pos()
|
||||
$(parent).Add(self.$(id).win)
|
||||
#else
|
||||
$(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
|
||||
#end if</make>
|
||||
<callback>set_fft_window($wintype)</callback>
|
||||
<callback>set_frequency_range($freq_center, $freq_span)</callback>
|
||||
<param>
|
||||
<name>Window Type</name>
|
||||
<key>wintype</key>
|
||||
<value>window.WIN_BLACKMAN_hARRIS</value>
|
||||
<type>int</type>
|
||||
<hide>part</hide>
|
||||
<option>
|
||||
<name>Blackman-harris</name>
|
||||
<key>window.WIN_BLACKMAN_hARRIS</key>
|
||||
</option>
|
||||
<option>
|
||||
<name>Hamming</name>
|
||||
<key>window.WIN_HAMMING</key>
|
||||
</option>
|
||||
<option>
|
||||
<name>Hann</name>
|
||||
<key>window.WIN_HANN</key>
|
||||
</option>
|
||||
<option>
|
||||
<name>Blackman</name>
|
||||
<key>window.WIN_BLACKMAN</key>
|
||||
</option>
|
||||
<option>
|
||||
<name>Rectangular</name>
|
||||
<key>window.WIN_RECTANGULAR</key>
|
||||
</option>
|
||||
<option>
|
||||
<name>Kaiser</name>
|
||||
<key>window.WIN_KAISER</key>
|
||||
</option>
|
||||
</param>
|
||||
<param>
|
||||
<name>Center Frequency (Hz)</name>
|
||||
<key>freq_center</key>
|
||||
<value>0</value>
|
||||
<type>real</type>
|
||||
</param>
|
||||
<param>
|
||||
<name>Span (Hz)</name>
|
||||
<key>freq_span</key>
|
||||
<value>samp_rate</value>
|
||||
<type>real</type>
|
||||
</param>
|
||||
<param>
|
||||
<name>Window Size</name>
|
||||
<key>win_size</key>
|
||||
<value></value>
|
||||
<type>int_vector</type>
|
||||
<hide>#if $win_size() then 'none' else 'part'#</hide>
|
||||
</param>
|
||||
<param>
|
||||
<name>Grid Position</name>
|
||||
<key>grid_pos</key>
|
||||
<value></value>
|
||||
<type>grid_pos</type>
|
||||
</param>
|
||||
<param>
|
||||
<name>Notebook</name>
|
||||
<key>notebook</key>
|
||||
<value></value>
|
||||
<type>notebook</type>
|
||||
</param>
|
||||
<check>not $win_size or len($win_size) == 2</check>
|
||||
<sink>
|
||||
<name>in</name>
|
||||
<type>complex</type>
|
||||
</sink>
|
||||
|
||||
<doc>
|
||||
Key Bindings
|
||||
============
|
||||
z: toggle zoom mode
|
||||
a/d: move zoom frequency down/up
|
||||
s/w: adjust zoom width
|
||||
q/e: adjust screen split between waterfall and fft
|
||||
space: pause display
|
||||
|
||||
(left)/(right) adjust dB/div
|
||||
(up)/(down) adjust reference level
|
||||
|
||||
</doc>
|
||||
</block>
|
|
@ -27,7 +27,6 @@ list(APPEND fosphor_headers
|
|||
|
||||
list_cond_append(ENABLE_GLFW fosphor_headers glfw_sink_c.h)
|
||||
list_cond_append(ENABLE_QT fosphor_headers qt_sink_c.h)
|
||||
list_cond_append(ENABLE_WX fosphor_headers wx_core_sink_c.h)
|
||||
|
||||
install(FILES
|
||||
${fosphor_headers}
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2013-2014 Sylvain Munaut <tnt@246tNt.com>
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef INCLUDED_GR_FOSPHOR_WX_CORE_SINK_C_H
|
||||
#define INCLUDED_GR_FOSPHOR_WX_CORE_SINK_C_H
|
||||
|
||||
#include <gnuradio/fosphor/api.h>
|
||||
#include <gnuradio/fosphor/base_sink_c.h>
|
||||
|
||||
#include <gnuradio/sync_block.h>
|
||||
|
||||
namespace gr {
|
||||
namespace fosphor {
|
||||
|
||||
/*!
|
||||
* \brief WX version of fosphor sink (core)
|
||||
* \ingroup fosphor
|
||||
*/
|
||||
class GR_FOSPHOR_API wx_core_sink_c : virtual public base_sink_c
|
||||
{
|
||||
public:
|
||||
typedef boost::shared_ptr<wx_core_sink_c> sptr;
|
||||
|
||||
/*!
|
||||
* \brief Return a shared_ptr to a new instance of fosphor::wx_core_sink_c.
|
||||
*
|
||||
* To avoid accidental use of raw pointers, fosphor::wx_core_sink_c's
|
||||
* constructor is in a private implementation
|
||||
* class. fosphor::wx_core_sink_c::make is the public interface for
|
||||
* creating new instances.
|
||||
*/
|
||||
static sptr make(PyObject *cb_init, PyObject *cb_fini,
|
||||
PyObject *cb_swap, PyObject *cb_update);
|
||||
|
||||
virtual void pycb_reshape(int width, int height) = 0;
|
||||
};
|
||||
|
||||
} // namespace fosphor
|
||||
} // namespace gr
|
||||
|
||||
#endif /* INCLUDED_GR_FOSPHOR_WX_CORE_SINK_C_H */
|
||||
|
|
@ -87,7 +87,6 @@ list(APPEND fosphor_sources
|
|||
|
||||
list_cond_append(ENABLE_GLFW fosphor_sources glfw_sink_c_impl.cc)
|
||||
list_cond_append(ENABLE_QT fosphor_sources QGLSurface.cc qt_sink_c_impl.cc)
|
||||
list_cond_append(ENABLE_WX fosphor_sources wx_core_sink_c_impl.cc)
|
||||
|
||||
list(APPEND fosphor_libraries
|
||||
${OPENGL_LIBRARIES}
|
||||
|
|
|
@ -1,123 +0,0 @@
|
|||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2013-2014 Sylvain Munaut <tnt@246tNt.com>
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "wx_core_sink_c_impl.h"
|
||||
|
||||
|
||||
namespace gr {
|
||||
namespace fosphor {
|
||||
|
||||
wx_core_sink_c::sptr
|
||||
wx_core_sink_c::make(PyObject *cb_init, PyObject *cb_fini,
|
||||
PyObject *cb_swap, PyObject *cb_update)
|
||||
{
|
||||
return gnuradio::get_initial_sptr(
|
||||
new wx_core_sink_c_impl(cb_init, cb_fini, cb_swap, cb_update)
|
||||
);
|
||||
}
|
||||
|
||||
wx_core_sink_c_impl::wx_core_sink_c_impl(PyObject *cb_init, PyObject *cb_fini,
|
||||
PyObject *cb_swap, PyObject *cb_update)
|
||||
: base_sink_c("wx_core_sink_c"),
|
||||
d_cb_init(cb_init), d_cb_fini(cb_fini),
|
||||
d_cb_swap(cb_swap), d_cb_update(cb_update)
|
||||
{
|
||||
/* Make sure we keep reference to callbacks */
|
||||
Py_INCREF(this->d_cb_init);
|
||||
Py_INCREF(this->d_cb_fini);
|
||||
Py_INCREF(this->d_cb_swap);
|
||||
Py_INCREF(this->d_cb_update);
|
||||
}
|
||||
|
||||
wx_core_sink_c_impl::~wx_core_sink_c_impl()
|
||||
{
|
||||
/* Release callbacks */
|
||||
Py_DECREF(this->d_cb_init);
|
||||
Py_DECREF(this->d_cb_fini);
|
||||
Py_DECREF(this->d_cb_swap);
|
||||
Py_DECREF(this->d_cb_update);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
wx_core_sink_c_impl::pycall(PyObject *cb)
|
||||
{
|
||||
PyObject *arglist;
|
||||
PyObject *result;
|
||||
|
||||
PyGILState_STATE gstate;
|
||||
gstate = PyGILState_Ensure();
|
||||
|
||||
arglist = Py_BuildValue("()");
|
||||
result = PyEval_CallObject(cb, arglist);
|
||||
Py_DECREF(arglist);
|
||||
|
||||
if (result != NULL)
|
||||
Py_DECREF(result);
|
||||
|
||||
PyGILState_Release(gstate);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
wx_core_sink_c_impl::glctx_init()
|
||||
{
|
||||
this->pycall(this->d_cb_init);
|
||||
}
|
||||
|
||||
void
|
||||
wx_core_sink_c_impl::glctx_swap()
|
||||
{
|
||||
this->pycall(this->d_cb_swap);
|
||||
}
|
||||
|
||||
void
|
||||
wx_core_sink_c_impl::glctx_poll()
|
||||
{
|
||||
/* Nothing to do */
|
||||
}
|
||||
|
||||
void
|
||||
wx_core_sink_c_impl::glctx_fini()
|
||||
{
|
||||
this->pycall(this->d_cb_fini);
|
||||
}
|
||||
|
||||
void
|
||||
wx_core_sink_c_impl::glctx_update()
|
||||
{
|
||||
this->pycall(this->d_cb_update);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
wx_core_sink_c_impl::pycb_reshape(int width, int height)
|
||||
{
|
||||
this->cb_reshape(width, height);
|
||||
}
|
||||
|
||||
} /* namespace fosphor */
|
||||
} /* namespace gr */
|
|
@ -1,67 +0,0 @@
|
|||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2013-2014 Sylvain Munaut <tnt@246tNt.com>
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef INCLUDED_GR_FOSPHOR_WX_CORE_SINK_C_IMPL_H
|
||||
#define INCLUDED_GR_FOSPHOR_WX_CORE_SINK_C_IMPL_H
|
||||
|
||||
#include <gnuradio/fosphor/wx_core_sink_c.h>
|
||||
|
||||
#include "base_sink_c_impl.h"
|
||||
|
||||
namespace gr {
|
||||
namespace fosphor {
|
||||
|
||||
/*!
|
||||
* \brief WX version of fosphor sink (core implementation)
|
||||
* \ingroup fosphor
|
||||
*/
|
||||
class wx_core_sink_c_impl : public wx_core_sink_c, public base_sink_c_impl
|
||||
{
|
||||
private:
|
||||
/* Delegation to python */
|
||||
void pycall(PyObject *cb);
|
||||
|
||||
PyObject *d_cb_init;
|
||||
PyObject *d_cb_fini;
|
||||
PyObject *d_cb_swap;
|
||||
PyObject *d_cb_update;
|
||||
|
||||
protected:
|
||||
/* Delegated implementation of GL context management */
|
||||
void glctx_init();
|
||||
void glctx_swap();
|
||||
void glctx_poll();
|
||||
void glctx_fini();
|
||||
void glctx_update();
|
||||
|
||||
public:
|
||||
wx_core_sink_c_impl(PyObject *cb_init, PyObject *cb_fini,
|
||||
PyObject *cb_swap, PyObject *cb_update);
|
||||
~wx_core_sink_c_impl();
|
||||
|
||||
void pycb_reshape(int width, int height);
|
||||
};
|
||||
|
||||
} // namespace fosphor
|
||||
} // namespace gr
|
||||
|
||||
#endif /* INCLUDED_GR_FOSPHOR_WX_CORE_SINK_C_IMPL_H */
|
||||
|
|
@ -32,8 +32,6 @@ list(APPEND fosphor_python
|
|||
__init__.py
|
||||
)
|
||||
|
||||
list_cond_append(ENABLE_WX fosphor_python wx_sink_c.py)
|
||||
|
||||
GR_PYTHON_INSTALL(
|
||||
FILES
|
||||
${fosphor_python}
|
||||
|
|
|
@ -25,14 +25,3 @@ description here (python/__init__.py).
|
|||
|
||||
# import swig generated symbols into the fosphor namespace
|
||||
from fosphor_swig import *
|
||||
|
||||
# import any pure python here
|
||||
try:
|
||||
from wx_sink_c import wx_sink_c
|
||||
except ImportError:
|
||||
# No Python WX or OpenGL support most likely
|
||||
import sys
|
||||
exc_info = sys.exc_info()
|
||||
def wx_sink_c(*args, **kwargs):
|
||||
raise exc_info[0], exc_info[1], exc_info[2]
|
||||
#
|
||||
|
|
|
@ -1,112 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright 2013-2014 Sylvain Munaut <tnt@246tNt.com>
|
||||
#
|
||||
# This is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
|
||||
import numpy
|
||||
|
||||
import wx
|
||||
import wx.glcanvas
|
||||
from OpenGL import GL
|
||||
|
||||
from gnuradio import gr
|
||||
|
||||
from fosphor_swig import base_sink_c, wx_core_sink_c
|
||||
|
||||
import threading
|
||||
|
||||
class wx_sink_c(gr.hier_block2):
|
||||
|
||||
def __init__(self, parent, size=(600,600)):
|
||||
gr.hier_block2.__init__(
|
||||
self,
|
||||
"wx_sink_c",
|
||||
gr.io_signature(1, 1, gr.sizeof_gr_complex),
|
||||
gr.io_signature(0, 0, 0),
|
||||
)
|
||||
|
||||
# Create the GL Canvas (without context for now)
|
||||
attribList = (wx.glcanvas.WX_GL_DOUBLEBUFFER, wx.glcanvas.WX_GL_RGBA)
|
||||
self.win = wx.glcanvas.GLCanvas(parent, wx.ID_ANY,
|
||||
attribList=attribList,
|
||||
size=size,
|
||||
style=wx.WANTS_CHARS
|
||||
)
|
||||
|
||||
self.win.Bind(wx.EVT_SIZE, self._evt_size)
|
||||
self.win.Bind(wx.EVT_KEY_DOWN, self._evt_key_down)
|
||||
self.win.SetFocus()
|
||||
|
||||
self._gl_ctx = None
|
||||
|
||||
# Create the underlying WX sink core
|
||||
self.sink = wx_core_sink_c(self._glctx_init, self._glctx_fini,
|
||||
self._glctx_swap, self._glctx_update)
|
||||
self.connect(self, self.sink)
|
||||
|
||||
def _evt_size(self, evt):
|
||||
self.sink.pycb_reshape(*evt.GetSize())
|
||||
|
||||
def _evt_key_down(self, evt):
|
||||
actions = {
|
||||
wx.WXK_UP: base_sink_c.REF_DOWN,
|
||||
wx.WXK_DOWN: base_sink_c.REF_UP,
|
||||
wx.WXK_LEFT: base_sink_c.DB_PER_DIV_DOWN,
|
||||
wx.WXK_RIGHT: base_sink_c.DB_PER_DIV_UP,
|
||||
ord('Z'): base_sink_c.ZOOM_TOGGLE,
|
||||
ord('W'): base_sink_c.ZOOM_WIDTH_UP,
|
||||
ord('S'): base_sink_c.ZOOM_WIDTH_DOWN,
|
||||
ord('D'): base_sink_c.ZOOM_CENTER_UP,
|
||||
ord('A'): base_sink_c.ZOOM_CENTER_DOWN,
|
||||
ord('Q'): base_sink_c.RATIO_UP,
|
||||
ord('E'): base_sink_c.RATIO_DOWN,
|
||||
wx.WXK_SPACE: base_sink_c.FREEZE_TOGGLE,
|
||||
}
|
||||
|
||||
k = evt.GetKeyCode()
|
||||
|
||||
if k in actions:
|
||||
self.sink.execute_ui_action(actions[k])
|
||||
else:
|
||||
evt.Skip()
|
||||
|
||||
def _glctx_init(self):
|
||||
if self._gl_ctx is None:
|
||||
self._gl_ctx = wx.glcanvas.GLContext(self.win)
|
||||
self.win.SetCurrent(self._gl_ctx)
|
||||
|
||||
def _glctx_fini(self):
|
||||
self._gl_ctx = None
|
||||
|
||||
def _glctx_swap(self):
|
||||
self.win.SwapBuffers()
|
||||
|
||||
def _glctx_update(self):
|
||||
self.win.SetCurrent(self._gl_ctx)
|
||||
|
||||
def __getattr__(self, attr):
|
||||
try:
|
||||
return gr.hier_block2.__getattr__(self, attr)
|
||||
except:
|
||||
return getattr(self.sink, attr)
|
||||
|
||||
def set_baseband_freq(self, bb_freq):
|
||||
self.set_frequency_center(bb_freq)
|
||||
|
||||
def set_sample_rate(self, sample_rate):
|
||||
self.set_frequency_span(sample_rate)
|
|
@ -41,7 +41,6 @@ set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/fosphor)
|
|||
|
||||
list_cond_append(ENABLE_GLFW GR_SWIG_FLAGS -DENABLE_GLFW)
|
||||
list_cond_append(ENABLE_QT GR_SWIG_FLAGS -DENABLE_QT)
|
||||
list_cond_append(ENABLE_WX GR_SWIG_FLAGS -DENABLE_WX)
|
||||
|
||||
GR_SWIG_MAKE(fosphor_swig fosphor_swig.i)
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
%{
|
||||
#include "gnuradio/fosphor/glfw_sink_c.h"
|
||||
#include "gnuradio/fosphor/qt_sink_c.h"
|
||||
#include "gnuradio/fosphor/wx_core_sink_c.h"
|
||||
%}
|
||||
|
||||
%typemap(in) gr::fft::window::win_type {
|
||||
|
@ -29,8 +28,3 @@ GR_SWIG_BLOCK_MAGIC2(fosphor, glfw_sink_c);
|
|||
%include "gnuradio/fosphor/qt_sink_c.h"
|
||||
GR_SWIG_BLOCK_MAGIC2(fosphor, qt_sink_c);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_WX
|
||||
%include "gnuradio/fosphor/wx_core_sink_c.h"
|
||||
GR_SWIG_BLOCK_MAGIC2(fosphor, wx_core_sink_c);
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue