当前位置: 首页>>代码示例>>Python>>正文


Python NumberOption.get_value方法代码示例

本文整理汇总了Python中gramps.gen.plug.menu.NumberOption.get_value方法的典型用法代码示例。如果您正苦于以下问题:Python NumberOption.get_value方法的具体用法?Python NumberOption.get_value怎么用?Python NumberOption.get_value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gramps.gen.plug.menu.NumberOption的用法示例。


在下文中一共展示了NumberOption.get_value方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: PhotoTaggingOptions

# 需要导入模块: from gramps.gen.plug.menu import NumberOption [as 别名]
# 或者: from gramps.gen.plug.menu.NumberOption import get_value [as 别名]
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()
开发者ID:daleathan,项目名称:addons-source,代码行数:48,代码来源:PhotoTaggingGramplet.py

示例2: AncestorTreeOptions

# 需要导入模块: from gramps.gen.plug.menu import NumberOption [as 别名]
# 或者: from gramps.gen.plug.menu.NumberOption import get_value [as 别名]

#.........这里部分代码省略.........
        self.__blank = BooleanOption(_('Include Blank Pages'), True)
        self.__blank.set_help(_("Whether to include pages that are blank."))
        menu.add_option(category_name, "inc_blank", self.__blank)

        self.__check_blank()

        self.__include_images = BooleanOption(
                                 _('Include thumbnail images of people'), False)
        self.__include_images.set_help(
                                 _("Whether to include thumbnails of people."))
        menu.add_option(category_name, "includeImages", self.__include_images)

        #category_name = _("Notes")

        self.usenote = BooleanOption(_('Include a note'), False)
        self.usenote.set_help(_("Whether to include a note on "
                                "the report."))
        menu.add_option(category_name, "inc_note", self.usenote)

        self.notedisp = TextOption(_("Note"), [])
        self.notedisp.set_help(_("Add a note\n\n"
                                 "$T inserts today's date"))
        menu.add_option(category_name, "note_disp", self.notedisp)

        locales = NoteType(0, 1)
        self.notelocal = EnumeratedListOption(_("Note Location"), 0)
        for num, text in locales.note_locals():
            self.notelocal.add_item(num, text)
        self.notelocal.set_help(_("Where to place the note."))
        menu.add_option(category_name, "note_place", self.notelocal)

    def __check_blank(self):
        if self.__onepage:
            value = not self.__onepage.get_value()
        else:
            value = True
        off = value and (self.scale.get_value() != 2)
        self.__blank.set_available(off)

    def __fillout_vals(self):
        max_gen = self.max_gen.get_value()
        old_val = self.fillout.get_value()
        item_list = []
        item_list.append([0, _("No generations of empty boxes "
                               "for unknown ancestors")])
        if max_gen > 1:
            item_list.append([1, _("One Generation of empty boxes "
                                   "for unknown ancestors")])

        item_list.extend([itr, str(itr) +
                _(" Generations of empty boxes for unknown ancestors")]
                    for itr in range(2, max_gen)
                )

        self.fillout.set_items(item_list)
        if old_val+2 > len(item_list):
            self.fillout.set_value(len(item_list) -2)

    def make_default_style(self, default_style):
        """Make the default output style for the Ancestor Tree."""

        ## Paragraph Styles:
        font = FontStyle()
        font.set_size(9)
        font.set_type_face(FONT_SANS_SERIF)
        para_style = ParagraphStyle()
开发者ID:gogglesguy,项目名称:gramps,代码行数:70,代码来源:ancestortree.py


注:本文中的gramps.gen.plug.menu.NumberOption.get_value方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。