本文整理汇总了Python中gramps.gen.plug.menu.NumberOption.set_available方法的典型用法代码示例。如果您正苦于以下问题:Python NumberOption.set_available方法的具体用法?Python NumberOption.set_available怎么用?Python NumberOption.set_available使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gramps.gen.plug.menu.NumberOption
的用法示例。
在下文中一共展示了NumberOption.set_available方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: FamilyLinesOptions
# 需要导入模块: from gramps.gen.plug.menu import NumberOption [as 别名]
# 或者: from gramps.gen.plug.menu.NumberOption import set_available [as 别名]
#.........这里部分代码省略.........
self.include_dates = BooleanOption(_('Include dates'), True)
self.include_dates.set_help(_('Whether to include dates for people '
'and families.'))
add_option('incdates', self.include_dates)
self.include_dates.connect('value-changed', self.include_dates_changed)
self.justyears = BooleanOption(_("Limit dates to years only"), False)
self.justyears.set_help(_("Prints just dates' year, neither "
"month or day nor date approximation "
"or interval are shown."))
add_option("justyears", self.justyears)
include_places = BooleanOption(_('Include places'), True)
include_places.set_help(_('Whether to include placenames for people '
'and families.'))
add_option('incplaces', include_places)
include_num_children = BooleanOption(_('Include the number of '
'children'), True)
include_num_children.set_help(_('Whether to include the number of '
'children for families with more '
'than 1 child.'))
add_option('incchildcnt', include_num_children)
self.include_images = BooleanOption(_('Include '
'thumbnail images of people'),
True)
self.include_images.set_help(_('Whether to '
'include thumbnail images of people.'))
add_option('incimages', self.include_images)
self.include_images.connect('value-changed', self.images_changed)
self.image_location = EnumeratedListOption(_('Thumbnail location'), 0)
self.image_location.add_item(0, _('Above the name'))
self.image_location.add_item(1, _('Beside the name'))
self.image_location.set_help(_('Where the thumbnail image '
'should appear relative to the name'))
add_option('imageonside', self.image_location)
self.image_size = EnumeratedListOption(_('Thumbnail size'), SIZE_NORMAL)
self.image_size.add_item(SIZE_NORMAL, _('Normal'))
self.image_size.add_item(SIZE_LARGE, _('Large'))
self.image_size.set_help(_('Size of the thumbnail image'))
add_option('imagesize', self.image_size)
# ----------------------------
add_option = partial(menu.add_option, _('Family Colors'))
# ----------------------------
surname_color = SurnameColorOption(_('Family colors'))
surname_color.set_help(_('Colors to use for various family lines.'))
add_option('surnamecolors', surname_color)
# -------------------------
add_option = partial(menu.add_option, _('Individuals'))
# -------------------------
color_males = ColorOption(_('Males'), '#e0e0ff')
color_males.set_help(_('The color to use to display men.'))
add_option('colormales', color_males)
color_females = ColorOption(_('Females'), '#ffe0e0')
color_females.set_help(_('The color to use to display women.'))
add_option('colorfemales', color_females)
color_unknown = ColorOption(_('Unknown'), '#e0e0e0')
color_unknown.set_help(_('The color to use '
'when the gender is unknown.'))
add_option('colorunknown', color_unknown)
color_family = ColorOption(_('Families'), '#ffffe0')
color_family.set_help(_('The color to use to display families.'))
add_option('colorfamilies', color_family)
self.limit_changed()
self.images_changed()
def limit_changed(self):
"""
Handle the change of limiting parents and children.
"""
self.max_parents.set_available(self.limit_parents.get_value())
self.max_children.set_available(self.limit_children.get_value())
def images_changed(self):
"""
Handle the change of including images.
"""
self.image_location.set_available(self.include_images.get_value())
self.image_size.set_available(self.include_images.get_value())
def include_dates_changed(self):
"""
Enable/disable menu items if dates are required
"""
if self.include_dates.get_value():
self.justyears.set_available(True)
else:
self.justyears.set_available(False)