[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r6760 - gnuradio/branches/developers/michaelld/ptt/gnu
From: |
michaelld |
Subject: |
[Commit-gnuradio] r6760 - gnuradio/branches/developers/michaelld/ptt/gnuradio-examples/python/usrp |
Date: |
Wed, 31 Oct 2007 08:43:43 -0600 (MDT) |
Author: michaelld
Date: 2007-10-31 08:43:42 -0600 (Wed, 31 Oct 2007)
New Revision: 6760
Modified:
gnuradio/branches/developers/michaelld/ptt/gnuradio-examples/python/usrp/usrp_nbfm_ptt.py
Log:
Added PTT buttons, for combined "Hit Space ..." or pushbutton functionality.
Modified:
gnuradio/branches/developers/michaelld/ptt/gnuradio-examples/python/usrp/usrp_nbfm_ptt.py
===================================================================
---
gnuradio/branches/developers/michaelld/ptt/gnuradio-examples/python/usrp/usrp_nbfm_ptt.py
2007-10-31 14:30:46 UTC (rev 6759)
+++
gnuradio/branches/developers/michaelld/ptt/gnuradio-examples/python/usrp/usrp_nbfm_ptt.py
2007-10-31 14:43:42 UTC (rev 6760)
@@ -127,9 +127,33 @@
return self.set_freq(kv['freq'])
self.panel = panel
-
- # FIXME This REALLY needs to be replaced with a hand-crafted button
- # that sends both button down and button up events
+
+ panel.Bind(wx.EVT_KEY_DOWN, self._on_key_down)
+ panel.Bind(wx.EVT_KEY_UP, self._on_key_up)
+ panel.Bind(wx.EVT_KILL_FOCUS, self._on_kill_focus)
+ panel.SetFocus()
+
+ # top border
+ vbox.Add ((0,10), 0)
+
+ # creat the hbox sizer for the overall panel
+ overall_hbox = wx.BoxSizer (wx.HORIZONTAL)
+ # left border, non-stretch
+ overall_hbox.Add ((5,0), 0)
+
+ # left PTT button
+ self.xmit_left = wx.Button (panel, -1, "PTT") #, size=(50,350))
+ self.xmit_left.Bind (wx.EVT_LEFT_DOWN, self.callback_xmit_left_down)
+ self.xmit_left.Bind (wx.EVT_LEFT_UP, self.callback_xmit_left_up)
+ self.xmit_left.Bind (wx.EVT_LEAVE_WINDOW, self.callback_leave_left)
+ overall_hbox.Add (self.xmit_left, 0, wx.EXPAND)
+ # border between left button and mid-section
+ overall_hbox.Add ((5,0), 0)
+
+ # create the vbox sizer for the middle section
+ middle_vbox = wx.BoxSizer (wx.VERTICAL)
+
+ # create a top box for the text "Press Space Bar ..."
hbox = wx.BoxSizer(wx.HORIZONTAL)
hbox.Add((10,0), 1)
self.status_msg = wx.StaticText(panel, -1, "Press Space Bar to
Transmit")
@@ -137,26 +161,21 @@
self.status_msg.SetFont(wx.Font(15, of.GetFamily(), of.GetStyle(),
of.GetWeight()))
hbox.Add(self.status_msg, 0, wx.ALIGN_CENTER)
hbox.Add((10,0), 1)
- vbox.Add(hbox, 0, wx.EXPAND | wx.ALIGN_CENTER)
+ middle_vbox.Add(hbox, 0, wx.EXPAND | wx.ALIGN_CENTER)
- panel.Bind(wx.EVT_KEY_DOWN, self._on_key_down)
- panel.Bind(wx.EVT_KEY_UP, self._on_key_up)
- panel.Bind(wx.EVT_KILL_FOCUS, self._on_kill_focus)
- panel.SetFocus()
-
if 1 and not(no_gui):
rx_fft = fftsink2.fft_sink_c(panel, title="Rx Input", fft_size=512,
sample_rate=self.rxpath.if_rate,
ref_level=80, y_per_div=20)
self.connect (self.rxpath.u, rx_fft)
- vbox.Add (rx_fft.win, 1, wx.EXPAND)
+ middle_vbox.Add (rx_fft.win, 1, wx.EXPAND)
if 1 and not(no_gui):
rx_fft = fftsink2.fft_sink_c(panel, title="Post s/w DDC",
fft_size=512,
sample_rate=self.rxpath.quad_rate,
ref_level=80, y_per_div=20)
self.connect (self.rxpath.ddc, rx_fft)
- vbox.Add (rx_fft.win, 1, wx.EXPAND)
+ middle_vbox.Add (rx_fft.win, 1, wx.EXPAND)
if 0 and not(no_gui):
foo = scopesink2.scope_sink_f(panel, title="Squelch",
@@ -164,15 +183,14 @@
self.connect (self.rxpath.fmrx.div, (foo,0))
self.connect (self.rxpath.fmrx.gate, (foo,1))
self.connect (self.rxpath.fmrx.squelch_lpf, (foo,2))
- vbox.Add (foo.win, 1, wx.EXPAND)
+ middle_vbox.Add (foo.win, 1, wx.EXPAND)
if 0 and not(no_gui):
tx_fft = fftsink2.fft_sink_c(panel, title="Tx Output",
fft_size=512,
sample_rate=self.txpath.usrp_rate)
self.connect (self.txpath.amp, tx_fft)
- vbox.Add (tx_fft.win, 1, wx.EXPAND)
+ middle_vbox.Add (tx_fft.win, 1, wx.EXPAND)
-
# add control area at the bottom
self.myform = myform = form.form()
@@ -185,7 +203,7 @@
callback=myform.check_input_and_call(_form_set_freq,
self._set_status_msg))
hbox.Add((5,0), 0, 0)
- vbox.Add(hbox, 0, wx.EXPAND)
+ middle_vbox.Add(hbox, 0, wx.EXPAND)
# second row
@@ -205,11 +223,31 @@
weight=3,
range=self.rxpath.subdev.gain_range(),
callback=self.set_rx_gain)
hbox.Add((5,0), 0)
- vbox.Add(hbox, 0, wx.EXPAND)
+ middle_vbox.Add(hbox, 0, wx.EXPAND)
-
self._build_subpanel(vbox)
+ # add the middle vbox to the overall hbox
+ overall_hbox.Add (middle_vbox, 1, wx.EXPAND)
+
+ # right PTT button
+ self.xmit_right = wx.Button (panel, -1, "PTT")
+ self.xmit_right.Bind (wx.EVT_LEFT_DOWN,
+ self.callback_xmit_right_down)
+ self.xmit_right.Bind (wx.EVT_LEFT_UP,
+ self.callback_xmit_right_up)
+ self.xmit_right.Bind (wx.EVT_LEAVE_WINDOW,
+ self.callback_leave_right)
+ overall_hbox.Add (self.xmit_right, 0, wx.EXPAND)
+ # border between mid-section and right button
+ overall_hbox.Add ((5,0), 0)
+
+ # add the overall hbox to the overall sizer
+ vbox.Add (overall_hbox, 1, wx.EXPAND)
+
+ # bottom border
+ vbox.Add ((0,10), 0)
+
def _build_subpanel(self, vbox_arg):
# build a secondary information panel (sometimes hidden)
@@ -247,23 +285,41 @@
self.frame.GetStatusBar().SetStatusText(msg, which)
def _on_key_down(self, evt):
- # print "key_down:", evt.m_keyCode
+ #print "key_down:", evt.m_keyCode
if evt.m_keyCode == wx.WXK_SPACE and not(self.space_bar_pressed):
self.space_bar_pressed = True
self.set_transmit(True)
def _on_key_up(self, evt):
- # print "key_up", evt.m_keyCode
+ #print "key_up", evt.m_keyCode
if evt.m_keyCode == wx.WXK_SPACE:
self.space_bar_pressed = False
self.set_transmit(False)
def _on_kill_focus(self, evt):
+ #print "kill focus"
# if we lose the keyboard focus, turn off the transmitter
self.space_bar_pressed = False
self.set_transmit(False)
-
+ def callback_xmit_left_down (self, event):
+ self.set_transmit (True)
+
+ def callback_xmit_left_up (self, event):
+ self.set_transmit (False)
+
+ def callback_leave_left (self, event):
+ self.set_transmit (False)
+
+ def callback_xmit_right_down (self, event):
+ self.set_transmit (True)
+
+ def callback_xmit_right_up (self, event):
+ self.set_transmit (False)
+
+ def callback_leave_right (self, event):
+ self.set_transmit (False)
+
# ////////////////////////////////////////////////////////////////////////
# Transmit Path
# ////////////////////////////////////////////////////////////////////////
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r6760 - gnuradio/branches/developers/michaelld/ptt/gnuradio-examples/python/usrp,
michaelld <=