root/branch/ggpolo/umitInventory/RefreshDialog.py @ 1260

Revision 1260, 2.0 kB (checked in by ggpolo, 6 years ago)

minor changes

Line 
1# Copyright (C) 2007 Insecure.Com LLC.
2#
3# Author: Guilherme Polo <ggpolo@gmail.com>
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program; if not, write to the Free Software
17# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19"""
20Dialog for changing custom time refresh for TLGraph
21"""
22
23import gtk
24
25from umitCore.I18N import _
26
27from higwidgets.higdialogs import HIGDialog
28
29class CustomRefreshDialog(HIGDialog):
30    """
31    Dialog for adjusting custom refresh time for TLGraph.
32    """
33
34    def __init__(self, start_value):
35        HIGDialog.__init__(self, title=_("Refresh Time"),
36                            buttons=(gtk.STOCK_OK, gtk.RESPONSE_OK,
37                                     gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
38       
39        lbl = gtk.Label(_("Minutes"))
40        self.spinbtn = gtk.SpinButton(gtk.Adjustment(value=start_value, 
41                                                     lower=1, upper=10000,
42                                                     step_incr=1), 1)
43                                                       
44        hbox = gtk.HBox()
45        hbox.add(lbl)
46        hbox.add(self.spinbtn)
47
48        self.vbox.pack_start(hbox)
49        self.show_all()
50
51
52def custom_refresh(*args):
53    """
54    Runs CustomRefreshDialog dialog.
55    """
56    dialog = CustomRefreshDialog(*args)
57    response = dialog.run()
58    dialog.destroy()
59
60    if response == gtk.RESPONSE_OK:
61        return dialog.spinbtn.get_value_as_int()
Note: See TracBrowser for help on using the browser.