Home | Trees | Indices | Help |
|
---|
|
1 # 2 # Copyright (C) 2009 Martin Owens (DoctorMO) <doctormo@gmail.com> 3 # 4 # This program is free software; you can redistribute it and/or modify 5 # it under the terms of the GNU General Public License as published by 6 # the Free Software Foundation; either version 3 of the License, or 7 # (at your option) any later version. 8 # 9 # This program is distributed in the hope that it will be useful, 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 # GNU General Public License for more details. 13 # 14 # You should have received a copy of the GNU General Public License 15 # along with this program; if not, write to the Free Software 16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 # 18 """ 19 Time options, these classes will display a text box. 20 """ 21 22 import gtk 23 24 from screenlets.options import _ 25 from colour_option import ColorOption 2628 """An class for time options.""" 298031 """Generate a textbox for a time options""" 32 self.widget = gtk.HBox() 33 input_hour = gtk.SpinButton() 34 input_minute = gtk.SpinButton() 35 input_second = gtk.SpinButton() 36 input_hour.set_range(0, 23) 37 input_hour.set_max_length(2) 38 input_hour.set_increments(1, 1) 39 input_hour.set_numeric(True) 40 input_hour.set_value(value[0]) 41 input_minute.set_range(0, 59) 42 input_minute.set_max_length(2) 43 input_minute.set_increments(1, 1) 44 input_minute.set_numeric(True) 45 input_minute.set_value(value[1]) 46 input_second.set_range(0, 59) 47 input_second.set_max_length(2) 48 input_second.set_increments(1, 1) 49 input_second.set_numeric(True) 50 input_second.set_value(value[2]) 51 input_hour.connect('value-changed', self.has_changed) 52 input_minute.connect('value-changed', self.has_changed) 53 input_second.connect('value-changed', self.has_changed) 54 input_hour.set_tooltip_text(self.desc) 55 input_minute.set_tooltip_text(self.desc) 56 input_second.set_tooltip_text(self.desc) 57 self.widget.add(input_hour) 58 self.widget.add(gtk.Label(':')) 59 self.widget.add(input_minute) 60 self.widget.add(gtk.Label(':')) 61 self.widget.add(input_second) 62 self.widget.add(gtk.Label('h')) 63 self.widget.show_all() 64 return self.widget65 6971 """Executed when the widget event kicks off.""" 72 box = widget.get_parent() 73 inputs = box.get_children() 74 self.value = ( 75 int(inputs[0].get_value()), 76 int(inputs[2].get_value()), 77 int(inputs[4].get_value()), 78 ) 79 super(ColorOption, self).has_changed()
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Mon Jun 6 10:56:40 2011 | http://epydoc.sourceforge.net |