예제 #1
0
    def add_menu_options(self, menu):
        """ Add the options for this report """
        category_name = _("Report Options")

        self.__title = StringOption(_('book|Title'), _('Title of the Book'))
        self.__title.set_help(_("Title string for the book."))
        menu.add_option(category_name, "title", self.__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)
    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)

        locale_opt = stdoptions.add_localization_option(menu, category_name)
예제 #3
0
    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)
예제 #4
0
    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)
예제 #5
0
class SetPrivacyOptions(MenuToolOptions):
    """Handles the Set Privacy Tool menu options."""
    def __init__(self, name, person_id=None, dbstate=None):
        MenuToolOptions.__init__(self, name, person_id, dbstate)

    def add_menu_options(self, menu):
        self.person = BooleanOption(_("Persons"), False)
        menu.add_option(_("Option"), "person", self.person)

        self.event = BooleanOption(_("Events"), False)
        menu.add_option(_("Option"), "event", self.event)

        self.media = BooleanOption(_("Media"), False)
        menu.add_option(_("Option"), "media", self.media)

        self.no_date = BooleanOption(_("Always private if no date."), False)
        self.no_date.set_help(
            _("If checked, all objects without a date will "
              "also be set private."))
        menu.add_option(_("Option"), "no_date", self.no_date)

        self.years = NumberOption(_("Years"), 0, 0, 2000)
        self.years.set_help(
            _("The time range in years from today you want to "
              "set objects private.\n"
              "'0 years' = remove privacy from all objects."))
        menu.add_option(_("Option"), "years", self.years)
예제 #6
0
    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, 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)

        category_name = _("Report Options (2)")

        stdoptions.add_name_format_option(menu, category_name)

        stdoptions.add_private_data_option(menu, category_name)

        stdoptions.add_living_people_option(menu, category_name)

        stdoptions.add_localization_option(menu, category_name)
예제 #7
0
    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)
예제 #8
0
    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)

        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_private_data_option(menu, category_name)

        stdoptions.add_localization_option(menu, category_name)
예제 #9
0
    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)
예제 #10
0
    def add_menu_options(self, menu):
        """
        Add options to the menu for the fan chart.
        """
        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_private_data_option(menu, category_name)

        stdoptions.add_living_people_option(menu, category_name)

        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)

        stdoptions.add_localization_option(menu, category_name)
예제 #11
0
    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)
예제 #12
0
    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)
예제 #13
0
    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)
예제 #14
0
    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)
예제 #15
0
class SetPrivacyOptions(MenuToolOptions):
    """Handles the Set Privacy Tool menu options."""
    def __init__(self, name, person_id=None, dbstate=None):
        MenuToolOptions.__init__(self, name, person_id, dbstate)

    def add_menu_options(self, menu):

        self.person = BooleanOption(_("Persons"), False)
        menu.add_option(_("Option"), "person", self.person)

        self.__person_filter = FilterOption(_("Person Filter"), 0)
        self.__person_filter.set_help(_("Select filter to restrict people"))
        menu.add_option(_("Option"), "person_filter", self.__person_filter)
        person_filter_all = GenericFilterFactory("Person")()
        person_filter_all.name = _("Entire Database")
        person_filter_list = [person_filter_all
                              ] + CustomFilters.get_filters("Person")
        self.__person_filter.set_filters(person_filter_list)

        self.event = BooleanOption(_("Events"), False)
        menu.add_option(_("Option"), "event", self.event)

        self.__event_filter = FilterOption(_("Event Filter"), 0)
        self.__event_filter.set_help(_("Select filter to restrict events"))
        menu.add_option(_("Option"), "event_filter", self.__event_filter)
        event_filter_all = GenericFilterFactory("Event")()
        event_filter_all.name = _("Entire Database")
        event_filter_list = [event_filter_all
                             ] + CustomFilters.get_filters('Event')
        self.__event_filter.set_filters(event_filter_list)

        self.media = BooleanOption(_("Media"), False)
        menu.add_option(_("Option"), "media", self.media)

        self.__media_filter = FilterOption(_("Media Filter"), 0)
        self.__media_filter.set_help(_("Select filter to restrict medias"))
        menu.add_option(_("Option"), "media_filter", self.__media_filter)
        media_filter_all = GenericFilterFactory("Media")()
        media_filter_all.name = _("Entire Database")
        media_filter_list = [media_filter_all
                             ] + CustomFilters.get_filters('Media')
        self.__media_filter.set_filters(media_filter_list)

        self.no_date = BooleanOption(_("Always private if no date."), False)
        self.no_date.set_help(
            _("If checked, all objects without a date will "
              "also be set private."))
        menu.add_option(_("Option"), "no_date", self.no_date)

        self.years = NumberOption(_("Years"), 0, 0, 2000)
        self.years.set_help(
            _("The time range in years from today you want to "
              "set objects private.\n"
              "'0 years' = remove privacy from all objects."))
        menu.add_option(_("Option"), "years", self.years)
예제 #16
0
    def add_menu_options(self, menu):
        """
        Create all the menu options for this report.
        """
        category_name = _("Report Options")

        pid = PersonOption(_("Center Person"))
        pid.set_help(_("The Center person for the graph"))
        menu.add_option(category_name, "pid", pid)

        stdoptions.add_name_format_option(menu, category_name)

        stdoptions.add_private_data_option(menu, category_name)

        stdoptions.add_living_people_option(menu, category_name)

        max_gen = NumberOption(_('Max Descendant Generations'), 10, 1, 15)
        max_gen.set_help(
            _("The number of generations of descendants to "
              "include in the graph"))
        menu.add_option(category_name, "maxdescend", max_gen)

        max_gen = NumberOption(_('Max Ancestor Generations'), 10, 1, 15)
        max_gen.set_help(
            _("The number of generations of ancestors to "
              "include in the graph"))
        menu.add_option(category_name, "maxascend", max_gen)

        include_id = EnumeratedListOption(_('Include Gramps ID'), 0)
        include_id.add_item(0, _('Do not include'))
        include_id.add_item(1, _('Share an existing line'))
        include_id.add_item(2, _('On a line of its own'))
        include_id.set_help(_("Whether (and where) to include Gramps IDs"))
        menu.add_option(category_name, "incid", include_id)

        stdoptions.add_localization_option(menu, category_name)

        ################################
        category_name = _("Graph Style")
        ################################

        color = EnumeratedListOption(_("Graph coloring"), "filled")
        for i in range(0, len(_COLORS)):
            color.add_item(_COLORS[i]["value"], _COLORS[i]["name"])
        color.set_help(
            _("Males will be shown with blue, females "
              "with red.  If the sex of an individual "
              "is unknown it will be shown with gray."))
        menu.add_option(category_name, "color", color)

        roundedcorners = BooleanOption(_("Use rounded corners"), False)  # 2180
        roundedcorners.set_help(
            _("Use rounded corners to differentiate between women and men."))
        menu.add_option(category_name, "roundcorners", roundedcorners)
예제 #17
0
파일: asciidoc.py 프로젝트: kulath/gramps
    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)
예제 #18
0
파일: fanchart.py 프로젝트: ennoborg/gramps
    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)
예제 #19
0
    def add_menu_options(self, menu):
        """
        Create all the menu options for this report.
        """
        category_name = _("Report Options")

        pid = PersonOption(_("Center Person"))
        pid.set_help(_("The Center person for the graph"))
        menu.add_option(category_name, "pid", pid)

        stdoptions.add_name_format_option(menu, category_name)

        stdoptions.add_private_data_option(menu, category_name)

        stdoptions.add_living_people_option(menu, category_name)

        max_gen = NumberOption(_('Max Descendant Generations'), 10, 1, 15)
        max_gen.set_help(_("The number of generations of descendants to "
                           "include in the graph"))
        menu.add_option(category_name, "maxdescend", max_gen)

        max_gen = NumberOption(_('Max Ancestor Generations'), 10, 1, 15)
        max_gen.set_help(_("The number of generations of ancestors to "
                           "include in the graph"))
        menu.add_option(category_name, "maxascend", max_gen)

        include_id = EnumeratedListOption(_('Include Gramps ID'), 0)
        include_id.add_item(0, _('Do not include'))
        include_id.add_item(1, _('Share an existing line'))
        include_id.add_item(2, _('On a line of its own'))
        include_id.set_help(_("Whether (and where) to include Gramps IDs"))
        menu.add_option(category_name, "incid", include_id)

        stdoptions.add_localization_option(menu, category_name)

        ################################
        category_name = _("Graph Style")
        ################################

        color = EnumeratedListOption(_("Graph coloring"), "filled")
        for i in range( 0, len(_COLORS) ):
            color.add_item(_COLORS[i]["value"], _COLORS[i]["name"])
        color.set_help(_("Males will be shown with blue, females "
                         "with red.  If the sex of an individual "
                         "is unknown it will be shown with gray."))
        menu.add_option(category_name, "color", color)

        roundedcorners = BooleanOption(     # see bug report #2180
                    _("Use rounded corners"), False)
        roundedcorners.set_help(
                    _("Use rounded corners to differentiate "
                      "between women and men."))
        menu.add_option(category_name, "roundcorners", roundedcorners)
예제 #20
0
    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)
예제 #21
0
    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)
예제 #22
0
    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)
예제 #23
0
    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)
예제 #24
0
    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)
예제 #25
0
    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)
예제 #26
0
    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)
예제 #27
0
    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)

        shift = NumberOption(_("Grandparent family spacing"), 0, 0, 50)
        shift.set_help(_("Extra spacing of grandparent families (mm)"))
        menu.add_option(category_name, "shift", shift)

        images = BooleanOption(_("Include images"), False)
        images.set_help(_("Include images of people in the nodes."))
        menu.add_option(category_name, "images", images)
예제 #28
0
    def add_menu_options(self, menu):
        """
        Create all the menu options for this report.
        """
        category_name = _("Options")
        
        pid = PersonOption(_("Center Person"))
        pid.set_help(_("The Center person for the graph"))
        menu.add_option(category_name, "pid", pid)
        
        stdoptions.add_name_format_option(menu, category_name)

        max_gen = NumberOption(_('Max Descendant Generations'), 10, 1, 15)
        max_gen.set_help(_("The number of generations of descendants to "
                           "include in the graph"))
        menu.add_option(category_name, "maxdescend", max_gen)
        
        max_gen = NumberOption(_('Max Ancestor Generations'), 10, 1, 15)
        max_gen.set_help(_("The number of generations of ancestors to "
                           "include in the graph"))
        menu.add_option(category_name, "maxascend", max_gen)

        stdoptions.add_localization_option(menu, category_name)

        ################################
        category_name = _("Graph Style")
        ################################

        color = EnumeratedListOption(_("Graph coloring"), "filled")
        for i in range( 0, len(_COLORS) ):
            color.add_item(_COLORS[i]["value"], _COLORS[i]["name"])
        color.set_help(_("Males will be shown with blue, females "
                         "with red.  If the sex of an individual "
                         "is unknown it will be shown with gray."))
        menu.add_option(category_name, "color", color)

        roundedcorners = BooleanOption(     # see bug report #2180
                    _("Use rounded corners"), False)
        roundedcorners.set_help(
                    _("Use rounded corners to differentiate "
                      "between women and men."))
        menu.add_option(category_name, "roundcorners", roundedcorners)
예제 #29
0
    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)
예제 #30
0
    def add_menu_options(self, menu):
        """Add the options to the report option menu"""
        head = StringOption(_("Heading"), "")
        menu.add_option(_("Report Options"), "head", head)

        media = MediaOption(_("Media"))
        media.set_help(_("Select a media file for this report"))
        menu.add_option(_("Report Options"), "mid", media)

        self.note = NoteOption(_("Custom note"))
        self.note.set_help(_("Select a note for this report"))
        menu.add_option(_("Report Options"), "note", self.note)

        self.incl_note = BooleanOption(_("Include custom note"), False)
        self.incl_note.set_help(_("The custom note will be included"))
        menu.add_option(_("Report Options"), "incl_note", self.incl_note)
        self.incl_note.connect('value-changed', self.__update_custom_note_opt)

        incl_pers = BooleanOption(_("Include referenced people"), False)
        incl_pers.set_help(_("Referenced people will be included"))
        menu.add_option(_("Report Options"), "incl_pers", incl_pers)

        incl_data = BooleanOption(_("Include media data"), False)
        incl_data.set_help(_("Tags, notes and attributes will be included"))
        menu.add_option(_("Report Options"), "incl_data", incl_data)

        media_w = NumberOption(_("Media width"), 100, 10, 100, 10)
        media_w.set_help(
            _("Maximum media width in % of available "
              "page width."))
        menu.add_option(_("Report Options"), "media_w", media_w)

        media_h = NumberOption(_("Media height"), 100, 10, 100, 10)
        media_h.set_help(
            _("Maximum media height in % of available page "
              "height."))
        menu.add_option(_("Report Options"), "media_h", media_h)
예제 #31
0
    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)
예제 #32
0
    def add_menu_options(self, menu):
        """
        Add Menu Options
        """
        from functools import partial

        # Report Options
        category = _("Report Options")
        addopt = partial(menu.add_option, category)

        self.__pid = PersonOption(_("Center Person"))
        self.__pid.set_help(_("The center person for the report"))
        addopt("pid", self.__pid)

        start_number = NumberOption(_("Sosa-Stradonitz number"), 1, 1, 16384)
        start_number.set_help(
            _('The Sosa-Stradonitz number of the central person.'))
        addopt("initial_sosa", start_number)

        gen = NumberOption(_("Generations"), 10, 1, 100)
        gen.set_help(_("The number of generations to include in the report"))
        addopt("gen", gen)

        stdoptions.add_gramps_id_option(menu, category)

        pagebbg = BooleanOption(_("Page break between generations"), False)
        pagebbg.set_help(
            _("Whether to start a new page after each generation."))
        addopt("pagebbg", pagebbg)

        pageben = BooleanOption(_("Page break before end notes"), False)
        pageben.set_help(
            _("Whether to start a new page before the end notes."))
        addopt("pageben", pageben)

        category = _("Report Options (2)")
        addopt = partial(menu.add_option, category)

        stdoptions.add_name_format_option(menu, category)

        stdoptions.add_private_data_option(menu, category)

        stdoptions.add_living_people_option(menu, category)

        locale_opt = stdoptions.add_localization_option(menu, category)

        stdoptions.add_date_format_option(menu, category, locale_opt)

        # Content options

        addopt = partial(menu.add_option, _("Content"))

        verbose = BooleanOption(_("Use complete sentences"), True)
        verbose.set_help(
            _("Whether to use complete sentences or succinct language."))
        addopt("verbose", verbose)

        fulldates = BooleanOption(
            _("Use full dates instead of only the year"), True)
        fulldates.set_help(
            _("Whether to use full dates instead of just year."))
        addopt("fulldates", fulldates)

        computeage = BooleanOption(_("Compute death age"), True)
        computeage.set_help(_("Whether to compute a person's age at death."))
        addopt("computeage", computeage)

        omitda = BooleanOption(_("Omit duplicate ancestors"), True)
        omitda.set_help(_("Whether to omit duplicate ancestors."))
        addopt("omitda", omitda)

        usecall = BooleanOption(_("Use callname for common name"), False)
        usecall.set_help(_("Whether to use the call name as the first name."))
        addopt("usecall", usecall)

        # What to include

        addopt = partial(menu.add_option, _("Include"))

        listc = BooleanOption(_("Include children"), True)
        listc.set_help(_("Whether to list children."))
        addopt("listc", listc)

        listc_spouses = BooleanOption(_("Include spouses of children"), False)
        listc_spouses.set_help(
            _("Whether to list the spouses of the children."))
        addopt("listc_spouses", listc_spouses)

        incevents = BooleanOption(_("Include events"), False)
        incevents.set_help(_("Whether to include events."))
        addopt("incevents", incevents)

        incotherevents = BooleanOption(_("Include other events"), False)
        incotherevents.set_help(_("Whether to include other events "
                                  "people participated in."))
        addopt("incotherevents", incotherevents)

        desref = BooleanOption(
            _("Include descendant reference in child list"), True)
        desref.set_help(
            _("Whether to add descendant references in child list."))
        addopt("desref", desref)

        incphotos = BooleanOption(
            _("Include Photo/Images from Gallery"), False)
        incphotos.set_help(_("Whether to include images."))
        addopt("incphotos", incphotos)

        addopt = partial(menu.add_option, _("Include (2)"))

        incnotes = BooleanOption(_("Include notes"), True)
        incnotes.set_help(_("Whether to include notes."))
        addopt("incnotes", incnotes)

        incsources = BooleanOption(_("Include sources"), False)
        incsources.set_help(_("Whether to include source references."))
        addopt("incsources", incsources)

        incsrcnotes = BooleanOption(_("Include sources notes"), False)
        incsrcnotes.set_help(
            _("Whether to include source notes in the "
              "Endnotes section. Only works if Include sources is selected."))
        addopt("incsrcnotes", incsrcnotes)

        incattrs = BooleanOption(_("Include attributes"), False)
        incattrs.set_help(_("Whether to include attributes."))
        addopt("incattrs", incattrs)

        incaddresses = BooleanOption(_("Include addresses"), False)
        incaddresses.set_help(_("Whether to include addresses."))
        addopt("incaddresses", incaddresses)

        incnames = BooleanOption(_("Include alternative names"), False)
        incnames.set_help(_("Whether to include other names."))
        addopt("incnames", incnames)

        # How to handle missing information
        addopt = partial(menu.add_option, _("Missing information"))

        repplace = BooleanOption(_("Replace missing places with ______"), False)
        repplace.set_help(_("Whether to replace missing Places with blanks."))
        addopt("repplace", repplace)

        repdate = BooleanOption(_("Replace missing dates with ______"), False)
        repdate.set_help(_("Whether to replace missing Dates with blanks."))
        addopt("repdate", repdate)
    def add_menu_options(self, menu):
        """
        Add options to the menu for the detailed descendant report.
        """

        # Report Options
        category = _("Report Options")
        add_option = partial(menu.add_option, category)

        pid = PersonOption(_("Center Person"))
        pid.set_help(_("The center person for the report"))
        add_option("pid", pid)

        stdoptions.add_name_format_option(menu, category)

        stdoptions.add_private_data_option(menu, category)

        numbering = EnumeratedListOption(_("Numbering system"), "Henry")
        numbering.set_items([("Henry", _("Henry numbering")),
                             ("d'Aboville", _("d'Aboville numbering")),
                             ("Record (Modified Register)",
                              _("Record (Modified Register) numbering"))])
        numbering.set_help(_("The numbering system to be used"))
        add_option("numbering", numbering)

        generations = NumberOption(_("Generations"), 10, 1, 100)
        generations.set_help(
            _("The number of generations to include in the report"))
        add_option("gen", generations)

        pagebbg = BooleanOption(_("Page break between generations"), False)
        pagebbg.set_help(
            _("Whether to start a new page after each generation."))
        add_option("pagebbg", pagebbg)

        pageben = BooleanOption(_("Page break before end notes"), False)
        pageben.set_help(
            _("Whether to start a new page before the end notes."))
        add_option("pageben", pageben)

        stdoptions.add_localization_option(menu, category)

        # Content

        add_option = partial(menu.add_option, _("Content"))

        usecall = BooleanOption(_("Use callname for common name"), False)
        usecall.set_help(_("Whether to use the call name as the first name."))
        add_option("usecall", usecall)

        fulldates = BooleanOption(_("Use full dates instead of only the year"),
                                  True)
        fulldates.set_help(
            _("Whether to use full dates instead of just year."))
        add_option("fulldates", fulldates)

        listc = BooleanOption(_("List children"), True)
        listc.set_help(_("Whether to list children."))
        add_option("listc", listc)

        computeage = BooleanOption(_("Compute death age"), True)
        computeage.set_help(_("Whether to compute a person's age at death."))
        add_option("computeage", computeage)

        omitda = BooleanOption(_("Omit duplicate ancestors"), True)
        omitda.set_help(_("Whether to omit duplicate ancestors."))
        add_option("omitda", omitda)

        verbose = BooleanOption(_("Use complete sentences"), True)
        verbose.set_help(
            _("Whether to use complete sentences or succinct language."))
        add_option("verbose", verbose)

        desref = BooleanOption(_("Add descendant reference in child list"),
                               True)
        desref.set_help(
            _("Whether to add descendant references in child list."))
        add_option("desref", desref)

        category_name = _("Include")
        add_option = partial(menu.add_option, _("Include"))

        incnotes = BooleanOption(_("Include notes"), True)
        incnotes.set_help(_("Whether to include notes."))
        add_option("incnotes", incnotes)

        incattrs = BooleanOption(_("Include attributes"), False)
        incattrs.set_help(_("Whether to include attributes."))
        add_option("incattrs", incattrs)

        incphotos = BooleanOption(_("Include Photo/Images from Gallery"),
                                  False)
        incphotos.set_help(_("Whether to include images."))
        add_option("incphotos", incphotos)

        incnames = BooleanOption(_("Include alternative names"), False)
        incnames.set_help(_("Whether to include other names."))
        add_option("incnames", incnames)

        incevents = BooleanOption(_("Include events"), False)
        incevents.set_help(_("Whether to include events."))
        add_option("incevents", incevents)

        incaddresses = BooleanOption(_("Include addresses"), False)
        incaddresses.set_help(_("Whether to include addresses."))
        add_option("incaddresses", incaddresses)

        incsources = BooleanOption(_("Include sources"), False)
        incsources.set_help(_("Whether to include source references."))
        add_option("incsources", incsources)

        incsrcnotes = BooleanOption(_("Include sources notes"), False)
        incsrcnotes.set_help(
            _("Whether to include source notes in the "
              "Endnotes section. Only works if Include sources is selected."))
        add_option("incsrcnotes", incsrcnotes)

        incmates = BooleanOption(_("Include spouses"), False)
        incmates.set_help(_("Whether to include detailed spouse information."))
        add_option("incmates", incmates)

        incmateref = BooleanOption(_("Include spouse reference"), False)
        incmateref.set_help(_("Whether to include reference to spouse."))
        add_option("incmateref", incmateref)

        incssign = BooleanOption(
            _("Include sign of succession ('+')"
              " in child-list"), True)
        incssign.set_help(
            _("Whether to include a sign ('+') before the"
              " descendant number in the child-list to indicate"
              " a child has succession."))
        add_option("incssign", incssign)

        incpaths = BooleanOption(_("Include path to start-person"), False)
        incpaths.set_help(
            _("Whether to include the path of descendancy "
              "from the start-person to each descendant."))
        add_option("incpaths", incpaths)

        # Missing information

        add_option = partial(menu.add_option, _("Missing information"))

        repplace = BooleanOption(_("Replace missing places with ______"),
                                 False)
        repplace.set_help(_("Whether to replace missing Places with blanks."))
        add_option("repplace", repplace)

        repdate = BooleanOption(_("Replace missing dates with ______"), False)
        repdate.set_help(_("Whether to replace missing Dates with blanks."))
        add_option("repdate", repdate)
예제 #34
0
class AncestralFanChartOptions(MenuReportOptions):

    """
    Defines options and provides handling interface.
    """

    def __init__(self, name, dbase):
        self._dbase = dbase
        self._maxgen = None
        MenuReportOptions.__init__(self, name, dbase)

    def validate_gen(self):
        """
        Validate Max generation > 0
        """
        if self._maxgen is not None:
            maxgen = self._maxgen.get_value()
            if maxgen < 1:
                self._maxgen.set_value(1)

    def add_menu_options(self, menu):
        """
        Add options to the menu for the ancestral fan chart report.
        """
        category_name = _("Ancestral Fan Chart Options")

        pid = PersonOption(_("Center Person"))
        pid.set_help(_("The center person for the report"))
        menu.add_option(category_name, "pid", pid)

        # 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)

        self._maxgen = NumberOption(_("Include Generations"), 10, 1, 100)
        self._maxgen.set_help(_("The number of generations to include in " +
            "the report"))
        menu.add_option(category_name, "maxgen", self._maxgen)
        self._maxgen.connect('value-changed', self.validate_gen)

        pat_bg = ColorOption(_("Paternal Background Color"), "#ccddff")
        pat_bg.set_help(_("RGB-color for paternal box background."))
        menu.add_option(category_name, "pat_bg", pat_bg)

        mat_bg = ColorOption(_("Maternal Background"), "#ffb2a1")
        mat_bg.set_help(_("RGB-color for maternal box background."))
        menu.add_option(category_name, "mat_bg", mat_bg)

        dest_path = DestinationOption(_("Destination"),
            config.get('paths.website-directory'))
        dest_path.set_help(_("The destination path for generated files."))
        dest_path.set_directory_entry(True)
        menu.add_option(category_name, "dest_path", dest_path)

        dest_file = StringOption(_("Filename"), "AncestralFanchart.html")
        dest_file.set_help(_("The destination file name for html content."))
        menu.add_option(category_name, "dest_file", dest_file)
    def add_menu_options(self, menu):

        """ Add the options """
        category_name = _("Options")

        self.__filter = FilterOption(_("Filter"), 0)
        self.__filter.set_help(_("Select filter to restrict people"))
        menu.add_option(category_name, "filter", self.__filter)
        self.__filter.connect('value-changed', self.__filter_changed)

        self.__pid = PersonOption(_("Filter Person"))
        self.__pid.set_help(_("The center person for the filter"))
        menu.add_option(category_name, "pid", self.__pid)
        self.__pid.connect('value-changed', self.__update_filters)

        self.__update_filters()

        source_text = StringOption(_("Source text"),
                                   _("Calculated Date Estimates"))
        source_text.set_help(_("Source to remove and/or add"))
        menu.add_option(category_name, "source_text", source_text)

        remove = BooleanOption(_("Remove previously added events, notes, and source"), True)
        remove.set_help(_("Remove calculated events, notes, and source; occurs immediately on Execute"))
        menu.add_option(category_name, "remove", remove)

        birth = EnumeratedListOption(_("Birth"), 0)
        birth.add_item(0, _("Do not add birth events"))
        birth.add_item(1, _("Add birth events without dates"))
        birth.add_item(2, _("Add birth events with dates"))
        birth.set_help( _("Add a birth events with or without estimated dates"))
        menu.add_option(category_name, "add_birth", birth)

        death = EnumeratedListOption(_("Death"), 0)
        death.add_item(0, _("Do not add death events"))
        death.add_item(1, _("Add death events without dates"))
        death.add_item(2, _("Add death events with dates"))
        death.set_help( _("Add death events with or without estimated dates"))
        menu.add_option(category_name, "add_death", death)

        # -----------------------------------------------------
        num = NumberOption(_("Maximum age"),
                           config.get('behavior.max-age-prob-alive'),
                           0, 200)
        num.set_help(_("Maximum age that one can live to"))
        menu.add_option(category_name, "MAX_AGE_PROB_ALIVE", num)

        num = NumberOption(_("Maximum sibling age difference"),
                           config.get('behavior.max-sib-age-diff'),
                           0, 200)
        num.set_help(_("Maximum age difference between siblings"))
        menu.add_option(category_name, "MAX_SIB_AGE_DIFF", num)

        num = NumberOption(_("Average years between generations"),
                           config.get('behavior.avg-generation-gap'),
                           0, 200)
        num.set_help(_("Average years between two generations"))
        menu.add_option(category_name, "AVG_GENERATION_GAP", num)

        dates = EnumeratedListOption(_("Estimated Dates"), 0)
        dates.add_item(0, _("Approximate (about)"))
        dates.add_item(1, _("Extremes (after and before)"))
        dates.set_help( _("Dates on events are either about or after/before"))
        menu.add_option(category_name, "dates", dates)
예제 #36
0
class AncestralFanChartOptions(MenuReportOptions):
    """
    Defines options and provides handling interface.
    """
    def __init__(self, name, dbase):
        self._dbase = dbase
        self._maxgen = None
        MenuReportOptions.__init__(self, name, dbase)

    def validate_gen(self):
        """
        Validate Max generation > 0
        """
        if self._maxgen is not None:
            maxgen = self._maxgen.get_value()
            if maxgen < 1:
                self._maxgen.set_value(1)

    def add_menu_options(self, menu):
        """
        Add options to the menu for the ancestral fan chart report.
        """
        category_name = _("Ancestral Fan Chart Options")

        pid = PersonOption(_("Center Person"))
        pid.set_help(_("The center person for the report"))
        menu.add_option(category_name, "pid", pid)

        # 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)

        self._maxgen = NumberOption(_("Include Generations"), 10, 1, 100)
        self._maxgen.set_help(
            _("The number of generations to include in " + "the report"))
        menu.add_option(category_name, "maxgen", self._maxgen)
        self._maxgen.connect('value-changed', self.validate_gen)

        pat_bg = ColorOption(_("Paternal Background Color"), "#ccddff")
        pat_bg.set_help(_("RGB-color for paternal box background."))
        menu.add_option(category_name, "pat_bg", pat_bg)

        mat_bg = ColorOption(_("Maternal Background"), "#ffb2a1")
        mat_bg.set_help(_("RGB-color for maternal box background."))
        menu.add_option(category_name, "mat_bg", mat_bg)

        dest_path = DestinationOption(_("Destination"),
                                      config.get('paths.website-directory'))
        dest_path.set_help(_("The destination path for generated files."))
        dest_path.set_directory_entry(True)
        menu.add_option(category_name, "dest_path", dest_path)

        dest_file = StringOption(_("Filename"), "AncestralFanchart.html")
        dest_file.set_help(_("The destination file name for html content."))
        menu.add_option(category_name, "dest_file", dest_file)
    def add_menu_options(self, menu):
        """ Add the options for the text birthday report """
        category_name = _("Report Options")

        self.__filter = FilterOption(_("Filter"), 0)
        self.__filter.set_help(
            _("Select the filter to be applied to the report."))
        menu.add_option(category_name, "filter", self.__filter)
        self.__filter.connect('value-changed', self.__filter_changed)

        self.__pid = PersonOption(_("Filter Person"))
        self.__pid.set_help(_("The center person for the filter."))
        menu.add_option(category_name, "pid", self.__pid)
        self.__pid.connect('value-changed', self.__update_filters)

        titletext = StringOption(_("Title text"), _(_TITLE0))
        titletext.set_help(_("Title of report"))
        menu.add_option(category_name, "titletext", titletext)

        text1 = StringOption(_("Text Area 1"), _(_TITLE1))
        text1.set_help(_("First line of text at bottom of report"))
        menu.add_option(category_name, "text1", text1)

        text2 = StringOption(_("Text Area 2"), _(_TITLE2))
        text2.set_help(_("Second line of text at bottom of report"))
        menu.add_option(category_name, "text2", text2)

        text3 = StringOption(
            _("Text Area 3"),
            URL_HOMEPAGE,
        )
        text3.set_help(_("Third line of text at bottom of report"))
        menu.add_option(category_name, "text3", text3)

        category_name = _("Report Options (2)")

        self._nf = stdoptions.add_name_format_option(menu, category_name)
        self._nf.connect('value-changed', self.__update_filters)

        stdoptions.add_private_data_option(menu, category_name)

        alive = BooleanOption(_("Include only living people"), True)
        alive.set_help(_("Include only living people in the report"))
        menu.add_option(category_name, "alive", alive)

        self.__update_filters()

        stdoptions.add_localization_option(menu, category_name)

        category_name = _("Content")

        year = NumberOption(_("Year of report"),
                            time.localtime()[0], 1000, 3000)
        year.set_help(_("Year of report"))
        menu.add_option(category_name, "year", year)

        country = EnumeratedListOption(_("Country for holidays"), 0)
        holiday_table = libholiday.HolidayTable()
        countries = holiday_table.get_countries()
        countries.sort()
        if (len(countries) == 0
                or (len(countries) > 0 and countries[0] != '')):
            countries.insert(0, '')
        count = 0
        for c in countries:
            country.add_item(count, c)
            count += 1
        country.set_help(_("Select the country to see associated holidays"))
        menu.add_option(category_name, "country", country)

        maiden_name = EnumeratedListOption(_("Birthday surname"), "own")
        maiden_name.add_item(
            "spouse_first",
            _("Wives use husband's surname (from first family listed)"))
        maiden_name.add_item(
            "spouse_last",
            _("Wives use husband's surname (from last family listed)"))
        maiden_name.add_item("own", _("Wives use their own surname"))
        maiden_name.set_help(_("Select married women's displayed surname"))
        menu.add_option(category_name, "maiden_name", maiden_name)

        birthdays = BooleanOption(_("Include birthdays"), True)
        birthdays.set_help(_("Whether to include birthdays"))
        menu.add_option(category_name, "birthdays", birthdays)

        anniversaries = BooleanOption(_("Include anniversaries"), True)
        anniversaries.set_help(_("Whether to include anniversaries"))
        menu.add_option(category_name, "anniversaries", anniversaries)

        show_relships = BooleanOption(
            _("Include relationship to center person"), False)
        show_relships.set_help(
            _("Whether to include relationships to the center person"))
        menu.add_option(category_name, "relationships", show_relships)
예제 #38
0
    def add_menu_options(self, menu):
        """ Add the options for the text birthday report """
        category_name = _("Report Options")

        self.__filter = FilterOption(_("Filter"), 0)
        self.__filter.set_help(
            _("Select the filter to be applied to the report."))
        menu.add_option(category_name, "filter", self.__filter)
        self.__filter.connect('value-changed', self.__filter_changed)

        self.__pid = PersonOption(_("Filter Person"))
        self.__pid.set_help(_("The center person for the filter."))
        menu.add_option(category_name, "pid", self.__pid)
        self.__pid.connect('value-changed', self.__update_filters)

        self._nf = stdoptions.add_name_format_option(menu, category_name)
        self._nf.connect('value-changed', self.__update_filters)

        stdoptions.add_private_data_option(menu, category_name)

        alive = BooleanOption(_("Include only living people"), True)
        alive.set_help(_("Include only living people in the report"))
        menu.add_option(category_name, "alive", alive)

        self.__update_filters()

        stdoptions.add_localization_option(menu, category_name)

        category_name = _("Content")

        year = NumberOption(_("Year of report"), time.localtime()[0],
                            1000, 3000)
        year.set_help(_("Year of report"))
        menu.add_option(category_name, "year", year)

        country = EnumeratedListOption(_("Country for holidays"), 0)
        holiday_table = libholiday.HolidayTable()
        countries = holiday_table.get_countries()
        countries.sort()
        if (len(countries) == 0 or
            (len(countries) > 0 and countries[0] != '')):
            countries.insert(0, '')
        count = 0
        for c in  holiday_table.get_countries():
            country.add_item(count, c)
            count += 1
        country.set_help(_("Select the country to see associated holidays"))
        menu.add_option(category_name, "country", country)

        start_dow = EnumeratedListOption(_("First day of week"), 1)
        long_days = date_displayer.long_days
        for count in range(1, 8):
            # conversion between gramps numbering (sun=1) and iso numbering (mon=1) of weekdays below
            start_dow.add_item((count+5) % 7 + 1, long_days[count].capitalize())
        start_dow.set_help(_("Select the first day of the week for the report"))
        menu.add_option(category_name, "start_dow", start_dow)

        maiden_name = EnumeratedListOption(_("Birthday surname"), "own")
        maiden_name.add_item("spouse_first", _("Wives use husband's surname (from first family listed)"))
        maiden_name.add_item("spouse_last", _("Wives use husband's surname (from last family listed)"))
        maiden_name.add_item("own", _("Wives use their own surname"))
        maiden_name.set_help(_("Select married women's displayed surname"))
        menu.add_option(category_name, "maiden_name", maiden_name)

        birthdays = BooleanOption(_("Include birthdays"), True)
        birthdays.set_help(_("Include birthdays in the report"))
        menu.add_option(category_name, "birthdays", birthdays)

        anniversaries = BooleanOption(_("Include anniversaries"), True)
        anniversaries.set_help(_("Include anniversaries in the report"))
        menu.add_option(category_name, "anniversaries", anniversaries)

        option = BooleanOption(_("Include relationships to center person"),
                               False)
        option.set_help(_("Include relationships to center person (slower)"))
        menu.add_option(category_name, "relationships", option)

        category_name = _("Text Options")

        titletext = StringOption(_("Title text"), _(_TITLE0))
        titletext.set_help(_("Title of report"))
        menu.add_option(category_name, "titletext", titletext)

        text1 = StringOption(_("Text Area 1"), _(_TITLE1))
        text1.set_help(_("First line of text at bottom of report"))
        menu.add_option(category_name, "text1", text1)

        text2 = StringOption(_("Text Area 2"), _(_TITLE2))
        text2.set_help(_("Second line of text at bottom of report"))
        menu.add_option(category_name, "text2", text2)

        text3 = StringOption(_("Text Area 3"), URL_HOMEPAGE,)
        text3.set_help(_("Third line of text at bottom of report"))
        menu.add_option(category_name, "text3", text3)
예제 #39
0
    def add_menu_options(self, menu):
        """
        Add options to the menu for the statistics report.
        """

        ################################
        category_name = _("Report Options")
        add_option = partial(menu.add_option, category_name)
        ################################

        self.__filter = FilterOption(_("Filter"), 0)
        self.__filter.set_help(_("Determines what people are included "
                                 "in the report."))
        add_option("filter", self.__filter)
        self.__filter.connect('value-changed', self.__filter_changed)

        self.__pid = PersonOption(_("Filter Person"))
        self.__pid.set_help(_("The center person for the filter."))
        menu.add_option(category_name, "pid", self.__pid)
        self.__pid.connect('value-changed', self.__update_filters)

        sortby = EnumeratedListOption(_('Sort chart items by'),
                                      _options.SORT_VALUE)
        for item_idx in range(len(_options.opt_sorts)):
            item = _options.opt_sorts[item_idx]
            sortby.add_item(item_idx, item[2])
        sortby.set_help(_("Select how the statistical data is sorted."))
        add_option("sortby", sortby)

        reverse = BooleanOption(_("Sort in reverse order"), False)
        reverse.set_help(_("Check to reverse the sorting order."))
        add_option("reverse", reverse)

        this_year = time.localtime()[0]
        year_from = NumberOption(_("People Born After"),
                                 1700, 1, this_year)
        year_from.set_help(_("Birth year from which to include people."))
        add_option("year_from", year_from)

        year_to = NumberOption(_("People Born Before"),
                               this_year, 1, this_year)
        year_to.set_help(_("Birth year until which to include people"))
        add_option("year_to", year_to)

        no_years = BooleanOption(_("Include people without known birth years"),
                                 False)
        no_years.set_help(_("Whether to include people without "
                            "known birth years."))
        add_option("no_years", no_years)

        gender = EnumeratedListOption(_('Genders included'),
                                      Person.UNKNOWN)
        for item_idx in range(len(_options.opt_genders)):
            item = _options.opt_genders[item_idx]
            gender.add_item(item[0], item[2])
        gender.set_help(_("Select which genders are included into "
                          "statistics."))
        add_option("gender", gender)

        bar_items = NumberOption(_("Max. items for a pie"), 8, 0, 20)
        bar_items.set_help(_("With fewer items pie chart and legend will be "
                             "used instead of a bar chart."))
        add_option("bar_items", bar_items)

        ################################
        category_name = _("Report Options (2)")
        add_option = partial(menu.add_option, category_name)
        ################################

        self._nf = stdoptions.add_name_format_option(menu, category_name)
        self._nf.connect('value-changed', self.__update_filters)

        self.__update_filters()

        stdoptions.add_private_data_option(menu, category_name)

        stdoptions.add_living_people_option(menu, category_name)

        stdoptions.add_localization_option(menu, category_name)

        ################################
        # List of available charts on separate option tabs
        ################################

        idx = 0
        third = (len(_Extract.extractors) + 1) // 3
        chart_types = []
        for (chart_opt, ctuple) in _Extract.extractors.items():
            chart_types.append((_(ctuple[1]), chart_opt, ctuple))
        sorted_chart_types = sorted(chart_types,
                                    key=lambda x: glocale.sort_key(x[0]))
        for (translated_option_name, opt_name, ctuple) in sorted_chart_types:
            if idx >= (third * 2):
                category_name = _("Charts 3")
            elif idx >= third:
                category_name = _("Charts 2")
            else:
                category_name = _("Charts 1")
            opt = BooleanOption(translated_option_name, False)
            opt.set_help(_("Include charts with indicated data."))
            menu.add_option(category_name, opt_name, opt)
            idx += 1

        # Enable a couple of charts by default
        menu.get_option_by_name("data_gender").set_value(True)
        menu.get_option_by_name("data_ccount").set_value(True)
        menu.get_option_by_name("data_bmonth").set_value(True)
예제 #40
0
class AncestorTreeOptions(MenuReportOptions):
    """
    Defines options and provides handling interface.
    """
    def __init__(self, name, dbase):
        self.__db = dbase
        self.__pid = None
        self.box_Y_sf = None
        self.box_shadow_sf = None
        MenuReportOptions.__init__(self, name, dbase)

    def get_subject(self):
        """ Return a string that describes the subject of the report. """
        gid = self.__pid.get_value()
        person = self.__db.get_person_from_gramps_id(gid)
        return _nd.display(person)

    def add_menu_options(self, menu):

        ##################
        category_name = _("Tree Options")

        self.__pid = PersonOption(_("Center Person"))
        self.__pid.set_help(_("The center person for the tree"))
        menu.add_option(category_name, "pid", self.__pid)

        stdoptions.add_name_format_option(menu, category_name)

        stdoptions.add_living_people_option(menu, category_name)

        stdoptions.add_private_data_option(menu, category_name)

        siblings = BooleanOption(_('Include siblings of the center person'),
                                 False)
        siblings.set_help(
            _("Whether to only display the center person or all "
              "of his/her siblings too"))
        menu.add_option(category_name, "inc_siblings", siblings)

        self.max_gen = NumberOption(_("Generations"), 10, 1, 50)
        self.max_gen.set_help(
            _("The number of generations to include "
              "in the tree"))
        menu.add_option(category_name, "maxgen", self.max_gen)

        self.fillout = EnumeratedListOption(_("Display unknown\ngenerations"),
                                            0)
        self.fillout.set_help(
            _("The number of generations of empty "
              "boxes that will be displayed"))
        menu.add_option(category_name, "fill_out", self.fillout)

        self.max_gen.connect('value-changed', self.__fillout_vals)
        self.__fillout_vals()

        compress = BooleanOption(_('Compress tree'), True)
        compress.set_help(
            _("Whether to remove any extra blank spaces set "
              "aside for people that are unknown"))
        menu.add_option(category_name, "compress_tree", compress)

        #better to 'Show siblings of\nthe center person
        #Spouse_disp = EnumeratedListOption(_("Show spouses of\nthe center "
        #                                     "person"), 0)
        #Spouse_disp.add_item(0, _("No.  Do not show Spouses"))
        #Spouse_disp.add_item(1, _("Yes, and use the Main Display Format"))
        #Spouse_disp.add_item(2, _("Yes, and use the Secondary "
        #                           "Display Format"))
        #Spouse_disp.set_help(_("Show spouses of the center person?"))
        #menu.add_option(category_name, "Spouse_disp", Spouse_disp)

        ##################
        category_name = _("Report Options")

        self.title = EnumeratedListOption(_("Report Title"), 0)
        self.title.add_item(0, _("Do not include a title"))
        self.title.add_item(1, _("Include Report Title"))
        self.title.set_help(_("Choose a title for the report"))
        menu.add_option(category_name, "report_title", self.title)

        border = BooleanOption(_('Include a border'), False)
        border.set_help(_("Whether to make a border around the report."))
        menu.add_option(category_name, "inc_border", border)

        prnnum = BooleanOption(_('Include Page Numbers'), False)
        prnnum.set_help(_("Whether to print page numbers on each page."))
        menu.add_option(category_name, "inc_pagenum", prnnum)

        stdoptions.add_localization_option(menu, category_name)

        ##################
        category_name = _("Display")

        disp = TextOption(
            _("Father\nDisplay Format"),
            ["$n", "%s $b" % _BORN, "-{%s $d}" % _DIED])
        disp.set_help(_("Display format for the fathers box."))
        menu.add_option(category_name, "father_disp", disp)

        #Will add when libsubstkeyword supports it.
        #missing = EnumeratedListOption(_("Replace missing\nplaces\\dates \
        #                                 with"), 0)
        #missing.add_item(0, _("Does not display anything"))
        #missing.add_item(1, _("Displays '_____'"))
        #missing.set_help(_("What will print when information is not known"))
        #menu.add_option(category_name, "miss_val", missing)

        #category_name = _("Secondary")

        disp_mom = TextOption(
            _("Mother\nDisplay Format"),
            ["$n", "%s $b" % _BORN,
             "%s $m" % _MARR,
             "-{%s $d}" % _DIED])
        disp_mom.set_help(_("Display format for the mothers box."))
        menu.add_option(category_name, "mother_disp", disp_mom)

        center_disp = EnumeratedListOption(
            _("Center person uses\n"
              "which format"), 0)
        center_disp.add_item(0, _("Use Fathers Display format"))
        center_disp.add_item(1, _("Use Mothers display format"))
        center_disp.set_help(
            _("Which Display format to use the center person"))
        menu.add_option(category_name, "center_uses", center_disp)

        incmarr = BooleanOption(_('Include Marriage box'), False)
        incmarr.set_help(
            _("Whether to include a separate marital box in the report"))
        menu.add_option(category_name, "inc_marr", incmarr)

        marrdisp = StringOption(_("Marriage\nDisplay Format"), "%s $m" % _MARR)
        marrdisp.set_help(_("Display format for the marital box."))
        menu.add_option(category_name, "marr_disp", marrdisp)

        ##################
        category_name = _("Size")

        self.scale = EnumeratedListOption(_("Scale tree to fit"), 0)
        self.scale.add_item(0, _("Do not scale tree"))
        self.scale.add_item(1, _("Scale tree to fit page width only"))
        self.scale.add_item(2, _("Scale tree to fit the size of the page"))
        self.scale.set_help(
            _("Whether to scale the tree to fit a specific paper size"))
        menu.add_option(category_name, "scale_tree", self.scale)
        self.scale.connect('value-changed', self.__check_blank)

        if "BKI" not in self.name.split(","):
            self.__onepage = BooleanOption(
                _("Resize Page to Fit Tree size\n"
                  "\n"
                  "Note: Overrides options in the 'Paper Option' tab"), False)
            self.__onepage.set_help(
                _("Whether to resize the page to fit the size \n"
                  "of the tree.  Note:  the page will have a \n"
                  "non standard size.\n"
                  "\n"
                  "With this option selected, the following will happen:\n"
                  "\n"
                  "With the 'Do not scale tree' option the page\n"
                  "  is resized to the height/width of the tree\n"
                  "\n"
                  "With 'Scale tree to fit page width only' the height of\n"
                  "  the page is resized to the height of the tree\n"
                  "\n"
                  "With 'Scale tree to fit the size of the page' the page\n"
                  "  is resized to remove any gap in either height or width"))
            menu.add_option(category_name, "resize_page", self.__onepage)
            self.__onepage.connect('value-changed', self.__check_blank)
        else:
            self.__onepage = None

        self.box_Y_sf = NumberOption(_("inter-box scale factor"), 1.00, 0.10,
                                     2.00, 0.01)
        self.box_Y_sf.set_help(
            _("Make the inter-box spacing bigger or smaller"))
        menu.add_option(category_name, "box_Yscale", self.box_Y_sf)

        self.box_shadow_sf = NumberOption(_("box shadow scale factor"), 1.00,
                                          0.00, 2.00, 0.01)  # down to 0
        self.box_shadow_sf.set_help(_("Make the box shadow bigger or smaller"))
        menu.add_option(category_name, "shadowscale", self.box_shadow_sf)

        ##################
        category_name = _("Replace")

        repldisp = TextOption(
            _("Replace Display Format:\n'Replace this'/' with this'"), [])
        repldisp.set_help(_("i.e.\nUnited States of America/U.S.A"))
        menu.add_option(category_name, "replace_list", repldisp)

        ##################
        category_name = _("Include")

        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()

        # TODO this code is never used and so I conclude it is for future use
        # 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()
        para_style.set_font(font)
        para_style.set_description(
            _('The basic style used for the '
              'text display.'))
        default_style.add_paragraph_style("AC2-Normal", para_style)
        box_shadow = PT2CM(font.get_size()) * .6

        font = FontStyle()
        font.set_size(9)
        font.set_type_face(FONT_SANS_SERIF)
        para_style = ParagraphStyle()
        para_style.set_font(font)
        para_style.set_description(
            _('The basic style used for the '
              'note display.'))
        default_style.add_paragraph_style("AC2-Note", para_style)

        font = FontStyle()
        font.set_size(16)
        font.set_type_face(FONT_SANS_SERIF)
        para_style = ParagraphStyle()
        para_style.set_font(font)
        para_style.set_alignment(PARA_ALIGN_CENTER)
        para_style.set_description(
            _('The basic style used for the '
              'title display.'))
        default_style.add_paragraph_style("AC2-Title", para_style)

        ## Draw styles
        graph_style = GraphicsStyle()
        graph_style.set_paragraph_style("AC2-Normal")
        graph_style.set_shadow(1, box_shadow)  #shadow set by text size
        graph_style.set_fill_color((255, 255, 255))
        default_style.add_draw_style("AC2-box", graph_style)

        graph_style = GraphicsStyle()
        graph_style.set_paragraph_style("AC2-Normal")
        #graph_style.set_shadow(0, PT2CM(9))  #shadow set by text size
        graph_style.set_fill_color((255, 255, 255))
        default_style.add_draw_style("AC2-fam-box", graph_style)

        graph_style = GraphicsStyle()
        graph_style.set_paragraph_style("AC2-Note")
        graph_style.set_fill_color((255, 255, 255))
        default_style.add_draw_style("AC2-note-box", graph_style)

        graph_style = GraphicsStyle()
        graph_style.set_paragraph_style("AC2-Title")
        graph_style.set_color((0, 0, 0))
        graph_style.set_fill_color((255, 255, 255))
        graph_style.set_line_width(0)
        default_style.add_draw_style("AC2-Title", graph_style)

        graph_style = GraphicsStyle()
        default_style.add_draw_style("AC2-line", graph_style)
예제 #41
0
    def add_menu_options(self, menu):
        """
        Create all the menu options for this report.
        """
        category_name = _("Report Options")

        pid = PersonOption(_("Center Person"))
        pid.set_help(_("The Center person for the graph"))
        menu.add_option(category_name, "pid", pid)

        stdoptions.add_name_format_option(menu, category_name)

        stdoptions.add_private_data_option(menu, category_name)

        stdoptions.add_living_people_option(menu, category_name)

        max_gen = NumberOption(_('Max Descendant Generations'), 10, 1, 15)
        max_gen.set_help(_("The number of generations of descendants to "
                           "include in the graph"))
        menu.add_option(category_name, "maxdescend", max_gen)

        max_gen = NumberOption(_('Max Ancestor Generations'), 10, 1, 15)
        max_gen.set_help(_("The number of generations of ancestors to "
                           "include in the graph"))
        menu.add_option(category_name, "maxascend", max_gen)

        include_id = EnumeratedListOption(_('Include Gramps ID'), 0)
        include_id.add_item(0, _('Do not include'))
        include_id.add_item(1, _('Share an existing line'))
        include_id.add_item(2, _('On a line of its own'))
        include_id.set_help(_("Whether (and where) to include Gramps IDs"))
        menu.add_option(category_name, "incid", include_id)

        stdoptions.add_localization_option(menu, category_name)

        ################################
        category_name = _("Graph Style")
        ################################

        color = EnumeratedListOption(_("Graph coloring"), "filled")
        for i in range(0, len(_COLORS)):
            color.add_item(_COLORS[i]["value"], _COLORS[i]["name"])
        color.set_help(_("Males will be shown with blue, females "
                         "with red.  If the sex of an individual "
                         "is unknown it will be shown with gray."))
        menu.add_option(category_name, "color", color)

        color_males = ColorOption(_('Males'), '#e0e0ff')
        color_males.set_help(_('The color to use to display men.'))
        menu.add_option(category_name, 'colormales', color_males)

        color_females = ColorOption(_('Females'), '#ffe0e0')
        color_females.set_help(_('The color to use to display women.'))
        menu.add_option(category_name, 'colorfemales', color_females)

        color_unknown = ColorOption(_('Unknown'), '#e0e0e0')
        color_unknown.set_help(_('The color to use '
                                 'when the gender is unknown.'))
        menu.add_option(category_name, 'colorunknown', color_unknown)

        color_family = ColorOption(_('Families'), '#ffffe0')
        color_family.set_help(_('The color to use to display families.'))
        menu.add_option(category_name, 'colorfamilies', color_family)

        arrow = EnumeratedListOption(_("Arrowhead direction"), 'o')
        for i in range( 0, len(_ARROWS) ):
            arrow.add_item(_ARROWS[i]["value"], _ARROWS[i]["name"])
        arrow.set_help(_("Choose the direction that the arrows point."))
        menu.add_option(category_name, "arrow", arrow)

        roundedcorners = BooleanOption(_("Use rounded corners"), False) # 2180
        roundedcorners.set_help(
            _("Use rounded corners to differentiate between women and men."))
        menu.add_option(category_name, "roundcorners", roundedcorners)
예제 #42
0
class AncestorTreeOptions(MenuReportOptions):

    """
    Defines options and provides handling interface.
    """

    def __init__(self, name, dbase):
        self.box_Y_sf = None
        self.box_shadow_sf = None
        MenuReportOptions.__init__(self, name, dbase)

    def add_menu_options(self, menu):

        ##################
        category_name = _("Tree Options")

        pid = PersonOption(_("Center Person"))
        pid.set_help(_("The center person for the tree"))
        menu.add_option(category_name, "pid", pid)

        siblings = BooleanOption(_('Include siblings of the center person'), False)
        siblings.set_help(_("Whether to only display the center person or all "
            "of his/her siblings too"))
        menu.add_option(category_name, "inc_siblings", siblings)

        self.max_gen = NumberOption(_("Generations"), 10, 1, 50)
        self.max_gen.set_help(_("The number of generations to include "
                                "in the tree"))
        menu.add_option(category_name, "maxgen", self.max_gen)

        self.fillout = EnumeratedListOption(_("Display unknown\ngenerations"),
                                            0)
        self.fillout.set_help(_("The number of generations of empty "
                                "boxes that will be displayed"))
        menu.add_option(category_name, "fill_out", self.fillout)

        self.max_gen.connect('value-changed', self.__fillout_vals)
        self.__fillout_vals()

        compress = BooleanOption(_('Compress tree'), True)
        compress.set_help(_("Whether to remove any extra blank spaces set "
            "aside for people that are unknown"))
        menu.add_option(category_name, "compress_tree", compress)

        #better to 'Show siblings of\nthe center person
        #Spouse_disp = EnumeratedListOption(_("Show spouses of\nthe center "
        #                                     "person"), 0)
        #Spouse_disp.add_item( 0, _("No.  Do not show Spouses"))
        #Spouse_disp.add_item( 1, _("Yes, and use the Main Display Format"))
        #Spouse_disp.add_item( 2, _("Yes, and use the Secondary "
        #                           "Display Format"))
        #Spouse_disp.set_help(_("Show spouses of the center person?"))
        #menu.add_option(category_name, "Spouse_disp", Spouse_disp)

        ##################
        category_name = _("Report Options")

        self.title = EnumeratedListOption(_("Report Title"), 0)
        self.title.add_item(0, _("Do not include a title"))
        self.title.add_item(1, _("Include Report Title"))
        self.title.set_help(_("Choose a title for the report"))
        menu.add_option(category_name, "report_title", self.title)

        border = BooleanOption(_('Include a border'), False)
        border.set_help(_("Whether to make a border around the report."))
        menu.add_option(category_name, "inc_border", border)

        prnnum = BooleanOption(_('Include Page Numbers'), False)
        prnnum.set_help(_("Whether to print page numbers on each page."))
        menu.add_option(category_name, "inc_pagenum", prnnum)

        stdoptions.add_private_data_option(menu, category_name)

        stdoptions.add_name_format_option(menu, category_name)

        stdoptions.add_localization_option(menu, category_name)

        ##################
        category_name = _("Display")

        disp = TextOption(_("Father\nDisplay Format"),
                           ["$n",
                            "%s $b" %_BORN,
                            "-{%s $d}" %_DIED])
        disp.set_help(_("Display format for the fathers box."))
        menu.add_option(category_name, "father_disp", disp)

        #Will add when libsubstkeyword supports it.
        #missing = EnumeratedListOption(_("Replace missing\nplaces\\dates \
        #                                 with"), 0)
        #missing.add_item( 0, _("Does not display anything"))
        #missing.add_item( 1, _("Displays '_____'"))
        #missing.set_help(_("What will print when information is not known"))
        #menu.add_option(category_name, "miss_val", missing)

        #category_name = _("Secondary")

        dispMom = TextOption(_("Mother\nDisplay Format"),
                               ["$n",
                                "%s $b" %_BORN,
                                "%s $m" %_MARR,
                                "-{%s $d}" %_DIED]
                            )
        dispMom.set_help(_("Display format for the mothers box."))
        menu.add_option(category_name, "mother_disp", dispMom)

        centerDisp = EnumeratedListOption(_("Center person uses\n"
                                        "which format"), 0)
        centerDisp.add_item(0, _("Use Fathers Display format"))
        centerDisp.add_item(1, _("Use Mothers display format"))
        centerDisp.set_help(_("Which Display format to use the center person"))
        menu.add_option(category_name, "center_uses", centerDisp)

        incmarr = BooleanOption(_('Include Marriage box'), False)
        incmarr.set_help(
            _("Whether to include a separate marital box in the report"))
        menu.add_option(category_name, "inc_marr", incmarr)

        marrdisp = StringOption(_("Marriage\nDisplay Format"), "%s $m" % _MARR)
        marrdisp.set_help(_("Display format for the marital box."))
        menu.add_option(category_name, "marr_disp", marrdisp)

        ##################
        category_name = _("Size")

        self.scale = EnumeratedListOption(_("Scale tree to fit"), 0)
        self.scale.add_item(0, _("Do not scale tree"))
        self.scale.add_item(1, _("Scale tree to fit page width only"))
        self.scale.add_item(2, _("Scale tree to fit the size of the page"))
        self.scale.set_help(
            _("Whether to scale the tree to fit a specific paper size")
            )
        menu.add_option(category_name, "scale_tree", self.scale)
        self.scale.connect('value-changed', self.__check_blank)

        if "BKI" not in self.name.split(","):
            self.__onepage = BooleanOption(_("Resize Page to Fit Tree size\n"
                "\n"
                "Note: Overrides options in the 'Paper Option' tab"
                ),
                False)
            self.__onepage.set_help(
                _("Whether to resize the page to fit the size \n"
                "of the tree.  Note:  the page will have a \n"
                "non standard size.\n"
                "\n"
                "With this option selected, the following will happen:\n"
                "\n"
                "With the 'Do not scale tree' option the page\n"
                "  is resized to the height/width of the tree\n"
                "\n"
                "With 'Scale tree to fit page width only' the height of\n"
                "  the page is resized to the height of the tree\n"
                "\n"
                "With 'Scale tree to fit the size of the page' the page\n"
                "  is resized to remove any gap in either height or width"
                ))
            menu.add_option(category_name, "resize_page", self.__onepage)
            self.__onepage.connect('value-changed', self.__check_blank)
        else:
            self.__onepage = None

        self.box_Y_sf = NumberOption(_("inter-box scale factor"),
                                     1.00, 0.10, 2.00, 0.01)
        self.box_Y_sf.set_help(_("Make the inter-box spacing bigger or smaller"))
        menu.add_option(category_name, "box_Yscale", self.box_Y_sf)

        self.box_shadow_sf = NumberOption(_("box shadow scale factor"),
                                          1.00, 0.00, 2.00, 0.01) # down to 0
        self.box_shadow_sf.set_help(_("Make the box shadow bigger or smaller"))
        menu.add_option(category_name, "shadowscale", self.box_shadow_sf)


        ##################
        category_name = _("Replace")

        repldisp = TextOption(
            _("Replace Display Format:\n'Replace this'/' with this'"),
            [])
        repldisp.set_help(_("i.e.\nUnited States of America/U.S.A"))
        menu.add_option(category_name, "replace_list", repldisp)


        ##################
        category_name = _("Include")

        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()
        para_style.set_font(font)
        para_style.set_description(_('The basic style used for the '
                                     'text display.'))
        default_style.add_paragraph_style("AC2-Normal", para_style)
        box_shadow = PT2CM(font.get_size()) * .6

        font = FontStyle()
        font.set_size(9)
        font.set_type_face(FONT_SANS_SERIF)
        para_style = ParagraphStyle()
        para_style.set_font(font)
        para_style.set_description(_('The basic style used for the '
                                     'note display.'))
        default_style.add_paragraph_style("AC2-Note", para_style)

        font = FontStyle()
        font.set_size(16)
        font.set_type_face(FONT_SANS_SERIF)
        para_style = ParagraphStyle()
        para_style.set_font(font)
        para_style.set_alignment(PARA_ALIGN_CENTER)
        para_style.set_description(_('The basic style used for the '
                                     'title display.'))
        default_style.add_paragraph_style("AC2-Title", para_style)

        ## Draw styles
        graph_style = GraphicsStyle()
        graph_style.set_paragraph_style("AC2-Normal")
        graph_style.set_shadow(1, box_shadow)  #shadow set by text size
        graph_style.set_fill_color((255, 255, 255))
        default_style.add_draw_style("AC2-box", graph_style)

        graph_style = GraphicsStyle()
        graph_style.set_paragraph_style("AC2-Normal")
        #graph_style.set_shadow(0, PT2CM(9))  #shadow set by text size
        graph_style.set_fill_color((255, 255, 255))
        default_style.add_draw_style("AC2-fam-box", graph_style)

        graph_style = GraphicsStyle()
        graph_style.set_paragraph_style("AC2-Note")
        graph_style.set_fill_color((255, 255, 255))
        default_style.add_draw_style("AC2-note-box", graph_style)

        # TODO - Why is this here twice?
        #graph_style = GraphicsStyle()
        #graph_style.set_paragraph_style("AC2-Title")
        #graph_style.set_color((0, 0, 0))
        #graph_style.set_fill_color((255, 255, 255))
        #graph_style.set_line_width(0)
        #default_style.add_draw_style("AC2-Title", graph_style)

        graph_style = GraphicsStyle()
        default_style.add_draw_style("AC2-line", graph_style)
예제 #43
0
    def add_menu_options(self, menu):
        """ Add the options for the graphical calendar """

        ##########################
        category_name = _("Report Options")
        add_option = partial(menu.add_option, category_name)
        ##########################

        self.__filter = FilterOption(_("Filter"), 0)
        self.__filter.set_help(
            _("Select filter to restrict people that appear on calendar"))
        add_option("filter", self.__filter)
        self.__filter.connect('value-changed', self.__filter_changed)

        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._nf = stdoptions.add_name_format_option(menu, category_name)
        self._nf.connect('value-changed', self.__update_filters)

        self.__update_filters()

        stdoptions.add_private_data_option(menu, category_name)

        alive = BooleanOption(_("Include only living people"), True)
        alive.set_help(_("Include only living people in the calendar"))
        add_option("alive", alive)

        stdoptions.add_localization_option(menu, category_name)

        ##########################
        category_name = _("Content Options")
        add_option = partial(menu.add_option, category_name)
        ##########################

        year = NumberOption(_("Year of calendar"),
                            time.localtime()[0], 1000, 3000)
        year.set_help(_("Year of calendar"))
        add_option("year", year)

        country = EnumeratedListOption(_("Country for holidays"), 0)
        holiday_table = libholiday.HolidayTable()
        countries = holiday_table.get_countries()
        countries.sort()
        if (len(countries) == 0
                or (len(countries) > 0 and countries[0] != '')):
            countries.insert(0, '')
        count = 0
        for c in countries:
            country.add_item(count, c)
            count += 1
        country.set_help(_("Select the country to see associated holidays"))
        add_option("country", country)

        start_dow = EnumeratedListOption(_("First day of week"), 1)
        long_days = date_displayer.long_days
        for count in range(1, 8):
            # conversion between gramps numbering (sun=1) and iso numbering (mon=1) of weekdays below
            start_dow.add_item((count + 5) % 7 + 1,
                               long_days[count].capitalize())
        start_dow.set_help(
            _("Select the first day of the week for the calendar"))
        add_option("start_dow", start_dow)

        maiden_name = EnumeratedListOption(_("Birthday surname"), "own")
        maiden_name.add_item(
            "spouse_first",
            _("Wives use husband's surname (from first family listed)"))
        maiden_name.add_item(
            "spouse_last",
            _("Wives use husband's surname (from last family listed)"))
        maiden_name.add_item("own", _("Wives use their own surname"))
        maiden_name.set_help(_("Select married women's displayed surname"))
        add_option("maiden_name", maiden_name)

        birthdays = BooleanOption(_("Include birthdays"), True)
        birthdays.set_help(_("Include birthdays in the calendar"))
        add_option("birthdays", birthdays)

        anniversaries = BooleanOption(_("Include anniversaries"), True)
        anniversaries.set_help(_("Include anniversaries in the calendar"))
        add_option("anniversaries", anniversaries)

        ##########################
        category_name = _("Text Options")
        add_option = partial(menu.add_option, _("Text Options"))
        ##########################

        text1 = StringOption(_("Text Area 1"), _(_TITLE1))
        text1.set_help(_("First line of text at bottom of calendar"))
        add_option("text1", text1)

        text2 = StringOption(_("Text Area 2"), _(_TITLE2))
        text2.set_help(_("Second line of text at bottom of calendar"))
        add_option("text2", text2)

        text3 = StringOption(_("Text Area 3"), URL_HOMEPAGE)
        text3.set_help(_("Third line of text at bottom of calendar"))
        add_option("text3", text3)
예제 #44
0
    def add_menu_options(self, menu):
        """
        Create all the menu options for this report.
        """
        category_name = _("Report Options")

        pid = PersonOption(_("Center Person"))
        pid.set_help(_("The Center person for the graph"))
        menu.add_option(category_name, "pid", pid)

        max_gen_d = NumberOption(_('Max Descendant Generations'), 10, 1, 15)
        max_gen_d.set_help(_("The number of generations of descendants to "
                           "include in the graph"))
        menu.add_option(category_name, "maxdescend", max_gen_d)

        max_gen_a = NumberOption(_('Max Ancestor Generations'), 10, 1, 15)
        max_gen_a.set_help(_("The number of generations of ancestors to "
                           "include in the graph"))
        menu.add_option(category_name, "maxascend", max_gen_a)

        arrow = EnumeratedListOption(_("Arrowhead direction"), 'o')
        for i in range( 0, len(_ARROWS) ):
            arrow.add_item(_ARROWS[i]["value"], _ARROWS[i]["name"])
        arrow.set_help(_("Choose the direction that the arrows point."))
        menu.add_option(category_name, "arrow", arrow)

        color = EnumeratedListOption(_("Graph coloring"), "filled")
        for i in range(0, len(_COLORS)):
            color.add_item(_COLORS[i]["value"], _COLORS[i]["name"])
        color.set_help(_("Males will be shown with blue, females "
                         "with red.  If the sex of an individual "
                         "is unknown it will be shown with gray."))
        menu.add_option(category_name, "color", color)

        roundedcorners = BooleanOption(_("Use rounded corners"), False) # 2180
        roundedcorners.set_help(
            _("Use rounded corners to differentiate between women and men."))
        menu.add_option(category_name, "roundcorners", roundedcorners)

        stdoptions.add_gramps_id_option(menu, category_name, ownline=True)

        category_name = _("Report Options (2)")

        stdoptions.add_name_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)

        ################################
        category_name = _("Graph Style")
        ################################

        color_males = ColorOption(_('Males'), '#e0e0ff')
        color_males.set_help(_('The color to use to display men.'))
        menu.add_option(category_name, 'colormales', color_males)

        color_females = ColorOption(_('Females'), '#ffe0e0')
        color_females.set_help(_('The color to use to display women.'))
        menu.add_option(category_name, 'colorfemales', color_females)

        color_unknown = ColorOption(_('Unknown'), '#e0e0e0')
        color_unknown.set_help(_('The color to use '
                                 'when the gender is unknown.'))
        menu.add_option(category_name, 'colorunknown', color_unknown)

        color_family = ColorOption(_('Families'), '#ffffe0')
        color_family.set_help(_('The color to use to display families.'))
        menu.add_option(category_name, 'colorfamilies', color_family)
예제 #45
0
    def add_menu_options(self, menu):
        """ Add options to the menu for the ancestral fan chart report. """
        # ---------------------------- *
        category_general = _("General")

        pid = PersonOption(_("Center Person"))
        pid.set_help(_("The center person for the report"))
        menu.add_option(category_general, "pid", pid)

        pid_year = NumberOption(_("Year of Birth of Center Person"),
            0, -9999, 9999
        )
        pid_year.set_help(_("The year of birth of the center person. "
                            "Estimate a year if unknown")
                         )
        menu.add_option(category_general, "pid_year", pid_year)

        dest_path = DestinationOption(_("Destination directory"),
                                      config.get('paths.website-directory')
                                     )
        dest_path.set_help(_("Path for generated files"))
        dest_path.set_directory_entry(True)
        menu.add_option(category_general, "dest_path", dest_path)

        dest_file = StringOption(_("Filename"), "index.html")
        dest_file.set_help(_("The destination file name for html content."))
        menu.add_option(category_general, "dest_file", dest_file)

        age_diff = StringOption(_("Default Age"), "25")
        age_diff.set_help(_("Default age of parent when child is born "
            "with unknown year of birth")
        )
        menu.add_option(category_general, "age_diff", age_diff)

        locale_opt = stdoptions.add_localization_option(menu, category_general)
        stdoptions.add_date_format_option(menu, category_general, locale_opt)

        # ---------------------------- *
        category_what   = _("What to show")

        show_id = BooleanOption(_("Show GrampsID"), True)
        show_id.set_help(_("Show GrampsID on top right of the box"))
        menu.add_option(category_what, "show_id", show_id)

        optimize = BooleanOption(_("Optimize"), True)
        optimize.set_help(_("Use as little space in horizontal "
            "direction as possible")
        )
        menu.add_option(category_what, "optimize", optimize)

        # ---------------------------- *
        category_color  = _("Color")

        m_bg = ColorOption(_("Male Box Color"), "#cda476")
        m_bg.set_help(_("Box background color for male person"))
        menu.add_option(category_color, "m_bg", m_bg)

        w_bg = ColorOption(_("Female Box Color"), "#efdfcf")
        w_bg.set_help(_("Box background color for female person"))
        menu.add_option(category_color, "w_bg", w_bg)

        # ---------------------------- *
        category_size   = _("Size")

        year_to_pixel_factor = StringOption(_("Number of pixel per year"), "8")
        year_to_pixel_factor.set_help(_("How many pixel height is one year?"))
        menu.add_option(category_size, "year_to_pixel_factor",
            year_to_pixel_factor
        )

        offset_x = StringOption(_("Offset X Coordinate"), "60")
        offset_x.set_help(
            _("How many pixel are unused besides the "
            "most left and most right boxes?")
        )
        menu.add_option(category_size, "offset_x", offset_x)

        offset_y = StringOption(_("Offset Y Coordinate"), "75")
        offset_y.set_help(_("How many pixel are unused above first box?"))
        menu.add_option(category_size, "offset_y", offset_y)

        box_width = StringOption(_("Width of a box in pixel"), "140")
        box_width.set_help(_("Width of the box of a person in pixel"))
        menu.add_option(category_size, "box_width", box_width)

        box_offset_x = StringOption(_("Horizontal space "
            "between boxes in pixel"), "20"
        )
        box_offset_x.set_help(_("Minimum horizontal space "
            "between 2 boxes in pixel")
        )
        menu.add_option(category_size, "box_offset_x", box_offset_x)

        vert_length = StringOption(
            _("Length of vertical part of a line in pixel"), "100"
        )
        vert_length.set_help(_("Parent and child boxes are connected "
            "with lines. This is the length of the vertical part of "
            "the lines in pixel")
        )
        menu.add_option(category_size, "vert_length", vert_length)

        scale_x = StringOption(
            _("Number of pixel between left border and scale"), "10"
        )
        scale_x.set_help(_("Number of pixel between left border and scale"))
        menu.add_option(category_size, "scale_x", scale_x)
예제 #46
0
class AncestralCollapsibleTreeOptions(MenuReportOptions):
    """
    Defines options and provides handling interface.
    """
    def __init__(self, name, dbase):
        self._dbase = dbase
        MenuReportOptions.__init__(self, name, dbase)

    def validate_gen(self):
        """
        Validate Max generation > 0
        """
        maxgen = self.maxgen.get_value()
        if maxgen < 1:
            self.maxgen.set_value(1)

    def add_menu_options(self, menu):
        """
        Add options to the menu for the ancestral collapsible tree report.
        """
        category_name = _("Ancestral Collapsible Tree Options")

        pid = PersonOption(_("Center Person"))
        pid.set_help(_("The center person for the report"))
        menu.add_option(category_name, "pid", pid)

        pid = menu.get_option_by_name('pid').get_value()
        center_person = self._dbase.get_person_from_gramps_id(
            menu.get_option_by_name('pid').get_value())
        if center_person:
            name_str = global_name_display.display_formal(center_person)
        else:
            name_str = ""

        # 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)

        self.maxgen = NumberOption(_("Include Generations"), 10, 1, 100)
        self.maxgen.set_help(
            _("The number of generations to include in the " + "report"))
        menu.add_option(category_name, "maxgen", self.maxgen)
        self.maxgen.connect('value-changed', self.validate_gen)

        male_bg = ColorOption(_("Male Background Color"), "#ffffff")
        male_bg.set_help(_("RGB-color for male box background."))
        menu.add_option(category_name, "male_bg", male_bg)

        exp_male_bg = ColorOption(_("Male Expandable Background Color"),
                                  "#B4C4D9")
        exp_male_bg.set_help(
            _("RGB-color for male expandable box background."))
        menu.add_option(category_name, "exp_male_bg", exp_male_bg)

        female_bg = ColorOption(_("Female Background"), "#ffffff")
        female_bg.set_help(_("RGB-color for female box background."))
        menu.add_option(category_name, "female_bg", female_bg)

        exp_female_bg = ColorOption(_("Female Expandable Background"),
                                    "#F0D5D7")
        exp_female_bg.set_help(
            _("RGB-color for female expandable box " + "background."))
        menu.add_option(category_name, "exp_female_bg", exp_female_bg)

        dest_path = DestinationOption(_("Destination"),
                                      config.get('paths.website-directory'))
        dest_path.set_help(_("The destination path for generated files."))
        dest_path.set_directory_entry(True)
        menu.add_option(category_name, "dest_path", dest_path)

        dest_file = StringOption(_("Filename"), "AncestralCollapsible.html")
        dest_file.set_help(_("The destination file name for html content."))
        menu.add_option(category_name, "dest_file", dest_file)
예제 #47
0
    def add_menu_options(self, menu):
        """
        Add options to the menu for the detailed descendant report.
        """

        # Report Options
        category = _("Report Options")
        add_option = partial(menu.add_option, category)

        pid = PersonOption(_("Center Person"))
        pid.set_help(_("The center person for the report"))
        add_option("pid", pid)

        stdoptions.add_name_format_option(menu, category)

        stdoptions.add_private_data_option(menu, category)

        numbering = EnumeratedListOption(_("Numbering system"), "Henry")
        numbering.set_items([
                ("Henry",      _("Henry numbering")),
                ("d'Aboville", _("d'Aboville numbering")),
                ("Record (Modified Register)",
                               _("Record (Modified Register) numbering"))])
        numbering.set_help(_("The numbering system to be used"))
        add_option("numbering", numbering)

        generations = NumberOption(_("Generations"), 10, 1, 100)
        generations.set_help(
            _("The number of generations to include in the report")
            )
        add_option("gen", generations)

        pagebbg = BooleanOption(_("Page break between generations"), False)
        pagebbg.set_help(
                     _("Whether to start a new page after each generation."))
        add_option("pagebbg", pagebbg)

        pageben = BooleanOption(_("Page break before end notes"),False)
        pageben.set_help(
                     _("Whether to start a new page before the end notes."))
        add_option("pageben", pageben)

        stdoptions.add_localization_option(menu, category)

        # Content

        add_option = partial(menu.add_option, _("Content"))

        usecall = BooleanOption(_("Use callname for common name"), False)
        usecall.set_help(_("Whether to use the call name as the first name."))
        add_option("usecall", usecall)

        fulldates = BooleanOption(_("Use full dates instead of only the year"),
                                  True)
        fulldates.set_help(_("Whether to use full dates instead of just year."))
        add_option("fulldates", fulldates)

        listc = BooleanOption(_("List children"), True)
        listc.set_help(_("Whether to list children."))
        add_option("listc", listc)

        computeage = BooleanOption(_("Compute death age"),True)
        computeage.set_help(_("Whether to compute a person's age at death."))
        add_option("computeage", computeage)

        omitda = BooleanOption(_("Omit duplicate ancestors"), True)
        omitda.set_help(_("Whether to omit duplicate ancestors."))
        add_option("omitda", omitda)

        verbose = BooleanOption(_("Use complete sentences"), True)
        verbose.set_help(
                 _("Whether to use complete sentences or succinct language."))
        add_option("verbose", verbose)

        desref = BooleanOption(_("Add descendant reference in child list"),
                               True)
        desref.set_help(
                    _("Whether to add descendant references in child list."))
        add_option("desref", desref)

        category_name = _("Include")
        add_option = partial(menu.add_option, _("Include"))

        incnotes = BooleanOption(_("Include notes"), True)
        incnotes.set_help(_("Whether to include notes."))
        add_option("incnotes", incnotes)

        incattrs = BooleanOption(_("Include attributes"), False)
        incattrs.set_help(_("Whether to include attributes."))
        add_option("incattrs", incattrs)

        incphotos = BooleanOption(_("Include Photo/Images from Gallery"), False)
        incphotos.set_help(_("Whether to include images."))
        add_option("incphotos", incphotos)

        incnames = BooleanOption(_("Include alternative names"), False)
        incnames.set_help(_("Whether to include other names."))
        add_option("incnames", incnames)

        incevents = BooleanOption(_("Include events"), False)
        incevents.set_help(_("Whether to include events."))
        add_option("incevents", incevents)

        incaddresses = BooleanOption(_("Include addresses"), False)
        incaddresses.set_help(_("Whether to include addresses."))
        add_option("incaddresses", incaddresses)

        incsources = BooleanOption(_("Include sources"), False)
        incsources.set_help(_("Whether to include source references."))
        add_option("incsources", incsources)

        incsrcnotes = BooleanOption(_("Include sources notes"), False)
        incsrcnotes.set_help(_("Whether to include source notes in the "
            "Endnotes section. Only works if Include sources is selected."))
        add_option("incsrcnotes", incsrcnotes)

        incmates = BooleanOption(_("Include spouses"), False)
        incmates.set_help(_("Whether to include detailed spouse information."))
        add_option("incmates", incmates)

        incmateref = BooleanOption(_("Include spouse reference"), False)
        incmateref.set_help(_("Whether to include reference to spouse."))
        add_option("incmateref", incmateref)

        incssign = BooleanOption(_("Include sign of succession ('+')"
                                   " in child-list"), True)
        incssign.set_help(_("Whether to include a sign ('+') before the"
                            " descendant number in the child-list to indicate"
                            " a child has succession."))
        add_option("incssign", incssign)

        incpaths = BooleanOption(_("Include path to start-person"), False)
        incpaths.set_help(_("Whether to include the path of descendancy "
                            "from the start-person to each descendant."))
        add_option("incpaths", incpaths)

        # Missing information

        add_option = partial(menu.add_option, _("Missing information"))

        repplace = BooleanOption(_("Replace missing places with ______"), False)
        repplace.set_help(_("Whether to replace missing Places with blanks."))
        add_option("repplace", repplace)

        repdate = BooleanOption(_("Replace missing dates with ______"), False)
        repdate.set_help(_("Whether to replace missing Dates with blanks."))
        add_option("repdate", repdate)
    def add_menu_options(self, menu):

        """ Add the options """
        category_name = _("Options")

        self.__filter = FilterOption(_("Filter"), 0)
        self.__filter.set_help(_("Select filter to restrict people"))
        menu.add_option(category_name, "filter", self.__filter)
        self.__filter.connect('value-changed', self.__filter_changed)

        self.__pid = PersonOption(_("Filter Person"))
        self.__pid.set_help(_("The center person for the filter"))
        menu.add_option(category_name, "pid", self.__pid)
        self.__pid.connect('value-changed', self.__update_filters)

        self.__update_filters()

        source_text = StringOption(_("Source text"),
                                   _("Calculated Date Estimates"))
        source_text.set_help(_("Source to remove and/or add"))
        menu.add_option(category_name, "source_text", source_text)

        remove = BooleanOption(_("Remove previously added events, notes, and source"), True)
        remove.set_help(_("Remove calculated events, notes, and source; occurs immediately on Execute"))
        menu.add_option(category_name, "remove", remove)

        birth = EnumeratedListOption(_("Birth"), 0)
        birth.add_item(0, _("Do not add birth events"))
        birth.add_item(1, _("Add birth events without dates"))
        birth.add_item(2, _("Add birth events with dates"))
        birth.set_help( _("Add a birth events with or without estimated dates"))
        menu.add_option(category_name, "add_birth", birth)

        death = EnumeratedListOption(_("Death"), 0)
        death.add_item(0, _("Do not add death events"))
        death.add_item(1, _("Add death events without dates"))
        death.add_item(2, _("Add death events with dates"))
        death.set_help( _("Add death events with or without estimated dates"))
        menu.add_option(category_name, "add_death", death)

        # -----------------------------------------------------
        num = NumberOption(_("Maximum age"),
                           config.get('behavior.max-age-prob-alive'),
                           0, 200)
        num.set_help(_("Maximum age that one can live to"))
        menu.add_option(category_name, "MAX_AGE_PROB_ALIVE", num)

        num = NumberOption(_("Maximum sibling age difference"),
                           config.get('behavior.max-sib-age-diff'),
                           0, 200)
        num.set_help(_("Maximum age difference between siblings"))
        menu.add_option(category_name, "MAX_SIB_AGE_DIFF", num)

        num = NumberOption(_("Average years between generations"),
                           config.get('behavior.avg-generation-gap'),
                           0, 200)
        num.set_help(_("Average years between two generations"))
        menu.add_option(category_name, "AVG_GENERATION_GAP", num)

        dates = EnumeratedListOption(_("Estimated Dates"), 0)
        dates.add_item(0, _("Approximate (about)"))
        dates.add_item(1, _("Extremes (after and before)"))
        dates.set_help( _("Dates on events are either about or after/before"))
        menu.add_option(category_name, "dates", dates)
예제 #49
0
    def add_menu_options(self, menu):
        """
        Add options to the menu for the statistics report.
        """

        ################################
        category_name = _("Report Options")
        add_option = partial(menu.add_option, category_name)
        ################################

        self.__filter = FilterOption(_("Filter"), 0)
        self.__filter.set_help(_("Determines what people are included "
                                 "in the report."))
        add_option("filter", self.__filter)
        self.__filter.connect('value-changed', self.__filter_changed)

        self.__pid = PersonOption(_("Filter Person"))
        self.__pid.set_help(_("The center person for the filter."))
        menu.add_option(category_name, "pid", self.__pid)
        self.__pid.connect('value-changed', self.__update_filters)

        sortby = EnumeratedListOption(_('Sort chart items by'),
                                      _options.SORT_VALUE)
        for item_idx in range(len(_options.opt_sorts)):
            item = _options.opt_sorts[item_idx]
            sortby.add_item(item_idx, item[2])
        sortby.set_help(_("Select how the statistical data is sorted."))
        add_option("sortby", sortby)

        reverse = BooleanOption(_("Sort in reverse order"), False)
        reverse.set_help(_("Check to reverse the sorting order."))
        add_option("reverse", reverse)

        this_year = time.localtime()[0]
        year_from = NumberOption(_("People Born After"),
                                 1700, 1, this_year)
        year_from.set_help(_("Birth year from which to include people."))
        add_option("year_from", year_from)

        year_to = NumberOption(_("People Born Before"),
                               this_year, 1, this_year)
        year_to.set_help(_("Birth year until which to include people"))
        add_option("year_to", year_to)

        no_years = BooleanOption(_("Include people without known birth years"),
                                 False)
        no_years.set_help(_("Whether to include people without "
                            "known birth years."))
        add_option("no_years", no_years)

        gender = EnumeratedListOption(_('Genders included'),
                                      Person.UNKNOWN)
        for item_idx in range(len(_options.opt_genders)):
            item = _options.opt_genders[item_idx]
            gender.add_item(item[0], item[2])
        gender.set_help(_("Select which genders are included into "
                          "statistics."))
        add_option("gender", gender)

        bar_items = NumberOption(_("Max. items for a pie"), 8, 0, 20)
        bar_items.set_help(_("With fewer items pie chart and legend will be "
                             "used instead of a bar chart."))
        add_option("bar_items", bar_items)

        ################################
        category_name = _("Report Options (2)")
        add_option = partial(menu.add_option, category_name)
        ################################

        self._nf = stdoptions.add_name_format_option(menu, category_name)
        self._nf.connect('value-changed', self.__update_filters)

        self.__update_filters()

        stdoptions.add_private_data_option(menu, category_name)

        stdoptions.add_living_people_option(menu, category_name)

        stdoptions.add_localization_option(menu, category_name)

        ################################
        # List of available charts on separate option tabs
        ################################

        idx = 0
        third = (len(_Extract.extractors) + 1) // 3
        chart_types = []
        for (chart_opt, ctuple) in _Extract.extractors.items():
            chart_types.append((_(ctuple[1]), chart_opt, ctuple))
        sorted_chart_types = sorted(chart_types,
                                    key=lambda x: glocale.sort_key(x[0]))
        for (translated_option_name, opt_name, ctuple) in sorted_chart_types:
            if idx >= (third * 2):
                category_name = _("Charts 3")
            elif idx >= third:
                category_name = _("Charts 2")
            else:
                category_name = _("Charts 1")
            opt = BooleanOption(translated_option_name, False)
            opt.set_help(_("Include charts with indicated data."))
            menu.add_option(category_name, opt_name, opt)
            idx += 1

        # Enable a couple of charts by default
        menu.get_option_by_name("data_gender").set_value(True)
        menu.get_option_by_name("data_ccount").set_value(True)
        menu.get_option_by_name("data_bmonth").set_value(True)
class AncestralCollapsibleTreeOptions(MenuReportOptions):

    """
    Defines options and provides handling interface.
    """

    def __init__(self, name, dbase):
        self._dbase = dbase
        MenuReportOptions.__init__(self, name, dbase)

    def validate_gen(self):
        """
        Validate Max generation > 0
        """
        maxgen = self.maxgen.get_value()
        if maxgen < 1:
            self.maxgen.set_value(1)

    def add_menu_options(self, menu):
        """
        Add options to the menu for the ancestral collapsible tree report.
        """
        category_name = _("Ancestral Collapsible Tree Options")

        pid = PersonOption(_("Center Person"))
        pid.set_help(_("The center person for the report"))
        menu.add_option(category_name, "pid", pid)

        pid = menu.get_option_by_name('pid').get_value()
        center_person = self._dbase.get_person_from_gramps_id(
            menu.get_option_by_name('pid').get_value())
        if center_person :
            name_str = global_name_display.display_formal(center_person)
        else:
            name_str = ""

        # 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)

        self.maxgen = NumberOption(_("Include Generations"), 10, 1, 100)
        self.maxgen.set_help(_("The number of generations to include in the " +
            "report"))
        menu.add_option(category_name, "maxgen", self.maxgen)
        self.maxgen.connect('value-changed', self.validate_gen)

        male_bg = ColorOption(_("Male Background Color"), "#ffffff")
        male_bg.set_help(_("RGB-color for male box background."))
        menu.add_option(category_name, "male_bg", male_bg)

        exp_male_bg = ColorOption(_("Male Expandable Background Color"),
            "#B4C4D9")
        exp_male_bg.set_help(_("RGB-color for male expandable box background."))
        menu.add_option(category_name, "exp_male_bg", exp_male_bg)

        female_bg = ColorOption(_("Female Background"), "#ffffff")
        female_bg.set_help(_("RGB-color for female box background."))
        menu.add_option(category_name, "female_bg", female_bg)

        exp_female_bg = ColorOption(_("Female Expandable Background"),
            "#F0D5D7")
        exp_female_bg.set_help(_("RGB-color for female expandable box " +
            "background."))
        menu.add_option(category_name, "exp_female_bg", exp_female_bg)

        dest_path = DestinationOption(_("Destination"),
            config.get('paths.website-directory'))
        dest_path.set_help(_("The destination path for generated files."))
        dest_path.set_directory_entry(True)
        menu.add_option(category_name, "dest_path", dest_path)

        dest_file = StringOption(_("Filename"), "AncestralCollapsible.html")
        dest_file.set_help(_("The destination file name for html content."))
        menu.add_option(category_name, "dest_file", dest_file)
예제 #51
0
class FamilyLinesOptions(MenuReportOptions):
    """
    Defines all of the controls necessary
    to configure the FamilyLines report.
    """
    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
        self.justyears = None
        self.include_dates = None
        MenuReportOptions.__init__(self, name, dbase)

    def add_menu_options(self, menu):

        # ---------------------
        category_name = _('Report Options')
        add_option = partial(menu.add_option, category_name)
        # ---------------------

        followpar = BooleanOption(_('Follow parents to determine '
                                    '"family lines"'), True)
        followpar.set_help(_('Parents and their ancestors will be '
                             'considered when determining "family lines".'))
        add_option('followpar', followpar)

        followchild = BooleanOption(_('Follow children to determine '
                                      '"family lines"'), True)
        followchild.set_help(_('Children will be considered when '
                               'determining "family lines".'))
        add_option('followchild', followchild)

        remove_extra_people = BooleanOption(_('Try to remove extra '
                                              'people and families'), True)
        remove_extra_people.set_help(_('People and families not directly '
                                       'related to people of interest will '
                                       'be removed when determining '
                                       '"family lines".'))
        add_option('removeextra', remove_extra_people)

        arrow = EnumeratedListOption(_("Arrowhead direction"), 'd')
        for i in range( 0, len(_ARROWS) ):
            arrow.add_item(_ARROWS[i]["value"], _ARROWS[i]["name"])
        arrow.set_help(_("Choose the direction that the arrows point."))
        add_option("arrow", arrow)

        color = EnumeratedListOption(_("Graph coloring"), "filled")
        for i in range(len(_COLORS)):
            color.add_item(_COLORS[i]["value"], _COLORS[i]["name"])
        color.set_help(_("Males will be shown with blue, females "
                         "with red, unless otherwise set above for filled. "
                         "If the sex of an individual "
                         "is unknown it will be shown with gray."))
        add_option("color", color)

        roundedcorners = EnumeratedListOption(_("Rounded corners"), '')
        for i in range( 0, len(_CORNERS) ):
            roundedcorners.add_item(_CORNERS[i]["value"], _CORNERS[i]["name"])
        roundedcorners.set_help(_("Use rounded corners e.g. to differentiate "
                         "between women and men."))
        add_option("useroundedcorners", roundedcorners)

        stdoptions.add_gramps_id_option(menu, category_name, ownline=True)

        # ---------------------
        category_name = _('Report Options (2)')
        add_option = partial(menu.add_option, category_name)
        # ---------------------

        stdoptions.add_name_format_option(menu, category_name)

        stdoptions.add_private_data_option(menu, category_name, default=False)

        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)

        # --------------------------------
        add_option = partial(menu.add_option, _('People of Interest'))
        # --------------------------------

        person_list = PersonListOption(_('People of interest'))
        person_list.set_help(_('People of interest are used as a starting '
                               'point when determining "family lines".'))
        add_option('gidlist', person_list)

        self.limit_parents = BooleanOption(_('Limit the number of ancestors'),
                                           False)
        self.limit_parents.set_help(_('Whether to '
                                      'limit the number of ancestors.'))
        add_option('limitparents', self.limit_parents)
        self.limit_parents.connect('value-changed', self.limit_changed)

        self.max_parents = NumberOption('', 50, 10, 9999)
        self.max_parents.set_help(_('The maximum number '
                                    'of ancestors to include.'))
        add_option('maxparents', self.max_parents)

        self.limit_children = BooleanOption(_('Limit the number '
                                              'of descendants'),
                                            False)
        self.limit_children.set_help(_('Whether to '
                                       'limit the number of descendants.'))
        add_option('limitchildren', self.limit_children)
        self.limit_children.connect('value-changed', self.limit_changed)

        self.max_children = NumberOption('', 50, 10, 9999)
        self.max_children.set_help(_('The maximum number '
                                     'of descendants to include.'))
        add_option('maxchildren', self.max_children)

        # --------------------
        category_name = _('Include')
        add_option = partial(menu.add_option, category_name)
        # --------------------

        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)
예제 #52
0
    def add_menu_options(self, menu):
        """ Add the options for the text birthday report """
        category_name = _("Report Options")

        self.__filter = FilterOption(_("Filter"), 0)
        self.__filter.set_help(
            _("Select the filter to be applied to the report."))
        menu.add_option(category_name, "filter", self.__filter)
        self.__filter.connect('value-changed', self.__filter_changed)

        self.__pid = PersonOption(_("Filter Person"))
        self.__pid.set_help(_("The center person for the filter."))
        menu.add_option(category_name, "pid", self.__pid)
        self.__pid.connect('value-changed', self.__update_filters)

        titletext = StringOption(_("Title text"), _(_TITLE0))
        titletext.set_help(_("Title of report"))
        menu.add_option(category_name, "titletext", titletext)

        text1 = StringOption(_("Text Area 1"), _(_TITLE1))
        text1.set_help(_("First line of text at bottom of report"))
        menu.add_option(category_name, "text1", text1)

        text2 = StringOption(_("Text Area 2"), _(_TITLE2))
        text2.set_help(_("Second line of text at bottom of report"))
        menu.add_option(category_name, "text2", text2)

        text3 = StringOption(_("Text Area 3"), URL_HOMEPAGE,)
        text3.set_help(_("Third line of text at bottom of report"))
        menu.add_option(category_name, "text3", text3)

        category_name = _("Report Options (2)")

        self._nf = stdoptions.add_name_format_option(menu, category_name)
        self._nf.connect('value-changed', self.__update_filters)

        stdoptions.add_private_data_option(menu, category_name)

        alive = BooleanOption(_("Include only living people"), True)
        alive.set_help(_("Include only living people in the report"))
        menu.add_option(category_name, "alive", alive)

        deadtxt = StringOption(_("Dead Symbol"), _(_DEADTXT))
        deadtxt.set_help(_("This will show after name to indicate that person is dead"))
        menu.add_option(category_name, "deadtxt", deadtxt)

        self.__update_filters()

        stdoptions.add_localization_option(menu, category_name)

        showyear = BooleanOption(_("Show event year"), True)
        showyear.set_help(_("Prints the year the event took place in the report"))
        menu.add_option(category_name, "showyear", showyear)

        category_name = _("Content")

        year = NumberOption(_("Year of report"), time.localtime()[0],
                            1000, 3000)
        year.set_help(_("Year of report"))
        menu.add_option(category_name, "year", year)

        country = EnumeratedListOption(_("Country for holidays"), 0)
        holiday_table = libholiday.HolidayTable()
        countries = holiday_table.get_countries()
        countries.sort()
        if (len(countries) == 0 or
            (len(countries) > 0 and countries[0] != '')):
            countries.insert(0, '')
        count = 0
        for c in countries:
            country.add_item(count, c)
            count += 1
        country.set_help(_("Select the country to see associated holidays"))
        menu.add_option(category_name, "country", country)

        maiden_name = EnumeratedListOption(_("Birthday surname"), "own")
        maiden_name.add_item(
            "spouse_first",
            _("Wives use husband's surname (from first family listed)"))
        maiden_name.add_item(
            "spouse_last",
            _("Wives use husband's surname (from last family listed)"))
        maiden_name.add_item("own", _("Wives use their own surname"))
        maiden_name.set_help(_("Select married women's displayed surname"))
        menu.add_option(category_name, "maiden_name", maiden_name)

        birthdays = BooleanOption(_("Include birthdays"), True)
        birthdays.set_help(_("Whether to include birthdays"))
        menu.add_option(category_name, "birthdays", birthdays)

        anniversaries = BooleanOption(_("Include anniversaries"), True)
        anniversaries.set_help(_("Whether to include anniversaries"))
        menu.add_option(category_name, "anniversaries", anniversaries)

        death_anniversaries = BooleanOption(_("Include death anniversaries"), True)
        death_anniversaries.set_help(_("Whether to include anniversaries of death"))
        menu.add_option(category_name, "death_anniversaries", death_anniversaries)

        show_relships = BooleanOption(
            _("Include relationship to center person"), False)
        show_relships.set_help(
            _("Whether to include relationships to the center person"))
        menu.add_option(category_name, "relationships", show_relships)
예제 #53
0
    def add_menu_options(self, menu):
        from functools import partial

        # Report Options
        category = _("Report Options")
        addopt = partial(menu.add_option, category)
        
        pid = PersonOption(_("Center Person"))
        pid.set_help(_("The center person for the report"))
        addopt("pid", pid)

        start_number = NumberOption(_("Sosa-Stradonitz number"), 1, 1, 16384)
        start_number.set_help(
                    _('The Sosa-Stradonitz number of the central person.'))
        addopt("initial_sosa", start_number)

        stdoptions.add_name_format_option(menu, category)
        
        gen = NumberOption(_("Generations"),10,1,100)
        gen.set_help(_("The number of generations to include in the report"))
        addopt("gen", gen)
        
        stdoptions.add_private_data_option(menu, category)

        pagebbg = BooleanOption(_("Page break between generations"),False)
        pagebbg.set_help(
                     _("Whether to start a new page after each generation."))
        addopt("pagebbg", pagebbg)

        pageben = BooleanOption(_("Page break before end notes"),False)
        pageben.set_help(
                     _("Whether to start a new page before the end notes."))
        addopt("pageben", pageben)

        stdoptions.add_localization_option(menu, category)

        # Content options

        addopt = partial(menu.add_option, _("Content"))

        usecall = BooleanOption(_("Use callname for common name"),False)
        usecall.set_help(_("Whether to use the call name as the first name."))
        addopt("usecall", usecall)
        
        fulldates = BooleanOption(
                              _("Use full dates instead of only the year"),True)
        fulldates.set_help(_("Whether to use full dates instead of just year."))
        addopt("fulldates", fulldates)
        
        listc = BooleanOption(_("List children"),True)
        listc.set_help(_("Whether to list children."))
        addopt("listc", listc)
        
        computeage = BooleanOption(_("Compute death age"),True)
        computeage.set_help(_("Whether to compute a person's age at death."))
        addopt("computeage", computeage)
        
        omitda = BooleanOption(_("Omit duplicate ancestors"),True)
        omitda.set_help(_("Whether to omit duplicate ancestors."))
        addopt("omitda", omitda)
        
        verbose = BooleanOption(_("Use Complete Sentences"),True)
        verbose.set_help(
                 _("Whether to use complete sentences or succinct language."))
        addopt("verbose", verbose)

        desref = BooleanOption(_("Add descendant reference in child list"),True)
        desref.set_help(
                    _("Whether to add descendant references in child list."))
        addopt("desref", desref)

        # What to include

        addopt = partial(menu.add_option, _("Include"))
        
        incnotes = BooleanOption(_("Include notes"),True)
        incnotes.set_help(_("Whether to include notes."))
        addopt("incnotes", incnotes)

        incattrs = BooleanOption(_("Include attributes"),False)
        incattrs.set_help(_("Whether to include attributes."))
        addopt("incattrs", incattrs)
        
        incphotos = BooleanOption(_("Include Photo/Images from Gallery"),False)
        incphotos.set_help(_("Whether to include images."))
        addopt("incphotos", incphotos)

        incnames = BooleanOption(_("Include alternative names"),False)
        incnames.set_help(_("Whether to include other names."))
        addopt("incnames", incnames)

        incevents = BooleanOption(_("Include events"),False)
        incevents.set_help(_("Whether to include events."))
        addopt("incevents", incevents)

        incaddresses = BooleanOption(_("Include addresses"),False)
        incaddresses.set_help(_("Whether to include addresses."))
        addopt("incaddresses", incaddresses)

        incsources = BooleanOption(_("Include sources"),False)
        incsources.set_help(_("Whether to include source references."))
        addopt("incsources", incsources)

        incsrcnotes = BooleanOption(_("Include sources notes"), False)
        incsrcnotes.set_help(_("Whether to include source notes in the "
            "Endnotes section. Only works if Include sources is selected."))
        addopt("incsrcnotes", incsrcnotes)

        # How to handle missing information

        addopt = partial(menu.add_option, _("Missing information"))

        repplace = BooleanOption(_("Replace missing places with ______"),False)
        repplace.set_help(_("Whether to replace missing Places with blanks."))
        addopt("repplace", repplace)

        repdate = BooleanOption(_("Replace missing dates with ______"),False)
        repdate.set_help(_("Whether to replace missing Dates with blanks."))
        addopt("repdate", repdate)
예제 #54
0
def add_living_people_option(menu, category,
                             mode=LivingProxyDb.MODE_INCLUDE_ALL,
                             after_death_years=0,
                             process_names=True):
    """
    Insert an option for deciding how the information in the
    database for living people shall be handled by the report

    Because historically, before this option, the entire database was
    used, including all information on all living people, the default
    mode for this option has been set to include all such information

    The value of the "living_people" option is the same as the value
    of the "mode" argument in the call to the LivingProxyDb proxy DB

    :param menu: The menu the options should be added to.
    :type menu: :class:`.Menu`
    :param category: A label that describes the category that the option
        belongs to.
        Example: "Report Options"
    :type category: string
    :param mode:
        The method for handling living people.
        LivingProxyDb.MODE_EXCLUDE_ALL will remove living people altogether.
        LivingProxyDb.MODE_INCLUDE_LAST_NAME_ONLY will remove all
            information and change their given name to "[Living]" or whatever
            has been set in Preferences -> Text -> Private given name.
        LivingProxyDb.MODE_REPLACE_COMPLETE_NAME will remove all
            information and change their given name and surname to
            "[Living]" or whatever has been set in Preferences -> Text
            for Private surname and Private given name.
        LivingProxyDb.MODE_INCLUDE_FULL_NAME_ONLY will remove all
            information but leave the entire name intact.
        LivingProxyDb.MODE_INCLUDE_ALL will not invoke LivingProxyDb at all.
    :type mode: int
    :param after_death_years:
        The number of years after a person's death to
        still consider them as living.
    :type after_death_years: int
    :return: nothing
    :param process_names: whether to offer name-oriented option choices
    :type process_names: Boolean
    """

    def living_people_changed():
        """
        Handle a change in the living_people option
        """
        if living_people.get_value() == LivingProxyDb.MODE_INCLUDE_ALL:
            years_past_death.set_available(False)
        else:
            years_past_death.set_available(True)

    living_people = EnumeratedListOption(_("Living People"), mode)
    items = [(LivingProxyDb.MODE_INCLUDE_ALL,
              _T_("'living people'|Included, and all data"))]
    if process_names:
        items += [
            (LivingProxyDb.MODE_INCLUDE_FULL_NAME_ONLY,
             _T_("'living people'|Full names, but data removed")),
            (LivingProxyDb.MODE_INCLUDE_LAST_NAME_ONLY,
             _T_("'living people'|Given names replaced, and data removed")),
            (LivingProxyDb.MODE_REPLACE_COMPLETE_NAME,
             _T_("'living people'|Complete names replaced, and data removed"))]
    items += [(LivingProxyDb.MODE_EXCLUDE_ALL,
               _T_("'living people'|Not included"))]
    living_people.set_items(items, xml_items=True) # for deferred translation
    living_people.set_help(_("How to handle living people"))
    menu.add_option(category, "living_people", living_people)
    living_people.connect('value-changed', living_people_changed)
    years_past_death = NumberOption(_("Years from death to consider living"),
                                      after_death_years, 0, 100)
    years_past_death.set_help(_("This allows you to restrict "
                                "information on people who have not "
                                "been dead for very long"))
    menu.add_option(category, "years_past_death", years_past_death)
    living_people_changed()