3
# openipmi GUI handling for domains
5
# Author: MontaVista Software, Inc.
6
# Corey Minyard <minyard@mvista.com>
9
# Copyright 2006 MontaVista Software Inc.
11
# This program is free software; you can redistribute it and/or
12
# modify it under the terms of the GNU Lesser General Public License
13
# as published by the Free Software Foundation; either version 2 of
14
# the License, or (at your option) any later version.
17
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
18
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
23
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
25
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
26
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
# You should have received a copy of the GNU Lesser General Public
29
# License along with this program; if not, write to the Free
30
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
36
def __init__(self, handler, val, pd):
37
self.handler = handler
44
self.handler(self.val)
54
def setdone(self, event):
60
def popup(ui, event, handlers, point=None):
61
menu = Tix.Menu(ui, tearoff=0);
65
p = PopupSelector(h[1], h[2], pd)
68
p = PopupSelector(h[1], None, pd)
70
menu.add("command", command=p.handle, label=h[0])
75
menu.post(point.x_root, point.y_root)
76
menu.grab_set_global()
77
menu.bind("<FocusOut>", pd.setdone)
78
menu.bind("<ButtonRelease-3>", pd.setdone)
80
event.widget.tk.dooneevent()