Change the availability of some options in FamilyLines depending on the value of other options.
svn: r9945
This commit is contained in:
parent
f37918ad3a
commit
a25fb9bdd6
@ -1,3 +1,9 @@
|
|||||||
|
2008-01-28 Brian Matherly <brian@gramps-project.org>
|
||||||
|
* src/PluginUtils/_GuiOptions.py:
|
||||||
|
* src/plugins/GVFamilyLines.py:
|
||||||
|
Change the availability of some options in FamilyLines depending on the
|
||||||
|
value of other options.
|
||||||
|
|
||||||
2008-01-28 Benny Malengier <benny.malengier@gramps-project.org>
|
2008-01-28 Benny Malengier <benny.malengier@gramps-project.org>
|
||||||
* src/ArgHandler.py:
|
* src/ArgHandler.py:
|
||||||
* src/DbManager.py:
|
* src/DbManager.py:
|
||||||
|
@ -225,6 +225,9 @@ class GuiNumberOption(gtk.SpinButton):
|
|||||||
self.connect('value_changed', self.__value_changed)
|
self.connect('value_changed', 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.
|
||||||
@ -232,6 +235,13 @@ class GuiNumberOption(gtk.SpinButton):
|
|||||||
vtype = type(self.__option.get_value())
|
vtype = type(self.__option.get_value())
|
||||||
self.__option.set_value( vtype(self.get_value()) )
|
self.__option.set_value( vtype(self.get_value()) )
|
||||||
|
|
||||||
|
def __update_avail(self):
|
||||||
|
"""
|
||||||
|
Update the availability (sensitivity) of this widget.
|
||||||
|
"""
|
||||||
|
avail = self.__option.get_available()
|
||||||
|
self.set_sensitive(avail)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GuiTextOption class
|
# GuiTextOption class
|
||||||
|
@ -81,6 +81,12 @@ class FamilyLinesOptions(MenuReportOptions):
|
|||||||
to configure the FamilyLines reports.
|
to configure the FamilyLines reports.
|
||||||
"""
|
"""
|
||||||
def __init__(self, name, dbase):
|
def __init__(self, name, dbase):
|
||||||
|
self.limit_parents = None
|
||||||
|
self.max_parents = None
|
||||||
|
self.limit_children = None
|
||||||
|
self.max_children = None
|
||||||
|
self.include_images = None
|
||||||
|
self.image_location = None
|
||||||
MenuReportOptions.__init__(self, name, dbase)
|
MenuReportOptions.__init__(self, name, dbase)
|
||||||
|
|
||||||
def add_menu_options(self, menu):
|
def add_menu_options(self, menu):
|
||||||
@ -133,35 +139,47 @@ class FamilyLinesOptions(MenuReportOptions):
|
|||||||
colourFamily.set_help( _('The colour to use to display families.'))
|
colourFamily.set_help( _('The colour to use to display families.'))
|
||||||
menu.add_option(category, 'FLcolourFamilies', colourFamily)
|
menu.add_option(category, 'FLcolourFamilies', colourFamily)
|
||||||
|
|
||||||
self.limitParents = BooleanOption( _('Limit the number of parents'), False)
|
self.limit_parents = BooleanOption(_('Limit the number of parents'),
|
||||||
self.limitParents.set_help( _('The maximum number of ancestors to include.'))
|
False)
|
||||||
menu.add_option(category, 'FLlimitParents', self.limitParents)
|
self.limit_parents.set_help(
|
||||||
|
_('The maximum number of ancestors to include.'))
|
||||||
|
menu.add_option(category, 'FLlimitParents', self.limit_parents)
|
||||||
|
self.limit_parents.connect('value-changed', self.limit_changed)
|
||||||
|
|
||||||
self.maxParents = NumberOption( '', 50, 10, 9999)
|
self.max_parents = NumberOption('', 50, 10, 9999)
|
||||||
self.maxParents.set_help( _('The maximum number of ancestors to include.'))
|
self.max_parents.set_help(
|
||||||
menu.add_option(category, 'FLmaxParents', self.maxParents)
|
_('The maximum number of ancestors to include.'))
|
||||||
|
menu.add_option(category, 'FLmaxParents', self.max_parents)
|
||||||
|
|
||||||
self.limitChildren = BooleanOption( _('Limit the number of children'), False)
|
self.limit_children = BooleanOption(_('Limit the number of children'),
|
||||||
self.limitChildren.set_help( _('The maximum number of children to include.'))
|
False)
|
||||||
menu.add_option(category, 'FLlimitChildren', self.limitChildren)
|
self.limit_children.set_help(
|
||||||
|
_('The maximum number of children to include.'))
|
||||||
|
menu.add_option(category, 'FLlimitChildren', self.limit_children)
|
||||||
|
self.limit_children.connect('value-changed', self.limit_changed)
|
||||||
|
|
||||||
self.maxChildren = NumberOption( '', 50, 10, 9999)
|
self.max_children = NumberOption('', 50, 10, 9999)
|
||||||
self.maxChildren.set_help( _('The maximum number of children to include.'))
|
self.max_children.set_help(
|
||||||
menu.add_option(category, 'FLmaxChildren', self.maxChildren)
|
_('The maximum number of children to include.'))
|
||||||
|
menu.add_option(category, 'FLmaxChildren', self.max_children)
|
||||||
|
|
||||||
# --------------------
|
# --------------------
|
||||||
category = _('Images')
|
category = _('Images')
|
||||||
# --------------------
|
# --------------------
|
||||||
|
|
||||||
self.includeImages = BooleanOption( _('Include thumbnail images of people'), True)
|
self.include_images = BooleanOption(
|
||||||
self.includeImages.set_help( _('The maximum number of children to include.'))
|
_('Include thumbnail images of people'), True)
|
||||||
menu.add_option(category, 'FLincludeImages', self.includeImages)
|
self.include_images.set_help(
|
||||||
|
_('The maximum number of children to include.'))
|
||||||
|
menu.add_option(category, 'FLincludeImages', self.include_images)
|
||||||
|
self.include_images.connect('value-changed', self.images_changed)
|
||||||
|
|
||||||
self.imageLocation = EnumeratedListOption(_('Thumbnail location'), 0)
|
self.image_location = EnumeratedListOption(_('Thumbnail location'), 0)
|
||||||
self.imageLocation.add_item(0, _('Above the name'))
|
self.image_location.add_item(0, _('Above the name'))
|
||||||
self.imageLocation.add_item(1, _('Beside the name'))
|
self.image_location.add_item(1, _('Beside the name'))
|
||||||
self.imageLocation.set_help( _('Where the thumbnail image should appear relative to the name'))
|
self.image_location.set_help(
|
||||||
menu.add_option(category, 'FLimageOnTheSide', self.imageLocation)
|
_('Where the thumbnail image should appear relative to the name'))
|
||||||
|
menu.add_option(category, 'FLimageOnTheSide', self.image_location)
|
||||||
|
|
||||||
# ---------------------
|
# ---------------------
|
||||||
category = _('Options')
|
category = _('Options')
|
||||||
@ -194,28 +212,21 @@ class FamilyLinesOptions(MenuReportOptions):
|
|||||||
includePrivate.set_help( _('Whether to include names, dates, and families that are marked as private.'))
|
includePrivate.set_help( _('Whether to include names, dates, and families that are marked as private.'))
|
||||||
menu.add_option(category, 'FLincludePrivate', includePrivate)
|
menu.add_option(category, 'FLincludePrivate', includePrivate)
|
||||||
|
|
||||||
|
self.limit_changed()
|
||||||
|
self.images_changed()
|
||||||
|
|
||||||
def limitChanged(self, button):
|
def limit_changed(self):
|
||||||
self.maxParents.gobj.set_sensitive(self.limitParents.gobj.get_active())
|
"""
|
||||||
self.maxChildren.gobj.set_sensitive(self.limitChildren.gobj.get_active())
|
Handle the change of limiting parents and children.
|
||||||
|
"""
|
||||||
|
self.max_parents.set_available(self.limit_parents.get_value())
|
||||||
def imagesChanged(self, button):
|
self.max_children.set_available(self.limit_children.get_value())
|
||||||
self.imageLocation.gobj.set_sensitive(self.includeImages.gobj.get_active())
|
|
||||||
|
|
||||||
|
|
||||||
def post_init(self, dialog):
|
|
||||||
# this method is called after all of the controls have been
|
|
||||||
# created, but before the notebook itself has been created
|
|
||||||
|
|
||||||
self.limitParents. gobj.connect('toggled', self.limitChanged )
|
|
||||||
self.limitChildren. gobj.connect('toggled', self.limitChanged )
|
|
||||||
self.includeImages. gobj.connect('toggled', self.imagesChanged )
|
|
||||||
|
|
||||||
# ensure things are initialized correctly when it first comes up
|
|
||||||
self.limitChanged( self.limitParents.gobj )
|
|
||||||
self.imagesChanged( self.includeImages.gobj )
|
|
||||||
|
|
||||||
|
def images_changed(self):
|
||||||
|
"""
|
||||||
|
Handle the change of including images.
|
||||||
|
"""
|
||||||
|
self.image_location.set_available(self.include_images.get_value())
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user