2
# Copyright 2009 Free Software Foundation, Inc.
4
# This file is part of GNU Radio
6
# GNU Radio is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 3, or (at your option)
11
# GNU Radio is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with GNU Radio; see the file COPYING. If not, write to
18
# the Free Software Foundation, Inc., 51 Franklin Street,
19
# Boston, MA 02110-1301, USA.
23
The following classes will be available through gnuradio.wxgui.forms:
26
########################################################################
28
########################################################################
29
from converters import \
30
eval_converter, str_converter, \
31
float_converter, int_converter
33
########################################################################
35
########################################################################
37
radio_buttons, drop_down, notebook, \
38
button, toggle_button, single_button, \
39
check_box, text_box, static_text, \
40
slider, log_slider, gauge, \
41
make_bold, DataEvent, EVT_DATA
43
########################################################################
45
########################################################################
48
class static_box_sizer(wx.StaticBoxSizer):
50
A box sizer with label and border.
51
@param parent the parent widget
52
@param sizer add this widget to sizer if provided (optional)
53
@param proportion the proportion when added to the sizer (default=0)
54
@param flag the flag argument when added to the sizer (default=wx.EXPAND)
55
@param label title label for this widget (optional)
56
@param bold true to boldify the label
57
@param orient the sizer orientation wx.VERTICAL or wx.HORIZONTAL (default=wx.VERTICAL)
59
def __init__(self, parent, label='', bold=False, sizer=None, orient=wx.VERTICAL, proportion=0, flag=wx.EXPAND):
60
box = wx.StaticBox(parent=parent, label=label)
61
if bold: make_bold(box)
62
wx.StaticBoxSizer.__init__(self, box=box, orient=orient)
63
if sizer: sizer.Add(self, proportion, flag)
65
class incr_decr_buttons(wx.BoxSizer):
67
A horizontal box sizer with a increment and a decrement button.
68
@param parent the parent widget
69
@param sizer add this widget to sizer if provided (optional)
70
@param proportion the proportion when added to the sizer (default=0)
71
@param flag the flag argument when added to the sizer (default=wx.EXPAND)
72
@param label title label for this widget (optional)
73
@param on_incr the callback for pressing the + button
74
@param on_decr the callback for pressing the - button
76
def __init__(self, parent, on_incr, on_decr, label='', sizer=None, proportion=0, flag=wx.EXPAND):
78
@param parent the parent window
79
@param on_incr the event handler for increment
80
@param on_decr the event handler for decrement
82
wx.BoxSizer.__init__(self, wx.HORIZONTAL)
83
buttons_box = wx.BoxSizer(wx.HORIZONTAL)
84
self._incr_button = wx.Button(parent, label='+', style=wx.BU_EXACTFIT)
85
self._incr_button.Bind(wx.EVT_BUTTON, on_incr)
86
buttons_box.Add(self._incr_button, 0, wx.ALIGN_CENTER_VERTICAL)
87
self._decr_button = wx.Button(parent, label=' - ', style=wx.BU_EXACTFIT)
88
self._decr_button.Bind(wx.EVT_BUTTON, on_decr)
89
buttons_box.Add(self._decr_button, 0, wx.ALIGN_CENTER_VERTICAL)
91
self.Add(wx.StaticText(parent, label='%s: '%label), 1, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT)
92
self.Add(buttons_box, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
93
else: self.Add(buttons_box, 0, wx.ALIGN_CENTER_VERTICAL)
94
if sizer: sizer.Add(self, proportion, flag)
96
def Disable(self, disable=True): self.Enable(not disable)
97
def Enable(self, enable=True):
99
self._incr_button.Enable()
100
self._decr_button.Enable()
102
self._incr_button.Disable()
103
self._decr_button.Disable()