diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e6aa78..7182d43 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}) diff --git a/grc/CMakeLists.txt b/grc/CMakeLists.txt index 6cfe5af..e3ef1cd 100644 --- a/grc/CMakeLists.txt +++ b/grc/CMakeLists.txt @@ -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} diff --git a/grc/fosphor_wx_sink_c.xml b/grc/fosphor_wx_sink_c.xml deleted file mode 100644 index 705c775..0000000 --- a/grc/fosphor_wx_sink_c.xml +++ /dev/null @@ -1,105 +0,0 @@ - - - WX fosphor sink - fosphor_wx_sink_c - Instrumentation/WX - from gnuradio import fosphor - from gnuradio.fft import window - #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 - set_fft_window($wintype) - set_frequency_range($freq_center, $freq_span) - - Window Type - wintype - window.WIN_BLACKMAN_hARRIS - int - part - - - - - - - - - Center Frequency (Hz) - freq_center - 0 - real - - - Span (Hz) - freq_span - samp_rate - real - - - Window Size - win_size - - int_vector - #if $win_size() then 'none' else 'part'# - - - Grid Position - grid_pos - - grid_pos - - - Notebook - notebook - - notebook - - not $win_size or len($win_size) == 2 - - in - complex - - - - 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 - - - diff --git a/include/gnuradio/fosphor/CMakeLists.txt b/include/gnuradio/fosphor/CMakeLists.txt index 201bcfa..7d39cc8 100644 --- a/include/gnuradio/fosphor/CMakeLists.txt +++ b/include/gnuradio/fosphor/CMakeLists.txt @@ -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} diff --git a/include/gnuradio/fosphor/wx_core_sink_c.h b/include/gnuradio/fosphor/wx_core_sink_c.h deleted file mode 100644 index fc8ea9f..0000000 --- a/include/gnuradio/fosphor/wx_core_sink_c.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2013-2014 Sylvain Munaut - * - * 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 -#include - -#include - -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 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 */ - diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 165d9f8..8791e7e 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -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} diff --git a/lib/wx_core_sink_c_impl.cc b/lib/wx_core_sink_c_impl.cc deleted file mode 100644 index 2ee513e..0000000 --- a/lib/wx_core_sink_c_impl.cc +++ /dev/null @@ -1,123 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2013-2014 Sylvain Munaut - * - * 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 - -#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 */ diff --git a/lib/wx_core_sink_c_impl.h b/lib/wx_core_sink_c_impl.h deleted file mode 100644 index 04a2c66..0000000 --- a/lib/wx_core_sink_c_impl.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2013-2014 Sylvain Munaut - * - * 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 - -#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 */ - diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 7530656..cb076ae 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -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} diff --git a/python/__init__.py b/python/__init__.py index ac51a5a..354ca33 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -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] -# diff --git a/python/wx_sink_c.py b/python/wx_sink_c.py deleted file mode 100644 index 1214228..0000000 --- a/python/wx_sink_c.py +++ /dev/null @@ -1,112 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2013-2014 Sylvain Munaut -# -# 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) diff --git a/swig/CMakeLists.txt b/swig/CMakeLists.txt index 4cba070..3d56e59 100644 --- a/swig/CMakeLists.txt +++ b/swig/CMakeLists.txt @@ -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) diff --git a/swig/fosphor_swig.i b/swig/fosphor_swig.i index 064ab9b..7806ec1 100644 --- a/swig/fosphor_swig.i +++ b/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