本文整理汇总了Python中gramps.gen.plug.menu.NumberOption类的典型用法代码示例。如果您正苦于以下问题:Python NumberOption类的具体用法?Python NumberOption怎么用?Python NumberOption使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NumberOption类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_menu_options
def add_menu_options(self, menu):
"""
Add options to the menu for the ancestor report.
"""
category_name = _("Report Options")
pid = PersonOption(_("Center Person"))
pid.set_help(_("The center person for the report"))
menu.add_option(category_name, "pid", pid)
stdoptions.add_name_format_option(menu, category_name)
stdoptions.add_private_data_option(menu, category_name)
maxgen = NumberOption(_("Generations"), 10, 1, 100)
maxgen.set_help(_("The number of generations to include in the report"))
menu.add_option(category_name, "maxgen", maxgen)
pagebbg = BooleanOption(_("Page break between generations"), False)
pagebbg.set_help(
_("Whether to start a new page after each generation."))
menu.add_option(category_name, "pagebbg", pagebbg)
namebrk = BooleanOption(_("Add linebreak after each name"), False)
namebrk.set_help(_("Indicates if a line break should follow the name."))
menu.add_option(category_name, "namebrk", namebrk)
stdoptions.add_localization_option(menu, category_name)
示例2: add_menu_options
def add_menu_options(self, menu):
category_name = _("Selection")
self.replace_without_asking = BooleanOption(
_("Replace existing references to the person "
"being assigned without asking"),
REPLACE_WITHOUT_ASKING)
menu.add_option(category_name, "replace_without_asking",
self.replace_without_asking)
category_name = _("Face detection")
width, height = MIN_FACE_SIZE
sensitivity = SENSITIVITY
self.min_face_width = NumberOption(_("Minimum face width (px)"),
width, 1, 1000, 1)
self.min_face_height = NumberOption(_("Minimum face height (px)"),
height, 1, 1000, 1)
self.detect_inside_existing_boxes = BooleanOption(
_("Detect faces inside existing boxes"),
DETECT_INSIDE_EXISTING_BOXES)
self.sensitivity = NumberOption(_("Sensitivity (1 min .. 20 max)"),
sensitivity, 1, 20, 1)
menu.add_option(category_name, "min_face_width", self.min_face_width)
menu.add_option(category_name, "min_face_height", self.min_face_height)
menu.add_option(category_name, "sensitivity", self.sensitivity)
menu.add_option(category_name, "detect_inside_existing_boxes",
self.detect_inside_existing_boxes)
示例3: add_menu_options
def add_menu_options(self, menu):
""" Add the options for this report """
category_name = _("Report Options")
title = StringOption(_("book|Title"), _("Title of the Book"))
title.set_help(_("Title string for the book."))
menu.add_option(category_name, "title", title)
subtitle = StringOption(_("Subtitle"), _("Subtitle of the Book"))
subtitle.set_help(_("Subtitle string for the book."))
menu.add_option(category_name, "subtitle", subtitle)
dateinfo = time.localtime(time.time())
rname = self.__db.get_researcher().get_name()
footer_string = _("Copyright %(year)d %(name)s") % {"year": dateinfo[0], "name": rname}
footer = StringOption(_("Footer"), footer_string)
footer.set_help(_("Footer string for the page."))
menu.add_option(category_name, "footer", footer)
imgid = MediaOption(_("Image"))
imgid.set_help(_("Gramps ID of the media object to use as an image."))
menu.add_option(category_name, "imgid", imgid)
imgsize = NumberOption(_("Image Size"), 0, 0, 20, 0.1)
imgsize.set_help(
_("Size of the image in cm. A value of 0 indicates " "that the image should be fit to the page.")
)
menu.add_option(category_name, "imgsize", imgsize)
示例4: add_menu_options
def add_menu_options(self, menu):
"""
Add options to the document menu for the AsciiDoc docgen.
"""
category_name = 'Document Options' # internal name: don't translate
linechars = NumberOption(_('Characters per line'), 72, 20, 9999)
linechars.set_help(_("The number of characters per line"))
menu.add_option(category_name, 'linechars', linechars)
示例5: add_menu_options
def add_menu_options(self, menu):
"""
Add options to the document menu for the AsciiDoc docgen.
"""
category_name = DOCGEN_OPTIONS
linechars = NumberOption(_('Characters per line'), 72, 20, 9999)
linechars.set_help(_("The number of characters per line"))
menu.add_option(category_name, 'linechars', linechars)
示例6: add_menu_options
def add_menu_options(self, menu):
"""
Add options to the menu for the ancestor report.
"""
category_name = _("Report Options")
self.__pid = PersonOption(_("Center Person"))
self.__pid.set_help(_("The center person for the report"))
menu.add_option(category_name, "pid", self.__pid)
maxgen = NumberOption(_("Generations"), 10, 1, 300)
maxgen.set_help(_("The number of generations to include in the report"))
menu.add_option(category_name, "maxgen", maxgen)
Filleddigit = NumberOption(_("Filled digit"), 10, 1, 50)
Filleddigit.set_help(_("The number of digits after comma to include in the report for the percentage of ancestor found at a given generation"))
menu.add_option(category_name, "Filled_digit", Filleddigit)
Collapsedigit = NumberOption(_("Collapsed digit"), 10, 1, 50)
Collapsedigit.set_help(_("The number of digits after comma to include in the report for the pedigree Collapse"))
menu.add_option(category_name, "Collapsed_digit", Collapsedigit)
displayth = BooleanOption(_("Display theoretical"), False)
displayth.set_help(_("Whether to display the theoretical number of ancestor by generation"))
menu.add_option(category_name, "Display_theoretical", displayth)
stdoptions.add_name_format_option(menu, category_name)
stdoptions.add_localization_option(menu, category_name)
示例7: add_menu_options
def add_menu_options(self, menu):
"""
Add options to the document menu for the AsciiDoc docgen.
"""
# next line for internal use only, never will be in UI: don't translate
category_name = 'Document Options'
linechars = NumberOption(_('Characters per line'), 72, 20, 9999)
linechars.set_help(_("The number of characters per line"))
menu.add_option(category_name, 'linechars', linechars)
示例8: add_menu_options
def add_menu_options(self, menu):
"""
Add options to the menu for the fan chart.
"""
category_name = _("Report Options")
self.__pid = PersonOption(_("Center Person"))
self.__pid.set_help(_("The center person for the report"))
menu.add_option(category_name, "pid", self.__pid)
max_gen = NumberOption(_("Generations"), 5, 1, self.max_generations)
max_gen.set_help(_("The number of generations "
"to include in the report"))
menu.add_option(category_name, "maxgen", max_gen)
circle = EnumeratedListOption(_('Type of graph'), HALF_CIRCLE)
circle.add_item(FULL_CIRCLE, _('full circle'))
circle.add_item(HALF_CIRCLE, _('half circle'))
circle.add_item(QUAR_CIRCLE, _('quarter circle'))
circle.set_help(_("The form of the graph: full circle, half circle,"
" or quarter circle."))
menu.add_option(category_name, "circle", circle)
background = EnumeratedListOption(_('Background color'), BACKGROUND_GEN)
background.add_item(BACKGROUND_WHITE, _('white'))
background.add_item(BACKGROUND_GEN, _('generation dependent'))
background.set_help(_("Background color is either white or generation"
" dependent"))
menu.add_option(category_name, "background", background)
radial = EnumeratedListOption(_('Orientation of radial texts'),
RADIAL_UPRIGHT)
radial.add_item(RADIAL_UPRIGHT, _('upright'))
radial.add_item(RADIAL_ROUNDABOUT, _('roundabout'))
radial.set_help(_("Print radial texts upright or roundabout"))
menu.add_option(category_name, "radial", radial)
draw_empty = BooleanOption(_("Draw empty boxes"), True)
draw_empty.set_help(_("Draw the background "
"although there is no information"))
menu.add_option(category_name, "draw_empty", draw_empty)
same_style = BooleanOption(_("Use one font style "
"for all generations"), True)
same_style.set_help(_("You can customize font and color "
"for each generation in the style editor"))
menu.add_option(category_name, "same_style", same_style)
category_name = _("Report Options (2)")
stdoptions.add_private_data_option(menu, category_name)
stdoptions.add_living_people_option(menu, category_name)
stdoptions.add_localization_option(menu, category_name)
示例9: add_menu_options
def add_menu_options(self, menu):
category_name = _("Report Options")
self.__pid = PersonOption(_("Center Person"))
self.__pid.set_help(_("The center person for the report"))
menu.add_option(category_name, "pid", self.__pid)
numbering = EnumeratedListOption(_("Numbering system"), "Simple")
numbering.set_items([
("Simple", _("Simple numbering")),
("d'Aboville", _("d'Aboville numbering")),
("Henry", _("Henry numbering")),
("Modified Henry", _("Modified Henry numbering")),
("de Villiers/Pama", _("de Villiers/Pama numbering")),
("Meurgey de Tupigny", _("Meurgey de Tupigny numbering"))])
numbering.set_help(_("The numbering system to be used"))
menu.add_option(category_name, "numbering", numbering)
gen = NumberOption(_("Generations"), 10, 1, 15)
gen.set_help(_("The number of generations to include in the report"))
menu.add_option(category_name, "gen", gen)
stdoptions.add_gramps_id_option(menu, category_name)
marrs = BooleanOption(_('Show marriage info'), False)
marrs.set_help(
_("Whether to show marriage information in the report."))
menu.add_option(category_name, "marrs", marrs)
divs = BooleanOption(_('Show divorce info'), False)
divs.set_help(_("Whether to show divorce information in the report."))
menu.add_option(category_name, "divs", divs)
dups = BooleanOption(_('Show duplicate trees'), True)
dups.set_help(
_("Whether to show duplicate Family Trees in the report."))
menu.add_option(category_name, "dups", dups)
category_name = _("Report Options (2)")
stdoptions.add_name_format_option(menu, category_name)
stdoptions.add_place_format_option(menu, category_name)
stdoptions.add_private_data_option(menu, category_name)
stdoptions.add_living_people_option(menu, category_name)
locale_opt = stdoptions.add_localization_option(menu, category_name)
stdoptions.add_date_format_option(menu, category_name, locale_opt)
示例10: add_menu_options
def add_menu_options(self, menu):
category_name = _("Report Options")
self.__filter = FilterOption(_("Filter"), 0)
self.__filter.set_help(
_("Select filter to restrict people that appear in the report"))
menu.add_option(category_name, "filter", self.__filter)
self.__pid = PersonOption(_("Center Person"))
self.__pid.set_help(_("The center person for the report"))
menu.add_option(category_name, "pid", self.__pid)
self.__pid.connect('value-changed', self.__update_filters)
self.__update_filters()
# We must figure out the value of the first option before we can
# create the EnumeratedListOption
fmt_list = global_name_display.get_name_format()
name_format = EnumeratedListOption(_("Name format"), 0)
name_format.add_item(0, _("Default"))
for num, name, fmt_str, act in fmt_list:
name_format.add_item(num, name)
name_format.set_help(_("Select the format to display names"))
menu.add_option(category_name, "name_format", name_format)
numbering = EnumeratedListOption(_("Numbering system"), "Simple")
numbering.set_items([
("Simple", _("Simple numbering")),
("de Villiers/Pama", _("de Villiers/Pama numbering")),
("Meurgey de Tupigny", _("Meurgey de Tupigny numbering"))])
numbering.set_help(_("The numbering system to be used"))
menu.add_option(category_name, "numbering", numbering)
gen = NumberOption(_("Generations"), 10, 1, 15)
gen.set_help(_("The number of generations to include in the report"))
menu.add_option(category_name, "gen", gen)
marrs = BooleanOption(_('Show marriage info'), False)
marrs.set_help(_("Whether to show marriage information in the report."))
menu.add_option(category_name, "marrs", marrs)
divs = BooleanOption(_('Show divorce info'), False)
divs.set_help(_("Whether to show divorce information in the report."))
menu.add_option(category_name, "divs", divs)
dups = BooleanOption(_('Show duplicate trees'), True)
dups.set_help(_("Whether to show duplicate family trees in the report."))
menu.add_option(category_name, "dups", dups)
示例11: add_menu_options
def add_menu_options(self, menu):
category_name = _("Report Options")
self.__pid = PersonOption(_("Center Person"))
self.__pid.set_help(_("The center person for the report"))
menu.add_option(category_name, "pid", self.__pid)
maxgen = NumberOption(_("Generations"), 10, 1, 100)
maxgen.set_help(_("The number of generations to include in the tree"))
menu.add_option(category_name, "maxgen", maxgen)
images = BooleanOption(_("Include images"), False)
images.set_help(_("Include images of people in the nodes."))
menu.add_option(category_name, "images", images)
示例12: add_menu_options
def add_menu_options(self, menu):
"""Add the menu options to the report dialog"""
category_name = _("Tree Options")
pid = PersonOption(_("Center Person"))
pid.set_help(_("The center person for the tree"))
menu.add_option(category_name, "pid", pid)
max_gen = NumberOption(_("Generations"), 10, 1, 50)
max_gen.set_help(_("The number of generations to include in the tree"))
menu.add_option(category_name, "maxgen", max_gen)
show_captions = BooleanOption(_("Show Mother/Father captions"), False)
show_captions.set_help(_("Show the title of mother or father beside each ancestor's box."))
menu.add_option(category_name, "showcaptions", show_captions)
示例13: PhotoTaggingOptions
class PhotoTaggingOptions(MenuOptions):
def __init__(self):
MenuOptions.__init__(self)
def add_menu_options(self, menu):
category_name = _("Selection")
self.replace_without_asking = BooleanOption(
_("Replace existing references to the person "
"being assigned without asking"),
REPLACE_WITHOUT_ASKING)
menu.add_option(category_name, "replace_without_asking",
self.replace_without_asking)
category_name = _("Face detection")
width, height = MIN_FACE_SIZE
sensitivity = SENSITIVITY
self.min_face_width = NumberOption(_("Minimum face width (px)"),
width, 1, 1000, 1)
self.min_face_height = NumberOption(_("Minimum face height (px)"),
height, 1, 1000, 1)
self.detect_inside_existing_boxes = BooleanOption(
_("Detect faces inside existing boxes"),
DETECT_INSIDE_EXISTING_BOXES)
self.sensitivity = NumberOption(_("Sensitivity (1 min .. 20 max)"),
sensitivity, 1, 20, 1)
menu.add_option(category_name, "min_face_width", self.min_face_width)
menu.add_option(category_name, "min_face_height", self.min_face_height)
menu.add_option(category_name, "sensitivity", self.sensitivity)
menu.add_option(category_name, "detect_inside_existing_boxes",
self.detect_inside_existing_boxes)
def update_settings(self):
global REPLACE_WITHOUT_ASKING
global DETECT_INSIDE_EXISTING_BOXES
global MIN_FACE_SIZE
global SENSITIVITY
REPLACE_WITHOUT_ASKING = self.replace_without_asking.get_value()
DETECT_INSIDE_EXISTING_BOXES = self.detect_inside_existing_boxes.get_value()
width = self.min_face_width.get_value()
height = self.min_face_height.get_value()
MIN_FACE_SIZE = (width, height)
SENSITIVITY = self.sensitivity.get_value()
save_config()
示例14: add_menu_options
def add_menu_options(self, menu):
category_name = _("Report Options")
if self.name.split(",")[0] == _PERSON_RPT_NAME:
self.__pid = PersonOption(_("Center Person"))
self.__pid.set_help(_("The center person for the report"))
menu.add_option(category_name, "pid", self.__pid)
else:
self.__pid = FamilyOption(_("Center Family"))
self.__pid.set_help(_("The center family for the report"))
menu.add_option(category_name, "pid", self.__pid)
genup = NumberOption(_("Generations up"), 10, 0, 100)
genup.set_help(_("The number of generations to include in the tree"))
menu.add_option(category_name, "genup", genup)
gendown = NumberOption(_("Generations down"), 10, 0, 100)
gendown.set_help(_("The number of generations to include in the tree"))
menu.add_option(category_name, "gendown", gendown)
siblings = BooleanOption(_("Include siblings"), True)
siblings.set_help(_("Include siblings of ancestors."))
menu.add_option(category_name, "siblings", siblings)
images = BooleanOption(_("Include images"), False)
images.set_help(_("Include images of people in the nodes."))
menu.add_option(category_name, "images", images)
示例15: add_menu_options
def add_menu_options(self, menu):
"""
Add options to the menu for the kinship report.
"""
category_name = _("Report Options")
pid = PersonOption(_("Center Person"))
pid.set_help(_("The center person for the report"))
menu.add_option(category_name, "pid", pid)
stdoptions.add_name_format_option(menu, category_name)
stdoptions.add_private_data_option(menu, category_name)
maxdescend = NumberOption(_("Max Descendant Generations"), 2, 1, 20)
maxdescend.set_help(_("The maximum number of descendant generations"))
menu.add_option(category_name, "maxdescend", maxdescend)
maxascend = NumberOption(_("Max Ancestor Generations"), 2, 1, 20)
maxascend.set_help(_("The maximum number of ancestor generations"))
menu.add_option(category_name, "maxascend", maxascend)
incspouses = BooleanOption(_("Include spouses"), True)
incspouses.set_help(_("Whether to include spouses"))
menu.add_option(category_name, "incspouses", incspouses)
inccousins = BooleanOption(_("Include cousins"), True)
inccousins.set_help(_("Whether to include cousins"))
menu.add_option(category_name, "inccousins", inccousins)
incaunts = BooleanOption(_("Include aunts/uncles/nephews/nieces"), True)
incaunts.set_help(_("Whether to include aunts/uncles/nephews/nieces"))
menu.add_option(category_name, "incaunts", incaunts)
stdoptions.add_localization_option(menu, category_name)