From 9988664127b367fa8fee4409f8460673d6f265e1 Mon Sep 17 00:00:00 2001 From: jblum Date: Tue, 23 Jun 2009 20:38:18 +0000 Subject: [PATCH] Merging r11186:11273 from grc branch. Fixes, features, and reorganization for grc. Minor fixes and features for wxgui forms. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11274 221aa14e-8319-0410-a670-987f0aec2ac5 --- config/grc_grc.m4 | 28 +- gr-wxgui/src/python/forms/converters.py | 17 +- gr-wxgui/src/python/forms/forms.py | 2 +- grc/Makefile.am | 38 ++- grc/Makefile.inc | 5 +- grc/__init__.py.in | 21 ++ grc/{src/platforms => }/base/Block.py | 24 +- grc/{src/platforms => }/base/Connection.py | 7 +- .../Constants.py.in => base/Constants.py} | 11 +- grc/{src/platforms => }/base/Element.py | 45 +--- grc/{src/platforms => }/base/FlowGraph.py | 15 +- grc/{src/platforms/gui => base}/Makefile.am | 16 +- grc/{src/platforms => }/base/Param.py | 44 ++-- grc/{src/utils => base}/ParseXML.py | 2 +- grc/{src/platforms => }/base/Platform.py | 111 +++++--- grc/{src/platforms => }/base/Port.py | 5 +- grc/{src/utils => base}/__init__.py | 0 grc/{data/platforms => }/base/block_tree.dtd | 0 grc/{data/platforms => }/base/flow_graph.dtd | 0 grc/{src/utils => base}/odict.py | 0 .../platforms/python => }/blocks/Makefile.am | 10 +- .../python => }/blocks/audio_sink.xml | 0 .../python => }/blocks/audio_source.xml | 0 .../python => }/blocks/band_pass_filter.xml | 56 +++- .../python => }/blocks/band_reject_filter.xml | 12 +- .../python => }/blocks/blks2_am_demod_cf.xml | 0 .../blocks/blks2_analysis_filterbank.xml | 0 .../python => }/blocks/blks2_dxpsk_demod.xml | 32 +++ .../python => }/blocks/blks2_dxpsk_mod.xml | 32 +++ .../python => }/blocks/blks2_error_rate.xml | 0 .../python => }/blocks/blks2_fm_deemph.xml | 0 .../python => }/blocks/blks2_fm_demod_cf.xml | 0 .../python => }/blocks/blks2_fm_preemph.xml | 0 .../python => }/blocks/blks2_gmsk_demod.xml | 32 +++ .../python => }/blocks/blks2_gmsk_mod.xml | 32 +++ .../python => }/blocks/blks2_logpwrfft_x.xml | 15 +- .../python => }/blocks/blks2_nbfm_rx.xml | 0 .../python => }/blocks/blks2_nbfm_tx.xml | 0 .../python => }/blocks/blks2_ofdm_demod.xml | 0 .../python => }/blocks/blks2_ofdm_mod.xml | 0 .../blocks/blks2_packet_decoder.xml | 0 .../blocks/blks2_packet_encoder.xml | 0 .../python => }/blocks/blks2_qamx_demod.xml | 32 +++ .../python => }/blocks/blks2_qamx_mod.xml | 32 +++ .../blocks/blks2_rational_resampler_xxx.xml | 0 .../python => }/blocks/blks2_selector.xml | 0 .../blocks/blks2_standard_squelch.xml | 0 .../blks2_stream_to_vector_decimator.xml | 0 .../blocks/blks2_synthesis_filterbank.xml | 0 .../python => }/blocks/blks2_tcp_sink.xml | 0 .../python => }/blocks/blks2_tcp_source.xml | 0 .../python => }/blocks/blks2_valve.xml | 0 .../blocks/blks2_variable_sink_x.xml | 0 .../python => }/blocks/blks2_wfm_rcv.xml | 0 .../python => }/blocks/blks2_wfm_rcv_pll.xml | 0 .../python => }/blocks/blks2_wfm_tx.xml | 0 .../python => blocks}/block_tree.xml | 4 + .../python => }/blocks/const_source_x.xml | 0 .../python => }/blocks/gr_add_const_vxx.xml | 0 .../python => }/blocks/gr_add_xx.xml | 0 .../python => }/blocks/gr_agc2_xx.xml | 0 .../python => }/blocks/gr_agc_xx.xml | 0 .../python => }/blocks/gr_and_xx.xml | 0 .../python => }/blocks/gr_argmax_xx.xml | 0 .../blocks/gr_binary_slicer_fb.xml | 0 .../python => }/blocks/gr_channel_model.xml | 0 .../python => }/blocks/gr_char_to_float.xml | 0 .../blocks/gr_chunks_to_symbols.xml | 0 .../blocks/gr_clock_recovery_mm_xx.xml | 0 .../blocks/gr_cma_equalizer_cc.xml | 0 .../python => }/blocks/gr_complex_to_arg.xml | 0 .../blocks/gr_complex_to_float.xml | 0 .../python => }/blocks/gr_complex_to_imag.xml | 0 .../gr_complex_to_interleaved_short.xml | 0 .../python => }/blocks/gr_complex_to_mag.xml | 0 .../blocks/gr_complex_to_mag_squared.xml | 0 .../python => }/blocks/gr_complex_to_real.xml | 0 .../python => }/blocks/gr_conjugate_cc.xml | 0 .../blocks/gr_constellation_decoder_cb.xml | 0 .../blocks/gr_correlate_access_code_bb.xml | 0 .../python => }/blocks/gr_costas_loop_cc.xml | 0 .../python => }/blocks/gr_cpfsk_bc.xml | 0 .../python => }/blocks/gr_dd_mpsk_sync_cc.xml | 0 .../blocks/gr_decode_ccsds_27_fb.xml | 0 .../python => }/blocks/gr_deinterleave.xml | 0 .../platforms/python => }/blocks/gr_delay.xml | 0 .../python => }/blocks/gr_descrambler_bb.xml | 0 .../python => }/blocks/gr_diff_decoder_bb.xml | 0 .../python => }/blocks/gr_diff_encoder_bb.xml | 0 .../python => }/blocks/gr_diff_phasor_cc.xml | 0 .../python => }/blocks/gr_divide_xx.xml | 0 .../python => }/blocks/gr_dpll_bb.xml | 0 .../blocks/gr_encode_ccsds_27_bb.xml | 0 .../blocks/gr_feedforward_agc_cc.xml | 0 .../python => }/blocks/gr_fft_filter_xxx.xml | 0 .../python => }/blocks/gr_fft_vxx.xml | 0 .../python => }/blocks/gr_file_sink.xml | 0 .../python => }/blocks/gr_file_source.xml | 0 .../python => }/blocks/gr_filter_delay_fc.xml | 0 .../python => }/blocks/gr_fir_filter_xxx.xml | 0 .../python => }/blocks/gr_float_to_char.xml | 0 .../blocks/gr_float_to_complex.xml | 0 .../python => }/blocks/gr_float_to_short.xml | 0 .../python => }/blocks/gr_float_to_uchar.xml | 0 .../blocks/gr_fractional_interpolator_xx.xml | 0 .../blocks/gr_freq_xlating_fir_filter_xxx.xml | 0 .../blocks/gr_frequency_modulator_fc.xml | 0 .../python => }/blocks/gr_glfsr_source_x.xml | 0 .../python => }/blocks/gr_goertzel_fc.xml | 0 .../platforms/python => }/blocks/gr_head.xml | 0 .../python => }/blocks/gr_hilbert_fc.xml | 0 .../python => }/blocks/gr_iir_filter_ffd.xml | 0 .../python => }/blocks/gr_integrate_xx.xml | 0 .../python => }/blocks/gr_interleave.xml | 0 .../gr_interleaved_short_to_complex.xml | 0 .../blocks/gr_interp_fir_filter_xxx.xml | 0 .../python => }/blocks/gr_iqcomp_cc.xml | 0 .../python => }/blocks/gr_keep_one_in_n.xml | 0 .../python => }/blocks/gr_kludge_copy.xml | 0 .../python => }/blocks/gr_map_bb.xml | 0 .../python => }/blocks/gr_max_xx.xml | 0 .../blocks/gr_moving_average_xx.xml | 0 .../blocks/gr_mpsk_receiver_cc.xml | 0 .../python => }/blocks/gr_mpsk_sync_cc.xml | 0 .../blocks/gr_multiply_const_vxx.xml | 0 .../python => }/blocks/gr_multiply_xx.xml | 0 .../python => }/blocks/gr_mute_xx.xml | 0 .../python => }/blocks/gr_nlog10_ff.xml | 0 .../python => }/blocks/gr_noise_source_x.xml | 0 .../platforms/python => }/blocks/gr_nop.xml | 0 .../python => }/blocks/gr_not_xx.xml | 0 .../python => }/blocks/gr_null_sink.xml | 0 .../python => }/blocks/gr_null_source.xml | 0 .../platforms/python => }/blocks/gr_or_xx.xml | 0 .../blocks/gr_packed_to_unpacked_xx.xml | 0 .../blocks/gr_peak_detector2_fb.xml | 0 .../blocks/gr_peak_detector_xb.xml | 0 .../blocks/gr_phase_modulator_fc.xml | 0 .../blocks/gr_pll_carriertracking_cc.xml | 0 .../python => }/blocks/gr_pll_freqdet_cf.xml | 0 .../python => }/blocks/gr_pll_refout_cc.xml | 0 .../blocks/gr_pn_correlator_cc.xml | 0 .../blocks/gr_probe_avg_mag_sqrd_x.xml | 0 .../python => }/blocks/gr_probe_density_b.xml | 0 .../blocks/gr_probe_mpsk_snr_c.xml | 0 .../python => }/blocks/gr_pwr_squelch_xx.xml | 0 .../blocks/gr_quadrature_demod_cf.xml | 0 .../blocks/gr_rational_resampler_base_xxx.xml | 0 .../python => }/blocks/gr_repeat.xml | 0 .../python => }/blocks/gr_rms_xx.xml | 0 .../blocks/gr_sample_and_hold_xx.xml | 0 .../python => }/blocks/gr_scrambler_bb.xml | 0 .../python => }/blocks/gr_short_to_float.xml | 0 .../python => }/blocks/gr_sig_source_x.xml | 0 .../blocks/gr_simple_correlator.xml | 0 .../python => }/blocks/gr_simple_framer.xml | 0 .../blocks/gr_simple_squelch_cc.xml | 0 .../blocks/gr_single_pole_iir_filter_xx.xml | 0 .../python => }/blocks/gr_skiphead.xml | 0 .../blocks/gr_stream_to_streams.xml | 0 .../blocks/gr_stream_to_vector.xml | 0 .../blocks/gr_streams_to_stream.xml | 0 .../blocks/gr_streams_to_vector.xml | 0 .../python => }/blocks/gr_sub_xx.xml | 0 .../python => }/blocks/gr_threshold_ff.xml | 0 .../python => }/blocks/gr_throttle.xml | 0 .../python => }/blocks/gr_uchar_to_float.xml | 0 .../python => }/blocks/gr_udp_sink.xml | 0 .../python => }/blocks/gr_udp_source.xml | 0 .../blocks/gr_unpack_k_bits_bb.xml | 0 .../blocks/gr_unpacked_to_packed_xx.xml | 0 .../platforms/python => }/blocks/gr_vco_f.xml | 0 .../python => }/blocks/gr_vector_sink_x.xml | 0 .../python => }/blocks/gr_vector_source_x.xml | 0 .../blocks/gr_vector_to_stream.xml | 0 .../blocks/gr_vector_to_streams.xml | 0 .../python => }/blocks/gr_wavfile_sink.xml | 0 .../python => }/blocks/gr_wavfile_source.xml | 0 .../python => }/blocks/gr_xor_xx.xml | 0 .../python => }/blocks/high_pass_filter.xml | 12 +- .../platforms/python => }/blocks/import.xml | 0 .../python => }/blocks/low_pass_filter.xml | 12 +- .../platforms/python => }/blocks/note.xml | 0 .../platforms/python => }/blocks/options.xml | 37 ++- .../platforms/python => }/blocks/pad_sink.xml | 0 .../python => }/blocks/pad_source.xml | 0 .../python => }/blocks/parameter.xml | 1 + .../python => }/blocks/probe_function.xml | 0 .../python => }/blocks/random_source_x.xml | 0 grc/blocks/root_raised_cosine_filter.xml | 101 +++++++ .../python => }/blocks/trellis_encoder_xx.xml | 0 .../python => }/blocks/trellis_metrics_x.xml | 0 .../blocks/trellis_permutation.xml | 0 .../blocks/trellis_siso_combined_f.xml | 0 .../python => }/blocks/trellis_siso_f.xml | 0 .../blocks/trellis_viterbi_combined_xx.xml | 0 .../python => }/blocks/trellis_viterbi_x.xml | 0 .../python => }/blocks/usrp2_probe.xml | 0 .../python => }/blocks/usrp2_sink_xxxx.xml | 0 .../python => }/blocks/usrp2_source_xxxx.xml | 0 .../python => }/blocks/usrp_dual_sink_x.xml | 0 .../python => }/blocks/usrp_dual_source_x.xml | 0 .../python => }/blocks/usrp_probe.xml | 0 .../python => }/blocks/usrp_simple_sink_x.xml | 0 .../blocks/usrp_simple_source_x.xml | 0 .../platforms/python => }/blocks/variable.xml | 4 +- grc/blocks/variable_check_box.xml | 75 ++++++ .../python => }/blocks/variable_chooser.xml | 16 +- grc/blocks/variable_config.xml | 86 ++++++ .../python => }/blocks/variable_slider.xml | 29 +- grc/blocks/variable_static_text.xml | 88 +++++++ .../python => }/blocks/variable_text_box.xml | 29 +- .../blocks/wxgui_constellationsink2.xml | 0 .../python => }/blocks/wxgui_fftsink2.xml | 0 .../python => }/blocks/wxgui_histosink2.xml | 0 .../python => }/blocks/wxgui_numbersink2.xml | 0 .../python => }/blocks/wxgui_scopesink2.xml | 0 .../blocks/wxgui_waterfallsink2.xml | 0 .../python => }/blocks/xmlrpc_client.xml | 0 .../python => }/blocks/xmlrpc_server.xml | 0 grc/cpp/README | 5 + grc/data/Makefile.am | 24 -- grc/data/platforms/Makefile.am | 24 -- grc/data/platforms/base/Makefile.am | 28 -- grc/data/platforms/python/Makefile.am | 32 --- grc/grc.conf.in | 9 + grc/{src => grc_gnuradio}/Makefile.am | 33 ++- grc/grc_gnuradio/README | 14 + grc/{src => grc_gnuradio}/__init__.py | 0 grc/{src => }/grc_gnuradio/blks2/__init__.py | 0 .../grc_gnuradio/blks2/error_rate.py | 0 grc/{src => }/grc_gnuradio/blks2/packet.py | 0 grc/{src => }/grc_gnuradio/blks2/probe.py | 0 grc/{src => }/grc_gnuradio/blks2/selector.py | 0 grc/{src => }/grc_gnuradio/blks2/tcp.py | 0 .../grc_gnuradio/blks2/variable_sink.py | 0 grc/{src => }/grc_gnuradio/usrp/__init__.py | 0 grc/{src => }/grc_gnuradio/usrp/common.py | 0 grc/{src => }/grc_gnuradio/usrp/dual_usrp.py | 0 .../grc_gnuradio/usrp/simple_usrp.py | 0 grc/{src => }/grc_gnuradio/wxgui/__init__.py | 0 .../grc_gnuradio/wxgui/top_block_gui.py | 15 +- grc/{src => }/gui/ActionHandler.py | 11 +- grc/{src => }/gui/Actions.py | 2 + grc/{src => }/gui/Bars.py | 1 + grc/{src/platforms => }/gui/Block.py | 2 +- grc/{src => }/gui/BlockTreeWindow.py | 2 +- grc/{src/platforms => }/gui/Colors.py | 0 grc/{src/platforms => }/gui/Connection.py | 0 grc/{src/platforms => }/gui/Constants.py | 39 +++ grc/{src => }/gui/Dialogs.py | 57 ++-- grc/{src => }/gui/DrawingArea.py | 0 grc/{src/platforms => }/gui/Element.py | 0 grc/{src => }/gui/FileDialogs.py | 21 +- grc/{src/platforms => }/gui/FlowGraph.py | 5 +- grc/{src => }/gui/MainWindow.py | 57 ++-- grc/{src => }/gui/Makefile.am | 13 +- grc/{src => }/gui/Messages.py | 5 +- grc/{src => }/gui/NotebookPage.py | 21 +- grc/{src/platforms => }/gui/Param.py | 3 +- grc/{src => }/gui/ParamsDialog.py | 1 + grc/{src/platforms => }/gui/Platform.py | 0 grc/{src/platforms => }/gui/Port.py | 0 grc/{src => }/gui/Preferences.py | 0 grc/{src => }/gui/StateCache.py | 0 grc/{src/platforms => }/gui/Utils.py | 0 grc/{src/grc_gnuradio => gui}/__init__.py | 0 grc/{src/platforms => }/python/Block.py | 33 +-- grc/{src/platforms => }/python/Connection.py | 4 +- .../Constants.py.in => python/Constants.py} | 23 +- grc/{src/platforms => }/python/FlowGraph.py | 41 ++- grc/{src/platforms => }/python/Generator.py | 41 +-- .../python/utils => python}/Makefile.am | 19 +- grc/{src/platforms => }/python/Param.py | 160 +++++------ grc/{src/platforms => }/python/Platform.py | 38 ++- grc/{src/platforms => }/python/Port.py | 8 +- grc/{src/gui => python}/__init__.py | 0 grc/{data/platforms => }/python/block.dtd | 3 +- .../python/utils => python}/convert_hier.py | 9 +- .../python/default_flow_graph.grc | 0 .../python/utils => python}/expr_utils.py | 10 +- .../python/utils => python}/extract_docs.py | 8 +- .../platforms => }/python/flow_graph.tmpl | 50 ++-- grc/scripts/grc | 11 +- grc/scripts/usrp2_probe | 6 +- grc/scripts/usrp_probe | 6 +- grc/src/grc_gnuradio/Makefile.am | 31 --- grc/src/grc_gnuradio/blks2/Makefile.am | 33 --- grc/src/grc_gnuradio/usrp/Makefile.am | 30 --- grc/src/grc_gnuradio/wxgui/Makefile.am | 27 -- grc/src/gui/Constants.py | 48 ---- grc/src/platforms/Makefile.am | 31 --- grc/src/platforms/__init__.py | 1 - grc/src/platforms/base/Makefile.am | 46 ---- grc/src/platforms/base/__init__.py | 1 - grc/src/platforms/gui/__init__.py | 1 - grc/src/platforms/python/Makefile.am | 48 ---- grc/src/platforms/python/__init__.py | 1 - grc/src/platforms/python/utils/__init__.py | 1 - grc/src/utils/Makefile.am | 30 --- grc/src/utils/converter.py | 248 ------------------ grc/todo.txt | 30 ++- 302 files changed, 1415 insertions(+), 1256 deletions(-) create mode 100644 grc/__init__.py.in rename grc/{src/platforms => }/base/Block.py (92%) rename grc/{src/platforms => }/base/Connection.py (92%) rename grc/{src/platforms/base/Constants.py.in => base/Constants.py} (78%) rename grc/{src/platforms => }/base/Element.py (66%) rename grc/{src/platforms => }/base/FlowGraph.py (95%) rename grc/{src/platforms/gui => base}/Makefile.am (81%) rename grc/{src/platforms => }/base/Param.py (84%) rename grc/{src/utils => base}/ParseXML.py (99%) rename grc/{src/platforms => }/base/Platform.py (55%) rename grc/{src/platforms => }/base/Port.py (93%) rename grc/{src/utils => base}/__init__.py (100%) rename grc/{data/platforms => }/base/block_tree.dtd (100%) rename grc/{data/platforms => }/base/flow_graph.dtd (100%) rename grc/{src/utils => base}/odict.py (100%) rename grc/{data/platforms/python => }/blocks/Makefile.am (96%) rename grc/{data/platforms/python => }/blocks/audio_sink.xml (100%) rename grc/{data/platforms/python => }/blocks/audio_source.xml (100%) rename grc/{data/platforms/python => }/blocks/band_pass_filter.xml (59%) rename grc/{data/platforms/python => }/blocks/band_reject_filter.xml (88%) rename grc/{data/platforms/python => }/blocks/blks2_am_demod_cf.xml (100%) rename grc/{data/platforms/python => }/blocks/blks2_analysis_filterbank.xml (100%) rename grc/{data/platforms/python => }/blocks/blks2_dxpsk_demod.xml (74%) rename grc/{data/platforms/python => }/blocks/blks2_dxpsk_mod.xml (66%) rename grc/{data/platforms/python => }/blocks/blks2_error_rate.xml (100%) rename grc/{data/platforms/python => }/blocks/blks2_fm_deemph.xml (100%) rename grc/{data/platforms/python => }/blocks/blks2_fm_demod_cf.xml (100%) rename grc/{data/platforms/python => }/blocks/blks2_fm_preemph.xml (100%) rename grc/{data/platforms/python => }/blocks/blks2_gmsk_demod.xml (64%) rename grc/{data/platforms/python => }/blocks/blks2_gmsk_mod.xml (52%) rename grc/{data/platforms/python => }/blocks/blks2_logpwrfft_x.xml (96%) rename grc/{data/platforms/python => }/blocks/blks2_nbfm_rx.xml (100%) rename grc/{data/platforms/python => }/blocks/blks2_nbfm_tx.xml (100%) rename grc/{data/platforms/python => }/blocks/blks2_ofdm_demod.xml (100%) rename grc/{data/platforms/python => }/blocks/blks2_ofdm_mod.xml (100%) rename grc/{data/platforms/python => }/blocks/blks2_packet_decoder.xml (100%) rename grc/{data/platforms/python => }/blocks/blks2_packet_encoder.xml (100%) rename grc/{data/platforms/python => }/blocks/blks2_qamx_demod.xml (75%) rename grc/{data/platforms/python => }/blocks/blks2_qamx_mod.xml (67%) rename grc/{data/platforms/python => }/blocks/blks2_rational_resampler_xxx.xml (100%) rename grc/{data/platforms/python => }/blocks/blks2_selector.xml (100%) rename grc/{data/platforms/python => }/blocks/blks2_standard_squelch.xml (100%) rename grc/{data/platforms/python => }/blocks/blks2_stream_to_vector_decimator.xml (100%) rename grc/{data/platforms/python => }/blocks/blks2_synthesis_filterbank.xml (100%) rename grc/{data/platforms/python => }/blocks/blks2_tcp_sink.xml (100%) rename grc/{data/platforms/python => }/blocks/blks2_tcp_source.xml (100%) rename grc/{data/platforms/python => }/blocks/blks2_valve.xml (100%) rename grc/{data/platforms/python => }/blocks/blks2_variable_sink_x.xml (100%) rename grc/{data/platforms/python => }/blocks/blks2_wfm_rcv.xml (100%) rename grc/{data/platforms/python => }/blocks/blks2_wfm_rcv_pll.xml (100%) rename grc/{data/platforms/python => }/blocks/blks2_wfm_tx.xml (100%) rename grc/{data/platforms/python => blocks}/block_tree.xml (98%) rename grc/{data/platforms/python => }/blocks/const_source_x.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_add_const_vxx.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_add_xx.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_agc2_xx.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_agc_xx.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_and_xx.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_argmax_xx.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_binary_slicer_fb.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_channel_model.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_char_to_float.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_chunks_to_symbols.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_clock_recovery_mm_xx.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_cma_equalizer_cc.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_complex_to_arg.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_complex_to_float.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_complex_to_imag.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_complex_to_interleaved_short.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_complex_to_mag.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_complex_to_mag_squared.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_complex_to_real.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_conjugate_cc.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_constellation_decoder_cb.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_correlate_access_code_bb.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_costas_loop_cc.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_cpfsk_bc.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_dd_mpsk_sync_cc.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_decode_ccsds_27_fb.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_deinterleave.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_delay.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_descrambler_bb.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_diff_decoder_bb.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_diff_encoder_bb.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_diff_phasor_cc.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_divide_xx.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_dpll_bb.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_encode_ccsds_27_bb.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_feedforward_agc_cc.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_fft_filter_xxx.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_fft_vxx.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_file_sink.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_file_source.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_filter_delay_fc.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_fir_filter_xxx.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_float_to_char.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_float_to_complex.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_float_to_short.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_float_to_uchar.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_fractional_interpolator_xx.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_freq_xlating_fir_filter_xxx.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_frequency_modulator_fc.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_glfsr_source_x.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_goertzel_fc.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_head.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_hilbert_fc.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_iir_filter_ffd.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_integrate_xx.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_interleave.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_interleaved_short_to_complex.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_interp_fir_filter_xxx.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_iqcomp_cc.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_keep_one_in_n.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_kludge_copy.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_map_bb.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_max_xx.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_moving_average_xx.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_mpsk_receiver_cc.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_mpsk_sync_cc.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_multiply_const_vxx.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_multiply_xx.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_mute_xx.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_nlog10_ff.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_noise_source_x.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_nop.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_not_xx.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_null_sink.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_null_source.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_or_xx.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_packed_to_unpacked_xx.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_peak_detector2_fb.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_peak_detector_xb.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_phase_modulator_fc.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_pll_carriertracking_cc.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_pll_freqdet_cf.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_pll_refout_cc.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_pn_correlator_cc.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_probe_avg_mag_sqrd_x.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_probe_density_b.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_probe_mpsk_snr_c.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_pwr_squelch_xx.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_quadrature_demod_cf.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_rational_resampler_base_xxx.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_repeat.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_rms_xx.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_sample_and_hold_xx.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_scrambler_bb.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_short_to_float.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_sig_source_x.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_simple_correlator.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_simple_framer.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_simple_squelch_cc.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_single_pole_iir_filter_xx.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_skiphead.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_stream_to_streams.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_stream_to_vector.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_streams_to_stream.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_streams_to_vector.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_sub_xx.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_threshold_ff.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_throttle.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_uchar_to_float.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_udp_sink.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_udp_source.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_unpack_k_bits_bb.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_unpacked_to_packed_xx.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_vco_f.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_vector_sink_x.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_vector_source_x.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_vector_to_stream.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_vector_to_streams.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_wavfile_sink.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_wavfile_source.xml (100%) rename grc/{data/platforms/python => }/blocks/gr_xor_xx.xml (100%) rename grc/{data/platforms/python => }/blocks/high_pass_filter.xml (88%) rename grc/{data/platforms/python => }/blocks/import.xml (100%) rename grc/{data/platforms/python => }/blocks/low_pass_filter.xml (88%) rename grc/{data/platforms/python => }/blocks/note.xml (100%) rename grc/{data/platforms/python => }/blocks/options.xml (77%) rename grc/{data/platforms/python => }/blocks/pad_sink.xml (100%) rename grc/{data/platforms/python => }/blocks/pad_source.xml (100%) rename grc/{data/platforms/python => }/blocks/parameter.xml (97%) rename grc/{data/platforms/python => }/blocks/probe_function.xml (100%) rename grc/{data/platforms/python => }/blocks/random_source_x.xml (100%) create mode 100644 grc/blocks/root_raised_cosine_filter.xml rename grc/{data/platforms/python => }/blocks/trellis_encoder_xx.xml (100%) rename grc/{data/platforms/python => }/blocks/trellis_metrics_x.xml (100%) rename grc/{data/platforms/python => }/blocks/trellis_permutation.xml (100%) rename grc/{data/platforms/python => }/blocks/trellis_siso_combined_f.xml (100%) rename grc/{data/platforms/python => }/blocks/trellis_siso_f.xml (100%) rename grc/{data/platforms/python => }/blocks/trellis_viterbi_combined_xx.xml (100%) rename grc/{data/platforms/python => }/blocks/trellis_viterbi_x.xml (100%) rename grc/{data/platforms/python => }/blocks/usrp2_probe.xml (100%) rename grc/{data/platforms/python => }/blocks/usrp2_sink_xxxx.xml (100%) rename grc/{data/platforms/python => }/blocks/usrp2_source_xxxx.xml (100%) rename grc/{data/platforms/python => }/blocks/usrp_dual_sink_x.xml (100%) rename grc/{data/platforms/python => }/blocks/usrp_dual_source_x.xml (100%) rename grc/{data/platforms/python => }/blocks/usrp_probe.xml (100%) rename grc/{data/platforms/python => }/blocks/usrp_simple_sink_x.xml (100%) rename grc/{data/platforms/python => }/blocks/usrp_simple_source_x.xml (100%) rename grc/{data/platforms/python => }/blocks/variable.xml (80%) create mode 100644 grc/blocks/variable_check_box.xml rename grc/{data/platforms/python => }/blocks/variable_chooser.xml (87%) create mode 100644 grc/blocks/variable_config.xml rename grc/{data/platforms/python => }/blocks/variable_slider.xml (81%) create mode 100644 grc/blocks/variable_static_text.xml rename grc/{data/platforms/python => }/blocks/variable_text_box.xml (70%) rename grc/{data/platforms/python => }/blocks/wxgui_constellationsink2.xml (100%) rename grc/{data/platforms/python => }/blocks/wxgui_fftsink2.xml (100%) rename grc/{data/platforms/python => }/blocks/wxgui_histosink2.xml (100%) rename grc/{data/platforms/python => }/blocks/wxgui_numbersink2.xml (100%) rename grc/{data/platforms/python => }/blocks/wxgui_scopesink2.xml (100%) rename grc/{data/platforms/python => }/blocks/wxgui_waterfallsink2.xml (100%) rename grc/{data/platforms/python => }/blocks/xmlrpc_client.xml (100%) rename grc/{data/platforms/python => }/blocks/xmlrpc_server.xml (100%) create mode 100644 grc/cpp/README delete mode 100644 grc/data/Makefile.am delete mode 100644 grc/data/platforms/Makefile.am delete mode 100644 grc/data/platforms/base/Makefile.am delete mode 100644 grc/data/platforms/python/Makefile.am create mode 100644 grc/grc.conf.in rename grc/{src => grc_gnuradio}/Makefile.am (55%) create mode 100644 grc/grc_gnuradio/README rename grc/{src => grc_gnuradio}/__init__.py (100%) rename grc/{src => }/grc_gnuradio/blks2/__init__.py (100%) rename grc/{src => }/grc_gnuradio/blks2/error_rate.py (100%) rename grc/{src => }/grc_gnuradio/blks2/packet.py (100%) rename grc/{src => }/grc_gnuradio/blks2/probe.py (100%) rename grc/{src => }/grc_gnuradio/blks2/selector.py (100%) rename grc/{src => }/grc_gnuradio/blks2/tcp.py (100%) rename grc/{src => }/grc_gnuradio/blks2/variable_sink.py (100%) rename grc/{src => }/grc_gnuradio/usrp/__init__.py (100%) rename grc/{src => }/grc_gnuradio/usrp/common.py (100%) rename grc/{src => }/grc_gnuradio/usrp/dual_usrp.py (100%) rename grc/{src => }/grc_gnuradio/usrp/simple_usrp.py (100%) rename grc/{src => }/grc_gnuradio/wxgui/__init__.py (100%) rename grc/{src => }/grc_gnuradio/wxgui/top_block_gui.py (92%) rename grc/{src => }/gui/ActionHandler.py (98%) rename grc/{src => }/gui/Actions.py (98%) rename grc/{src => }/gui/Bars.py (99%) rename grc/{src/platforms => }/gui/Block.py (99%) rename grc/{src => }/gui/BlockTreeWindow.py (99%) rename grc/{src/platforms => }/gui/Colors.py (100%) rename grc/{src/platforms => }/gui/Connection.py (100%) rename grc/{src/platforms => }/gui/Constants.py (71%) rename grc/{src => }/gui/Dialogs.py (74%) rename grc/{src => }/gui/DrawingArea.py (100%) rename grc/{src/platforms => }/gui/Element.py (100%) rename grc/{src => }/gui/FileDialogs.py (89%) rename grc/{src/platforms => }/gui/FlowGraph.py (99%) rename grc/{src => }/gui/MainWindow.py (89%) rename grc/{src => }/gui/Makefile.am (85%) rename grc/{src => }/gui/Messages.py (96%) rename grc/{src => }/gui/NotebookPage.py (88%) rename grc/{src/platforms => }/gui/Param.py (98%) rename grc/{src => }/gui/ParamsDialog.py (99%) rename grc/{src/platforms => }/gui/Platform.py (100%) rename grc/{src/platforms => }/gui/Port.py (100%) rename grc/{src => }/gui/Preferences.py (100%) rename grc/{src => }/gui/StateCache.py (100%) rename grc/{src/platforms => }/gui/Utils.py (100%) rename grc/{src/grc_gnuradio => gui}/__init__.py (100%) rename grc/{src/platforms => }/python/Block.py (83%) rename grc/{src/platforms => }/python/Connection.py (86%) rename grc/{src/platforms/python/Constants.py.in => python/Constants.py} (72%) rename grc/{src/platforms => }/python/FlowGraph.py (78%) rename grc/{src/platforms => }/python/Generator.py (76%) rename grc/{src/platforms/python/utils => python}/Makefile.am (72%) rename grc/{src/platforms => }/python/Param.py (75%) rename grc/{src/platforms => }/python/Platform.py (62%) rename grc/{src/platforms => }/python/Port.py (92%) rename grc/{src/gui => python}/__init__.py (100%) rename grc/{data/platforms => }/python/block.dtd (92%) rename grc/{src/platforms/python/utils => python}/convert_hier.py (93%) rename grc/{data/platforms => }/python/default_flow_graph.grc (100%) rename grc/{src/platforms/python/utils => python}/expr_utils.py (95%) rename grc/{src/platforms/python/utils => python}/extract_docs.py (92%) rename grc/{data/platforms => }/python/flow_graph.tmpl (83%) delete mode 100644 grc/src/grc_gnuradio/Makefile.am delete mode 100644 grc/src/grc_gnuradio/blks2/Makefile.am delete mode 100644 grc/src/grc_gnuradio/usrp/Makefile.am delete mode 100644 grc/src/grc_gnuradio/wxgui/Makefile.am delete mode 100644 grc/src/gui/Constants.py delete mode 100644 grc/src/platforms/Makefile.am delete mode 100644 grc/src/platforms/__init__.py delete mode 100644 grc/src/platforms/base/Makefile.am delete mode 100644 grc/src/platforms/base/__init__.py delete mode 100644 grc/src/platforms/gui/__init__.py delete mode 100644 grc/src/platforms/python/Makefile.am delete mode 100644 grc/src/platforms/python/__init__.py delete mode 100644 grc/src/platforms/python/utils/__init__.py delete mode 100644 grc/src/utils/Makefile.am delete mode 100644 grc/src/utils/converter.py diff --git a/config/grc_grc.m4 b/config/grc_grc.m4 index d8bc02a2..ce23e3c2 100644 --- a/config/grc_grc.m4 +++ b/config/grc_grc.m4 @@ -1,4 +1,4 @@ -dnl Copyright 2008 Free Software Foundation, Inc. +dnl Copyright 2008, 2009 Free Software Foundation, Inc. dnl dnl This file is part of GNU Radio dnl @@ -47,27 +47,15 @@ AC_DEFUN([GRC_GRC],[ AC_SUBST(PYTHONW) AC_CONFIG_FILES([ \ - grc/src/grc_gnuradio/Makefile \ - grc/src/grc_gnuradio/wxgui/Makefile \ - grc/src/grc_gnuradio/blks2/Makefile \ - grc/src/grc_gnuradio/usrp/Makefile \ - grc/src/Makefile \ - grc/src/platforms/Makefile \ - grc/src/platforms/base/Makefile \ - grc/src/platforms/python/Makefile \ - grc/src/platforms/python/utils/Makefile \ - grc/src/platforms/gui/Makefile \ - grc/src/utils/Makefile \ - grc/src/gui/Makefile \ - grc/examples/Makefile \ grc/Makefile \ - grc/data/Makefile \ - grc/data/platforms/Makefile \ - grc/data/platforms/base/Makefile \ - grc/data/platforms/python/Makefile \ - grc/data/platforms/python/blocks/Makefile \ - grc/scripts/Makefile \ + grc/base/Makefile \ + grc/blocks/Makefile \ + grc/examples/Makefile \ grc/freedesktop/Makefile \ + grc/grc_gnuradio/Makefile \ + grc/gui/Makefile \ + grc/python/Makefile \ + grc/scripts/Makefile \ ]) GRC_BUILD_CONDITIONAL(grc) diff --git a/gr-wxgui/src/python/forms/converters.py b/gr-wxgui/src/python/forms/converters.py index 123aefeb..e535cb2d 100644 --- a/gr-wxgui/src/python/forms/converters.py +++ b/gr-wxgui/src/python/forms/converters.py @@ -85,22 +85,28 @@ class eval_converter(abstract_converter): Possible uses, set a complex number, constellation points. Used in text box. """ - def external_to_internal(self, s): - return str(s) + def __init__(self, formatter=lambda x: '%s'%(x)): + self._formatter = formatter + def external_to_internal(self, v): + return self._formatter(v) def internal_to_external(self, s): return eval(s) def help(self): return "Value must be evaluatable by python's eval." class str_converter(abstract_converter): + def __init__(self, formatter=lambda x: '%s'%(x)): + self._formatter = formatter def external_to_internal(self, v): - return str(v) + return self._formatter(v) def internal_to_external(self, s): return str(s) class int_converter(abstract_converter): + def __init__(self, formatter=lambda x: '%d'%round(x)): + self._formatter = formatter def external_to_internal(self, v): - return str(int(round(v))) + return self._formatter(v) def internal_to_external(self, s): return int(s, 0) def help(self): @@ -127,7 +133,8 @@ class slider_converter(abstract_converter): self._scaler = float(maximum - minimum)/num_steps self._cast = cast def external_to_internal(self, v): - return (v - self._offset)/self._scaler + #slider's internal representation is an integer + return int(round((v - self._offset)/self._scaler)) def internal_to_external(self, v): return self._cast(v*self._scaler + self._offset) def help(self): diff --git a/gr-wxgui/src/python/forms/forms.py b/gr-wxgui/src/python/forms/forms.py index 10f6a482..c69315b0 100644 --- a/gr-wxgui/src/python/forms/forms.py +++ b/gr-wxgui/src/python/forms/forms.py @@ -115,7 +115,6 @@ class _form_base(pubsub, wx.BoxSizer): self.subscribe(INT_KEY, update) self.subscribe(INT_KEY, self._translate_internal_to_external) self.subscribe(EXT_KEY, self._translate_external_to_internal) - if self._callback: self.subscribe(EXT_KEY, self._callback) def _translate_external_to_internal(self, external): try: @@ -134,6 +133,7 @@ class _form_base(pubsub, wx.BoxSizer): except Exception, e: self._err_msg(internal, e) self[EXT_KEY] = self[EXT_KEY] #reset to last good setting + if self._callback: self._callback(self[EXT_KEY]) def _err_msg(self, value, e): print >> sys.stderr, self, 'Error translating value: "%s"\n\t%s\n\t%s'%(value, e, self._converter.help()) diff --git a/grc/Makefile.am b/grc/Makefile.am index 0583e88b..a921fdd3 100644 --- a/grc/Makefile.am +++ b/grc/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2008 Free Software Foundation, Inc. +# Copyright 2008, 2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,13 +23,43 @@ include $(top_srcdir)/grc/Makefile.inc if PYTHON SUBDIRS = \ - data \ + base \ + blocks \ examples \ - scripts \ - src + grc_gnuradio \ + gui \ + python \ + scripts ## append freedesktop to the list of subdirs when xdg utils are present if XDG_UTILS SUBDIRS += freedesktop endif + +ourpythondir = $(grc_src_prefix) +ourpython_PYTHON = __init__.py + +etcdir = $(gr_sysconfdir) +dist_etc_DATA = grc.conf + +EXTRA_DIST = \ + $(srcdir)/__init__.py.in \ + $(srcdir)/grc.conf.in + +BUILT_SOURCES = \ + __init__.py \ + grc.conf + +__init__.py: $(srcdir)/__init__.py.in Makefile + sed \ + -e 's|@VERSION[@]|$(VERSION)|g' \ + $< > $@ + +grc.conf: $(srcdir)/grc.conf.in Makefile + sed \ + -e 's|@pythonw[@]|$(PYTHONW)|g' \ + -e 's|@blocksdir[@]|$(grc_blocksdir)|g' \ + -e 's|@docdir[@]|$(gr_docdir)|g' \ + $< > $@ + endif diff --git a/grc/Makefile.inc b/grc/Makefile.inc index c400e532..96ee11b6 100644 --- a/grc/Makefile.inc +++ b/grc/Makefile.inc @@ -20,8 +20,5 @@ # include $(top_srcdir)/Makefile.common -grc_gnuradio_prefix = $(pythondir)/grc_gnuradio grc_src_prefix = $(pythondir)/gnuradio/grc -grc_base_data_reldir = grc/base -grc_python_data_reldir = grc/python -grc_blocks_data_reldir = grc/blocks +grc_blocksdir = $(pkgdatadir)/grc/blocks diff --git a/grc/__init__.py.in b/grc/__init__.py.in new file mode 100644 index 00000000..4c146f95 --- /dev/null +++ b/grc/__init__.py.in @@ -0,0 +1,21 @@ +""" +Copyright 2009 Free Software Foundation, Inc. +This file is part of GNU Radio + +GNU Radio Companion 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 2 +of the License, or (at your option) any later version. + +GNU Radio Companion 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 program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +""" + +#package and version constants +VERSION = '@VERSION@' diff --git a/grc/src/platforms/base/Block.py b/grc/base/Block.py similarity index 92% rename from grc/src/platforms/base/Block.py rename to grc/base/Block.py index 25688472..867a14f5 100644 --- a/grc/src/platforms/base/Block.py +++ b/grc/base/Block.py @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ -from ... utils import odict +from . import odict from Element import Element from Param import Param from Port import Port @@ -44,7 +44,7 @@ class TemplateArg(UserDict): return str(self._param.to_code()) def __call__(self): - return self._param.evaluate() + return self._param.get_evaluated() class Block(Element): @@ -89,8 +89,8 @@ class Block(Element): for param in map(lambda n: self.get_parent().get_parent().Param(self, n), params): key = param.get_key() #test against repeated keys - try: assert(key not in self.get_param_keys()) - except AssertionError: self._exit_with_error('Key "%s" already exists in params'%key) + try: assert key not in self.get_param_keys() + except AssertionError: raise Exception, 'Key "%s" already exists in params'%key #store the param self._params[key] = param #create the source objects @@ -98,8 +98,8 @@ class Block(Element): for source in map(lambda n: self.get_parent().get_parent().Source(self, n), sources): key = source.get_key() #test against repeated keys - try: assert(key not in self.get_source_keys()) - except AssertionError: self._exit_with_error('Key "%s" already exists in sources'%key) + try: assert key not in self.get_source_keys() + except AssertionError: raise Exception, 'Key "%s" already exists in sources'%key #store the port self._sources[key] = source #create the sink objects @@ -107,8 +107,8 @@ class Block(Element): for sink in map(lambda n: self.get_parent().get_parent().Sink(self, n), sinks): key = sink.get_key() #test against repeated keys - try: assert(key not in self.get_sink_keys()) - except AssertionError: self._exit_with_error('Key "%s" already exists in sinks'%key) + try: assert key not in self.get_sink_keys() + except AssertionError: raise Exception, 'Key "%s" already exists in sinks'%key #store the port self._sinks[key] = sink #begin the testing @@ -141,11 +141,14 @@ class Block(Element): All ports and params must be valid. All checks must evaluate to true. """ + Element.validate(self) for c in self.get_params() + self.get_ports() + self.get_connections(): - try: assert(c.is_valid()) + try: + c.validate() + assert c.is_valid() except AssertionError: for msg in c.get_error_messages(): - self._add_error_message('>>> %s:\n\t%s'%(c, msg)) + self.add_error_message('>>> %s:\n\t%s'%(c, msg)) def __str__(self): return 'Block - %s - %s(%s)'%(self.get_id(), self.get_name(), self.get_key()) @@ -256,4 +259,3 @@ class Block(Element): #the key must exist in this block's params if key in self.get_param_keys(): self.get_param(key).set_value(value) - self.validate() diff --git a/grc/src/platforms/base/Connection.py b/grc/base/Connection.py similarity index 92% rename from grc/src/platforms/base/Connection.py rename to grc/base/Connection.py index b8b75ac1..94d4751b 100644 --- a/grc/src/platforms/base/Connection.py +++ b/grc/base/Connection.py @@ -1,5 +1,5 @@ """ -Copyright 2008 Free Software Foundation, Inc. +Copyright 2008, 2009 Free Software Foundation, Inc. This file is part of GNU Radio GNU Radio Companion is free software; you can redistribute it and/or @@ -18,7 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ from Element import Element -from ... utils import odict +from . import odict class Connection(Element): @@ -59,10 +59,11 @@ class Connection(Element): Validate the connections. The ports must match in type. """ + Element.validate(self) source_type = self.get_source().get_type() sink_type = self.get_sink().get_type() try: assert source_type == sink_type - except AssertionError: self._add_error_message('Source type "%s" does not match sink type "%s".'%(source_type, sink_type)) + except AssertionError: self.add_error_message('Source type "%s" does not match sink type "%s".'%(source_type, sink_type)) def get_enabled(self): """ diff --git a/grc/src/platforms/base/Constants.py.in b/grc/base/Constants.py similarity index 78% rename from grc/src/platforms/base/Constants.py.in rename to grc/base/Constants.py index da958a6f..ef45be8d 100644 --- a/grc/src/platforms/base/Constants.py.in +++ b/grc/base/Constants.py @@ -1,5 +1,5 @@ """ -Copyright 2008 Free Software Foundation, Inc. +Copyright 2008, 2009 Free Software Foundation, Inc. This file is part of GNU Radio GNU Radio Companion is free software; you can redistribute it and/or @@ -19,12 +19,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA import os -#package and version constants -PACKAGE = '@PACKAGE@' -VERSION = '@VERSION@' - -#setup paths -PKG_DIR = os.environ.get('GR_DATADIR', '@pkgdatadir@') -DATA_DIR = os.path.join(PKG_DIR, '@reldatadir@') +#data files +DATA_DIR = os.path.dirname(__file__) FLOW_GRAPH_DTD = os.path.join(DATA_DIR, 'flow_graph.dtd') BLOCK_TREE_DTD = os.path.join(DATA_DIR, 'block_tree.dtd') diff --git a/grc/src/platforms/base/Element.py b/grc/base/Element.py similarity index 66% rename from grc/src/platforms/base/Element.py rename to grc/base/Element.py index a16be912..16000c46 100644 --- a/grc/src/platforms/base/Element.py +++ b/grc/base/Element.py @@ -21,7 +21,6 @@ class Element(object): def __init__(self, parent=None): self._parent = parent - self._error_messages = [] self.flag() def test(self): @@ -31,45 +30,17 @@ class Element(object): """ pass - def validate(self): - """ - Validate the data in this element. - Set the error message non blank for errors. - Overload this method in sub-classes. - """ - pass - - def is_valid(self): - self._error_messages = []#reset err msgs - if self.get_enabled(): - try: self.validate() - except: pass - return not self.get_error_messages() + ################################################## + # Element Validation API + ################################################## + def validate(self): self._error_messages = list() + def is_valid(self): return not self.get_error_messages() or not self.get_enabled() + def add_error_message(self, msg): self._error_messages.append(msg) + def get_error_messages(self): return self._error_messages def get_enabled(self): return True - def _add_error_message(self, msg): - self._error_messages.append(msg) - - def get_error_messages(self): - return self._error_messages - - def get_parent(self): - return self._parent - - def _exit_with_error(self, error): - parent = self - #build hier list of elements - elements = list() - while(parent): - elements.insert(0, parent) - parent = parent.get_parent() - #build error string - err_str = ">>> Error:" - for i, element in enumerate(elements + [error]): - err_str = err_str + '\n' + ''.join(' '*(i+2)) + str(element) - err_str = err_str + '\n' - exit(err_str) + def get_parent(self): return self._parent ############################################## ## Update flagging diff --git a/grc/src/platforms/base/FlowGraph.py b/grc/base/FlowGraph.py similarity index 95% rename from grc/src/platforms/base/FlowGraph.py rename to grc/base/FlowGraph.py index 6aeef2fa..ea489e94 100644 --- a/grc/src/platforms/base/FlowGraph.py +++ b/grc/base/FlowGraph.py @@ -17,11 +17,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ -from ... utils import odict +from . import odict from Element import Element from Block import Block from Connection import Connection -from ... gui import Messages +from .. gui import Messages class FlowGraph(Element): @@ -58,7 +58,7 @@ class FlowGraph(Element): @param key the param key for the options block @return the value held by that param """ - return self._options_block.get_param(key).evaluate() + return self._options_block.get_param(key).get_evaluated() def is_flow_graph(self): return True @@ -152,9 +152,12 @@ class FlowGraph(Element): Validate the flow graph. All connections and blocks must be valid. """ + Element.validate(self) for c in self.get_elements(): - try: assert c.is_valid() - except AssertionError: self._add_error_message('Element "%s" is not valid.'%c) + try: + c.validate() + assert c.is_valid() + except AssertionError: self.add_error_message('Element "%s" is not valid.'%c) ############################################## ## Import/Export Methods @@ -195,6 +198,7 @@ class FlowGraph(Element): #only load the block when the block key was valid if block: block.import_data(block_n) else: Messages.send_error_load('Block key "%s" not found in %s'%(key, self.get_parent())) + self.validate() #validate all blocks before connections are made (in case of nports) #build the connections for connection_n in connections_n: #try to make the connection @@ -221,4 +225,3 @@ class FlowGraph(Element): #build the connection self.connect(source, sink) except AssertionError: Messages.send_error_load('Connection between %s(%s) and %s(%s) could not be made.'%(source_block_id, source_key, sink_block_id, sink_key)) - self.validate() diff --git a/grc/src/platforms/gui/Makefile.am b/grc/base/Makefile.am similarity index 81% rename from grc/src/platforms/gui/Makefile.am rename to grc/base/Makefile.am index 2e3972ef..e489601d 100644 --- a/grc/src/platforms/gui/Makefile.am +++ b/grc/base/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2008 Free Software Foundation, Inc. +# Copyright 2008, 2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,17 +21,21 @@ include $(top_srcdir)/grc/Makefile.inc -ourpythondir = $(grc_src_prefix)/platforms/gui - +ourpythondir = $(grc_src_prefix)/base ourpython_PYTHON = \ + odict.py \ + ParseXML.py \ Block.py \ - Colors.py \ - Constants.py \ Connection.py \ + Constants.py \ Element.py \ FlowGraph.py \ Param.py \ Platform.py \ Port.py \ - Utils.py \ __init__.py + +ourdatadir = $(grc_src_prefix)/base +dist_ourdata_DATA = \ + block_tree.dtd \ + flow_graph.dtd diff --git a/grc/src/platforms/base/Param.py b/grc/base/Param.py similarity index 84% rename from grc/src/platforms/base/Param.py rename to grc/base/Param.py index 81783c79..8166d54e 100644 --- a/grc/src/platforms/base/Param.py +++ b/grc/base/Param.py @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ -from ... utils import odict +from . import odict from Element import Element import pygtk pygtk.require('2.0') @@ -98,15 +98,15 @@ class Option(Element): opts = n.findall('opt') #test against opts when non enum try: assert self.get_parent().is_enum() or not opts - except AssertionError: self._exit_with_error('Options for non-enum types cannot have sub-options') + except AssertionError: raise Exception, 'Options for non-enum types cannot have sub-options' #extract opts for opt in opts: #separate the key:value try: key, value = opt.split(':') - except: self._exit_with_error('Error separating "%s" into key:value'%opt) + except: raise Exception, 'Error separating "%s" into key:value'%opt #test against repeated keys try: assert not self._opts.has_key(key) - except AssertionError: self._exit_with_error('Key "%s" already exists in option'%key) + except AssertionError: raise Exception, 'Key "%s" already exists in option'%key #store the option self._opts[key] = value @@ -146,24 +146,24 @@ class Param(Element): for option in map(lambda o: Option(self, o), n.findall('option')): key = option.get_key() #test against repeated keys - try: assert(key not in self.get_option_keys()) - except AssertionError: self._exit_with_error('Key "%s" already exists in options'%key) + try: assert key not in self.get_option_keys() + except AssertionError: raise Exception, 'Key "%s" already exists in options'%key #store the option self._options[key] = option #test the enum options if self.is_enum(): #test against options with identical keys - try: assert(len(set(self.get_option_keys())) == len(self._options)) - except AssertionError: self._exit_with_error('Options keys "%s" are not unique.'%self.get_option_keys()) + try: assert len(set(self.get_option_keys())) == len(self._options) + except AssertionError: raise Exception, 'Options keys "%s" are not unique.'%self.get_option_keys() #test against inconsistent keys in options opt_keys = self._options.values()[0].get_opt_keys() for option in self._options.values(): - try: assert(set(opt_keys) == set(option.get_opt_keys())) - except AssertionError: self._exit_with_error('Opt keys "%s" are not identical across all options.'%opt_keys) + try: assert set(opt_keys) == set(option.get_opt_keys()) + except AssertionError: raise Exception, 'Opt keys "%s" are not identical across all options.'%opt_keys #if a value is specified, it must be in the options keys self._value = value or self.get_option_keys()[0] - try: assert(self.get_value() in self.get_option_keys()) - except AssertionError: self._exit_with_error('The value "%s" is not in the possible values of "%s".'%(self.get_value(), self.get_option_keys())) + try: assert self.get_value() in self.get_option_keys() + except AssertionError: raise Exception, 'The value "%s" is not in the possible values of "%s".'%(self.get_value(), self.get_option_keys()) else: self._value = value or '' def test(self): @@ -177,21 +177,11 @@ class Param(Element): Validate the param. The value must be evaluated and type must a possible type. """ - try: - assert(self.get_type() in self.TYPES) - try: self.evaluate() - except: - #if the evaluate failed but added no error messages, add the generic one below - if not self.get_error_messages(): - self._add_error_message('Value "%s" cannot be evaluated.'%self.get_value()) - except AssertionError: self._add_error_message('Type "%s" is not a possible type.'%self.get_type()) - - def evaluate(self): - """ - Evaluate the value of this param. - @throw NotImplementedError - """ - raise NotImplementedError + Element.validate(self) + try: assert self.get_type() in self.TYPES + except AssertionError: self.add_error_message('Type "%s" is not a possible type.'%self.get_type()) + + def get_evaluated(self): raise NotImplementedError def to_code(self): """ diff --git a/grc/src/utils/ParseXML.py b/grc/base/ParseXML.py similarity index 99% rename from grc/src/utils/ParseXML.py rename to grc/base/ParseXML.py index d05b7b8b..078ebd07 100644 --- a/grc/src/utils/ParseXML.py +++ b/grc/base/ParseXML.py @@ -18,7 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ from lxml import etree -from .. utils import odict +from . import odict class XMLSyntaxError(Exception): def __init__(self, error_log): diff --git a/grc/src/platforms/base/Platform.py b/grc/base/Platform.py similarity index 55% rename from grc/src/platforms/base/Platform.py rename to grc/base/Platform.py index 35227d99..6cbe741d 100644 --- a/grc/src/platforms/base/Platform.py +++ b/grc/base/Platform.py @@ -18,69 +18,97 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ import os -from ... utils import ParseXML +import sys +from .. base import ParseXML from Element import Element as _Element from FlowGraph import FlowGraph as _FlowGraph from Connection import Connection as _Connection from Block import Block as _Block from Port import Port as _Port from Param import Param as _Param -from Constants import BLOCK_TREE_DTD +from Constants import BLOCK_TREE_DTD, FLOW_GRAPH_DTD class Platform(_Element): - def __init__(self, name, key, block_paths, block_dtd, block_tree, default_flow_graph, generator): + def __init__(self, name, version, key, + block_paths, block_dtd, default_flow_graph, generator, + license='', website=None, colors=[]): """ Make a platform from the arguments. @param name the platform name + @param version the version string @param key the unique platform key @param block_paths the file paths to blocks in this platform @param block_dtd the dtd validator for xml block wrappers - @param block_tree the nested tree of block keys and categories @param default_flow_graph the default flow graph file path - @param load_one a single file to load into this platform or None + @param generator the generator class for this platform + @param colors a list of title, color_spec tuples + @param license a multi-line license (first line is copyright) + @param website the website url for this platform @return a platform object """ _Element.__init__(self) self._name = name + self._version = version self._key = key + self._license = license + self._website = website self._block_paths = block_paths self._block_dtd = block_dtd - self._block_tree = block_tree self._default_flow_graph = default_flow_graph self._generator = generator + self._colors = colors #create a dummy flow graph for the blocks self._flow_graph = _Element(self) - #load the blocks - self._blocks = dict() - self._blocks_n = dict() + #search for *.xml files in the given search path + xml_files = list() for block_path in self._block_paths: - if os.path.isfile(block_path): self._load_blocks(block_path) + if os.path.isfile(block_path): xml_files.append(block_path) elif os.path.isdir(block_path): for dirpath, dirnames, filenames in os.walk(block_path): for filename in filter(lambda f: f.endswith('.xml'), filenames): - self._load_blocks(os.path.join(dirpath, filename)) - - def _load_blocks(self, f): + xml_files.append(os.path.join(dirpath, filename)) + #load the blocks + self._blocks = dict() + self._blocks_n = dict() + self._block_tree_files = list() + for xml_file in xml_files: + try: #try to add the xml file as a block wrapper + ParseXML.validate_dtd(xml_file, self._block_dtd) + n = ParseXML.from_file(xml_file).find('block') + #inject block wrapper path + n['block_wrapper_path'] = xml_file + block = self.Block(self._flow_graph, n) + key = block.get_key() + #test against repeated keys + try: + assert key not in self.get_block_keys() + #store the block + self._blocks[key] = block + self._blocks_n[key] = n + except AssertionError: + print >> sys.stderr, 'Warning: Block with key "%s" already exists.\n\tIgnoring: %s'%(key, xml_file) + except ParseXML.XMLSyntaxError, e: + try: #try to add the xml file as a block tree + ParseXML.validate_dtd(xml_file, BLOCK_TREE_DTD) + self._block_tree_files.append(xml_file) + except ParseXML.XMLSyntaxError, e: + print >> sys.stderr, 'Warning: Block validation failed:\n\t%s\n\tIgnoring: %s'%(e, xml_file) + except Exception, e: + print >> sys.stderr, 'Warning: Block loading failed:\n\t%s\n\tIgnoring: %s'%(e, xml_file) + + def parse_flow_graph(self, flow_graph_file): """ - Load the block wrappers from the file path. - The block wrapper must pass validation. - If any of the checks fail, exit with error. - @param f the file path + Parse a saved flow graph file. + Ensure that the file exists, and passes the dtd check. + @param flow_graph_file the flow graph file + @return nested data + @throws exception if the validation fails """ - try: ParseXML.validate_dtd(f, self._block_dtd) - except ParseXML.XMLSyntaxError, e: self._exit_with_error('Block definition "%s" failed: \n\t%s'%(f, e)) - n = ParseXML.from_file(f).find('block') - #inject block wrapper path - n['block_wrapper_path'] = f - block = self.Block(self._flow_graph, n) - key = block.get_key() - #test against repeated keys - try: assert(key not in self.get_block_keys()) - except AssertionError: self._exit_with_error('Key "%s" already exists in blocks'%key) - #store the block - self._blocks[key] = block - self._blocks_n[key] = n + flow_graph_file = flow_graph_file or self._default_flow_graph + open(flow_graph_file, 'r') #test open + ParseXML.validate_dtd(flow_graph_file, FLOW_GRAPH_DTD) + return ParseXML.from_file(flow_graph_file) def load_block_tree(self, block_tree): """ @@ -98,17 +126,19 @@ class Platform(_Element): map(lambda c: load_category(c, parent), cat_n.findall('cat')) #add blocks in this category for block_key in cat_n.findall('block'): + if block_key not in self.get_block_keys(): + print >> sys.stderr, 'Warning: Block key "%s" not found when loading category tree.'%(block_key) + continue block_tree.add_block(parent, self.get_block(block_key)) #load the block tree - f = self._block_tree - try: ParseXML.validate_dtd(f, BLOCK_TREE_DTD) - except ParseXML.XMLSyntaxError, e: self._exit_with_error('Block tree "%s" failed: \n\t%s'%(f, e)) - #add all blocks in the tree - load_category(ParseXML.from_file(f).find('cat')) - #add all other blocks, use the catgory + for block_tree_file in self._block_tree_files: + #recursivly add all blocks in the tree + load_category(ParseXML.from_file(block_tree_file).find('cat')) + #add all other blocks, use the catgory tag for block in self.get_blocks(): #blocks with empty categories are in the xml block tree or hidden - if block.get_category(): block_tree.add_block(block.get_category(), block) + if not block.get_category(): continue + block_tree.add_block(block.get_category(), block) def __str__(self): return 'Platform - %s(%s)'%(self.get_key(), self.get_name()) @@ -116,8 +146,6 @@ class Platform(_Element): def get_new_flow_graph(self): return self.FlowGraph(self) - def get_default_flow_graph(self): return self._default_flow_graph - def get_generator(self): return self._generator ############################################## @@ -129,8 +157,11 @@ class Platform(_Element): def get_new_block(self, flow_graph, key): return self.Block(flow_graph, n=self._blocks_n[key]) def get_name(self): return self._name - + def get_version(self): return self._version def get_key(self): return self._key + def get_license(self): return self._license + def get_website(self): return self._website + def get_colors(self): return self._colors ############################################## # Constructors diff --git a/grc/src/platforms/base/Port.py b/grc/base/Port.py similarity index 93% rename from grc/src/platforms/base/Port.py rename to grc/base/Port.py index f46a8119..f4e8e5e1 100644 --- a/grc/src/platforms/base/Port.py +++ b/grc/base/Port.py @@ -46,8 +46,9 @@ class Port(Element): Validate the port. The port must be non-empty and type must a possible type. """ - try: assert(self.get_type() in self.TYPES) - except AssertionError: self._add_error_message('Type "%s" is not a possible type.'%self.get_type()) + Element.validate(self) + try: assert self.get_type() in self.TYPES + except AssertionError: self.add_error_message('Type "%s" is not a possible type.'%self.get_type()) def __str__(self): if self.is_source(): diff --git a/grc/src/utils/__init__.py b/grc/base/__init__.py similarity index 100% rename from grc/src/utils/__init__.py rename to grc/base/__init__.py diff --git a/grc/data/platforms/base/block_tree.dtd b/grc/base/block_tree.dtd similarity index 100% rename from grc/data/platforms/base/block_tree.dtd rename to grc/base/block_tree.dtd diff --git a/grc/data/platforms/base/flow_graph.dtd b/grc/base/flow_graph.dtd similarity index 100% rename from grc/data/platforms/base/flow_graph.dtd rename to grc/base/flow_graph.dtd diff --git a/grc/src/utils/odict.py b/grc/base/odict.py similarity index 100% rename from grc/src/utils/odict.py rename to grc/base/odict.py diff --git a/grc/data/platforms/python/blocks/Makefile.am b/grc/blocks/Makefile.am similarity index 96% rename from grc/data/platforms/python/blocks/Makefile.am rename to grc/blocks/Makefile.am index d3b3564c..d6df9fca 100644 --- a/grc/data/platforms/python/blocks/Makefile.am +++ b/grc/blocks/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2008 Free Software Foundation, Inc. +# Copyright 2008, 2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,9 +21,9 @@ include $(top_srcdir)/grc/Makefile.inc -ourdatadir = $(pkgdatadir)/$(grc_blocks_data_reldir) - +ourdatadir = $(grc_blocksdir) dist_ourdata_DATA = \ + block_tree.xml \ audio_sink.xml \ audio_source.xml \ band_pass_filter.xml \ @@ -191,6 +191,7 @@ dist_ourdata_DATA = \ parameter.xml \ probe_function.xml \ random_source_x.xml \ + root_raised_cosine_filter.xml \ trellis_encoder_xx.xml \ trellis_metrics_x.xml \ trellis_permutation.xml \ @@ -207,8 +208,11 @@ dist_ourdata_DATA = \ usrp_simple_sink_x.xml \ usrp_simple_source_x.xml \ variable.xml \ + variable_check_box.xml \ variable_chooser.xml \ + variable_config.xml \ variable_slider.xml \ + variable_static_text.xml \ variable_text_box.xml \ wxgui_constellationsink2.xml \ wxgui_fftsink2.xml \ diff --git a/grc/data/platforms/python/blocks/audio_sink.xml b/grc/blocks/audio_sink.xml similarity index 100% rename from grc/data/platforms/python/blocks/audio_sink.xml rename to grc/blocks/audio_sink.xml diff --git a/grc/data/platforms/python/blocks/audio_source.xml b/grc/blocks/audio_source.xml similarity index 100% rename from grc/data/platforms/python/blocks/audio_source.xml rename to grc/blocks/audio_source.xml diff --git a/grc/data/platforms/python/blocks/band_pass_filter.xml b/grc/blocks/band_pass_filter.xml similarity index 59% rename from grc/data/platforms/python/blocks/band_pass_filter.xml rename to grc/blocks/band_pass_filter.xml index 2dac2960..e2e9acf4 100644 --- a/grc/data/platforms/python/blocks/band_pass_filter.xml +++ b/grc/blocks/band_pass_filter.xml @@ -9,36 +9,70 @@ band_pass_filter from gnuradio import gr from gnuradio.gr import firdes - gr.$(type)($decim, firdes.band_pass( + gr.$(type)(#if str($type).startswith('interp') then $interp else $decim#, firdes.$(type.fcn)( $gain, $samp_rate, $low_cutoff_freq, $high_cutoff_freq, $width, firdes.$window, $beta)) - set_taps(firdes.band_pass($gain, $samp_rate, $low_cutoff_freq, $high_cutoff_freq, $width, firdes.$window, $beta)) + set_taps(firdes.$(type.fcn)($gain, $samp_rate, $low_cutoff_freq, $high_cutoff_freq, $width, firdes.$window, $beta)) FIR Type type enum + + + + + + @@ -46,6 +80,14 @@ decim 1 int + #if str($type).startswith('interp') then 'all' else 'none'# + + + Interpolation + interp + 1 + int + #if str($type).startswith('interp') then 'none' else 'all'# Gain @@ -116,8 +158,6 @@ This filter is a convenience wrapper for an fir filter and a firdes taps generating function. -The decimation paramater becomes interpolation when the filter type is set to interpolating. - Sample rate, cutoff frequency, and transition width are in Hertz. The beta paramater only applies to the Kaiser window. diff --git a/grc/data/platforms/python/blocks/band_reject_filter.xml b/grc/blocks/band_reject_filter.xml similarity index 88% rename from grc/data/platforms/python/blocks/band_reject_filter.xml rename to grc/blocks/band_reject_filter.xml index ed6a5fa8..3b58f0b5 100644 --- a/grc/data/platforms/python/blocks/band_reject_filter.xml +++ b/grc/blocks/band_reject_filter.xml @@ -9,7 +9,7 @@ band_reject_filter from gnuradio import gr from gnuradio.gr import firdes - gr.$(type)($decim, firdes.band_reject( + gr.$(type)(#if str($type).startswith('interp') then $interp else $decim#, firdes.band_reject( $gain, $samp_rate, $low_cutoff_freq, $high_cutoff_freq, $width, firdes.$window, $beta)) set_taps(firdes.band_reject($gain, $samp_rate, $low_cutoff_freq, $high_cutoff_freq, $width, firdes.$window, $beta)) @@ -46,6 +46,14 @@ decim 1 int + #if str($type).startswith('interp') then 'all' else 'none'# + + + Interpolation + interp + 1 + int + #if str($type).startswith('interp') then 'none' else 'all'# Gain @@ -116,8 +124,6 @@ This filter is a convenience wrapper for an fir filter and a firdes taps generating function. -The decimation paramater becomes interpolation when the filter type is set to interpolating. - Sample rate, cutoff frequency, and transition width are in Hertz. The beta paramater only applies to the Kaiser window. diff --git a/grc/data/platforms/python/blocks/blks2_am_demod_cf.xml b/grc/blocks/blks2_am_demod_cf.xml similarity index 100% rename from grc/data/platforms/python/blocks/blks2_am_demod_cf.xml rename to grc/blocks/blks2_am_demod_cf.xml diff --git a/grc/data/platforms/python/blocks/blks2_analysis_filterbank.xml b/grc/blocks/blks2_analysis_filterbank.xml similarity index 100% rename from grc/data/platforms/python/blocks/blks2_analysis_filterbank.xml rename to grc/blocks/blks2_analysis_filterbank.xml diff --git a/grc/data/platforms/python/blocks/blks2_dxpsk_demod.xml b/grc/blocks/blks2_dxpsk_demod.xml similarity index 74% rename from grc/data/platforms/python/blocks/blks2_dxpsk_demod.xml rename to grc/blocks/blks2_dxpsk_demod.xml index 20c7bd7f..4c13b341 100644 --- a/grc/data/platforms/python/blocks/blks2_dxpsk_demod.xml +++ b/grc/blocks/blks2_dxpsk_demod.xml @@ -16,6 +16,8 @@ mu=$mu, omega_relative_limit=$omega_relative_limit, gray_code=$gray_code, + verbose=$verbose, + log=$log, ) Type @@ -84,6 +86,36 @@ False + + Verbose + verbose + False + bool + #if str($verbose) == 'False' then 'part' else 'none'# + + + + + Logging + log + False + bool + #if str($log) == 'False' then 'part' else 'none'# + + + in complex diff --git a/grc/data/platforms/python/blocks/blks2_dxpsk_mod.xml b/grc/blocks/blks2_dxpsk_mod.xml similarity index 66% rename from grc/data/platforms/python/blocks/blks2_dxpsk_mod.xml rename to grc/blocks/blks2_dxpsk_mod.xml index e165fe9b..28fd742f 100644 --- a/grc/data/platforms/python/blocks/blks2_dxpsk_mod.xml +++ b/grc/blocks/blks2_dxpsk_mod.xml @@ -12,6 +12,8 @@ samples_per_symbol=$samples_per_symbol, excess_bw=$excess_bw, gray_code=$gray_code, + verbose=$verbose, + log=$log, ) Type @@ -56,6 +58,36 @@ False + + Verbose + verbose + False + bool + #if str($verbose) == 'False' then 'part' else 'none'# + + + + + Logging + log + False + bool + #if str($log) == 'False' then 'part' else 'none'# + + + in byte diff --git a/grc/data/platforms/python/blocks/blks2_error_rate.xml b/grc/blocks/blks2_error_rate.xml similarity index 100% rename from grc/data/platforms/python/blocks/blks2_error_rate.xml rename to grc/blocks/blks2_error_rate.xml diff --git a/grc/data/platforms/python/blocks/blks2_fm_deemph.xml b/grc/blocks/blks2_fm_deemph.xml similarity index 100% rename from grc/data/platforms/python/blocks/blks2_fm_deemph.xml rename to grc/blocks/blks2_fm_deemph.xml diff --git a/grc/data/platforms/python/blocks/blks2_fm_demod_cf.xml b/grc/blocks/blks2_fm_demod_cf.xml similarity index 100% rename from grc/data/platforms/python/blocks/blks2_fm_demod_cf.xml rename to grc/blocks/blks2_fm_demod_cf.xml diff --git a/grc/data/platforms/python/blocks/blks2_fm_preemph.xml b/grc/blocks/blks2_fm_preemph.xml similarity index 100% rename from grc/data/platforms/python/blocks/blks2_fm_preemph.xml rename to grc/blocks/blks2_fm_preemph.xml diff --git a/grc/data/platforms/python/blocks/blks2_gmsk_demod.xml b/grc/blocks/blks2_gmsk_demod.xml similarity index 64% rename from grc/data/platforms/python/blocks/blks2_gmsk_demod.xml rename to grc/blocks/blks2_gmsk_demod.xml index c8103981..13ecb334 100644 --- a/grc/data/platforms/python/blocks/blks2_gmsk_demod.xml +++ b/grc/blocks/blks2_gmsk_demod.xml @@ -14,6 +14,8 @@ mu=$mu, omega_relative_limit=$omega_relative_limit, freq_error=$freq_error, + verbose=$verbose, + log=$log, ) Samples/Symbol @@ -45,6 +47,36 @@ 0.0 real + + Verbose + verbose + False + bool + #if str($verbose) == 'False' then 'part' else 'none'# + + + + + Logging + log + False + bool + #if str($log) == 'False' then 'part' else 'none'# + + + in complex diff --git a/grc/data/platforms/python/blocks/blks2_gmsk_mod.xml b/grc/blocks/blks2_gmsk_mod.xml similarity index 52% rename from grc/data/platforms/python/blocks/blks2_gmsk_mod.xml rename to grc/blocks/blks2_gmsk_mod.xml index ab57357e..e80264f1 100644 --- a/grc/data/platforms/python/blocks/blks2_gmsk_mod.xml +++ b/grc/blocks/blks2_gmsk_mod.xml @@ -11,6 +11,8 @@ blks2.gmsk_mod( samples_per_symbol=$samples_per_symbol, bt=$bt, + verbose=$verbose, + log=$log, ) Samples/Symbol @@ -24,6 +26,36 @@ 0.35 real + + Verbose + verbose + False + bool + #if str($verbose) == 'False' then 'part' else 'none'# + + + + + Logging + log + False + bool + #if str($log) == 'False' then 'part' else 'none'# + + + in byte diff --git a/grc/data/platforms/python/blocks/blks2_logpwrfft_x.xml b/grc/blocks/blks2_logpwrfft_x.xml similarity index 96% rename from grc/data/platforms/python/blocks/blks2_logpwrfft_x.xml rename to grc/blocks/blks2_logpwrfft_x.xml index ef49c443..79a3bfc4 100644 --- a/grc/data/platforms/python/blocks/blks2_logpwrfft_x.xml +++ b/grc/blocks/blks2_logpwrfft_x.xml @@ -18,6 +18,7 @@ ) set_sample_rate($sample_rate) set_avg_alpha($avg_alpha) + set_average($average) Input Type type @@ -57,17 +58,11 @@ 30 real - - Average Alpha - avg_alpha - 1.0 - real - Average average False - enum + bool + + Average Alpha + avg_alpha + 1.0 + real + in $type diff --git a/grc/data/platforms/python/blocks/blks2_nbfm_rx.xml b/grc/blocks/blks2_nbfm_rx.xml similarity index 100% rename from grc/data/platforms/python/blocks/blks2_nbfm_rx.xml rename to grc/blocks/blks2_nbfm_rx.xml diff --git a/grc/data/platforms/python/blocks/blks2_nbfm_tx.xml b/grc/blocks/blks2_nbfm_tx.xml similarity index 100% rename from grc/data/platforms/python/blocks/blks2_nbfm_tx.xml rename to grc/blocks/blks2_nbfm_tx.xml diff --git a/grc/data/platforms/python/blocks/blks2_ofdm_demod.xml b/grc/blocks/blks2_ofdm_demod.xml similarity index 100% rename from grc/data/platforms/python/blocks/blks2_ofdm_demod.xml rename to grc/blocks/blks2_ofdm_demod.xml diff --git a/grc/data/platforms/python/blocks/blks2_ofdm_mod.xml b/grc/blocks/blks2_ofdm_mod.xml similarity index 100% rename from grc/data/platforms/python/blocks/blks2_ofdm_mod.xml rename to grc/blocks/blks2_ofdm_mod.xml diff --git a/grc/data/platforms/python/blocks/blks2_packet_decoder.xml b/grc/blocks/blks2_packet_decoder.xml similarity index 100% rename from grc/data/platforms/python/blocks/blks2_packet_decoder.xml rename to grc/blocks/blks2_packet_decoder.xml diff --git a/grc/data/platforms/python/blocks/blks2_packet_encoder.xml b/grc/blocks/blks2_packet_encoder.xml similarity index 100% rename from grc/data/platforms/python/blocks/blks2_packet_encoder.xml rename to grc/blocks/blks2_packet_encoder.xml diff --git a/grc/data/platforms/python/blocks/blks2_qamx_demod.xml b/grc/blocks/blks2_qamx_demod.xml similarity index 75% rename from grc/data/platforms/python/blocks/blks2_qamx_demod.xml rename to grc/blocks/blks2_qamx_demod.xml index 93dbe4bb..e332495a 100644 --- a/grc/data/platforms/python/blocks/blks2_qamx_demod.xml +++ b/grc/blocks/blks2_qamx_demod.xml @@ -16,6 +16,8 @@ mu=$mu, omega_relative_limit=$omega_relative_limit, gray_code=$gray_code, + verbose=$verbose, + log=$log, ) Type @@ -88,6 +90,36 @@ False + + Verbose + verbose + False + bool + #if str($verbose) == 'False' then 'part' else 'none'# + + + + + Logging + log + False + bool + #if str($log) == 'False' then 'part' else 'none'# + + + in complex diff --git a/grc/data/platforms/python/blocks/blks2_qamx_mod.xml b/grc/blocks/blks2_qamx_mod.xml similarity index 67% rename from grc/data/platforms/python/blocks/blks2_qamx_mod.xml rename to grc/blocks/blks2_qamx_mod.xml index 25a9fb24..69a2e9e7 100644 --- a/grc/data/platforms/python/blocks/blks2_qamx_mod.xml +++ b/grc/blocks/blks2_qamx_mod.xml @@ -12,6 +12,8 @@ samples_per_symbol=$samples_per_symbol, excess_bw=$excess_bw, gray_code=$gray_code, + verbose=$verbose, + log=$log, ) Type @@ -60,6 +62,36 @@ False + + Verbose + verbose + False + bool + #if str($verbose) == 'False' then 'part' else 'none'# + + + + + Logging + log + False + bool + #if str($log) == 'False' then 'part' else 'none'# + + + in byte diff --git a/grc/data/platforms/python/blocks/blks2_rational_resampler_xxx.xml b/grc/blocks/blks2_rational_resampler_xxx.xml similarity index 100% rename from grc/data/platforms/python/blocks/blks2_rational_resampler_xxx.xml rename to grc/blocks/blks2_rational_resampler_xxx.xml diff --git a/grc/data/platforms/python/blocks/blks2_selector.xml b/grc/blocks/blks2_selector.xml similarity index 100% rename from grc/data/platforms/python/blocks/blks2_selector.xml rename to grc/blocks/blks2_selector.xml diff --git a/grc/data/platforms/python/blocks/blks2_standard_squelch.xml b/grc/blocks/blks2_standard_squelch.xml similarity index 100% rename from grc/data/platforms/python/blocks/blks2_standard_squelch.xml rename to grc/blocks/blks2_standard_squelch.xml diff --git a/grc/data/platforms/python/blocks/blks2_stream_to_vector_decimator.xml b/grc/blocks/blks2_stream_to_vector_decimator.xml similarity index 100% rename from grc/data/platforms/python/blocks/blks2_stream_to_vector_decimator.xml rename to grc/blocks/blks2_stream_to_vector_decimator.xml diff --git a/grc/data/platforms/python/blocks/blks2_synthesis_filterbank.xml b/grc/blocks/blks2_synthesis_filterbank.xml similarity index 100% rename from grc/data/platforms/python/blocks/blks2_synthesis_filterbank.xml rename to grc/blocks/blks2_synthesis_filterbank.xml diff --git a/grc/data/platforms/python/blocks/blks2_tcp_sink.xml b/grc/blocks/blks2_tcp_sink.xml similarity index 100% rename from grc/data/platforms/python/blocks/blks2_tcp_sink.xml rename to grc/blocks/blks2_tcp_sink.xml diff --git a/grc/data/platforms/python/blocks/blks2_tcp_source.xml b/grc/blocks/blks2_tcp_source.xml similarity index 100% rename from grc/data/platforms/python/blocks/blks2_tcp_source.xml rename to grc/blocks/blks2_tcp_source.xml diff --git a/grc/data/platforms/python/blocks/blks2_valve.xml b/grc/blocks/blks2_valve.xml similarity index 100% rename from grc/data/platforms/python/blocks/blks2_valve.xml rename to grc/blocks/blks2_valve.xml diff --git a/grc/data/platforms/python/blocks/blks2_variable_sink_x.xml b/grc/blocks/blks2_variable_sink_x.xml similarity index 100% rename from grc/data/platforms/python/blocks/blks2_variable_sink_x.xml rename to grc/blocks/blks2_variable_sink_x.xml diff --git a/grc/data/platforms/python/blocks/blks2_wfm_rcv.xml b/grc/blocks/blks2_wfm_rcv.xml similarity index 100% rename from grc/data/platforms/python/blocks/blks2_wfm_rcv.xml rename to grc/blocks/blks2_wfm_rcv.xml diff --git a/grc/data/platforms/python/blocks/blks2_wfm_rcv_pll.xml b/grc/blocks/blks2_wfm_rcv_pll.xml similarity index 100% rename from grc/data/platforms/python/blocks/blks2_wfm_rcv_pll.xml rename to grc/blocks/blks2_wfm_rcv_pll.xml diff --git a/grc/data/platforms/python/blocks/blks2_wfm_tx.xml b/grc/blocks/blks2_wfm_tx.xml similarity index 100% rename from grc/data/platforms/python/blocks/blks2_wfm_tx.xml rename to grc/blocks/blks2_wfm_tx.xml diff --git a/grc/data/platforms/python/block_tree.xml b/grc/blocks/block_tree.xml similarity index 98% rename from grc/data/platforms/python/block_tree.xml rename to grc/blocks/block_tree.xml index 074b7976..4f9b1cd2 100644 --- a/grc/data/platforms/python/block_tree.xml +++ b/grc/blocks/block_tree.xml @@ -162,6 +162,7 @@ high_pass_filter band_pass_filter band_reject_filter + root_raised_cosine_filter gr_fir_filter_xxx gr_interp_fir_filter_xxx @@ -265,7 +266,10 @@ variable variable_slider variable_chooser + variable_check_box variable_text_box + variable_static_text + variable_config parameter diff --git a/grc/data/platforms/python/blocks/const_source_x.xml b/grc/blocks/const_source_x.xml similarity index 100% rename from grc/data/platforms/python/blocks/const_source_x.xml rename to grc/blocks/const_source_x.xml diff --git a/grc/data/platforms/python/blocks/gr_add_const_vxx.xml b/grc/blocks/gr_add_const_vxx.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_add_const_vxx.xml rename to grc/blocks/gr_add_const_vxx.xml diff --git a/grc/data/platforms/python/blocks/gr_add_xx.xml b/grc/blocks/gr_add_xx.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_add_xx.xml rename to grc/blocks/gr_add_xx.xml diff --git a/grc/data/platforms/python/blocks/gr_agc2_xx.xml b/grc/blocks/gr_agc2_xx.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_agc2_xx.xml rename to grc/blocks/gr_agc2_xx.xml diff --git a/grc/data/platforms/python/blocks/gr_agc_xx.xml b/grc/blocks/gr_agc_xx.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_agc_xx.xml rename to grc/blocks/gr_agc_xx.xml diff --git a/grc/data/platforms/python/blocks/gr_and_xx.xml b/grc/blocks/gr_and_xx.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_and_xx.xml rename to grc/blocks/gr_and_xx.xml diff --git a/grc/data/platforms/python/blocks/gr_argmax_xx.xml b/grc/blocks/gr_argmax_xx.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_argmax_xx.xml rename to grc/blocks/gr_argmax_xx.xml diff --git a/grc/data/platforms/python/blocks/gr_binary_slicer_fb.xml b/grc/blocks/gr_binary_slicer_fb.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_binary_slicer_fb.xml rename to grc/blocks/gr_binary_slicer_fb.xml diff --git a/grc/data/platforms/python/blocks/gr_channel_model.xml b/grc/blocks/gr_channel_model.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_channel_model.xml rename to grc/blocks/gr_channel_model.xml diff --git a/grc/data/platforms/python/blocks/gr_char_to_float.xml b/grc/blocks/gr_char_to_float.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_char_to_float.xml rename to grc/blocks/gr_char_to_float.xml diff --git a/grc/data/platforms/python/blocks/gr_chunks_to_symbols.xml b/grc/blocks/gr_chunks_to_symbols.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_chunks_to_symbols.xml rename to grc/blocks/gr_chunks_to_symbols.xml diff --git a/grc/data/platforms/python/blocks/gr_clock_recovery_mm_xx.xml b/grc/blocks/gr_clock_recovery_mm_xx.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_clock_recovery_mm_xx.xml rename to grc/blocks/gr_clock_recovery_mm_xx.xml diff --git a/grc/data/platforms/python/blocks/gr_cma_equalizer_cc.xml b/grc/blocks/gr_cma_equalizer_cc.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_cma_equalizer_cc.xml rename to grc/blocks/gr_cma_equalizer_cc.xml diff --git a/grc/data/platforms/python/blocks/gr_complex_to_arg.xml b/grc/blocks/gr_complex_to_arg.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_complex_to_arg.xml rename to grc/blocks/gr_complex_to_arg.xml diff --git a/grc/data/platforms/python/blocks/gr_complex_to_float.xml b/grc/blocks/gr_complex_to_float.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_complex_to_float.xml rename to grc/blocks/gr_complex_to_float.xml diff --git a/grc/data/platforms/python/blocks/gr_complex_to_imag.xml b/grc/blocks/gr_complex_to_imag.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_complex_to_imag.xml rename to grc/blocks/gr_complex_to_imag.xml diff --git a/grc/data/platforms/python/blocks/gr_complex_to_interleaved_short.xml b/grc/blocks/gr_complex_to_interleaved_short.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_complex_to_interleaved_short.xml rename to grc/blocks/gr_complex_to_interleaved_short.xml diff --git a/grc/data/platforms/python/blocks/gr_complex_to_mag.xml b/grc/blocks/gr_complex_to_mag.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_complex_to_mag.xml rename to grc/blocks/gr_complex_to_mag.xml diff --git a/grc/data/platforms/python/blocks/gr_complex_to_mag_squared.xml b/grc/blocks/gr_complex_to_mag_squared.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_complex_to_mag_squared.xml rename to grc/blocks/gr_complex_to_mag_squared.xml diff --git a/grc/data/platforms/python/blocks/gr_complex_to_real.xml b/grc/blocks/gr_complex_to_real.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_complex_to_real.xml rename to grc/blocks/gr_complex_to_real.xml diff --git a/grc/data/platforms/python/blocks/gr_conjugate_cc.xml b/grc/blocks/gr_conjugate_cc.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_conjugate_cc.xml rename to grc/blocks/gr_conjugate_cc.xml diff --git a/grc/data/platforms/python/blocks/gr_constellation_decoder_cb.xml b/grc/blocks/gr_constellation_decoder_cb.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_constellation_decoder_cb.xml rename to grc/blocks/gr_constellation_decoder_cb.xml diff --git a/grc/data/platforms/python/blocks/gr_correlate_access_code_bb.xml b/grc/blocks/gr_correlate_access_code_bb.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_correlate_access_code_bb.xml rename to grc/blocks/gr_correlate_access_code_bb.xml diff --git a/grc/data/platforms/python/blocks/gr_costas_loop_cc.xml b/grc/blocks/gr_costas_loop_cc.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_costas_loop_cc.xml rename to grc/blocks/gr_costas_loop_cc.xml diff --git a/grc/data/platforms/python/blocks/gr_cpfsk_bc.xml b/grc/blocks/gr_cpfsk_bc.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_cpfsk_bc.xml rename to grc/blocks/gr_cpfsk_bc.xml diff --git a/grc/data/platforms/python/blocks/gr_dd_mpsk_sync_cc.xml b/grc/blocks/gr_dd_mpsk_sync_cc.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_dd_mpsk_sync_cc.xml rename to grc/blocks/gr_dd_mpsk_sync_cc.xml diff --git a/grc/data/platforms/python/blocks/gr_decode_ccsds_27_fb.xml b/grc/blocks/gr_decode_ccsds_27_fb.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_decode_ccsds_27_fb.xml rename to grc/blocks/gr_decode_ccsds_27_fb.xml diff --git a/grc/data/platforms/python/blocks/gr_deinterleave.xml b/grc/blocks/gr_deinterleave.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_deinterleave.xml rename to grc/blocks/gr_deinterleave.xml diff --git a/grc/data/platforms/python/blocks/gr_delay.xml b/grc/blocks/gr_delay.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_delay.xml rename to grc/blocks/gr_delay.xml diff --git a/grc/data/platforms/python/blocks/gr_descrambler_bb.xml b/grc/blocks/gr_descrambler_bb.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_descrambler_bb.xml rename to grc/blocks/gr_descrambler_bb.xml diff --git a/grc/data/platforms/python/blocks/gr_diff_decoder_bb.xml b/grc/blocks/gr_diff_decoder_bb.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_diff_decoder_bb.xml rename to grc/blocks/gr_diff_decoder_bb.xml diff --git a/grc/data/platforms/python/blocks/gr_diff_encoder_bb.xml b/grc/blocks/gr_diff_encoder_bb.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_diff_encoder_bb.xml rename to grc/blocks/gr_diff_encoder_bb.xml diff --git a/grc/data/platforms/python/blocks/gr_diff_phasor_cc.xml b/grc/blocks/gr_diff_phasor_cc.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_diff_phasor_cc.xml rename to grc/blocks/gr_diff_phasor_cc.xml diff --git a/grc/data/platforms/python/blocks/gr_divide_xx.xml b/grc/blocks/gr_divide_xx.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_divide_xx.xml rename to grc/blocks/gr_divide_xx.xml diff --git a/grc/data/platforms/python/blocks/gr_dpll_bb.xml b/grc/blocks/gr_dpll_bb.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_dpll_bb.xml rename to grc/blocks/gr_dpll_bb.xml diff --git a/grc/data/platforms/python/blocks/gr_encode_ccsds_27_bb.xml b/grc/blocks/gr_encode_ccsds_27_bb.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_encode_ccsds_27_bb.xml rename to grc/blocks/gr_encode_ccsds_27_bb.xml diff --git a/grc/data/platforms/python/blocks/gr_feedforward_agc_cc.xml b/grc/blocks/gr_feedforward_agc_cc.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_feedforward_agc_cc.xml rename to grc/blocks/gr_feedforward_agc_cc.xml diff --git a/grc/data/platforms/python/blocks/gr_fft_filter_xxx.xml b/grc/blocks/gr_fft_filter_xxx.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_fft_filter_xxx.xml rename to grc/blocks/gr_fft_filter_xxx.xml diff --git a/grc/data/platforms/python/blocks/gr_fft_vxx.xml b/grc/blocks/gr_fft_vxx.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_fft_vxx.xml rename to grc/blocks/gr_fft_vxx.xml diff --git a/grc/data/platforms/python/blocks/gr_file_sink.xml b/grc/blocks/gr_file_sink.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_file_sink.xml rename to grc/blocks/gr_file_sink.xml diff --git a/grc/data/platforms/python/blocks/gr_file_source.xml b/grc/blocks/gr_file_source.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_file_source.xml rename to grc/blocks/gr_file_source.xml diff --git a/grc/data/platforms/python/blocks/gr_filter_delay_fc.xml b/grc/blocks/gr_filter_delay_fc.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_filter_delay_fc.xml rename to grc/blocks/gr_filter_delay_fc.xml diff --git a/grc/data/platforms/python/blocks/gr_fir_filter_xxx.xml b/grc/blocks/gr_fir_filter_xxx.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_fir_filter_xxx.xml rename to grc/blocks/gr_fir_filter_xxx.xml diff --git a/grc/data/platforms/python/blocks/gr_float_to_char.xml b/grc/blocks/gr_float_to_char.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_float_to_char.xml rename to grc/blocks/gr_float_to_char.xml diff --git a/grc/data/platforms/python/blocks/gr_float_to_complex.xml b/grc/blocks/gr_float_to_complex.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_float_to_complex.xml rename to grc/blocks/gr_float_to_complex.xml diff --git a/grc/data/platforms/python/blocks/gr_float_to_short.xml b/grc/blocks/gr_float_to_short.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_float_to_short.xml rename to grc/blocks/gr_float_to_short.xml diff --git a/grc/data/platforms/python/blocks/gr_float_to_uchar.xml b/grc/blocks/gr_float_to_uchar.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_float_to_uchar.xml rename to grc/blocks/gr_float_to_uchar.xml diff --git a/grc/data/platforms/python/blocks/gr_fractional_interpolator_xx.xml b/grc/blocks/gr_fractional_interpolator_xx.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_fractional_interpolator_xx.xml rename to grc/blocks/gr_fractional_interpolator_xx.xml diff --git a/grc/data/platforms/python/blocks/gr_freq_xlating_fir_filter_xxx.xml b/grc/blocks/gr_freq_xlating_fir_filter_xxx.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_freq_xlating_fir_filter_xxx.xml rename to grc/blocks/gr_freq_xlating_fir_filter_xxx.xml diff --git a/grc/data/platforms/python/blocks/gr_frequency_modulator_fc.xml b/grc/blocks/gr_frequency_modulator_fc.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_frequency_modulator_fc.xml rename to grc/blocks/gr_frequency_modulator_fc.xml diff --git a/grc/data/platforms/python/blocks/gr_glfsr_source_x.xml b/grc/blocks/gr_glfsr_source_x.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_glfsr_source_x.xml rename to grc/blocks/gr_glfsr_source_x.xml diff --git a/grc/data/platforms/python/blocks/gr_goertzel_fc.xml b/grc/blocks/gr_goertzel_fc.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_goertzel_fc.xml rename to grc/blocks/gr_goertzel_fc.xml diff --git a/grc/data/platforms/python/blocks/gr_head.xml b/grc/blocks/gr_head.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_head.xml rename to grc/blocks/gr_head.xml diff --git a/grc/data/platforms/python/blocks/gr_hilbert_fc.xml b/grc/blocks/gr_hilbert_fc.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_hilbert_fc.xml rename to grc/blocks/gr_hilbert_fc.xml diff --git a/grc/data/platforms/python/blocks/gr_iir_filter_ffd.xml b/grc/blocks/gr_iir_filter_ffd.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_iir_filter_ffd.xml rename to grc/blocks/gr_iir_filter_ffd.xml diff --git a/grc/data/platforms/python/blocks/gr_integrate_xx.xml b/grc/blocks/gr_integrate_xx.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_integrate_xx.xml rename to grc/blocks/gr_integrate_xx.xml diff --git a/grc/data/platforms/python/blocks/gr_interleave.xml b/grc/blocks/gr_interleave.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_interleave.xml rename to grc/blocks/gr_interleave.xml diff --git a/grc/data/platforms/python/blocks/gr_interleaved_short_to_complex.xml b/grc/blocks/gr_interleaved_short_to_complex.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_interleaved_short_to_complex.xml rename to grc/blocks/gr_interleaved_short_to_complex.xml diff --git a/grc/data/platforms/python/blocks/gr_interp_fir_filter_xxx.xml b/grc/blocks/gr_interp_fir_filter_xxx.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_interp_fir_filter_xxx.xml rename to grc/blocks/gr_interp_fir_filter_xxx.xml diff --git a/grc/data/platforms/python/blocks/gr_iqcomp_cc.xml b/grc/blocks/gr_iqcomp_cc.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_iqcomp_cc.xml rename to grc/blocks/gr_iqcomp_cc.xml diff --git a/grc/data/platforms/python/blocks/gr_keep_one_in_n.xml b/grc/blocks/gr_keep_one_in_n.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_keep_one_in_n.xml rename to grc/blocks/gr_keep_one_in_n.xml diff --git a/grc/data/platforms/python/blocks/gr_kludge_copy.xml b/grc/blocks/gr_kludge_copy.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_kludge_copy.xml rename to grc/blocks/gr_kludge_copy.xml diff --git a/grc/data/platforms/python/blocks/gr_map_bb.xml b/grc/blocks/gr_map_bb.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_map_bb.xml rename to grc/blocks/gr_map_bb.xml diff --git a/grc/data/platforms/python/blocks/gr_max_xx.xml b/grc/blocks/gr_max_xx.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_max_xx.xml rename to grc/blocks/gr_max_xx.xml diff --git a/grc/data/platforms/python/blocks/gr_moving_average_xx.xml b/grc/blocks/gr_moving_average_xx.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_moving_average_xx.xml rename to grc/blocks/gr_moving_average_xx.xml diff --git a/grc/data/platforms/python/blocks/gr_mpsk_receiver_cc.xml b/grc/blocks/gr_mpsk_receiver_cc.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_mpsk_receiver_cc.xml rename to grc/blocks/gr_mpsk_receiver_cc.xml diff --git a/grc/data/platforms/python/blocks/gr_mpsk_sync_cc.xml b/grc/blocks/gr_mpsk_sync_cc.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_mpsk_sync_cc.xml rename to grc/blocks/gr_mpsk_sync_cc.xml diff --git a/grc/data/platforms/python/blocks/gr_multiply_const_vxx.xml b/grc/blocks/gr_multiply_const_vxx.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_multiply_const_vxx.xml rename to grc/blocks/gr_multiply_const_vxx.xml diff --git a/grc/data/platforms/python/blocks/gr_multiply_xx.xml b/grc/blocks/gr_multiply_xx.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_multiply_xx.xml rename to grc/blocks/gr_multiply_xx.xml diff --git a/grc/data/platforms/python/blocks/gr_mute_xx.xml b/grc/blocks/gr_mute_xx.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_mute_xx.xml rename to grc/blocks/gr_mute_xx.xml diff --git a/grc/data/platforms/python/blocks/gr_nlog10_ff.xml b/grc/blocks/gr_nlog10_ff.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_nlog10_ff.xml rename to grc/blocks/gr_nlog10_ff.xml diff --git a/grc/data/platforms/python/blocks/gr_noise_source_x.xml b/grc/blocks/gr_noise_source_x.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_noise_source_x.xml rename to grc/blocks/gr_noise_source_x.xml diff --git a/grc/data/platforms/python/blocks/gr_nop.xml b/grc/blocks/gr_nop.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_nop.xml rename to grc/blocks/gr_nop.xml diff --git a/grc/data/platforms/python/blocks/gr_not_xx.xml b/grc/blocks/gr_not_xx.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_not_xx.xml rename to grc/blocks/gr_not_xx.xml diff --git a/grc/data/platforms/python/blocks/gr_null_sink.xml b/grc/blocks/gr_null_sink.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_null_sink.xml rename to grc/blocks/gr_null_sink.xml diff --git a/grc/data/platforms/python/blocks/gr_null_source.xml b/grc/blocks/gr_null_source.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_null_source.xml rename to grc/blocks/gr_null_source.xml diff --git a/grc/data/platforms/python/blocks/gr_or_xx.xml b/grc/blocks/gr_or_xx.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_or_xx.xml rename to grc/blocks/gr_or_xx.xml diff --git a/grc/data/platforms/python/blocks/gr_packed_to_unpacked_xx.xml b/grc/blocks/gr_packed_to_unpacked_xx.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_packed_to_unpacked_xx.xml rename to grc/blocks/gr_packed_to_unpacked_xx.xml diff --git a/grc/data/platforms/python/blocks/gr_peak_detector2_fb.xml b/grc/blocks/gr_peak_detector2_fb.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_peak_detector2_fb.xml rename to grc/blocks/gr_peak_detector2_fb.xml diff --git a/grc/data/platforms/python/blocks/gr_peak_detector_xb.xml b/grc/blocks/gr_peak_detector_xb.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_peak_detector_xb.xml rename to grc/blocks/gr_peak_detector_xb.xml diff --git a/grc/data/platforms/python/blocks/gr_phase_modulator_fc.xml b/grc/blocks/gr_phase_modulator_fc.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_phase_modulator_fc.xml rename to grc/blocks/gr_phase_modulator_fc.xml diff --git a/grc/data/platforms/python/blocks/gr_pll_carriertracking_cc.xml b/grc/blocks/gr_pll_carriertracking_cc.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_pll_carriertracking_cc.xml rename to grc/blocks/gr_pll_carriertracking_cc.xml diff --git a/grc/data/platforms/python/blocks/gr_pll_freqdet_cf.xml b/grc/blocks/gr_pll_freqdet_cf.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_pll_freqdet_cf.xml rename to grc/blocks/gr_pll_freqdet_cf.xml diff --git a/grc/data/platforms/python/blocks/gr_pll_refout_cc.xml b/grc/blocks/gr_pll_refout_cc.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_pll_refout_cc.xml rename to grc/blocks/gr_pll_refout_cc.xml diff --git a/grc/data/platforms/python/blocks/gr_pn_correlator_cc.xml b/grc/blocks/gr_pn_correlator_cc.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_pn_correlator_cc.xml rename to grc/blocks/gr_pn_correlator_cc.xml diff --git a/grc/data/platforms/python/blocks/gr_probe_avg_mag_sqrd_x.xml b/grc/blocks/gr_probe_avg_mag_sqrd_x.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_probe_avg_mag_sqrd_x.xml rename to grc/blocks/gr_probe_avg_mag_sqrd_x.xml diff --git a/grc/data/platforms/python/blocks/gr_probe_density_b.xml b/grc/blocks/gr_probe_density_b.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_probe_density_b.xml rename to grc/blocks/gr_probe_density_b.xml diff --git a/grc/data/platforms/python/blocks/gr_probe_mpsk_snr_c.xml b/grc/blocks/gr_probe_mpsk_snr_c.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_probe_mpsk_snr_c.xml rename to grc/blocks/gr_probe_mpsk_snr_c.xml diff --git a/grc/data/platforms/python/blocks/gr_pwr_squelch_xx.xml b/grc/blocks/gr_pwr_squelch_xx.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_pwr_squelch_xx.xml rename to grc/blocks/gr_pwr_squelch_xx.xml diff --git a/grc/data/platforms/python/blocks/gr_quadrature_demod_cf.xml b/grc/blocks/gr_quadrature_demod_cf.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_quadrature_demod_cf.xml rename to grc/blocks/gr_quadrature_demod_cf.xml diff --git a/grc/data/platforms/python/blocks/gr_rational_resampler_base_xxx.xml b/grc/blocks/gr_rational_resampler_base_xxx.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_rational_resampler_base_xxx.xml rename to grc/blocks/gr_rational_resampler_base_xxx.xml diff --git a/grc/data/platforms/python/blocks/gr_repeat.xml b/grc/blocks/gr_repeat.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_repeat.xml rename to grc/blocks/gr_repeat.xml diff --git a/grc/data/platforms/python/blocks/gr_rms_xx.xml b/grc/blocks/gr_rms_xx.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_rms_xx.xml rename to grc/blocks/gr_rms_xx.xml diff --git a/grc/data/platforms/python/blocks/gr_sample_and_hold_xx.xml b/grc/blocks/gr_sample_and_hold_xx.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_sample_and_hold_xx.xml rename to grc/blocks/gr_sample_and_hold_xx.xml diff --git a/grc/data/platforms/python/blocks/gr_scrambler_bb.xml b/grc/blocks/gr_scrambler_bb.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_scrambler_bb.xml rename to grc/blocks/gr_scrambler_bb.xml diff --git a/grc/data/platforms/python/blocks/gr_short_to_float.xml b/grc/blocks/gr_short_to_float.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_short_to_float.xml rename to grc/blocks/gr_short_to_float.xml diff --git a/grc/data/platforms/python/blocks/gr_sig_source_x.xml b/grc/blocks/gr_sig_source_x.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_sig_source_x.xml rename to grc/blocks/gr_sig_source_x.xml diff --git a/grc/data/platforms/python/blocks/gr_simple_correlator.xml b/grc/blocks/gr_simple_correlator.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_simple_correlator.xml rename to grc/blocks/gr_simple_correlator.xml diff --git a/grc/data/platforms/python/blocks/gr_simple_framer.xml b/grc/blocks/gr_simple_framer.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_simple_framer.xml rename to grc/blocks/gr_simple_framer.xml diff --git a/grc/data/platforms/python/blocks/gr_simple_squelch_cc.xml b/grc/blocks/gr_simple_squelch_cc.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_simple_squelch_cc.xml rename to grc/blocks/gr_simple_squelch_cc.xml diff --git a/grc/data/platforms/python/blocks/gr_single_pole_iir_filter_xx.xml b/grc/blocks/gr_single_pole_iir_filter_xx.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_single_pole_iir_filter_xx.xml rename to grc/blocks/gr_single_pole_iir_filter_xx.xml diff --git a/grc/data/platforms/python/blocks/gr_skiphead.xml b/grc/blocks/gr_skiphead.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_skiphead.xml rename to grc/blocks/gr_skiphead.xml diff --git a/grc/data/platforms/python/blocks/gr_stream_to_streams.xml b/grc/blocks/gr_stream_to_streams.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_stream_to_streams.xml rename to grc/blocks/gr_stream_to_streams.xml diff --git a/grc/data/platforms/python/blocks/gr_stream_to_vector.xml b/grc/blocks/gr_stream_to_vector.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_stream_to_vector.xml rename to grc/blocks/gr_stream_to_vector.xml diff --git a/grc/data/platforms/python/blocks/gr_streams_to_stream.xml b/grc/blocks/gr_streams_to_stream.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_streams_to_stream.xml rename to grc/blocks/gr_streams_to_stream.xml diff --git a/grc/data/platforms/python/blocks/gr_streams_to_vector.xml b/grc/blocks/gr_streams_to_vector.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_streams_to_vector.xml rename to grc/blocks/gr_streams_to_vector.xml diff --git a/grc/data/platforms/python/blocks/gr_sub_xx.xml b/grc/blocks/gr_sub_xx.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_sub_xx.xml rename to grc/blocks/gr_sub_xx.xml diff --git a/grc/data/platforms/python/blocks/gr_threshold_ff.xml b/grc/blocks/gr_threshold_ff.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_threshold_ff.xml rename to grc/blocks/gr_threshold_ff.xml diff --git a/grc/data/platforms/python/blocks/gr_throttle.xml b/grc/blocks/gr_throttle.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_throttle.xml rename to grc/blocks/gr_throttle.xml diff --git a/grc/data/platforms/python/blocks/gr_uchar_to_float.xml b/grc/blocks/gr_uchar_to_float.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_uchar_to_float.xml rename to grc/blocks/gr_uchar_to_float.xml diff --git a/grc/data/platforms/python/blocks/gr_udp_sink.xml b/grc/blocks/gr_udp_sink.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_udp_sink.xml rename to grc/blocks/gr_udp_sink.xml diff --git a/grc/data/platforms/python/blocks/gr_udp_source.xml b/grc/blocks/gr_udp_source.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_udp_source.xml rename to grc/blocks/gr_udp_source.xml diff --git a/grc/data/platforms/python/blocks/gr_unpack_k_bits_bb.xml b/grc/blocks/gr_unpack_k_bits_bb.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_unpack_k_bits_bb.xml rename to grc/blocks/gr_unpack_k_bits_bb.xml diff --git a/grc/data/platforms/python/blocks/gr_unpacked_to_packed_xx.xml b/grc/blocks/gr_unpacked_to_packed_xx.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_unpacked_to_packed_xx.xml rename to grc/blocks/gr_unpacked_to_packed_xx.xml diff --git a/grc/data/platforms/python/blocks/gr_vco_f.xml b/grc/blocks/gr_vco_f.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_vco_f.xml rename to grc/blocks/gr_vco_f.xml diff --git a/grc/data/platforms/python/blocks/gr_vector_sink_x.xml b/grc/blocks/gr_vector_sink_x.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_vector_sink_x.xml rename to grc/blocks/gr_vector_sink_x.xml diff --git a/grc/data/platforms/python/blocks/gr_vector_source_x.xml b/grc/blocks/gr_vector_source_x.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_vector_source_x.xml rename to grc/blocks/gr_vector_source_x.xml diff --git a/grc/data/platforms/python/blocks/gr_vector_to_stream.xml b/grc/blocks/gr_vector_to_stream.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_vector_to_stream.xml rename to grc/blocks/gr_vector_to_stream.xml diff --git a/grc/data/platforms/python/blocks/gr_vector_to_streams.xml b/grc/blocks/gr_vector_to_streams.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_vector_to_streams.xml rename to grc/blocks/gr_vector_to_streams.xml diff --git a/grc/data/platforms/python/blocks/gr_wavfile_sink.xml b/grc/blocks/gr_wavfile_sink.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_wavfile_sink.xml rename to grc/blocks/gr_wavfile_sink.xml diff --git a/grc/data/platforms/python/blocks/gr_wavfile_source.xml b/grc/blocks/gr_wavfile_source.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_wavfile_source.xml rename to grc/blocks/gr_wavfile_source.xml diff --git a/grc/data/platforms/python/blocks/gr_xor_xx.xml b/grc/blocks/gr_xor_xx.xml similarity index 100% rename from grc/data/platforms/python/blocks/gr_xor_xx.xml rename to grc/blocks/gr_xor_xx.xml diff --git a/grc/data/platforms/python/blocks/high_pass_filter.xml b/grc/blocks/high_pass_filter.xml similarity index 88% rename from grc/data/platforms/python/blocks/high_pass_filter.xml rename to grc/blocks/high_pass_filter.xml index 0673fd12..5be916fa 100644 --- a/grc/data/platforms/python/blocks/high_pass_filter.xml +++ b/grc/blocks/high_pass_filter.xml @@ -9,7 +9,7 @@ high_pass_filter from gnuradio import gr from gnuradio.gr import firdes - gr.$(type)($decim, firdes.high_pass( + gr.$(type)(#if str($type).startswith('interp') then $interp else $decim#, firdes.high_pass( $gain, $samp_rate, $cutoff_freq, $width, firdes.$window, $beta)) set_taps(firdes.high_pass($gain, $samp_rate, $cutoff_freq, $width, firdes.$window, $beta)) @@ -46,6 +46,14 @@ decim 1 int + #if str($type).startswith('interp') then 'all' else 'none'# + + + Interpolation + interp + 1 + int + #if str($type).startswith('interp') then 'none' else 'all'# Gain @@ -111,8 +119,6 @@ This filter is a convenience wrapper for an fir filter and a firdes taps generating function. -The decimation paramater becomes interpolation when the filter type is set to interpolating. - Sample rate, cutoff frequency, and transition width are in Hertz. The beta paramater only applies to the Kaiser window. diff --git a/grc/data/platforms/python/blocks/import.xml b/grc/blocks/import.xml similarity index 100% rename from grc/data/platforms/python/blocks/import.xml rename to grc/blocks/import.xml diff --git a/grc/data/platforms/python/blocks/low_pass_filter.xml b/grc/blocks/low_pass_filter.xml similarity index 88% rename from grc/data/platforms/python/blocks/low_pass_filter.xml rename to grc/blocks/low_pass_filter.xml index 1e8802c8..27120c04 100644 --- a/grc/data/platforms/python/blocks/low_pass_filter.xml +++ b/grc/blocks/low_pass_filter.xml @@ -9,7 +9,7 @@ low_pass_filter from gnuradio import gr from gnuradio.gr import firdes - gr.$(type)($decim, firdes.low_pass( + gr.$(type)(#if str($type).startswith('interp') then $interp else $decim#, firdes.low_pass( $gain, $samp_rate, $cutoff_freq, $width, firdes.$window, $beta)) set_taps(firdes.low_pass($gain, $samp_rate, $cutoff_freq, $width, firdes.$window, $beta)) @@ -46,6 +46,14 @@ decim 1 int + #if str($type).startswith('interp') then 'all' else 'none'# + + + Interpolation + interp + 1 + int + #if str($type).startswith('interp') then 'none' else 'all'# Gain @@ -111,8 +119,6 @@ This filter is a convenience wrapper for an fir filter and a firdes taps generating function. -The decimation paramater becomes interpolation when the filter type is set to interpolating. - Sample rate, cutoff frequency, and transition width are in Hertz. The beta paramater only applies to the Kaiser window. diff --git a/grc/data/platforms/python/blocks/note.xml b/grc/blocks/note.xml similarity index 100% rename from grc/data/platforms/python/blocks/note.xml rename to grc/blocks/note.xml diff --git a/grc/data/platforms/python/blocks/options.xml b/grc/blocks/options.xml similarity index 77% rename from grc/data/platforms/python/blocks/options.xml rename to grc/blocks/options.xml index 82f30902..06ede76f 100644 --- a/grc/data/platforms/python/blocks/options.xml +++ b/grc/blocks/options.xml @@ -20,23 +20,27 @@ from gnuradio.eng_option import eng_option #end if + self.start($autostart) Title title - untitled + string + #if $title() then 'none' else 'part'# Author author - unknown + string + #if $author() then 'none' else 'part'# Description description - gnuradio flow graph + string + #if $description() then 'none' else 'part'# Window Size @@ -50,6 +54,7 @@ from gnuradio.eng_option import eng_option generate_options wx_gui enum + #if $generate_options() == 'wx_gui' then 'part' else 'none'# + + Realtime Scheduling realtime_scheduling @@ -106,6 +134,9 @@ The window size (width, height) must be between (300, 300) and (4096, 4096). The generate options controls the type of code generated. \ Non-graphical flow graphs should avoid using graphical sinks or graphical variable controls. +In a graphical application, \ +autostart can be controlled by a variable to start and stop the flowgraph at runtime. + The id of this block determines the name of the generated file and the name of the class. \ For example, an id of my_block will generate the file my_block.py and class my_block(gr.... diff --git a/grc/data/platforms/python/blocks/pad_sink.xml b/grc/blocks/pad_sink.xml similarity index 100% rename from grc/data/platforms/python/blocks/pad_sink.xml rename to grc/blocks/pad_sink.xml diff --git a/grc/data/platforms/python/blocks/pad_source.xml b/grc/blocks/pad_source.xml similarity index 100% rename from grc/data/platforms/python/blocks/pad_source.xml rename to grc/blocks/pad_source.xml diff --git a/grc/data/platforms/python/blocks/parameter.xml b/grc/blocks/parameter.xml similarity index 97% rename from grc/data/platforms/python/blocks/parameter.xml rename to grc/blocks/parameter.xml index e7bf6156..d3bab94c 100644 --- a/grc/data/platforms/python/blocks/parameter.xml +++ b/grc/blocks/parameter.xml @@ -7,6 +7,7 @@ Parameter parameter + self.$(id) = $(id) $value Label diff --git a/grc/data/platforms/python/blocks/probe_function.xml b/grc/blocks/probe_function.xml similarity index 100% rename from grc/data/platforms/python/blocks/probe_function.xml rename to grc/blocks/probe_function.xml diff --git a/grc/data/platforms/python/blocks/random_source_x.xml b/grc/blocks/random_source_x.xml similarity index 100% rename from grc/data/platforms/python/blocks/random_source_x.xml rename to grc/blocks/random_source_x.xml diff --git a/grc/blocks/root_raised_cosine_filter.xml b/grc/blocks/root_raised_cosine_filter.xml new file mode 100644 index 00000000..81688d29 --- /dev/null +++ b/grc/blocks/root_raised_cosine_filter.xml @@ -0,0 +1,101 @@ + + + + Root Raised Cosine Filter + root_raised_cosine_filter + from gnuradio import gr + from gnuradio.gr import firdes + gr.$(type)(#if str($type).startswith('interp') then $interp else $decim#, firdes.root_raised_cosine( + $gain, $samp_rate, $sym_rate, $alpha, $ntaps)) + set_taps(firdes.root_raised_cosine($gain, $samp_rate, $sym_rate, $alpha, $ntaps)) + + FIR Type + type + enum + + + + + + + Decimation + decim + 1 + int + #if str($type).startswith('interp') then 'all' else 'none'# + + + Interpolation + interp + 1 + int + #if str($type).startswith('interp') then 'none' else 'all'# + + + Gain + gain + 1 + real + + + Sample Rate + samp_rate + samp_rate + real + + + Symbol Rate + sym_rate + 1.0 + real + + + Alpha + alpha + 0.35 + real + + + Num Taps + ntaps + 11*samp_rate + int + + + in + $type.input + + + out + $type.output + + +This filter is a convenience wrapper for an fir filter and a firdes taps generating function. + +Sample rate in Hertz. + + diff --git a/grc/data/platforms/python/blocks/trellis_encoder_xx.xml b/grc/blocks/trellis_encoder_xx.xml similarity index 100% rename from grc/data/platforms/python/blocks/trellis_encoder_xx.xml rename to grc/blocks/trellis_encoder_xx.xml diff --git a/grc/data/platforms/python/blocks/trellis_metrics_x.xml b/grc/blocks/trellis_metrics_x.xml similarity index 100% rename from grc/data/platforms/python/blocks/trellis_metrics_x.xml rename to grc/blocks/trellis_metrics_x.xml diff --git a/grc/data/platforms/python/blocks/trellis_permutation.xml b/grc/blocks/trellis_permutation.xml similarity index 100% rename from grc/data/platforms/python/blocks/trellis_permutation.xml rename to grc/blocks/trellis_permutation.xml diff --git a/grc/data/platforms/python/blocks/trellis_siso_combined_f.xml b/grc/blocks/trellis_siso_combined_f.xml similarity index 100% rename from grc/data/platforms/python/blocks/trellis_siso_combined_f.xml rename to grc/blocks/trellis_siso_combined_f.xml diff --git a/grc/data/platforms/python/blocks/trellis_siso_f.xml b/grc/blocks/trellis_siso_f.xml similarity index 100% rename from grc/data/platforms/python/blocks/trellis_siso_f.xml rename to grc/blocks/trellis_siso_f.xml diff --git a/grc/data/platforms/python/blocks/trellis_viterbi_combined_xx.xml b/grc/blocks/trellis_viterbi_combined_xx.xml similarity index 100% rename from grc/data/platforms/python/blocks/trellis_viterbi_combined_xx.xml rename to grc/blocks/trellis_viterbi_combined_xx.xml diff --git a/grc/data/platforms/python/blocks/trellis_viterbi_x.xml b/grc/blocks/trellis_viterbi_x.xml similarity index 100% rename from grc/data/platforms/python/blocks/trellis_viterbi_x.xml rename to grc/blocks/trellis_viterbi_x.xml diff --git a/grc/data/platforms/python/blocks/usrp2_probe.xml b/grc/blocks/usrp2_probe.xml similarity index 100% rename from grc/data/platforms/python/blocks/usrp2_probe.xml rename to grc/blocks/usrp2_probe.xml diff --git a/grc/data/platforms/python/blocks/usrp2_sink_xxxx.xml b/grc/blocks/usrp2_sink_xxxx.xml similarity index 100% rename from grc/data/platforms/python/blocks/usrp2_sink_xxxx.xml rename to grc/blocks/usrp2_sink_xxxx.xml diff --git a/grc/data/platforms/python/blocks/usrp2_source_xxxx.xml b/grc/blocks/usrp2_source_xxxx.xml similarity index 100% rename from grc/data/platforms/python/blocks/usrp2_source_xxxx.xml rename to grc/blocks/usrp2_source_xxxx.xml diff --git a/grc/data/platforms/python/blocks/usrp_dual_sink_x.xml b/grc/blocks/usrp_dual_sink_x.xml similarity index 100% rename from grc/data/platforms/python/blocks/usrp_dual_sink_x.xml rename to grc/blocks/usrp_dual_sink_x.xml diff --git a/grc/data/platforms/python/blocks/usrp_dual_source_x.xml b/grc/blocks/usrp_dual_source_x.xml similarity index 100% rename from grc/data/platforms/python/blocks/usrp_dual_source_x.xml rename to grc/blocks/usrp_dual_source_x.xml diff --git a/grc/data/platforms/python/blocks/usrp_probe.xml b/grc/blocks/usrp_probe.xml similarity index 100% rename from grc/data/platforms/python/blocks/usrp_probe.xml rename to grc/blocks/usrp_probe.xml diff --git a/grc/data/platforms/python/blocks/usrp_simple_sink_x.xml b/grc/blocks/usrp_simple_sink_x.xml similarity index 100% rename from grc/data/platforms/python/blocks/usrp_simple_sink_x.xml rename to grc/blocks/usrp_simple_sink_x.xml diff --git a/grc/data/platforms/python/blocks/usrp_simple_source_x.xml b/grc/blocks/usrp_simple_source_x.xml similarity index 100% rename from grc/data/platforms/python/blocks/usrp_simple_source_x.xml rename to grc/blocks/usrp_simple_source_x.xml diff --git a/grc/data/platforms/python/blocks/variable.xml b/grc/blocks/variable.xml similarity index 80% rename from grc/data/platforms/python/blocks/variable.xml rename to grc/blocks/variable.xml index d620e160..afee0f5d 100644 --- a/grc/data/platforms/python/blocks/variable.xml +++ b/grc/blocks/variable.xml @@ -7,7 +7,9 @@ Variable variable - $value + self.$(id) = $(id) = $value + + self.set_$(id)($value) Value value diff --git a/grc/blocks/variable_check_box.xml b/grc/blocks/variable_check_box.xml new file mode 100644 index 00000000..59ace503 --- /dev/null +++ b/grc/blocks/variable_check_box.xml @@ -0,0 +1,75 @@ + + + + Variable Check Box + variable_check_box + from gnuradio.wxgui import forms + self.$(id) = $(id) = $value + self.$(id)_check_box = forms.check_box( + parent=self.GetWin(), + value=self.$id, + callback=self.set_$(id), + #if $label() + label=$label, + #else + label='$id', + #end if + true=$true, + false=$false, +) +#set $grid_pos = $grid_pos() +#if not grid_pos +self.Add(self.$(id)_check_box) +#else +self.GridAdd(self.$(id)_check_box, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos[3]) +#end if + self.set_$(id)($value) + self.$(id)_check_box.set_value($id) + + Label + label + + string + #if $label() then 'none' else 'part'# + + + Default Value + value + True + raw + + + True + true + True + raw + + + False + false + False + raw + + + Grid Position + grid_pos + + grid_pos + + $value in ($true, $false) + +This block creates a variable with a check box form. \ +Leave the label blank to use the variable id as the label. + +A check box form can switch between two states; \ +the default being True and False. \ +Override True and False to use alternative states. + +Use the Grid Position (row, column, row span, column span) to position the graphical element in the window. + + diff --git a/grc/data/platforms/python/blocks/variable_chooser.xml b/grc/blocks/variable_chooser.xml similarity index 87% rename from grc/data/platforms/python/blocks/variable_chooser.xml rename to grc/blocks/variable_chooser.xml index 3ca33045..2f0e9bbf 100644 --- a/grc/data/platforms/python/blocks/variable_chooser.xml +++ b/grc/blocks/variable_chooser.xml @@ -10,13 +10,11 @@ Variable Chooser variable_chooser from gnuradio.wxgui import forms - $value -self['$id'] = $id -self.subscribe('$id', self.set_$(id)) -self._$(id)_control = forms.$(type)( + self.$(id) = $(id) = $value + self.$(id)_chooser = forms.$(type)( parent=self.GetWin(), - ps=self, - key='$id', + value=self.$id, + callback=self.set_$(id), #if $label() label=$label, #else @@ -30,10 +28,12 @@ self._$(id)_control = forms.$(type)( ) #set $grid_pos = $grid_pos() #if not grid_pos -self.Add(self._$(id)_control) +self.Add(self.$(id)_chooser) #else -self.GridAdd(self._$(id)_control, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos[3]) +self.GridAdd(self.$(id)_chooser, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos[3]) #end if + self.set_$(id)($value) + self.$(id)_chooser.set_value($id) Label label diff --git a/grc/blocks/variable_config.xml b/grc/blocks/variable_config.xml new file mode 100644 index 00000000..f62a3def --- /dev/null +++ b/grc/blocks/variable_config.xml @@ -0,0 +1,86 @@ + + + + Variable Config + variable_config + import ConfigParser + self._$(id)_config = ConfigParser.ConfigParser() +self._$(id)_config.read($config_file) +if not self._$(id)_config.has_section($section): + self._$(id)_config.add_section($section) +try: $(id) = self._$(id)_config.$(type.get)($section, $option) +except: $(id) = $value +self.$(id) = $(id) + + self.set_$(id)($value) + self._$(id)_config.set($section, $option, str($writeback)) +self._$(id)_config.write(open($config_file, 'w')) + + Default Value + value + 0 + $type + + + Type + type + real + enum + + + + + + + Config File + config_file + default + file_open + + + Section + section + main + string + + + Option + option + key + string + + + WriteBack + writeback + None + raw + + +This block represents a variable that can be read from a config file. + +To save the value back into the config file: \ +enter the name of another variable into the writeback param. \ +When the other variable is changed at runtime, the config file will be re-written. + + diff --git a/grc/data/platforms/python/blocks/variable_slider.xml b/grc/blocks/variable_slider.xml similarity index 81% rename from grc/data/platforms/python/blocks/variable_slider.xml rename to grc/blocks/variable_slider.xml index f8a5543f..6a7c400e 100644 --- a/grc/data/platforms/python/blocks/variable_slider.xml +++ b/grc/blocks/variable_slider.xml @@ -9,15 +9,13 @@ Variable Slider variable_slider from gnuradio.wxgui import forms - $value -self['$id'] = $id -self.subscribe('$id', self.set_$(id)) -self._$(id)_sizer = wx.BoxSizer(wx.VERTICAL) -forms.text_box( + self.$(id) = $(id) = $value + _$(id)_sizer = wx.BoxSizer(wx.VERTICAL) +self.$(id)_text_box = forms.text_box( parent=self.GetWin(), - sizer=self._$(id)_sizer, - ps=self, - key='$id', + sizer=_$(id)_sizer, + value=self.$id, + callback=self.set_$(id), #if $label() label=$label, #else @@ -26,11 +24,11 @@ forms.text_box( converter=forms.$(converver)(), proportion=0, ) -forms.slider( +self.$(id)_slider = forms.slider( parent=self.GetWin(), - sizer=self._$(id)_sizer, - ps=self, - key='$id', + sizer=_$(id)_sizer, + value=self.$id, + callback=self.set_$(id), minimum=$min, maximum=$max, num_steps=$num_steps, @@ -40,10 +38,13 @@ forms.slider( ) #set $grid_pos = $grid_pos() #if not grid_pos -self.Add(self._$(id)_sizer) +self.Add(_$(id)_sizer) #else -self.GridAdd(self._$(id)_sizer, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos[3]) +self.GridAdd(_$(id)_sizer, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos[3]) #end if + self.set_$(id)($value) + self.$(id)_slider.set_value($id) + self.$(id)_text_box.set_value($id) Label label diff --git a/grc/blocks/variable_static_text.xml b/grc/blocks/variable_static_text.xml new file mode 100644 index 00000000..0179eb6e --- /dev/null +++ b/grc/blocks/variable_static_text.xml @@ -0,0 +1,88 @@ + + + + Variable Static Text + variable_static_text + from gnuradio.wxgui import forms + self.$(id) = $(id) = $value + self.$(id)_static_text = forms.static_text( + parent=self.GetWin(), + value=self.$id, + callback=self.set_$(id), + #if $label() + label=$label, + #else + label='$id', + #end if + #if $formatter() + converter=forms.$(converver)(formatter=$formatter), + #else + converter=forms.$(converver)(), + #end if +) +#set $grid_pos = $grid_pos() +#if not grid_pos +self.Add(self.$(id)_static_text) +#else +self.GridAdd(self.$(id)_static_text, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos[3]) +#end if + self.set_$(id)($value) + self.$(id)_static_text.set_value($id) + + Label + label + + string + #if $label() then 'none' else 'part'# + + + Default Value + value + 0 + raw + + + Converter + converver + float_converter + enum + + + + + + Formatter + formatter + None + raw + part + + + Grid Position + grid_pos + + grid_pos + + +This block creates a variable with a static text form. \ +Leave the label blank to use the variable id as the label. + +Format should be a function/lambda that converts a value into a string or None for the default formatter. + +Use the Grid Position (row, column, row span, column span) to position the graphical element in the window. + + diff --git a/grc/data/platforms/python/blocks/variable_text_box.xml b/grc/blocks/variable_text_box.xml similarity index 70% rename from grc/data/platforms/python/blocks/variable_text_box.xml rename to grc/blocks/variable_text_box.xml index b5acd9d2..2bcb680f 100644 --- a/grc/data/platforms/python/blocks/variable_text_box.xml +++ b/grc/blocks/variable_text_box.xml @@ -9,26 +9,30 @@ Variable Text Box variable_text_box from gnuradio.wxgui import forms - $value -self['$id'] = $id -self.subscribe('$id', self.set_$(id)) -self._$(id)_control = forms.text_box( + self.$(id) = $(id) = $value + self.$(id)_text_box = forms.text_box( parent=self.GetWin(), - ps=self, - key='$id', + value=self.$id, + callback=self.set_$(id), #if $label() label=$label, #else label='$id', #end if + #if $formatter() + converter=forms.$(converver)(formatter=$formatter), + #else converter=forms.$(converver)(), + #end if ) #set $grid_pos = $grid_pos() #if not grid_pos -self.Add(self._$(id)_control) +self.Add(self.$(id)_text_box) #else -self.GridAdd(self._$(id)_control, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos[3]) +self.GridAdd(self.$(id)_text_box, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos[3]) #end if + self.set_$(id)($value) + self.$(id)_text_box.set_value($id) Label label @@ -64,6 +68,13 @@ self.GridAdd(self._$(id)_control, $grid_pos[0], $grid_pos[1], $grid_pos[2], $gri eval_converter + + Formatter + formatter + None + raw + part + Grid Position grid_pos @@ -74,6 +85,8 @@ self.GridAdd(self._$(id)_control, $grid_pos[0], $grid_pos[1], $grid_pos[2], $gri This block creates a variable with a text box. \ Leave the label blank to use the variable id as the label. +Format should be a function/lambda that converts a value into a string or None for the default formatter. + Use the Grid Position (row, column, row span, column span) to position the graphical element in the window. diff --git a/grc/data/platforms/python/blocks/wxgui_constellationsink2.xml b/grc/blocks/wxgui_constellationsink2.xml similarity index 100% rename from grc/data/platforms/python/blocks/wxgui_constellationsink2.xml rename to grc/blocks/wxgui_constellationsink2.xml diff --git a/grc/data/platforms/python/blocks/wxgui_fftsink2.xml b/grc/blocks/wxgui_fftsink2.xml similarity index 100% rename from grc/data/platforms/python/blocks/wxgui_fftsink2.xml rename to grc/blocks/wxgui_fftsink2.xml diff --git a/grc/data/platforms/python/blocks/wxgui_histosink2.xml b/grc/blocks/wxgui_histosink2.xml similarity index 100% rename from grc/data/platforms/python/blocks/wxgui_histosink2.xml rename to grc/blocks/wxgui_histosink2.xml diff --git a/grc/data/platforms/python/blocks/wxgui_numbersink2.xml b/grc/blocks/wxgui_numbersink2.xml similarity index 100% rename from grc/data/platforms/python/blocks/wxgui_numbersink2.xml rename to grc/blocks/wxgui_numbersink2.xml diff --git a/grc/data/platforms/python/blocks/wxgui_scopesink2.xml b/grc/blocks/wxgui_scopesink2.xml similarity index 100% rename from grc/data/platforms/python/blocks/wxgui_scopesink2.xml rename to grc/blocks/wxgui_scopesink2.xml diff --git a/grc/data/platforms/python/blocks/wxgui_waterfallsink2.xml b/grc/blocks/wxgui_waterfallsink2.xml similarity index 100% rename from grc/data/platforms/python/blocks/wxgui_waterfallsink2.xml rename to grc/blocks/wxgui_waterfallsink2.xml diff --git a/grc/data/platforms/python/blocks/xmlrpc_client.xml b/grc/blocks/xmlrpc_client.xml similarity index 100% rename from grc/data/platforms/python/blocks/xmlrpc_client.xml rename to grc/blocks/xmlrpc_client.xml diff --git a/grc/data/platforms/python/blocks/xmlrpc_server.xml b/grc/blocks/xmlrpc_server.xml similarity index 100% rename from grc/data/platforms/python/blocks/xmlrpc_server.xml rename to grc/blocks/xmlrpc_server.xml diff --git a/grc/cpp/README b/grc/cpp/README new file mode 100644 index 00000000..3eccc5db --- /dev/null +++ b/grc/cpp/README @@ -0,0 +1,5 @@ +GRC could be used to generate c++ based flowgraphs: + +* A few base and gui classes would be overridden. +* Block info could be extracted from the doxygen xml. +* New flowgraph templates would be designed. diff --git a/grc/data/Makefile.am b/grc/data/Makefile.am deleted file mode 100644 index 961c183f..00000000 --- a/grc/data/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright 2008 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -include $(top_srcdir)/grc/Makefile.inc - -SUBDIRS = platforms diff --git a/grc/data/platforms/Makefile.am b/grc/data/platforms/Makefile.am deleted file mode 100644 index d26abd9b..00000000 --- a/grc/data/platforms/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright 2008 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -include $(top_srcdir)/grc/Makefile.inc - -SUBDIRS = base python diff --git a/grc/data/platforms/base/Makefile.am b/grc/data/platforms/base/Makefile.am deleted file mode 100644 index d323a144..00000000 --- a/grc/data/platforms/base/Makefile.am +++ /dev/null @@ -1,28 +0,0 @@ -# -# Copyright 2008 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -include $(top_srcdir)/grc/Makefile.inc - -ourdatadir = $(pkgdatadir)/$(grc_base_data_reldir) - -dist_ourdata_DATA = \ - block_tree.dtd \ - flow_graph.dtd diff --git a/grc/data/platforms/python/Makefile.am b/grc/data/platforms/python/Makefile.am deleted file mode 100644 index 3b056b3f..00000000 --- a/grc/data/platforms/python/Makefile.am +++ /dev/null @@ -1,32 +0,0 @@ -# -# Copyright 2008 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -include $(top_srcdir)/grc/Makefile.inc - -SUBDIRS = blocks - -ourdatadir = $(pkgdatadir)/$(grc_python_data_reldir) - -dist_ourdata_DATA = \ - block.dtd \ - block_tree.xml \ - default_flow_graph.grc \ - flow_graph.tmpl diff --git a/grc/grc.conf.in b/grc/grc.conf.in new file mode 100644 index 00000000..37a04997 --- /dev/null +++ b/grc/grc.conf.in @@ -0,0 +1,9 @@ +# This file contains system wide configuration data for GNU Radio. +# You may override any setting on a per-user basis by editing +# ~/.gnuradio/config.conf + +[grc] +pythonw = @pythonw@ +doc_dir = @docdir@ +global_blocks_path = @blocksdir@ +local_blocks_path = diff --git a/grc/src/Makefile.am b/grc/grc_gnuradio/Makefile.am similarity index 55% rename from grc/src/Makefile.am rename to grc/grc_gnuradio/Makefile.am index a726d493..9a15eb0e 100644 --- a/grc/src/Makefile.am +++ b/grc/grc_gnuradio/Makefile.am @@ -19,14 +19,31 @@ # Boston, MA 02110-1301, USA. # -include $(top_srcdir)/grc/Makefile.inc +include $(top_srcdir)/Makefile.common -SUBDIRS = \ - platforms \ - grc_gnuradio \ - gui \ - utils +grc_gnuradio_prefix = $(pythondir)/grc_gnuradio -ourpythondir = $(grc_src_prefix) +rootpythondir = $(grc_gnuradio_prefix) +rootpython_PYTHON = __init__.py -ourpython_PYTHON = __init__.py +blks2pythondir = $(grc_gnuradio_prefix)/blks2 +blks2python_PYTHON = \ + blks2/__init__.py \ + blks2/error_rate.py \ + blks2/packet.py \ + blks2/probe.py \ + blks2/selector.py \ + blks2/tcp.py \ + blks2/variable_sink.py + +usrppythondir = $(grc_gnuradio_prefix)/usrp +usrppython_PYTHON = \ + usrp/__init__.py \ + usrp/common.py \ + usrp/dual_usrp.py \ + usrp/simple_usrp.py + +wxguipythondir = $(grc_gnuradio_prefix)/wxgui +wxguipython_PYTHON = \ + wxgui/__init__.py \ + wxgui/top_block_gui.py diff --git a/grc/grc_gnuradio/README b/grc/grc_gnuradio/README new file mode 100644 index 00000000..5a89da54 --- /dev/null +++ b/grc/grc_gnuradio/README @@ -0,0 +1,14 @@ +This is the grc_gnuradio module. +It contains supplemental python modules that grc uses at runtime. +The supplemental modules are meant to mimic modules in gnuradio. +These will be phased-out as new functionaility is merged into gnuradio. + +The blk2s module wraps many blocks in blks2 and gives them streaming outputs. +Will be phased-out by new message passing implementations. +Other blks2 blocks will hopefully make their way into blks2impl. + +The usrp module contains the simple and dual usrp wrappers. +Will be phased-out by generic usrp and/or new usrp api. + +The wxgui module contains a top_block + wxgui frame. +Will be phased-out by gui.py in wxgui and a new top block template. diff --git a/grc/src/__init__.py b/grc/grc_gnuradio/__init__.py similarity index 100% rename from grc/src/__init__.py rename to grc/grc_gnuradio/__init__.py diff --git a/grc/src/grc_gnuradio/blks2/__init__.py b/grc/grc_gnuradio/blks2/__init__.py similarity index 100% rename from grc/src/grc_gnuradio/blks2/__init__.py rename to grc/grc_gnuradio/blks2/__init__.py diff --git a/grc/src/grc_gnuradio/blks2/error_rate.py b/grc/grc_gnuradio/blks2/error_rate.py similarity index 100% rename from grc/src/grc_gnuradio/blks2/error_rate.py rename to grc/grc_gnuradio/blks2/error_rate.py diff --git a/grc/src/grc_gnuradio/blks2/packet.py b/grc/grc_gnuradio/blks2/packet.py similarity index 100% rename from grc/src/grc_gnuradio/blks2/packet.py rename to grc/grc_gnuradio/blks2/packet.py diff --git a/grc/src/grc_gnuradio/blks2/probe.py b/grc/grc_gnuradio/blks2/probe.py similarity index 100% rename from grc/src/grc_gnuradio/blks2/probe.py rename to grc/grc_gnuradio/blks2/probe.py diff --git a/grc/src/grc_gnuradio/blks2/selector.py b/grc/grc_gnuradio/blks2/selector.py similarity index 100% rename from grc/src/grc_gnuradio/blks2/selector.py rename to grc/grc_gnuradio/blks2/selector.py diff --git a/grc/src/grc_gnuradio/blks2/tcp.py b/grc/grc_gnuradio/blks2/tcp.py similarity index 100% rename from grc/src/grc_gnuradio/blks2/tcp.py rename to grc/grc_gnuradio/blks2/tcp.py diff --git a/grc/src/grc_gnuradio/blks2/variable_sink.py b/grc/grc_gnuradio/blks2/variable_sink.py similarity index 100% rename from grc/src/grc_gnuradio/blks2/variable_sink.py rename to grc/grc_gnuradio/blks2/variable_sink.py diff --git a/grc/src/grc_gnuradio/usrp/__init__.py b/grc/grc_gnuradio/usrp/__init__.py similarity index 100% rename from grc/src/grc_gnuradio/usrp/__init__.py rename to grc/grc_gnuradio/usrp/__init__.py diff --git a/grc/src/grc_gnuradio/usrp/common.py b/grc/grc_gnuradio/usrp/common.py similarity index 100% rename from grc/src/grc_gnuradio/usrp/common.py rename to grc/grc_gnuradio/usrp/common.py diff --git a/grc/src/grc_gnuradio/usrp/dual_usrp.py b/grc/grc_gnuradio/usrp/dual_usrp.py similarity index 100% rename from grc/src/grc_gnuradio/usrp/dual_usrp.py rename to grc/grc_gnuradio/usrp/dual_usrp.py diff --git a/grc/src/grc_gnuradio/usrp/simple_usrp.py b/grc/grc_gnuradio/usrp/simple_usrp.py similarity index 100% rename from grc/src/grc_gnuradio/usrp/simple_usrp.py rename to grc/grc_gnuradio/usrp/simple_usrp.py diff --git a/grc/src/grc_gnuradio/wxgui/__init__.py b/grc/grc_gnuradio/wxgui/__init__.py similarity index 100% rename from grc/src/grc_gnuradio/wxgui/__init__.py rename to grc/grc_gnuradio/wxgui/__init__.py diff --git a/grc/src/grc_gnuradio/wxgui/top_block_gui.py b/grc/grc_gnuradio/wxgui/top_block_gui.py similarity index 92% rename from grc/src/grc_gnuradio/wxgui/top_block_gui.py rename to grc/grc_gnuradio/wxgui/top_block_gui.py index f3305d7c..97bed04a 100644 --- a/grc/src/grc_gnuradio/wxgui/top_block_gui.py +++ b/grc/grc_gnuradio/wxgui/top_block_gui.py @@ -21,11 +21,10 @@ import wx import sys, os from gnuradio import gr -from gnuradio.gr.pubsub import pubsub default_gui_size = (200, 100) -class top_block_gui(gr.top_block, pubsub): +class top_block_gui(gr.top_block): """gr top block with wx gui app and grid sizer.""" def __init__(self, title='', size=default_gui_size, icon=None): @@ -38,7 +37,6 @@ class top_block_gui(gr.top_block, pubsub): """ #initialize gr.top_block.__init__(self) - pubsub.__init__(self) self._size = size #set the icon if icon and os.path.isfile(icon): self._icon = icon @@ -74,7 +72,14 @@ class top_block_gui(gr.top_block, pubsub): """ self._wx_grid.Add(win, wx.GBPosition(row, col), wx.GBSpan(row_span, col_span), wx.EXPAND) - def Run(self): + def start(self, start=True): + if start: + gr.top_block.start(self) + else: + gr.top_block.stop(self) + gr.top_block.wait(self) + + def Run(self, autostart=True): """ Setup the wx gui elements. Start the gr top block. @@ -95,6 +100,6 @@ class top_block_gui(gr.top_block, pubsub): self._wx_frame.Show() self._wx_app.SetTopWindow(self._wx_frame) #start flow graph - gr.top_block.start(self) + self.start(autostart) #blocking main loop self._wx_app.MainLoop() diff --git a/grc/src/gui/ActionHandler.py b/grc/gui/ActionHandler.py similarity index 98% rename from grc/src/gui/ActionHandler.py rename to grc/gui/ActionHandler.py index 06e998b3..2c411a17 100644 --- a/grc/src/gui/ActionHandler.py +++ b/grc/gui/ActionHandler.py @@ -28,9 +28,9 @@ import gobject import Preferences from threading import Thread import Messages -from .. utils import ParseXML +from .. base import ParseXML import random -from .. platforms.gui.Platform import Platform +from Platform import Platform from MainWindow import MainWindow from ParamsDialog import ParamsDialog import Dialogs @@ -64,7 +64,7 @@ class ActionHandler: self.get_focus_flag = self.main_window.get_focus_flag #setup the messages Messages.register_messenger(self.main_window.add_report_line) - Messages.send_init() + Messages.send_init(platform) #initialize self.init_file_paths = file_paths self.handle_states(Actions.APPLICATION_INITIALIZE) @@ -133,6 +133,7 @@ class ActionHandler: Actions.FLOW_GRAPH_OPEN, Actions.FLOW_GRAPH_SAVE_AS, Actions.FLOW_GRAPH_CLOSE, Actions.ABOUT_WINDOW_DISPLAY, Actions.FLOW_GRAPH_SCREEN_CAPTURE, Actions.HELP_WINDOW_DISPLAY, + Actions.COLORS_WINDOW_DISPLAY, ): Actions.get_action_from_name(action).set_sensitive(True) if not self.init_file_paths: self.init_file_paths = Preferences.files_open() @@ -233,9 +234,11 @@ class ActionHandler: # Window stuff ################################################## elif state == Actions.ABOUT_WINDOW_DISPLAY: - Dialogs.AboutDialog() + Dialogs.AboutDialog(self.get_flow_graph().get_parent()) elif state == Actions.HELP_WINDOW_DISPLAY: Dialogs.HelpDialog() + elif state == Actions.COLORS_WINDOW_DISPLAY: + Dialogs.ColorsDialog(self.get_flow_graph().get_parent()) ################################################## # Param Modifications ################################################## diff --git a/grc/src/gui/Actions.py b/grc/gui/Actions.py similarity index 98% rename from grc/src/gui/Actions.py rename to grc/gui/Actions.py index 9b687df7..3695e09e 100644 --- a/grc/src/gui/Actions.py +++ b/grc/gui/Actions.py @@ -57,6 +57,7 @@ FLOW_GRAPH_KILL = 'flow graph kill' FLOW_GRAPH_SCREEN_CAPTURE = 'flow graph screen capture' ABOUT_WINDOW_DISPLAY = 'about window display' HELP_WINDOW_DISPLAY = 'help window display' +COLORS_WINDOW_DISPLAY = 'colors window display' ###################################################################################################### # Action Key Map @@ -131,6 +132,7 @@ _actions_list = ( gtk.Action(BLOCK_PASTE, '_Paste', 'Paste', gtk.STOCK_PASTE), gtk.Action(ABOUT_WINDOW_DISPLAY, '_About', 'About this program', gtk.STOCK_ABOUT), gtk.Action(HELP_WINDOW_DISPLAY, '_Help', 'Usage Tips', gtk.STOCK_HELP), + gtk.Action(COLORS_WINDOW_DISPLAY, '_Colors', 'Color Mapping', gtk.STOCK_DIALOG_INFO), gtk.Action(FLOW_GRAPH_GEN, '_Generate', 'Generate the flow graph', gtk.STOCK_CONVERT), gtk.Action(FLOW_GRAPH_EXEC, '_Execute', 'Execute the flow graph', gtk.STOCK_EXECUTE), gtk.Action(FLOW_GRAPH_KILL, '_Kill', 'Kill the flow graph', gtk.STOCK_STOP), diff --git a/grc/src/gui/Bars.py b/grc/gui/Bars.py similarity index 99% rename from grc/src/gui/Bars.py rename to grc/gui/Bars.py index 52e7ba1f..e0c547eb 100644 --- a/grc/src/gui/Bars.py +++ b/grc/gui/Bars.py @@ -88,6 +88,7 @@ MENU_BAR_LIST = ( ]), (gtk.Action('Help', '_Help', None, None), [ Actions.HELP_WINDOW_DISPLAY, + Actions.COLORS_WINDOW_DISPLAY, None, Actions.ABOUT_WINDOW_DISPLAY, ]), diff --git a/grc/src/platforms/gui/Block.py b/grc/gui/Block.py similarity index 99% rename from grc/src/platforms/gui/Block.py rename to grc/gui/Block.py index 862a5939..0496f0a2 100644 --- a/grc/src/platforms/gui/Block.py +++ b/grc/gui/Block.py @@ -20,7 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA from Element import Element import Utils import Colors -from ... utils import odict +from .. base import odict from Constants import BORDER_PROXIMITY_SENSITIVITY from Constants import \ BLOCK_LABEL_PADDING, \ diff --git a/grc/src/gui/BlockTreeWindow.py b/grc/gui/BlockTreeWindow.py similarity index 99% rename from grc/src/gui/BlockTreeWindow.py rename to grc/gui/BlockTreeWindow.py index 99056252..379c4a6a 100644 --- a/grc/src/gui/BlockTreeWindow.py +++ b/grc/gui/BlockTreeWindow.py @@ -18,7 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ from Constants import DEFAULT_BLOCKS_WINDOW_WIDTH, DND_TARGETS -from .. platforms.gui import Utils +import Utils import pygtk pygtk.require('2.0') import gtk diff --git a/grc/src/platforms/gui/Colors.py b/grc/gui/Colors.py similarity index 100% rename from grc/src/platforms/gui/Colors.py rename to grc/gui/Colors.py diff --git a/grc/src/platforms/gui/Connection.py b/grc/gui/Connection.py similarity index 100% rename from grc/src/platforms/gui/Connection.py rename to grc/gui/Connection.py diff --git a/grc/src/platforms/gui/Constants.py b/grc/gui/Constants.py similarity index 71% rename from grc/src/platforms/gui/Constants.py rename to grc/gui/Constants.py index 90c8c1c3..7fabcfc0 100644 --- a/grc/src/platforms/gui/Constants.py +++ b/grc/gui/Constants.py @@ -17,28 +17,67 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ +import pygtk +pygtk.require('2.0') +import gtk +import os + +##default path for the open/save dialogs +DEFAULT_FILE_PATH = os.getcwd() + +##file extensions +IMAGE_FILE_EXTENSION = '.png' + +##name for new/unsaved flow graphs +NEW_FLOGRAPH_TITLE = 'untitled' + +##main window constraints +MIN_WINDOW_WIDTH = 600 +MIN_WINDOW_HEIGHT = 400 +##dialog constraints +MIN_DIALOG_WIDTH = 500 +MIN_DIALOG_HEIGHT = 500 +##default sizes +DEFAULT_BLOCKS_WINDOW_WIDTH = 100 +DEFAULT_REPORTS_WINDOW_WIDTH = 100 + +##The size of the state saving cache in the flow graph (for undo/redo functionality) +STATE_CACHE_SIZE = 42 + +##Shared targets for drag and drop of blocks +DND_TARGETS = [('STRING', gtk.TARGET_SAME_APP, 0)] + #label constraint dimensions LABEL_SEPARATION = 3 BLOCK_LABEL_PADDING = 7 PORT_LABEL_PADDING = 2 + #port constraint dimensions PORT_SEPARATION = 17 PORT_BORDER_SEPARATION = 9 PORT_MIN_WIDTH = 20 + #minimal length of connector CONNECTOR_EXTENSION_MINIMAL = 11 + #increment length for connector CONNECTOR_EXTENSION_INCREMENT = 11 + #connection arrow dimensions CONNECTOR_ARROW_BASE = 13 CONNECTOR_ARROW_HEIGHT = 17 + #possible rotations in degrees POSSIBLE_ROTATIONS = (0, 90, 180, 270) + #How close can the mouse get to the window border before mouse events are ignored. BORDER_PROXIMITY_SENSITIVITY = 50 + #How close the mouse can get to the edge of the visible window before scrolling is invoked. SCROLL_PROXIMITY_SENSITIVITY = 30 + #When the window has to be scrolled, move it this distance in the required direction. SCROLL_DISTANCE = 15 + #How close the mouse click can be to a line and register a connection select. LINE_SELECT_SENSITIVITY = 5 diff --git a/grc/src/gui/Dialogs.py b/grc/gui/Dialogs.py similarity index 74% rename from grc/src/gui/Dialogs.py rename to grc/gui/Dialogs.py index d526b97b..8d764e28 100644 --- a/grc/src/gui/Dialogs.py +++ b/grc/gui/Dialogs.py @@ -20,8 +20,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA import pygtk pygtk.require('2.0') import gtk -from .. platforms.base.Constants import PACKAGE, VERSION import Preferences +import Utils class TextDisplay(gtk.TextView): """A non editable gtk text view.""" @@ -51,8 +51,8 @@ def MessageDialogHelper(type, buttons, title=None, markup=None): @return the gtk response from run() """ message_dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL, type, buttons) - if title != None: message_dialog.set_title(title) - if markup != None: message_dialog.set_markup(markup) + if title: message_dialog.set_title(title) + if markup: message_dialog.set_markup(markup) response = message_dialog.run() message_dialog.destroy() return response @@ -60,34 +60,22 @@ def MessageDialogHelper(type, buttons, title=None, markup=None): class AboutDialog(gtk.AboutDialog): """A cute little about dialog.""" - def __init__(self): + def __init__(self, platform): """AboutDialog constructor.""" gtk.AboutDialog.__init__(self) - self.set_name(PACKAGE) - self.set_version(VERSION) - self.set_license(__doc__) - self.set_copyright(__doc__.strip().splitlines()[0]) - self.set_website('http://gnuradio.org/trac/wiki/GNURadioCompanion') - self.set_comments("""\ -Thank you to all those from the mailing list who tested GNU Radio Companion and offered advice. ------ -Special Thanks: -A. Brinton Cooper -> starting the project -Patrick Mulligan -> starting the project -CER Technology Fellowship Grant -> initial funding -William R. Kenan Jr. Fund -> usrp & computers -Patrick Strasser -> the GRC icon -Achilleas Anastasopoulos -> trellis support ------""") + self.set_name(platform.get_name()) + self.set_version(platform.get_version()) + self.set_license(platform.get_license()) + self.set_copyright(platform.get_license().splitlines()[0]) + self.set_website(platform.get_website()) self.run() self.destroy() -def HelpDialog(): - MessageDialogHelper( - type=gtk.MESSAGE_INFO, - buttons=gtk.BUTTONS_CLOSE, - title='Help', - markup="""\ +def HelpDialog(): MessageDialogHelper( + type=gtk.MESSAGE_INFO, + buttons=gtk.BUTTONS_CLOSE, + title='Help', + markup="""\ Usage Tips Add block: drag and drop or double click a block in the block selection window. @@ -98,3 +86,20 @@ def HelpDialog(): Remove connection: select the connection and press delete, or drag the connection. * See the menu for other keyboard shortcuts.""") + +COLORS_DIALOG_MARKUP_TMPL = """\ +Color Mapping + +#if $colors + #set $max_len = max([len(color[0]) for color in $colors]) + 10 + #for $title, $color_spec in $colors +$($encode($title).center($max_len)) + #end for +#end if +""" + +def ColorsDialog(platform): MessageDialogHelper( + type=gtk.MESSAGE_INFO, + buttons=gtk.BUTTONS_CLOSE, + title='Colors', + markup=Utils.parse_template(COLORS_DIALOG_MARKUP_TMPL, colors=platform.get_colors())) diff --git a/grc/src/gui/DrawingArea.py b/grc/gui/DrawingArea.py similarity index 100% rename from grc/src/gui/DrawingArea.py rename to grc/gui/DrawingArea.py diff --git a/grc/src/platforms/gui/Element.py b/grc/gui/Element.py similarity index 100% rename from grc/src/platforms/gui/Element.py rename to grc/gui/Element.py diff --git a/grc/src/gui/FileDialogs.py b/grc/gui/FileDialogs.py similarity index 89% rename from grc/src/gui/FileDialogs.py rename to grc/gui/FileDialogs.py index 7c10d984..3b210c33 100644 --- a/grc/src/gui/FileDialogs.py +++ b/grc/gui/FileDialogs.py @@ -26,17 +26,29 @@ from Constants import \ NEW_FLOGRAPH_TITLE import Preferences from os import path +import Utils +################################################## +# Constants +################################################## OPEN_FLOW_GRAPH = 'open flow graph' SAVE_FLOW_GRAPH = 'save flow graph' SAVE_IMAGE = 'save image' +FILE_OVERWRITE_MARKUP_TMPL="""\ +File $encode($filename) Exists!\nWould you like to overwrite the existing file?""" + +FILE_DNE_MARKUP_TMPL="""\ +File $encode($filename) Does not Exist!""" + +################################################## +# File Filters +################################################## ##the filter for flow graph files def get_flow_graph_files_filter(): filter = gtk.FileFilter() filter.set_name('Flow Graph Files') filter.add_pattern('*'+Preferences.file_extension()) - filter.add_pattern('*.xml') #TEMP return filter ##the filter for image files @@ -53,6 +65,9 @@ def get_all_files_filter(): filter.add_pattern('*') return filter +################################################## +# File Dialogs +################################################## class FileDialogHelper(gtk.FileChooserDialog): """ A wrapper class for the gtk file chooser dialog. @@ -129,7 +144,7 @@ class FileDialog(FileDialogHelper): if path.exists(filename): #ask the user to confirm overwrite if MessageDialogHelper( gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, 'Confirm Overwrite!', - 'File "%s" Exists!\nWould you like to overwrite the existing file?'%filename, + Utils.parse_template(FILE_OVERWRITE_MARKUP_TMPL, filename=filename), ) == gtk.RESPONSE_NO: return self.get_rectified_filename() return filename ############################################# @@ -141,7 +156,7 @@ class FileDialog(FileDialogHelper): if not path.exists(filename): #show a warning and re-run MessageDialogHelper( gtk.MESSAGE_WARNING, gtk.BUTTONS_CLOSE, 'Cannot Open!', - 'File "%s" Does not Exist!'%filename, + Utils.parse_template(FILE_DNE_MARKUP_TMPL, filename=filename), ) return self.get_rectified_filename() return filenames diff --git a/grc/src/platforms/gui/FlowGraph.py b/grc/gui/FlowGraph.py similarity index 99% rename from grc/src/platforms/gui/FlowGraph.py rename to grc/gui/FlowGraph.py index 40f39181..26544faa 100644 --- a/grc/src/platforms/gui/FlowGraph.py +++ b/grc/gui/FlowGraph.py @@ -18,7 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ from Constants import SCROLL_PROXIMITY_SENSITIVITY, SCROLL_DISTANCE -from ... gui.Actions import \ +from Actions import \ ELEMENT_CREATE, ELEMENT_SELECT, \ BLOCK_PARAM_MODIFY, BLOCK_MOVE, \ ELEMENT_DELETE @@ -30,7 +30,7 @@ import pygtk pygtk.require('2.0') import gtk import random -from ... gui import Messages +import Messages class FlowGraph(Element): """ @@ -289,6 +289,7 @@ class FlowGraph(Element): """ Call update on all elements. """ + self.validate() for element in self.get_elements(): element.update() ########################################################################## diff --git a/grc/src/gui/MainWindow.py b/grc/gui/MainWindow.py similarity index 89% rename from grc/src/gui/MainWindow.py rename to grc/gui/MainWindow.py index bd5f73a8..6d36f4cf 100644 --- a/grc/src/gui/MainWindow.py +++ b/grc/gui/MainWindow.py @@ -31,8 +31,35 @@ from Dialogs import TextDisplay, MessageDialogHelper from NotebookPage import NotebookPage import Preferences import Messages +import Utils import os +MAIN_WINDOW_TITLE_TMPL = """\ +#if not $saved +*#slurp +#end if +#if $basename +$basename#slurp +#else +$new_flowgraph_title#slurp +#end if +#if $read_only + (read only)#slurp +#end if +#if $dirname + - $dirname#slurp +#end if + - $platform_name#slurp +""" + +PAGE_TITLE_MARKUP_TMPL = """\ +#set $foreground = $saved and 'black' or 'red' +$encode($title or $new_flowgraph_title)#slurp +#if $read_only + (ro)#slurp +#end if +""" + ############################################################ # Main window ############################################################ @@ -218,26 +245,24 @@ class MainWindow(gtk.Window): Show/hide the reports window. @param title the window title """ - title = ''.join(( - self._platform.get_name(), - ' - Editing: ', - (self.get_page().get_file_path() or NEW_FLOGRAPH_TITLE), - (self.get_page().get_saved() and ' ' or '*'), #blank must be non empty - (self.get_page().get_read_only() and ' (read-only)' or ''), + gtk.Window.set_title(self, Utils.parse_template(MAIN_WINDOW_TITLE_TMPL, + basename=os.path.basename(self.get_page().get_file_path()), + dirname=os.path.dirname(self.get_page().get_file_path()), + new_flowgraph_title=NEW_FLOGRAPH_TITLE, + read_only=self.get_page().get_read_only(), + saved=self.get_page().get_saved(), + platform_name=self._platform.get_name(), ) ) - gtk.Window.set_title(self, title) #set tab titles - for page in self._get_pages(): - #get filename and strip out file extension - title = os.path.splitext(os.path.basename(page.get_file_path()))[0] - page.set_text(''.join(( - (title or NEW_FLOGRAPH_TITLE), - (page.get_saved() and ' ' or '*'), #blank must be non empty - (page.get_read_only() and ' (ro)' or ''), - ) - ) + for page in self._get_pages(): page.set_markup( + Utils.parse_template(PAGE_TITLE_MARKUP_TMPL, + #get filename and strip out file extension + title=os.path.splitext(os.path.basename(page.get_file_path()))[0], + read_only=page.get_read_only(), saved=page.get_saved(), + new_flowgraph_title=NEW_FLOGRAPH_TITLE, ) + ) #show/hide notebook tabs self.notebook.set_show_tabs(len(self._get_pages()) > 1) diff --git a/grc/src/gui/Makefile.am b/grc/gui/Makefile.am similarity index 85% rename from grc/src/gui/Makefile.am rename to grc/gui/Makefile.am index a6639af4..c31bc5f6 100644 --- a/grc/src/gui/Makefile.am +++ b/grc/gui/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2008 Free Software Foundation, Inc. +# Copyright 2008, 2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,8 +22,17 @@ include $(top_srcdir)/grc/Makefile.inc ourpythondir = $(grc_src_prefix)/gui - ourpython_PYTHON = \ + Block.py \ + Colors.py \ + Constants.py \ + Connection.py \ + Element.py \ + FlowGraph.py \ + Param.py \ + Platform.py \ + Port.py \ + Utils.py \ ActionHandler.py \ Actions.py \ Bars.py \ diff --git a/grc/src/gui/Messages.py b/grc/gui/Messages.py similarity index 96% rename from grc/src/gui/Messages.py rename to grc/gui/Messages.py index e8939402..80057e0b 100644 --- a/grc/src/gui/Messages.py +++ b/grc/gui/Messages.py @@ -17,7 +17,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ -from .. platforms.base.Constants import PACKAGE, VERSION import traceback import sys @@ -44,8 +43,8 @@ register_messenger(sys.stdout.write) ########################################################################### # Special functions for specific program functionalities ########################################################################### -def send_init(): - send("""<<< Welcome to %s %s >>>\n"""%(PACKAGE, VERSION)) +def send_init(platform): + send("""<<< Welcome to %s %s >>>\n"""%(platform.get_name(), platform.get_version())) def send_page_switch(file_path): send('\nShowing: "%s"\n'%file_path) diff --git a/grc/src/gui/NotebookPage.py b/grc/gui/NotebookPage.py similarity index 88% rename from grc/src/gui/NotebookPage.py rename to grc/gui/NotebookPage.py index a3ec5b4e..cb6b7ed3 100644 --- a/grc/src/gui/NotebookPage.py +++ b/grc/gui/NotebookPage.py @@ -1,5 +1,5 @@ """ -Copyright 2008 Free Software Foundation, Inc. +Copyright 2008, 2009 Free Software Foundation, Inc. This file is part of GNU Radio GNU Radio Companion is free software; you can redistribute it and/or @@ -21,9 +21,7 @@ from Actions import FLOW_GRAPH_CLOSE import pygtk pygtk.require('2.0') import gtk -from .. utils import ParseXML from StateCache import StateCache -from .. platforms.base.Constants import FLOW_GRAPH_DTD from Constants import MIN_WINDOW_WIDTH, MIN_WINDOW_HEIGHT from DrawingArea import DrawingArea import os @@ -46,14 +44,7 @@ class NotebookPage(gtk.HBox): #import the file self.main_window = main_window self.set_file_path(file_path) - file_path = file_path or flow_graph.get_parent().get_default_flow_graph() - open(file_path, 'r') #test open - ############################################################ - from .. utils import converter - converter.convert(file_path, flow_graph.get_parent()) - ############################################################ - ParseXML.validate_dtd(file_path, FLOW_GRAPH_DTD) - initial_state = ParseXML.from_file(file_path) + initial_state = flow_graph.get_parent().parse_flow_graph(file_path) self.state_cache = StateCache(initial_state) self.set_saved(True) #import the data to the flow graph @@ -115,12 +106,12 @@ class NotebookPage(gtk.HBox): self.main_window.page_to_be_closed = self self.main_window.handle_states(FLOW_GRAPH_CLOSE) - def set_text(self, text): + def set_markup(self, markup): """ - Set the text in this label. - @param text the new text + Set the markup in this label. + @param markup the new markup text """ - self.label.set_text(text) + self.label.set_markup(markup) def get_tab(self): """ diff --git a/grc/src/platforms/gui/Param.py b/grc/gui/Param.py similarity index 98% rename from grc/src/platforms/gui/Param.py rename to grc/gui/Param.py index 33a9b1f5..3029569b 100644 --- a/grc/src/platforms/gui/Param.py +++ b/grc/gui/Param.py @@ -37,7 +37,7 @@ TIP_MARKUP_TMPL="""\ Key: $param.get_key() Type: $param.get_type() #if $param.is_valid() -Value: $param.evaluate() +Value: $param.get_evaluated() #elif len($param.get_error_messages()) == 1 Error: $(param.get_error_messages()[0]) #else @@ -75,6 +75,7 @@ class Param(Element): Finish by calling the exteral callback. """ self.set_value(self._input.get_text()) + self.validate() #is param is involved in a callback? #FIXME: messy has_cb = \ hasattr(self.get_parent(), 'get_callbacks') and \ diff --git a/grc/src/gui/ParamsDialog.py b/grc/gui/ParamsDialog.py similarity index 99% rename from grc/src/gui/ParamsDialog.py rename to grc/gui/ParamsDialog.py index 6cc42e8f..ccf19d1a 100644 --- a/grc/src/gui/ParamsDialog.py +++ b/grc/gui/ParamsDialog.py @@ -91,6 +91,7 @@ class ParamsDialog(gtk.Dialog): Update the documentation block. Hide the box if there are no docs. """ + self.block.validate() #update the errors box if self.block.is_valid(): self._error_box.hide() else: self._error_box.show() diff --git a/grc/src/platforms/gui/Platform.py b/grc/gui/Platform.py similarity index 100% rename from grc/src/platforms/gui/Platform.py rename to grc/gui/Platform.py diff --git a/grc/src/platforms/gui/Port.py b/grc/gui/Port.py similarity index 100% rename from grc/src/platforms/gui/Port.py rename to grc/gui/Port.py diff --git a/grc/src/gui/Preferences.py b/grc/gui/Preferences.py similarity index 100% rename from grc/src/gui/Preferences.py rename to grc/gui/Preferences.py diff --git a/grc/src/gui/StateCache.py b/grc/gui/StateCache.py similarity index 100% rename from grc/src/gui/StateCache.py rename to grc/gui/StateCache.py diff --git a/grc/src/platforms/gui/Utils.py b/grc/gui/Utils.py similarity index 100% rename from grc/src/platforms/gui/Utils.py rename to grc/gui/Utils.py diff --git a/grc/src/grc_gnuradio/__init__.py b/grc/gui/__init__.py similarity index 100% rename from grc/src/grc_gnuradio/__init__.py rename to grc/gui/__init__.py diff --git a/grc/src/platforms/python/Block.py b/grc/python/Block.py similarity index 83% rename from grc/src/platforms/python/Block.py rename to grc/python/Block.py index 341e5fdc..a9e99949 100644 --- a/grc/src/platforms/python/Block.py +++ b/grc/python/Block.py @@ -1,5 +1,5 @@ """ -Copyright 2008 Free Software Foundation, Inc. +Copyright 2008, 2009 Free Software Foundation, Inc. This file is part of GNU Radio GNU Radio Companion is free software; you can redistribute it and/or @@ -18,7 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ from .. base.Block import Block as _Block -from utils import extract_docs +import extract_docs class Block(_Block): @@ -35,22 +35,18 @@ class Block(_Block): @return block a new block """ #grab the data - doc = n.find('doc') or '' - imports = map(lambda i: i.strip(), n.findall('import')) - make = n.find('make') - checks = n.findall('check') - callbacks = n.findall('callback') + self._doc = n.find('doc') or '' + self._imports = map(lambda i: i.strip(), n.findall('import')) + self._make = n.find('make') + self._var_make = n.find('var_make') + self._checks = n.findall('check') + self._callbacks = n.findall('callback') #build the block _Block.__init__( self, flow_graph=flow_graph, n=n, ) - self._doc = doc - self._imports = imports - self._make = make - self._callbacks = callbacks - self._checks = checks def validate(self): """ @@ -66,8 +62,8 @@ class Block(_Block): try: check_eval = self.get_parent().evaluate(check_res) try: assert check_eval - except AssertionError: self._add_error_message('Check "%s" failed.'%check) - except: self._add_error_message('Check "%s" did not evaluate.'%check) + except AssertionError: self.add_error_message('Check "%s" failed.'%check) + except: self.add_error_message('Check "%s" did not evaluate.'%check) #adjust nports for ports, Port in ( (self._sources, self.get_parent().get_parent().Source), @@ -119,7 +115,7 @@ class Block(_Block): if param.is_enum() or param.get_key() not in nports_str: continue #try to increment the port controller by direction try: - value = param.evaluate() + value = param.get_evaluated() value = value + direction assert 0 < value param.set_value(value) @@ -143,10 +139,15 @@ class Block(_Block): return filter(lambda i: i, sum(map(lambda i: self.resolve_dependencies(i).split('\n'), self._imports), [])) def get_make(self): return self.resolve_dependencies(self._make) + def get_var_make(self): return self.resolve_dependencies(self._var_make) def get_callbacks(self): """ Get a list of function callbacks for this block. @return a list of strings """ - return map(lambda c: self.get_id() + '.' + self.resolve_dependencies(c), self._callbacks) + def make_callback(callback): + callback = self.resolve_dependencies(callback) + if callback.startswith('self.'): return callback + return 'self.%s.%s'%(self.get_id(), callback) + return map(make_callback, self._callbacks) diff --git a/grc/src/platforms/python/Connection.py b/grc/python/Connection.py similarity index 86% rename from grc/src/platforms/python/Connection.py rename to grc/python/Connection.py index f742ff63..d8a894bb 100644 --- a/grc/src/platforms/python/Connection.py +++ b/grc/python/Connection.py @@ -30,5 +30,5 @@ class Connection(_Connection): #check vector length source_vlen = self.get_source().get_vlen() sink_vlen = self.get_sink().get_vlen() - try: assert(source_vlen == sink_vlen) - except AssertionError: self._add_error_message('Source vector length "%s" does not match sink vector length "%s".'%(source_vlen, sink_vlen)) + try: assert source_vlen == sink_vlen + except AssertionError: self.add_error_message('Source vector length "%s" does not match sink vector length "%s".'%(source_vlen, sink_vlen)) diff --git a/grc/src/platforms/python/Constants.py.in b/grc/python/Constants.py similarity index 72% rename from grc/src/platforms/python/Constants.py.in rename to grc/python/Constants.py index 4a43147f..5f203237 100644 --- a/grc/src/platforms/python/Constants.py.in +++ b/grc/python/Constants.py @@ -1,5 +1,5 @@ """ -Copyright 2008 Free Software Foundation, Inc. +Copyright 2008, 2009 Free Software Foundation, Inc. This file is part of GNU Radio GNU Radio Companion is free software; you can redistribute it and/or @@ -20,24 +20,32 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA import os import sys import stat -from .. base.Constants import PKG_DIR +from gnuradio import gr -PYEXEC = '@PYTHONW@' +_gr_prefs = gr.prefs() + +PYEXEC = os.environ.get('PYTHONW', _gr_prefs.get_string('grc', 'pythonw', '')) #setup paths -DOCS_DIR = os.path.join(os.environ.get('GR_DOCDIR', '@docdir@'), 'xml') -DATA_DIR = os.path.join(PKG_DIR, '@reldatadir@') -BLOCKS_DIR = os.path.join(PKG_DIR, '@relblocksdir@') +PATH_SEP = ':' +DOCS_DIR = os.environ.get('GR_DOC_DIR', _gr_prefs.get_string('grc', 'doc_dir', '')) HIER_BLOCKS_LIB_DIR = os.path.join(os.path.expanduser('~'), '.grc_gnuradio') +BLOCKS_DIRS = filter( #filter blank strings + lambda x: x, PATH_SEP.join([ + os.environ.get('GRC_BLOCKS_PATH', ''), + _gr_prefs.get_string('grc', 'local_blocks_path', ''), + _gr_prefs.get_string('grc', 'global_blocks_path', ''), + ]).split(PATH_SEP), +) + [HIER_BLOCKS_LIB_DIR] #file creation modes TOP_BLOCK_FILE_MODE = stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | stat.S_IRGRP | stat.S_IWGRP | stat.S_IXGRP | stat.S_IROTH HIER_BLOCK_FILE_MODE = stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IWGRP | stat.S_IROTH #data files +DATA_DIR = os.path.dirname(__file__) FLOW_GRAPH_TEMPLATE = os.path.join(DATA_DIR, 'flow_graph.tmpl') BLOCK_DTD = os.path.join(DATA_DIR, 'block.dtd') -BLOCK_TREE = os.path.join(DATA_DIR, 'block_tree.xml') DEFAULT_FLOW_GRAPH = os.path.join(DATA_DIR, 'default_flow_graph.grc') #coloring @@ -52,3 +60,4 @@ INT_VECTOR_COLOR_SPEC = '#00CC99' SHORT_VECTOR_COLOR_SPEC = '#CCCC33' BYTE_VECTOR_COLOR_SPEC = '#CC66CC' ID_COLOR_SPEC = '#DDDDDD' +WILDCARD_COLOR_SPEC = '#FFFFFF' diff --git a/grc/src/platforms/python/FlowGraph.py b/grc/python/FlowGraph.py similarity index 78% rename from grc/src/platforms/python/FlowGraph.py rename to grc/python/FlowGraph.py index d0b997a5..47089a30 100644 --- a/grc/src/platforms/python/FlowGraph.py +++ b/grc/python/FlowGraph.py @@ -17,33 +17,27 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ -from utils import expr_utils +import expr_utils from .. base.FlowGraph import FlowGraph as _FlowGraph from Block import Block from Connection import Connection +import re -def _get_value_expr(variable_block): - """ - Get the expression to evaluate from the value param. - Parameter blocks need to be evaluated so the stringify flag can be determined. - @param variable_block the variable or parameter block - @return the expression string - """ - value_param = variable_block.get_param('value') - if variable_block.get_key() == 'parameter': value_param.evaluate() - return value_param.to_code() +_variable_matcher = re.compile('^(variable\w*)$') +_parameter_matcher = re.compile('^(parameter)$') class FlowGraph(_FlowGraph): _eval_cache = dict() - def _eval(self, code, namespace): + def _eval(self, code, namespace, namespace_hash): """ Evaluate the code with the given namespace. @param code a string with python code @param namespace a dict representing the namespace + @param namespace_hash a unique hash for the namespace @return the resultant object """ - my_hash = hash(code + str(namespace)) + my_hash = hash(code) ^ namespace_hash #cache if does not exist if not self._eval_cache.has_key(my_hash): self._eval_cache[my_hash] = eval(code, namespace, namespace) @@ -67,9 +61,9 @@ class FlowGraph(_FlowGraph): pad = pads[0] #take only the first, user should not have more than 1 #load io signature return { - 'nports': str(pad.get_param('nports').evaluate()), - 'type': str(pad.get_param('type').evaluate()), - 'vlen': str(pad.get_param('vlen').evaluate()), + 'nports': str(pad.get_param('nports').get_evaluated()), + 'type': str(pad.get_param('type').get_evaluated()), + 'vlen': str(pad.get_param('vlen').get_evaluated()), 'size': pad.get_param('type').get_opt('size'), } @@ -104,14 +98,12 @@ class FlowGraph(_FlowGraph): Exclude paramterized variables. @return a sorted list of variable blocks in order of dependency (indep -> dep) """ - variables = filter(lambda b: b.get_key() in ( - 'variable', 'variable_slider', 'variable_chooser', 'variable_text_box' - ), self.get_enabled_blocks()) + variables = filter(lambda b: _variable_matcher.match(b.get_key()), self.get_enabled_blocks()) #map var id to variable block id2var = dict([(var.get_id(), var) for var in variables]) #map var id to variable code #variable code is a concatenation of all param code (without the id param) - id2expr = dict([(var.get_id(), var.get_param('value').get_value()) for var in variables]) + id2expr = dict([(var.get_id(), var.get_var_make()) for var in variables]) #sort according to dependency sorted_ids = expr_utils.sort_variables(id2expr) #create list of sorted variable blocks @@ -123,7 +115,7 @@ class FlowGraph(_FlowGraph): Get a list of all paramterized variables in this flow graph namespace. @return a list of paramterized variables """ - parameters = filter(lambda b: b.get_key() == 'parameter', self.get_enabled_blocks()) + parameters = filter(lambda b: _parameter_matcher.match(b.get_key()), self.get_enabled_blocks()) return parameters def evaluate(self, expr): @@ -145,18 +137,19 @@ class FlowGraph(_FlowGraph): np = dict() for parameter in self.get_parameters(): try: - e = self._eval(_get_value_expr(parameter), n) + e = eval(parameter.get_param('value').to_code(), n, n) np[parameter.get_id()] = e except: pass n.update(np) #merge param namespace #load variables for variable in self.get_variables(): try: - e = self._eval(_get_value_expr(variable), n) + e = eval(variable.get_param('value').to_code(), n, n) n[variable.get_id()] = e except: pass #make namespace public self.n = n + self.n_hash = hash(str(n)) #evaluate - e = self._eval(expr, self.n) + e = self._eval(expr, self.n, self.n_hash) return e diff --git a/grc/src/platforms/python/Generator.py b/grc/python/Generator.py similarity index 76% rename from grc/src/platforms/python/Generator.py rename to grc/python/Generator.py index 93321404..cde7dc3d 100644 --- a/grc/src/platforms/python/Generator.py +++ b/grc/python/Generator.py @@ -1,5 +1,5 @@ """ -Copyright 2008 Free Software Foundation, Inc. +Copyright 2008, 2009 Free Software Foundation, Inc. This file is part of GNU Radio GNU Radio Companion is free software; you can redistribute it and/or @@ -20,13 +20,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA import os import subprocess from Cheetah.Template import Template -from utils import expr_utils +import expr_utils from Constants import \ TOP_BLOCK_FILE_MODE, HIER_BLOCK_FILE_MODE, \ HIER_BLOCKS_LIB_DIR, PYEXEC, \ FLOW_GRAPH_TEMPLATE -from utils import convert_hier -from ... gui import Messages +import convert_hier +from .. gui import Messages class Generator(object): @@ -81,11 +81,12 @@ Add a Misc->Throttle block to your flow graph to avoid CPU congestion.''') Convert the flow graph to python code. @return a string of python code """ + title = self._flow_graph.get_option('title') or self._flow_graph.get_option('id').replace('_', ' ').title() imports = self._flow_graph.get_imports() variables = self._flow_graph.get_variables() parameters = self._flow_graph.get_parameters() #list of variables with controls - controls = filter(lambda v: v.get_key().startswith('variable_'), variables) + controls = filter(lambda v: v.get_make(), variables) #list of blocks not including variables and imports and parameters and disabled blocks = sorted(self._flow_graph.get_enabled_blocks(), lambda x, y: cmp(x.get_id(), y.get_id())) probes = filter(lambda b: b.get_key().startswith('probe_'), blocks) #ensure probes are last in the block list @@ -94,37 +95,21 @@ Add a Misc->Throttle block to your flow graph to avoid CPU congestion.''') connections = self._flow_graph.get_enabled_connections() #list of variable names var_ids = [var.get_id() for var in parameters + variables] - #list of callbacks (prepend self.) + #prepend self. + replace_dict = dict([(var_id, 'self.%s'%var_id) for var_id in var_ids]) + #list of callbacks callbacks = [ - expr_utils.expr_prepend(cb, var_ids, 'self.') + expr_utils.expr_replace(cb, replace_dict) for cb in sum([block.get_callbacks() for block in self._flow_graph.get_enabled_blocks()], []) ] - #map var id to the expression (prepend self.) - var_id2expr = dict( - [(var.get_id(), expr_utils.expr_prepend(var.get_make().split('\n')[0], var_ids, 'self.')) - for var in parameters + variables] - ) - #create graph structure for variables - variable_graph = expr_utils.get_graph(var_id2expr) - #map var id to direct dependents - #for each var id, make a list of all 2nd order edges - #use all edges of that id that are not also 2nd order edges - #meaning: list variables the ONLY depend directly on this variable - #and not variables that also depend indirectly on this variable - var_id2deps = dict( - [(var_id, filter(lambda e: e not in sum([list(variable_graph.get_edges(edge)) - for edge in variable_graph.get_edges(var_id)], []), variable_graph.get_edges(var_id) - ) - ) - for var_id in var_ids] - ) #map var id to callbacks var_id2cbs = dict( - [(var_id, filter(lambda c: var_id in expr_utils.expr_split(c), callbacks)) + [(var_id, filter(lambda c: expr_utils.get_variable_dependencies(c, [var_id]), callbacks)) for var_id in var_ids] ) #load the namespace namespace = { + 'title': title, 'imports': imports, 'flow_graph': self._flow_graph, 'variables': variables, @@ -133,8 +118,6 @@ Add a Misc->Throttle block to your flow graph to avoid CPU congestion.''') 'blocks': blocks, 'connections': connections, 'generate_options': self._generate_options, - 'var_id2expr': var_id2expr, - 'var_id2deps': var_id2deps, 'var_id2cbs': var_id2cbs, } #build the template diff --git a/grc/src/platforms/python/utils/Makefile.am b/grc/python/Makefile.am similarity index 72% rename from grc/src/platforms/python/utils/Makefile.am rename to grc/python/Makefile.am index b12e51d8..e6d253f5 100644 --- a/grc/src/platforms/python/utils/Makefile.am +++ b/grc/python/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2008 Free Software Foundation, Inc. +# Copyright 2008, 2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,10 +21,23 @@ include $(top_srcdir)/grc/Makefile.inc -ourpythondir = $(grc_src_prefix)/platforms/python/utils - +ourpythondir = $(grc_src_prefix)/python ourpython_PYTHON = \ convert_hier.py \ expr_utils.py \ extract_docs.py \ + Block.py \ + Connection.py \ + Constants.py \ + FlowGraph.py \ + Generator.py \ + Param.py \ + Platform.py \ + Port.py \ __init__.py + +ourdatadir = $(grc_src_prefix)/python +dist_ourdata_DATA = \ + block.dtd \ + default_flow_graph.grc \ + flow_graph.tmpl diff --git a/grc/src/platforms/python/Param.py b/grc/python/Param.py similarity index 75% rename from grc/src/platforms/python/Param.py rename to grc/python/Param.py index e5ac1dcf..8b5efc97 100644 --- a/grc/src/platforms/python/Param.py +++ b/grc/python/Param.py @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ -from utils import expr_utils +import expr_utils from .. base.Param import Param as _Param, EntryParam import Constants import numpy @@ -26,6 +26,11 @@ import pygtk pygtk.require('2.0') import gtk from gnuradio import eng_notation +import re +from gnuradio import gr + +_check_id_matcher = re.compile('^[a-z|A-Z]\w*$') +_show_id_matcher = re.compile('^(variable\w*|parameter|options)$') class FileParam(EntryParam): """Provide an entry box for filename and a button to browse for a file.""" @@ -42,7 +47,7 @@ class FileParam(EntryParam): Replace the text in the entry with the new filename from the file dialog. """ #get the paths - file_path = self.param.is_valid() and self.param.evaluate() or '' + file_path = self.param.is_valid() and self.param.get_evaluated() or '' (dirname, basename) = os.path.isfile(file_path) and os.path.split(file_path) or (file_path, '') if not os.path.exists(dirname): dirname = os.getcwd() #fix bad paths #build the dialog @@ -65,7 +70,8 @@ class FileParam(EntryParam): #blacklist certain ids, its not complete, but should help import __builtin__ -ID_BLACKLIST = ['options', 'gr', 'blks2', 'wxgui', 'wx', 'math', 'forms', 'firdes'] + dir(__builtin__) +ID_BLACKLIST = ['self', 'options', 'gr', 'blks2', 'wxgui', 'wx', 'math', 'forms', 'firdes'] + \ + filter(lambda x: not x.startswith('_'), dir(gr.top_block())) + dir(__builtin__) #define types, native python + numpy VECTOR_TYPES = (tuple, list, set, numpy.ndarray) COMPLEX_TYPES = [complex, numpy.complex, numpy.complex64, numpy.complex128] @@ -86,7 +92,7 @@ class Param(_Param): TYPES = _Param.TYPES + [ 'complex', 'real', 'int', 'complex_vector', 'real_vector', 'int_vector', - 'hex', 'string', + 'hex', 'string', 'bool', 'file_open', 'file_save', 'id', 'grid_pos', 'import', @@ -115,9 +121,10 @@ class Param(_Param): ################################################## truncate = 0 #default center truncate max_len = max(27 - len(self.get_name()), 3) - e = self.evaluate() + e = self.get_evaluated() t = self.get_type() - if isinstance(e, COMPLEX_TYPES): dt_str = num_to_str(e) + if isinstance(e, bool): return str(e) + elif isinstance(e, COMPLEX_TYPES): dt_str = num_to_str(e) elif isinstance(e, VECTOR_TYPES): #vector types if len(e) > 8: dt_str = self.get_value() #large vectors use code @@ -159,10 +166,12 @@ class Param(_Param): 'real_vector': Constants.FLOAT_VECTOR_COLOR_SPEC, 'int_vector': Constants.INT_VECTOR_COLOR_SPEC, #special + 'bool': Constants.INT_COLOR_SPEC, 'hex': Constants.INT_COLOR_SPEC, 'string': Constants.BYTE_VECTOR_COLOR_SPEC, 'id': Constants.ID_COLOR_SPEC, 'grid_pos': Constants.INT_VECTOR_COLOR_SPEC, + 'raw': Constants.WILDCARD_COLOR_SPEC, }[self.get_type()] except: return _Param.get_color(self) @@ -178,9 +187,7 @@ class Param(_Param): hide = _Param.get_hide(self) if hide: return hide #hide ID in non variable blocks - if self.get_key() == 'id' and self.get_parent().get_key() not in ( - 'variable', 'variable_slider', 'variable_chooser', 'variable_text_box', 'parameter', 'options' - ): return 'part' + if self.get_key() == 'id' and not _show_id_matcher.match(self.get_parent().get_key()): return 'part' #hide port controllers for type and nports if self.get_key() in ' '.join(map( lambda p: ' '.join([p._type, p._nports]), self.get_parent().get_ports()) @@ -190,18 +197,31 @@ class Param(_Param): lambda p: p._vlen, self.get_parent().get_ports()) ): try: - assert int(self.evaluate()) == 1 + assert int(self.get_evaluated()) == 1 return 'part' except: pass #hide empty grid positions if self.get_key() == 'grid_pos' and not self.get_value(): return 'part' return hide + def validate(self): + """ + Validate the param. + A test evaluation is performed + """ + _Param.validate(self) #checks type + self._evaluated = None + try: self._evaluated = self.evaluate() + except Exception, e: self.add_error_message(str(e)) + + def get_evaluated(self): return self._evaluated + def evaluate(self): """ Evaluate the value. @return evaluated type """ + self._init = True self._lisitify_flag = False self._stringify_flag = False self._hostage_cells = list() @@ -222,31 +242,23 @@ class Param(_Param): ######################### # Numeric Types ######################### - elif t in ('raw', 'complex', 'real', 'int', 'complex_vector', 'real_vector', 'int_vector', 'hex'): + elif t in ('raw', 'complex', 'real', 'int', 'complex_vector', 'real_vector', 'int_vector', 'hex', 'bool'): #raise exception if python cannot evaluate this value try: e = self.get_parent().get_parent().evaluate(v) - except Exception, e: - self._add_error_message('Value "%s" cannot be evaluated: %s'%(v, e)) - raise Exception + except Exception, e: raise Exception, 'Value "%s" cannot be evaluated: %s'%(v, e) #raise an exception if the data is invalid if t == 'raw': return e elif t == 'complex': - try: assert(isinstance(e, COMPLEX_TYPES)) - except AssertionError: - self._add_error_message('Expression "%s" is invalid for type complex.'%str(e)) - raise Exception + try: assert isinstance(e, COMPLEX_TYPES) + except AssertionError: raise Exception, 'Expression "%s" is invalid for type complex.'%str(e) return e elif t == 'real': - try: assert(isinstance(e, REAL_TYPES)) - except AssertionError: - self._add_error_message('Expression "%s" is invalid for type real.'%str(e)) - raise Exception + try: assert isinstance(e, REAL_TYPES) + except AssertionError: raise Exception, 'Expression "%s" is invalid for type real.'%str(e) return e elif t == 'int': - try: assert(isinstance(e, INT_TYPES)) - except AssertionError: - self._add_error_message('Expression "%s" is invalid for type integer.'%str(e)) - raise Exception + try: assert isinstance(e, INT_TYPES) + except AssertionError: raise Exception, 'Expression "%s" is invalid for type integer.'%str(e) return e ######################### # Numeric Vector Types @@ -256,36 +268,30 @@ class Param(_Param): self._lisitify_flag = True e = [e] try: - for ei in e: - assert(isinstance(ei, COMPLEX_TYPES)) - except AssertionError: - self._add_error_message('Expression "%s" is invalid for type complex vector.'%str(e)) - raise Exception + for ei in e: assert isinstance(ei, COMPLEX_TYPES) + except AssertionError: raise Exception, 'Expression "%s" is invalid for type complex vector.'%str(e) return e elif t == 'real_vector': if not isinstance(e, VECTOR_TYPES): self._lisitify_flag = True e = [e] try: - for ei in e: - assert(isinstance(ei, REAL_TYPES)) - except AssertionError: - self._add_error_message('Expression "%s" is invalid for type real vector.'%str(e)) - raise Exception + for ei in e: assert isinstance(ei, REAL_TYPES) + except AssertionError: raise Exception, 'Expression "%s" is invalid for type real vector.'%str(e) return e elif t == 'int_vector': if not isinstance(e, VECTOR_TYPES): self._lisitify_flag = True e = [e] try: - for ei in e: - assert(isinstance(ei, INT_TYPES)) - except AssertionError: - self._add_error_message('Expression "%s" is invalid for type integer vector.'%str(e)) - raise Exception + for ei in e: assert isinstance(ei, INT_TYPES) + except AssertionError: raise Exception, 'Expression "%s" is invalid for type integer vector.'%str(e) + return e + elif t == 'hex': return hex(e) + elif t == 'bool': + try: assert isinstance(e, bool) + except AssertionError: raise Exception, 'Expression "%s" is invalid for type bool.'%str(e) return e - elif t == 'hex': - return hex(e) else: raise TypeError, 'Type "%s" not handled'%t ######################### # String Types @@ -299,23 +305,14 @@ class Param(_Param): ######################### elif t == 'id': #can python use this as a variable? - try: - assert(len(v) > 0) - assert(v[0].isalpha()) - for c in v: assert(c.isalnum() or c in ('_',)) - except AssertionError: - self._add_error_message('ID "%s" must be alpha-numeric or underscored, and begin with a letter.'%v) - raise Exception + try: assert _check_id_matcher.match(v) + except AssertionError: raise Exception, 'ID "%s" must begin with a letter and may contain letters, numbers, and underscores.'%v params = self.get_all_params('id') keys = [param.get_value() for param in params] 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 + except: raise Exception, 'ID "%s" is not unique.'%v try: assert v not in ID_BLACKLIST - except: - self._add_error_message('ID "%s" is blacklisted.'%v) - raise Exception + except: raise Exception, 'ID "%s" is blacklisted.'%v return v ######################### # Grid Position Type @@ -324,22 +321,16 @@ class Param(_Param): if not v: return '' #allow for empty grid pos e = self.get_parent().get_parent().evaluate(v) try: - assert(isinstance(e, (list, tuple)) and len(e) == 4) - for ei in e: assert(isinstance(ei, int)) - except AssertionError: - self._add_error_message('A grid position must be a list of 4 integers.') - raise Exception + assert isinstance(e, (list, tuple)) and len(e) == 4 + for ei in e: assert isinstance(ei, int) + except AssertionError: raise Exception, 'A grid position must be a list of 4 integers.' row, col, row_span, col_span = e #check row, col - try: assert(row >= 0 and col >= 0) - except AssertionError: - self._add_error_message('Row and column must be non-negative.') - raise Exception + try: assert row >= 0 and col >= 0 + except AssertionError: raise Exception, 'Row and column must be non-negative.' #check row span, col span - try: assert(row_span > 0 and col_span > 0) - except AssertionError: - self._add_error_message('Row and column span must be greater than zero.') - raise Exception + try: assert row_span > 0 and col_span > 0 + except AssertionError: raise Exception, 'Row and column span must be greater than zero.' #calculate hostage cells for r in range(row_span): for c in range(col_span): @@ -348,9 +339,7 @@ class Param(_Param): params = filter(lambda p: p is not self, self.get_all_params('grid_pos')) for param in params: for cell in param._hostage_cells: - if cell in self._hostage_cells: - self._add_error_message('Another graphical element is using cell "%s".'%str(cell)) - raise Exception + if cell in self._hostage_cells: raise Exception, 'Another graphical element is using cell "%s".'%str(cell) return e ######################### # Import Type @@ -358,12 +347,8 @@ class Param(_Param): elif t == 'import': n = dict() #new namespace try: exec v in n - except ImportError: - self._add_error_message('Import "%s" failed.'%v) - raise Exception - except Exception: - self._add_error_message('Bad import syntax: "%s".'%v) - raise Exception + except ImportError: raise Exception, 'Import "%s" failed.'%v + except Exception: raise Exception, 'Bad import syntax: "%s".'%v return filter(lambda k: str(k) != '__builtins__', n.keys()) ######################### else: raise TypeError, 'Type "%s" not handled'%t @@ -375,23 +360,16 @@ class Param(_Param): """ #run init tasks in evaluate #such as setting flags - if not self._init: - self.evaluate() - self._init = True + if not self._init: self.evaluate() v = self.get_value() t = self.get_type() if t in ('string', 'file_open', 'file_save'): #string types - if self._stringify_flag: - return '"%s"'%v.replace('"', '\"') - else: - return v + if self._stringify_flag: return '"%s"'%v.replace('"', '\"') + else: return v elif t in ('complex_vector', 'real_vector', 'int_vector'): #vector types - if self._lisitify_flag: - return '(%s, )'%v - else: - return '(%s)'%v - else: - return v + if self._lisitify_flag: return '(%s, )'%v + else: return '(%s)'%v + else: return v def get_all_params(self, type): """ diff --git a/grc/src/platforms/python/Platform.py b/grc/python/Platform.py similarity index 62% rename from grc/src/platforms/python/Platform.py rename to grc/python/Platform.py index d2bb4627..8718fe95 100644 --- a/grc/src/platforms/python/Platform.py +++ b/grc/python/Platform.py @@ -1,5 +1,5 @@ """ -Copyright 2008 Free Software Foundation, Inc. +Copyright 2008, 2009 Free Software Foundation, Inc. This file is part of GNU Radio GNU Radio Companion is free software; you can redistribute it and/or @@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ import os +from .. import VERSION #TEMP: until gnuradio has __version__ from .. base.Platform import Platform as _Platform from FlowGraph import FlowGraph as _FlowGraph from Connection import Connection as _Connection @@ -27,35 +28,46 @@ from Param import Param as _Param from Generator import Generator from Constants import \ HIER_BLOCKS_LIB_DIR, BLOCK_DTD, \ - BLOCK_TREE, DEFAULT_FLOW_GRAPH, \ - BLOCKS_DIR + DEFAULT_FLOW_GRAPH, BLOCKS_DIRS +import Constants -_critical_blocks_only = map(lambda b: os.path.join(BLOCKS_DIR, b), ['options.xml', 'usrp_probe.xml', 'usrp2_probe.xml']) +COLORS = (#title, #color spec + ('Complex', Constants.COMPLEX_COLOR_SPEC), + ('Float', Constants.FLOAT_COLOR_SPEC), + ('Integer', Constants.INT_COLOR_SPEC), + ('Short', Constants.SHORT_COLOR_SPEC), + ('Byte', Constants.BYTE_COLOR_SPEC), + ('Complex Vector', Constants.COMPLEX_VECTOR_COLOR_SPEC), + ('Float Vector', Constants.FLOAT_VECTOR_COLOR_SPEC), + ('Integer Vector', Constants.INT_VECTOR_COLOR_SPEC), + ('Short Vector', Constants.SHORT_VECTOR_COLOR_SPEC), + ('Byte Vector', Constants.BYTE_VECTOR_COLOR_SPEC), + ('Wildcard Type', Constants.WILDCARD_COLOR_SPEC), +) class Platform(_Platform): - def __init__(self, extra_blocks=[], critical_only=False): + def __init__(self): """ Make a platform for gnuradio. - @param extra_blocks a list of block paths to load in addition to main block library - @param critical_only only load critical blocks (used only for usrp probe scripts to speed up load time) """ #ensure hier dir if not os.path.exists(HIER_BLOCKS_LIB_DIR): os.mkdir(HIER_BLOCKS_LIB_DIR) - if critical_only: block_paths = _critical_blocks_only - else: block_paths = extra_blocks + [HIER_BLOCKS_LIB_DIR, BLOCKS_DIR] - #convert block paths to absolute paths, ensure uniqueness - block_paths = set(map(os.path.abspath, block_paths)) + #convert block paths to absolute paths + block_paths = set(map(os.path.abspath, BLOCKS_DIRS)) #init _Platform.__init__( self, - name='GRC', + name='GNU Radio Companion', + version=VERSION, key='grc', + license=__doc__.strip(), + website='http://gnuradio.org/trac/wiki/GNURadioCompanion', block_paths=block_paths, block_dtd=BLOCK_DTD, - block_tree=BLOCK_TREE, default_flow_graph=DEFAULT_FLOW_GRAPH, generator=Generator, + colors=COLORS, ) ############################################## diff --git a/grc/src/platforms/python/Port.py b/grc/python/Port.py similarity index 92% rename from grc/src/platforms/python/Port.py rename to grc/python/Port.py index b5bc9696..5a2b047f 100644 --- a/grc/src/platforms/python/Port.py +++ b/grc/python/Port.py @@ -47,10 +47,10 @@ class Port(_Port): def validate(self): _Port.validate(self) - try: assert(self.get_enabled_connections() or self.get_optional()) - except AssertionError: self._add_error_message('Port is not connected.') - try: assert(self.is_source() or len(self.get_enabled_connections()) <= 1) - except AssertionError: self._add_error_message('Port has too many connections.') + try: assert self.get_enabled_connections() or self.get_optional() + except AssertionError: self.add_error_message('Port is not connected.') + try: assert self.is_source() or len(self.get_enabled_connections()) <= 1 + except AssertionError: self.add_error_message('Port has too many connections.') def get_vlen(self): """ diff --git a/grc/src/gui/__init__.py b/grc/python/__init__.py similarity index 100% rename from grc/src/gui/__init__.py rename to grc/python/__init__.py diff --git a/grc/data/platforms/python/block.dtd b/grc/python/block.dtd similarity index 92% rename from grc/data/platforms/python/block.dtd rename to grc/python/block.dtd index d892b128..7c6c3981 100644 --- a/grc/data/platforms/python/block.dtd +++ b/grc/python/block.dtd @@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA Top level element. A block contains a name, ...parameters list, and list of IO ports. --> - + @@ -48,6 +48,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + diff --git a/grc/src/platforms/python/utils/convert_hier.py b/grc/python/convert_hier.py similarity index 93% rename from grc/src/platforms/python/utils/convert_hier.py rename to grc/python/convert_hier.py index 49535898..bdafbcbc 100644 --- a/grc/src/platforms/python/utils/convert_hier.py +++ b/grc/python/convert_hier.py @@ -17,9 +17,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ -from .. Constants import BLOCK_DTD -from .... utils import ParseXML -from .... utils import odict +from Constants import BLOCK_DTD +from .. base import ParseXML +from .. base import odict def convert_hier(flow_graph, python_file): #extract info from the flow graph @@ -38,10 +38,11 @@ def convert_hier(flow_graph, python_file): block_n['category'] = block_category block_n['import'] = 'execfile("%s")'%python_file #make data - block_n['make'] = '%s(\n\t%s,\n)'%( + if parameters: block_n['make'] = '%s(\n\t%s,\n)'%( block_key, ',\n\t'.join(['%s=$%s'%(param.get_id(), param.get_id()) for param in parameters]), ) + else: block_n['make'] = '%s()'%block_key #callback data block_n['callback'] = ['set_%s($%s)'%(param.get_id(), param.get_id()) for param in parameters] #param data diff --git a/grc/data/platforms/python/default_flow_graph.grc b/grc/python/default_flow_graph.grc similarity index 100% rename from grc/data/platforms/python/default_flow_graph.grc rename to grc/python/default_flow_graph.grc diff --git a/grc/src/platforms/python/utils/expr_utils.py b/grc/python/expr_utils.py similarity index 95% rename from grc/src/platforms/python/utils/expr_utils.py rename to grc/python/expr_utils.py index 40700993..1880c8f9 100644 --- a/grc/src/platforms/python/utils/expr_utils.py +++ b/grc/python/expr_utils.py @@ -75,17 +75,17 @@ def expr_split(expr): toks.append(tok) return filter(lambda t: t, toks) -def expr_prepend(expr, vars, prepend): +def expr_replace(expr, replace_dict): """ Search for vars in the expression and add the prepend. @param expr an expression string - @param vars a list of variable names - @param prepend the prepend string + @param replace_dict a dict of find:replace @return a new expression with the prepend """ expr_splits = expr_split(expr) for i, es in enumerate(expr_splits): - if es in vars: expr_splits[i] = prepend + es + if es in replace_dict.keys(): + expr_splits[i] = replace_dict[es] return ''.join(expr_splits) def get_variable_dependencies(expr, vars): @@ -110,7 +110,7 @@ def get_graph(exprs): for var in vars: var_graph.add_node(var) for var, expr in exprs.iteritems(): for dep in get_variable_dependencies(expr, vars): - var_graph.add_edge(dep, var) + if dep != var: var_graph.add_edge(dep, var) return var_graph def sort_variables(exprs): diff --git a/grc/src/platforms/python/utils/extract_docs.py b/grc/python/extract_docs.py similarity index 92% rename from grc/src/platforms/python/utils/extract_docs.py rename to grc/python/extract_docs.py index 523519f9..fa9140bd 100644 --- a/grc/src/platforms/python/utils/extract_docs.py +++ b/grc/python/extract_docs.py @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ -from .. Constants import DOCS_DIR +from Constants import DOCS_DIR from lxml import etree import os import re @@ -48,10 +48,8 @@ def _extract(key): @param key the block key @return a string with documentation """ - UBUNTU_DOCS_DIR = '/usr/share/doc/gnuradio-doc/xml' - if os.path.exists(DOCS_DIR): docs_dir = DOCS_DIR - elif os.path.exists(UBUNTU_DOCS_DIR): docs_dir = UBUNTU_DOCS_DIR - else: return '' + docs_dir = os.path.join(DOCS_DIR, 'xml') + if not os.path.exists(docs_dir): return '' #extract matches pattern = key.replace('_', '_*').replace('x', '\w') prog = re.compile('^class%s\..*$'%pattern) diff --git a/grc/data/platforms/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl similarity index 83% rename from grc/data/platforms/python/flow_graph.tmpl rename to grc/python/flow_graph.tmpl index 4c481dce..a45a918d 100644 --- a/grc/data/platforms/python/flow_graph.tmpl +++ b/grc/python/flow_graph.tmpl @@ -10,17 +10,23 @@ ##@param blocks the signal blocks ##@param connections the connections ##@param generate_options the type of flow graph -##@param var_id2expr variable id map to expression -##@param var_id2deps variable id map to direct dependencies ##@param var_id2cbs variable id map to callback strings ######################################################## +#def indent($code) +#set $code = '\n\t\t'.join(str($code).splitlines()) +$code#slurp +#end def #import time #set $DIVIDER = '#'*50 $DIVIDER # Gnuradio Python Flow Graph -# Title: $flow_graph.get_option('title') +# Title: $title +#if $flow_graph.get_option('author') # Author: $flow_graph.get_option('author') +#end if +#if $flow_graph.get_option('description') # Description: $flow_graph.get_option('description') +#end if # Generated: $time.ctime() $DIVIDER @@ -39,15 +45,16 @@ $imp ## Setup the IO signature (hier block only). ######################################################## #set $class_name = $flow_graph.get_option('id') +#set $param_str = ', '.join(['self'] + ['%s=%s'%(param.get_id(), param.get_make()) for param in $parameters]) #if $generate_options == 'wx_gui' #import gtk #set $icon = gtk.IconTheme().lookup_icon('gnuradio-grc', 32, 0) class $(class_name)(grc_wxgui.top_block_gui): - def __init__(self, options): + def __init__($param_str): grc_wxgui.top_block_gui.__init__( self, - title="$flow_graph.get_parent().get_name() - Executing: $flow_graph.get_option('title')", + title="$title", #if $icon icon="$icon.get_filename()", #end if @@ -55,18 +62,17 @@ class $(class_name)(grc_wxgui.top_block_gui): #elif $generate_options == 'no_gui' class $(class_name)(gr.top_block): - def __init__(self, options): - gr.top_block.__init__(self, "$flow_graph.get_option('title')") + def __init__($param_str): + gr.top_block.__init__(self, "$title") #elif $generate_options == 'hb' #set $in_sig = $flow_graph.get_input_signature() #set $out_sig = $flow_graph.get_output_signature() - #set $param_str = ', '.join(['self'] + ['%s=%s'%(param.get_id(), param.get_make()) for param in $parameters]) class $(class_name)(gr.hier_block2): def __init__($param_str): gr.hier_block2.__init__( self, - "$flow_graph.get_option('title')", + "$title", gr.io_signature($in_sig.nports, $in_sig.nports, $in_sig.size*$in_sig.vlen), gr.io_signature($out_sig.nports, $out_sig.nports, $out_sig.size*$out_sig.vlen), ) @@ -82,11 +88,7 @@ class $(class_name)(gr.hier_block2): $DIVIDER #end if #for $param in $parameters - #if $generate_options != 'hb' - self.$param.get_id() = $param.get_id() = options.$param.get_id() - #else - self.$param.get_id() = $param.get_id() - #end if + $indent($param.get_var_make()) #end for ######################################################## ##Create Variables @@ -100,8 +102,7 @@ class $(class_name)(gr.hier_block2): $DIVIDER #end if #for $var in $variables - #set $code = $var.get_make().splitlines()[0] - self.$var.get_id() = $var.get_id() = $code + $indent($var.get_var_make()) #end for ######################################################## ##Create Controls @@ -115,8 +116,7 @@ class $(class_name)(gr.hier_block2): $DIVIDER #end if #for $ctrl in $controls - #set $code = '\n\t\t'.join($ctrl.get_make().splitlines()[1:]) - $code + $indent($ctrl.get_make()) #end for ######################################################## ##Create Blocks @@ -129,8 +129,7 @@ class $(class_name)(gr.hier_block2): $DIVIDER #end if #for $blk in filter(lambda b: b.get_make(), $blocks) - #set $code = '\n\t\t'.join($blk.get_make().splitlines()) - self.$blk.get_id() = $code + self.$blk.get_id() = $indent($blk.get_make()) #end for ######################################################## ##Create Connections @@ -168,11 +167,8 @@ class $(class_name)(gr.hier_block2): #set $id = $var.get_id() def set_$(id)(self, $id): self.$id = $id - #for $dep in $var_id2deps[$id] - self.set_$(dep)($var_id2expr[$dep]) - #end for #for $callback in $var_id2cbs[$id] - self.$callback + $indent($callback) #end for #end for @@ -184,9 +180,11 @@ class $(class_name)(gr.hier_block2): #if $generate_options != 'hb' if __name__ == '__main__': parser = OptionParser(option_class=eng_option, usage="%prog: [options]") + #set $params_eq_list = list() #for $param in $parameters #set $type = $param.get_param('type').get_value() #if $type + #silent $params_eq_list.append('%s=options.%s'%($param.get_id(), $param.get_id())) parser.add_option("--$param.get_id()", dest="$param.get_id()", type="$type", default=$param.get_make()) #end if #end for @@ -195,9 +193,9 @@ if __name__ == '__main__': if gr.enable_realtime_scheduling() != gr.RT_OK: print "Error: failed to enable realtime scheduling." #end if - tb = $(class_name)(options) + tb = $(class_name)($(', '.join($params_eq_list))) #if $generate_options == 'wx_gui' - tb.Run() + tb.Run($flow_graph.get_option('autostart')) #elif $generate_options == 'no_gui' tb.start() raw_input('Press Enter to quit: ') diff --git a/grc/scripts/grc b/grc/scripts/grc index a2e3bc28..8a6cc0af 100755 --- a/grc/scripts/grc +++ b/grc/scripts/grc @@ -18,8 +18,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ -import os - import pygtk pygtk.require('2.0') import gtk @@ -32,7 +30,7 @@ Cannot import gnuradio. Are your PYTHONPATH and LD_LIBRARY_PATH set correctly?"" d.run() exit(-1) -from gnuradio.grc.platforms.base.Constants import VERSION +from gnuradio.grc import VERSION from optparse import OptionParser if __name__ == "__main__": @@ -47,13 +45,10 @@ and you are welcome to redistribute it. """%VERSION parser = OptionParser(usage=usage, version=version) (options, args) = parser.parse_args() - from gnuradio.grc.platforms.python.Platform import Platform + from gnuradio.grc.python.Platform import Platform from gnuradio.grc.gui.ActionHandler import ActionHandler #setup icon using icon theme try: gtk.window_set_default_icon(gtk.IconTheme().load_icon('gnuradio-grc', 256, 0)) except: pass - #extract extra block paths from environment variable, separated by semicolon - try: extra_blocks = os.environ['GRC_BLOCKS_PATH'].split(';') - except: extra_blocks = list() - ActionHandler(args, Platform(extra_blocks=extra_blocks)) + ActionHandler(args, Platform()) diff --git a/grc/scripts/usrp2_probe b/grc/scripts/usrp2_probe index fac2427d..00d4366d 100755 --- a/grc/scripts/usrp2_probe +++ b/grc/scripts/usrp2_probe @@ -29,10 +29,10 @@ import gobject from gnuradio.grc.gui.Dialogs import TextDisplay -from gnuradio.grc.platforms.python.Platform import Platform -platform = Platform(critical_only=True) +from gnuradio.grc.python.Platform import Platform +platform = Platform() -from gnuradio.grc.platforms.gui.Platform import Platform +from gnuradio.grc.gui.Platform import Platform platform = Platform(platform) flow_graph = platform.get_new_flow_graph() diff --git a/grc/scripts/usrp_probe b/grc/scripts/usrp_probe index 3eb3de58..6565612c 100755 --- a/grc/scripts/usrp_probe +++ b/grc/scripts/usrp_probe @@ -27,10 +27,10 @@ import gtk from gnuradio.grc.gui.Dialogs import TextDisplay -from gnuradio.grc.platforms.python.Platform import Platform -platform = Platform(critical_only=True) +from gnuradio.grc.python.Platform import Platform +platform = Platform() -from gnuradio.grc.platforms.gui.Platform import Platform +from gnuradio.grc.gui.Platform import Platform platform = Platform(platform) flow_graph = platform.get_new_flow_graph() diff --git a/grc/src/grc_gnuradio/Makefile.am b/grc/src/grc_gnuradio/Makefile.am deleted file mode 100644 index 767e8f67..00000000 --- a/grc/src/grc_gnuradio/Makefile.am +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright 2008 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -include $(top_srcdir)/grc/Makefile.inc - -SUBDIRS = \ - blks2 \ - usrp \ - wxgui - -ourpythondir = $(grc_gnuradio_prefix) - -ourpython_PYTHON = __init__.py diff --git a/grc/src/grc_gnuradio/blks2/Makefile.am b/grc/src/grc_gnuradio/blks2/Makefile.am deleted file mode 100644 index 89889605..00000000 --- a/grc/src/grc_gnuradio/blks2/Makefile.am +++ /dev/null @@ -1,33 +0,0 @@ -# -# Copyright 2008, 2009 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -include $(top_srcdir)/grc/Makefile.inc - -ourpythondir = $(grc_gnuradio_prefix)/blks2 - -ourpython_PYTHON = \ - __init__.py \ - error_rate.py \ - packet.py \ - probe.py \ - selector.py \ - tcp.py \ - variable_sink.py diff --git a/grc/src/grc_gnuradio/usrp/Makefile.am b/grc/src/grc_gnuradio/usrp/Makefile.am deleted file mode 100644 index 136a5dac..00000000 --- a/grc/src/grc_gnuradio/usrp/Makefile.am +++ /dev/null @@ -1,30 +0,0 @@ -# -# Copyright 2008 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -include $(top_srcdir)/grc/Makefile.inc - -ourpythondir = $(grc_gnuradio_prefix)/usrp - -ourpython_PYTHON = \ - __init__.py \ - common.py \ - dual_usrp.py \ - simple_usrp.py diff --git a/grc/src/grc_gnuradio/wxgui/Makefile.am b/grc/src/grc_gnuradio/wxgui/Makefile.am deleted file mode 100644 index 2e5e7ebd..00000000 --- a/grc/src/grc_gnuradio/wxgui/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright 2008 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -include $(top_srcdir)/grc/Makefile.inc - -ourpythondir = $(grc_gnuradio_prefix)/wxgui -ourpython_PYTHON = \ - __init__.py \ - top_block_gui.py diff --git a/grc/src/gui/Constants.py b/grc/src/gui/Constants.py deleted file mode 100644 index f23ab8b1..00000000 --- a/grc/src/gui/Constants.py +++ /dev/null @@ -1,48 +0,0 @@ -""" -Copyright 2008, 2009 Free Software Foundation, Inc. -This file is part of GNU Radio - -GNU Radio Companion 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 2 -of the License, or (at your option) any later version. - -GNU Radio Companion 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 program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA -""" - -import pygtk -pygtk.require('2.0') -import gtk -import os - -##default path for the open/save dialogs -DEFAULT_FILE_PATH = os.getcwd() - -##file extensions -IMAGE_FILE_EXTENSION = '.png' - -##name for new/unsaved flow graphs -NEW_FLOGRAPH_TITLE = 'untitled' - -##main window constraints -MIN_WINDOW_WIDTH = 600 -MIN_WINDOW_HEIGHT = 400 -##dialog constraints -MIN_DIALOG_WIDTH = 500 -MIN_DIALOG_HEIGHT = 500 -##default sizes -DEFAULT_BLOCKS_WINDOW_WIDTH = 100 -DEFAULT_REPORTS_WINDOW_WIDTH = 100 - -##The size of the state saving cache in the flow graph (for undo/redo functionality) -STATE_CACHE_SIZE = 42 - -##Shared targets for drag and drop of blocks -DND_TARGETS = [('STRING', gtk.TARGET_SAME_APP, 0)] diff --git a/grc/src/platforms/Makefile.am b/grc/src/platforms/Makefile.am deleted file mode 100644 index 1d3c385c..00000000 --- a/grc/src/platforms/Makefile.am +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright 2008 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -include $(top_srcdir)/grc/Makefile.inc - -SUBDIRS = \ - base \ - gui \ - python - -ourpythondir = $(grc_src_prefix)/platforms - -ourpython_PYTHON = __init__.py diff --git a/grc/src/platforms/__init__.py b/grc/src/platforms/__init__.py deleted file mode 100644 index 8b137891..00000000 --- a/grc/src/platforms/__init__.py +++ /dev/null @@ -1 +0,0 @@ - diff --git a/grc/src/platforms/base/Makefile.am b/grc/src/platforms/base/Makefile.am deleted file mode 100644 index 805c7b2b..00000000 --- a/grc/src/platforms/base/Makefile.am +++ /dev/null @@ -1,46 +0,0 @@ -# -# Copyright 2008,2009 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -include $(top_srcdir)/grc/Makefile.inc - -ourpythondir = $(grc_src_prefix)/platforms/base - -ourpython_PYTHON = \ - Block.py \ - Connection.py \ - Constants.py \ - Element.py \ - FlowGraph.py \ - Param.py \ - Platform.py \ - Port.py \ - __init__.py - -Constants.py: $(srcdir)/Constants.py.in Makefile - sed \ - -e 's|@PACKAGE[@]|$(PACKAGE)|g' \ - -e 's|@VERSION[@]|$(VERSION)|g' \ - -e 's|@pkgdatadir[@]|$(pkgdatadir)|g' \ - -e 's|@reldatadir[@]|$(grc_base_data_reldir)|g' \ - $< > $@ - -EXTRA_DIST = $(srcdir)/Constants.py.in -BUILT_SOURCES = Constants.py diff --git a/grc/src/platforms/base/__init__.py b/grc/src/platforms/base/__init__.py deleted file mode 100644 index 8b137891..00000000 --- a/grc/src/platforms/base/__init__.py +++ /dev/null @@ -1 +0,0 @@ - diff --git a/grc/src/platforms/gui/__init__.py b/grc/src/platforms/gui/__init__.py deleted file mode 100644 index 8b137891..00000000 --- a/grc/src/platforms/gui/__init__.py +++ /dev/null @@ -1 +0,0 @@ - diff --git a/grc/src/platforms/python/Makefile.am b/grc/src/platforms/python/Makefile.am deleted file mode 100644 index c23d1479..00000000 --- a/grc/src/platforms/python/Makefile.am +++ /dev/null @@ -1,48 +0,0 @@ -# -# Copyright 2008,2009 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -include $(top_srcdir)/grc/Makefile.inc - -SUBDIRS = utils - -ourpythondir = $(grc_src_prefix)/platforms/python - -ourpython_PYTHON = \ - Block.py \ - Connection.py \ - Constants.py \ - FlowGraph.py \ - Generator.py \ - Param.py \ - Platform.py \ - Port.py \ - __init__.py - -Constants.py: $(srcdir)/Constants.py.in Makefile - sed \ - -e 's|@PYTHONW[@]|$(PYTHONW)|g' \ - -e 's|@reldatadir[@]|$(grc_python_data_reldir)|g' \ - -e 's|@relblocksdir[@]|$(grc_blocks_data_reldir)|g' \ - -e 's|@docdir[@]|$(gr_docdir)|g' \ - $< > $@ - -EXTRA_DIST = $(srcdir)/Constants.py.in -BUILT_SOURCES = Constants.py diff --git a/grc/src/platforms/python/__init__.py b/grc/src/platforms/python/__init__.py deleted file mode 100644 index 8b137891..00000000 --- a/grc/src/platforms/python/__init__.py +++ /dev/null @@ -1 +0,0 @@ - diff --git a/grc/src/platforms/python/utils/__init__.py b/grc/src/platforms/python/utils/__init__.py deleted file mode 100644 index 8b137891..00000000 --- a/grc/src/platforms/python/utils/__init__.py +++ /dev/null @@ -1 +0,0 @@ - diff --git a/grc/src/utils/Makefile.am b/grc/src/utils/Makefile.am deleted file mode 100644 index a4890479..00000000 --- a/grc/src/utils/Makefile.am +++ /dev/null @@ -1,30 +0,0 @@ -# -# Copyright 2008, 2009 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -include $(top_srcdir)/grc/Makefile.inc - -ourpythondir = $(grc_src_prefix)/utils - -ourpython_PYTHON = \ - converter.py \ - odict.py \ - ParseXML.py \ - __init__.py diff --git a/grc/src/utils/converter.py b/grc/src/utils/converter.py deleted file mode 100644 index 34fc438f..00000000 --- a/grc/src/utils/converter.py +++ /dev/null @@ -1,248 +0,0 @@ -""" -Copyright 2008 Free Software Foundation, Inc. -This file is part of GNU Radio - -GNU Radio Companion 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 2 -of the License, or (at your option) any later version. - -GNU Radio Companion 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 program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA -""" - -from .. platforms.base.Constants import FLOW_GRAPH_DTD -import ParseXML -from .. import utils -from .. utils import odict -from lxml import etree -import difflib -import os - -def _make_param(key, value): - """ - Make a paramater dict from the key/value pair. - @param key the key - @param value the value - @return a dictionary object - """ - param = odict() - param['key'] = key - param['value'] = value - return param - -def _get_blocks(blocks, tag): - """ - Get a list of blocks with the tag. - @param blocks the old block list - @param tag the tag name - @retun a list of matching blocks - """ - return filter(lambda b: b['tag'] == tag, blocks) - -def _get_params(block): - """ - Get a list of params. - @param block the old block - @retun a list of params - """ - params = utils.exists_or_else(block, 'params', {}) or {} - params = utils.listify(params, 'param') - return params - -def _convert_id(id): - """ - Convert an old id to a new safe id. - Replace spaces with underscores. - Lower case the odl id. - @return the reformatted id - """ - return id.lower().replace(' ', '_') - -def convert(file_path, platform): - """ - Convert the flow graph to the new format. - Make a backup of the old file. - Save a reformated flow graph to the file path. - If this is a new format flow graph, do nothing. - @param file_path the path to the saved flow graph - @param platform the grc gnuradio platform - """ - try: #return if file passes validation - ParseXML.validate_dtd(file_path, FLOW_GRAPH_DTD) - try: - changed = False - #convert instances of gui_coordinate and gui_rotation - xml = etree.parse(file_path) - for find, replace in ( - ('gr_add_vxx', 'gr_add_xx'), - ('gr_multiply_vxx', 'gr_multiply_xx'), - ): - keys = xml.xpath('/flow_graph/block[key="%s"]/key'%find) - for key in keys: - key.text = replace - changed = True - if not changed: return - #backup after successful conversion - os.rename(file_path, file_path+'.bak') - #save new flow graph to file path - xml.write(file_path, xml_declaration=True, pretty_print=True) - except Exception, e: print e - return - except: pass #convert - ############################################################ - # extract window size, variables, blocks, and connections - ############################################################ - old_n = ParseXML.from_file(file_path)['flow_graph'] - try: window_width = min(3*int(old_n['window_width'])/2, 2048) - except: window_width = 2048 - try: window_height = min(3*int(old_n['window_height'])/2, 2048) - except: window_height = 2048 - window_size = '%d, %d'%(window_width, window_height) - variables = utils.exists_or_else(old_n, 'vars', {}) or {} - variables = utils.listify(variables, 'var') - blocks = utils.exists_or_else(old_n, 'signal_blocks', {}) or {} - blocks = utils.listify(blocks, 'signal_block') - connections = utils.exists_or_else(old_n, 'connections', {}) or {} - connections = utils.listify(connections, 'connection') - #initialize new nested data - new_n = odict() - new_n['block'] = list() - new_n['connection'] = list() - ############################################################ - # conversion - options block - ############################################################ - #get name - about_blocks = _get_blocks(blocks, 'About') - if about_blocks: title = _get_params(about_blocks[0])[0] - else: title = 'Untitled' - #get author - if about_blocks: author = _get_params(about_blocks[0])[1] - else: author = '' - #get desc - note_blocks = _get_blocks(blocks, 'Note') - if note_blocks: desc = _get_params(note_blocks[0])[0] - else: desc = '' - #create options block - options_block = odict() - options_block['key'] = 'options' - options_block['param'] = [ - _make_param('id', 'top_block'), - _make_param('title', title), - _make_param('author', author), - _make_param('description', desc), - _make_param('window_size', window_size), - _make_param('_coordinate', '(10, 10)'), - ] - #append options block - new_n['block'].append(options_block) - ############################################################ - # conversion - variables - ############################################################ - x = 100 - for variable in variables: - key = variable['key'] - value = variable['value'] - minimum = utils.exists_or_else(variable, 'min', '') - maximum = utils.exists_or_else(variable, 'max', '') - step = utils.exists_or_else(variable, 'step', '') - x = x + 150 - coor = '(%d, %d)'%(x, 10) - var_block = odict() - if minimum and maximum: #slider varible - #determine num steps - try: num_steps = str(int((float(maximum) - float(minimum))/float(step))) - except: num_steps = '100' - var_block['key'] = 'variable_slider' - var_block['param'] = [ - _make_param('id', key), - _make_param('value', value), - _make_param('min', minimum), - _make_param('max', maximum), - _make_param('num_steps', num_steps), - _make_param('_coordinate', coor), - ] - else: #regular variable - var_block['key'] = 'variable' - var_block['param'] = [ - _make_param('id', key), - _make_param('value', value), - _make_param('_coordinate', coor), - ] - #append variable block - new_n['block'].append(var_block) - ############################################################ - # conversion - blocks - ############################################################ - #create name to key map for all blocks in platform - name_to_key = dict((b.get_name(), b.get_key()) for b in platform.get_blocks()) - for block in blocks: - #extract info - tag = block['tag'] - #ignore list - if tag in ('Note', 'About'): continue - id = _convert_id(block['id']) - coor = '(%s, %s + 100)'%( - utils.exists_or_else(block, 'x_coordinate', '0'), - utils.exists_or_else(block, 'y_coordinate', '0'), - ) - rot = utils.exists_or_else(block, 'rotation', '0') - params = _get_params(block) - #new block - new_block = odict() - matches = difflib.get_close_matches(tag, name_to_key.keys(), 1) - if not matches: continue - #match found - key = name_to_key[matches[0]] - new_block['key'] = key - new_block['param'] = [ - _make_param('id', id), - _make_param('_coordinate', coor), - _make_param('_rotation', rot), - ] - #handle specific blocks - if key == 'wxgui_fftsink2': - params = params[0:3] + ['0'] + params[3:4] + ['8'] + params[4:] - #append params - for i, param in enumerate(params): - platform_block = platform.get_block(key) - try: platform_param = platform_block.get_params()[i+2] - except IndexError: break - if platform_param.is_enum(): - try: param_value = platform_param.get_option_keys()[int(param)] - except: param_value = platform_param.get_option_keys()[0] - else: - param_value = param.replace('$', '').replace('^', '**') - new_block['param'].append(_make_param(platform_param.get_key(), param_value)) - #append block - new_n['block'].append(new_block) - ############################################################ - # conversion - connections - ############################################################ - for connection in connections: - #extract info - input_signal_block_id = connection['input_signal_block_id'] - input_socket_index = connection['input_socket_index'] - output_signal_block_id = connection['output_signal_block_id'] - output_socket_index = connection['output_socket_index'] - #new connection - new_conn = odict() - new_conn['source_block_id'] = _convert_id(output_signal_block_id) - new_conn['sink_block_id'] = _convert_id(input_signal_block_id) - new_conn['source_key'] = output_socket_index - new_conn['sink_key'] = input_socket_index - #append connection - new_n['connection'].append(new_conn) - ############################################################ - # backup and replace - ############################################################ - #backup after successful conversion - os.rename(file_path, file_path+'.bak') - #save new flow graph to file path - ParseXML.to_file({'flow_graph': new_n}, file_path) diff --git a/grc/todo.txt b/grc/todo.txt index b4f020c0..ad7e62ff 100644 --- a/grc/todo.txt +++ b/grc/todo.txt @@ -1,3 +1,10 @@ +################################################## +# Examples +################################################## +* Push-to-Talk example +* Variable Config usage example +* Start/Stop the flow graph + ################################################## # Blocks ################################################## @@ -5,6 +12,8 @@ * log slider gui control * generic usrp (when its ready) * packet mod: whitening offset +* wx min window size in options block +* gr_adaptive_fir_ccf ################################################## # Features @@ -20,7 +29,18 @@ * separate generated code into top block and gui class * use gui.py in gr-wxgui and remove custom top_block_gui * configuration option for adding block paths -* data types guide/colors for the help menu +* orientations for ports (top, right, bottom, left) + * source defaults to right, sink defaults to left +* grid params take a notebook argument + * add a wx notebook block +* separation of variables and gui controls +* speedup w/ background layer and animation layer +* multiple doxygen directories (doc_dir becomes doc_path) +* use pango markup in tooltips for params +* use get_var_make to determine if it is a variable, not regexp +* concept of a project, or project flow graph + * collection of blocks, hier and top + * system-wide, default/work, and user created ################################################## # Problems @@ -34,12 +54,14 @@ * threads dont die on exit in probe and variable sink * overloaded gui classes for each platform, move param input objects into overloaded * align param titles in paramsdialog +* better error for blank string params +* weird grid params misbehaving +* params dialog needs to dynamically update for all params + * will not update for non-enum params + * needs to account for added or removed params ################################################## # Future ################################################## * require pygtk 2.12 for treeview tooltips * remove try/except in BlockTreeWindow.py -* remove support for saved flow graphs ending in .xml -* remove converter script for previous format -* reorganize module structure -- 2.30.2