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, write to the Free Software 17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 # 19 """ 20 String options, these classes will display a text box. 21 """ 22 23 import gtk 24 25 from screenlets.options import _ 26 from base import Option 2729 """An Option for string options.""" 30 choices = None 31 password = False 32 36 408142 """Generate a textbox for a string options""" 43 if self.choices: 44 # if a list of values is defined, show combobox 45 self.widget = gtk.combo_box_new_text() 46 p = -1 47 i = 0 48 for s in self.choices: 49 self.widget.append_text(s) 50 if s==value: 51 p = i 52 i+=1 53 self.widget.set_active(p) 54 else: 55 self.widget = gtk.Entry() 56 # if it is a password, set text to be invisible 57 if self.password: 58 self.widget.set_visibility(False) 59 60 self.set_value(value) 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( widget.get_active_text() ) 78 else: 79 self.set_value( widget.get_text() ) 80 super(StringOption, self).has_changed()
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Mon Jun 6 10:56:39 2011 | http://epydoc.sourceforge.net |