No changes between revisions
/Designs/Oscilloscope/SW/PC_side/gnuradio/top_block.py/top_block.py |
---|
0,0 → 1,84 |
#!/usr/bin/env python |
################################################## |
# Gnuradio Python Flow Graph |
# Title: Top Block |
# Generated: Sat Nov 12 20:35:22 2011 |
################################################## |
from PyQt4 import Qt |
from gnuradio import eng_notation |
from gnuradio import gr |
from gnuradio.eng_option import eng_option |
from gnuradio.gr import firdes |
from gnuradio.qtgui import qtgui |
from optparse import OptionParser |
import sip |
import sys |
class top_block(gr.top_block, Qt.QWidget): |
def __init__(self): |
gr.top_block.__init__(self, "Top Block") |
Qt.QWidget.__init__(self) |
self.setWindowTitle("Top Block") |
self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) |
self.top_scroll_layout = Qt.QVBoxLayout() |
self.setLayout(self.top_scroll_layout) |
self.top_scroll = Qt.QScrollArea() |
self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) |
self.top_scroll_layout.addWidget(self.top_scroll) |
self.top_scroll.setWidgetResizable(True) |
self.top_widget = Qt.QWidget() |
self.top_scroll.setWidget(self.top_widget) |
self.top_layout = Qt.QVBoxLayout(self.top_widget) |
self.top_grid_layout = Qt.QGridLayout() |
self.top_layout.addLayout(self.top_grid_layout) |
################################################## |
# Variables |
################################################## |
self.samp_rate = samp_rate = 250000 |
################################################## |
# Blocks |
################################################## |
self.qtgui_sink_x_0 = qtgui.sink_f( |
1024, #fftsize |
firdes.WIN_BLACKMAN_hARRIS, #wintype |
0, #fc |
samp_rate, #bw |
"QT GUI Plot", #name |
True, #plotfreq |
True, #plotwaterfall |
True, #plottime |
True, #plotconst |
) |
self._qtgui_sink_x_0_win = sip.wrapinstance(self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget) |
self.top_layout.addWidget(self._qtgui_sink_x_0_win) |
self.gr_short_to_float_0 = gr.short_to_float() |
self.gr_file_source_0 = gr.file_source(gr.sizeof_short*1, "/dev/ttyUSB0", True) |
################################################## |
# Connections |
################################################## |
self.connect((self.gr_file_source_0, 0), (self.gr_short_to_float_0, 0)) |
self.connect((self.gr_short_to_float_0, 0), (self.qtgui_sink_x_0, 0)) |
def get_samp_rate(self): |
return self.samp_rate |
def set_samp_rate(self, samp_rate): |
self.samp_rate = samp_rate |
self.qtgui_sink_x_0.set_frequency_range(0, self.samp_rate) |
if __name__ == '__main__': |
parser = OptionParser(option_class=eng_option, usage="%prog: [options]") |
(options, args) = parser.parse_args() |
qapp = Qt.QApplication(sys.argv) |
tb = top_block() |
tb.start() |
tb.show() |
qapp.exec_() |
tb.stop() |
Property changes: |
Added: svn:executable |
+* |
\ No newline at end of property |