Home | Trees | Indices | Help |
|
---|
|
1 # 2 # Copyright (C) 2009 Martin Owens (DoctorMO) <doctormo@gmail.com> 3 # Changed by Guido Tabbernuk 2011 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 3 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, see <http://www.gnu.org/licenses/>. 17 # 18 """ 19 String options, these classes will display a text box. 20 """ 21 22 import gtk 23 24 from screenlets.options import _ 25 from base import Option 2628 """An Option for string options.""" 29 choices = None 30 password = False 31 35 398141 """Generate a textbox for a string options""" 42 if self.choices: 43 # if a list of values is defined, show combobox 44 self.widget = gtk.combo_box_new_text() 45 p = -1 46 i = 0 47 for s in self.choices: 48 self.widget.append_text(s) 49 if s==value: 50 p = i 51 i+=1 52 self.widget.set_active(p) 53 else: 54 self.widget = gtk.Entry() 55 # if it is a password, set text to be invisible 56 if self.password: 57 self.widget.set_visibility(False) 58 59 self.set_value(value) 60 if self.realtime: 61 self.widget.connect("changed", self.has_changed) 62 #self.widget.set_size_request(180, 28) 63 return self.widget6466 """Set the string value as required.""" 67 self.value = value 68 if self.choices: 69 # TODO self.widget.set_active(p) 70 pass 71 else: 72 self.widget.set_text(value)7375 """Executed when the widget event kicks off.""" 76 if self.choices: 77 self.set_value( self.widget.get_active_text() ) 78 else: 79 self.set_value( self.widget.get_text() ) 80 super(StringOption, self).has_changed()
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Jan 4 16:58:25 2012 | http://epydoc.sourceforge.net |