Contribution from Craig J. Anderson: Add availability update to GuiStringOption and GuiBooleanOption.
svn: r11338
This commit is contained in:
parent
475da86de2
commit
2a33e32456
@ -3,6 +3,7 @@
|
|||||||
#
|
#
|
||||||
# Copyright (C) 2007-2008 Brian G. Matherly
|
# Copyright (C) 2007-2008 Brian G. Matherly
|
||||||
# Copyright (C) 2008 Gary Burton
|
# Copyright (C) 2008 Gary Burton
|
||||||
|
# Copyright (C) 2008 Craig J. Anderson
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -169,12 +170,22 @@ class GuiStringOption(gtk.Entry):
|
|||||||
self.connect('changed', self.__text_changed)
|
self.connect('changed', self.__text_changed)
|
||||||
tooltip.set_tip(self, self.__option.get_help())
|
tooltip.set_tip(self, self.__option.get_help())
|
||||||
|
|
||||||
|
self.__option.connect('avail-changed', self.__update_avail)
|
||||||
|
self.__update_avail()
|
||||||
|
|
||||||
def __text_changed(self, obj): # IGNORE:W0613 - obj is unused
|
def __text_changed(self, obj): # IGNORE:W0613 - obj is unused
|
||||||
"""
|
"""
|
||||||
Handle the change of the value.
|
Handle the change of the value.
|
||||||
"""
|
"""
|
||||||
self.__option.set_value( self.get_text() )
|
self.__option.set_value( self.get_text() )
|
||||||
|
|
||||||
|
def __update_avail(self):
|
||||||
|
"""
|
||||||
|
Update the availability (sensitivity) of this widget.
|
||||||
|
"""
|
||||||
|
avail = self.__option.get_available()
|
||||||
|
self.set_sensitive(avail)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GuiColorOption class
|
# GuiColorOption class
|
||||||
@ -305,13 +316,23 @@ class GuiBooleanOption(gtk.CheckButton):
|
|||||||
self.set_active(self.__option.get_value())
|
self.set_active(self.__option.get_value())
|
||||||
self.connect('toggled', self.__value_changed)
|
self.connect('toggled', self.__value_changed)
|
||||||
tooltip.set_tip(self, self.__option.get_help())
|
tooltip.set_tip(self, self.__option.get_help())
|
||||||
|
|
||||||
|
self.__option.connect('avail-changed', self.__update_avail)
|
||||||
|
self.__update_avail()
|
||||||
|
|
||||||
def __value_changed(self, obj): # IGNORE:W0613 - obj is unused
|
def __value_changed(self, obj): # IGNORE:W0613 - obj is unused
|
||||||
"""
|
"""
|
||||||
Handle the change of the value.
|
Handle the change of the value.
|
||||||
"""
|
"""
|
||||||
self.__option.set_value( self.get_active() )
|
self.__option.set_value( self.get_active() )
|
||||||
|
|
||||||
|
def __update_avail(self):
|
||||||
|
"""
|
||||||
|
Update the availability (sensitivity) of this widget.
|
||||||
|
"""
|
||||||
|
avail = self.__option.get_available()
|
||||||
|
self.set_sensitive(avail)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GuiEnumeratedListOption class
|
# GuiEnumeratedListOption class
|
||||||
|
Loading…
Reference in New Issue
Block a user