Exemplo n.º 1
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)
    def add_menu_options(self, menu):
        """Menu options."""
        menu.filter_list = CustomFilters.get_filters("Event")
        all_filter = GenericFilterFactory("Event")()
        all_filter.set_name(_("All Events"))
        all_filter.add_rule(rules.event.AllEvents([]))
        all_filter_in_list = False
        for fltr in menu.filter_list:
            if fltr.get_name() == all_filter.get_name():
                all_filter_in_list = True
        if not all_filter_in_list:
            menu.filter_list.insert(0, all_filter)

        events = FilterOption(_("Events"), 0)
        menu.add_option(_("Option"), "events", events)
        events.set_filters(menu.filter_list)

        find = StringOption(_("Find"), "")
        menu.add_option(_("Option"), "find", find)

        replace = StringOption(_("Replace"), "")
        menu.add_option(_("Option"), "replace", replace)

        keep_old = BooleanOption(_("Replace substring only"), False)
        keep_old.set_help(
            _("If True only the substring will be replaced, "
              "otherwise the whole description will be deleted "
              "and replaced by the new one."))
        menu.add_option(_("Option"), "keep_old", keep_old)
Exemplo n.º 3
0
    def add_menu_options(self, menu):
        """
        Add options to the menu for the marker report.
        """
        category_name = _("Report Options")

        all_tags = []
        for handle in self.__db.get_tag_handles():
            tag = self.__db.get_tag_from_handle(handle)
            all_tags.append(tag.get_name())

        if len(all_tags) > 0:
            tag_option = EnumeratedListOption(_("Tag"), all_tags[0])
            for tag_name in all_tags:
                tag_option.add_item(tag_name, tag_name)
        else:
            tag_option = EnumeratedListOption(_("Tag"), "")
            tag_option.add_item("", "")

        tag_option.set_help(_("The tag to use for the report"))
        menu.add_option(category_name, "tag", tag_option)

        can_group = BooleanOption(_("Group by reference type"), False)
        can_group.set_help(_("Group notes by Family, Person, Place, etc."))
        menu.add_option(category_name, "can_group", can_group)
Exemplo n.º 4
0
    def add_menu_options(self, menu):
        category_name = _("Selection")
        self.replace_without_asking = BooleanOption(
            _("Replace existing references to the person "
              "being assigned without asking"), REPLACE_WITHOUT_ASKING)

        menu.add_option(category_name, "replace_without_asking",
                        self.replace_without_asking)

        category_name = _("Face detection")
        width, height = MIN_FACE_SIZE
        sensitivity = SENSITIVITY
        self.min_face_width = NumberOption(_("Minimum face width (px)"), width,
                                           1, 1000, 1)
        self.min_face_height = NumberOption(_("Minimum face height (px)"),
                                            height, 1, 1000, 1)
        self.detect_inside_existing_boxes = BooleanOption(
            _("Detect faces inside existing boxes"),
            DETECT_INSIDE_EXISTING_BOXES)
        self.sensitivity = NumberOption(_("Sensitivity (1 min .. 20 max)"),
                                        sensitivity, 1, 20, 1)

        menu.add_option(category_name, "min_face_width", self.min_face_width)
        menu.add_option(category_name, "min_face_height", self.min_face_height)
        menu.add_option(category_name, "sensitivity", self.sensitivity)
        menu.add_option(category_name, "detect_inside_existing_boxes",
                        self.detect_inside_existing_boxes)
Exemplo n.º 5
0
    def add_menu_options(self, menu):

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

        self.__filter = FilterOption(_("Person 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)

        attribute_text = StringOption(_("Attribute"), "")
        attribute_value = StringOption(_("Value"), "")

        attribute_text.set_help(_("Attribute type to add or edit"))
        attribute_value.set_help(_("Attribute value to add or edit"))

        menu.add_option(category_name, "attribute_text", attribute_text)
        menu.add_option(category_name, "attribute_value", attribute_value)
        self.__attribute_text = attribute_text
        self.__attribute_value = attribute_value

        remove = BooleanOption(_("Remove"), False)
        remove.set_help(_("Remove attribute type and value set"))
        menu.add_option(category_name, "remove", remove)

        self.__update_filters()
Exemplo n.º 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, 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)
    def add_menu_options(self, menu):
        category_name = _("Selection")
        self.replace_without_asking = BooleanOption(
                                 _("Replace existing references to the person "
                                   "being assigned without asking"),
                                 REPLACE_WITHOUT_ASKING)

        menu.add_option(category_name, "replace_without_asking",
                        self.replace_without_asking)

        category_name = _("Face detection")
        width, height = MIN_FACE_SIZE
        sensitivity = SENSITIVITY
        self.min_face_width = NumberOption(_("Minimum face width (px)"),
                                           width, 1, 1000, 1)
        self.min_face_height = NumberOption(_("Minimum face height (px)"),
                                            height, 1, 1000, 1)
        self.detect_inside_existing_boxes = BooleanOption(
                                       _("Detect faces inside existing boxes"),
                                       DETECT_INSIDE_EXISTING_BOXES)
        self.sensitivity = NumberOption(_("Sensitivity (1 min .. 20 max)"),
                                        sensitivity, 1, 20, 1)

        menu.add_option(category_name, "min_face_width", self.min_face_width)
        menu.add_option(category_name, "min_face_height", self.min_face_height)
        menu.add_option(category_name, "sensitivity", self.sensitivity)
        menu.add_option(category_name, "detect_inside_existing_boxes",
                        self.detect_inside_existing_boxes)
Exemplo n.º 8
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)
Exemplo n.º 9
0
    def add_menu_options(self, menu):
        """
        Add options to the menu for the place report.
        """
        category_name = _("Report Options")

        # Reload filters to pick any new ones
        CustomFilters = None
        from gramps.gen.filters import CustomFilters, GenericFilter

        opt = FilterOption(_("Select using filter"), 0)
        opt.set_help(_("Select places using a filter"))
        filter_list = []
        filter_list.append(GenericFilter())
        filter_list.extend(CustomFilters.get_filters('Place'))
        opt.set_filters(filter_list)
        menu.add_option(category_name, "filter", opt)

        places = PlaceListOption(_("Select places individually"))
        places.set_help(_("List of places to report on"))
        menu.add_option(category_name, "places", places)

        reporttype = EnumeratedListOption(_("Type de Liste"), "ListeType")
        reporttype.set_items([("ListeEclair", _("Tiny Tafel")),
                              ("cousingenweb", _("cousingenweb"))])
        reporttype.set_help(_("Type de liste"))
        menu.add_option(category_name, "reporttype", reporttype)

        incpriv = BooleanOption(_("Include private data"), True)
        incpriv.set_help(_("Whether to include private data"))
        menu.add_option(category_name, "incpriv", incpriv)
Exemplo n.º 10
0
    def add_menu_options(self, menu):
        """
        Add options to the menu for the place report.
        """
        category_name = _("Report Options")

        # Reload filters to pick any new ones
        CustomFilters = None
        from gramps.gen.filters import CustomFilters, GenericFilter

        opt = FilterOption(_("Select using filter"), 0)
        opt.set_help(_("Select places using a filter"))
        filter_list = []
        filter_list.append(GenericFilter())
        filter_list.extend(CustomFilters.get_filters('Place'))
        opt.set_filters(filter_list)
        menu.add_option(category_name, "filter", opt)

        places = PlaceListOption(_("Select places individually"))
        places.set_help(_("List of places to report on"))
        menu.add_option(category_name, "places", places)

        reporttype = EnumeratedListOption(_("Type de Liste"), "ListeType")
        reporttype.set_items([
                ("ListeEclair",   _("Tiny Tafel")),
                ("cousingenweb",   _("cousingenweb"))])
        reporttype.set_help(_("Type de liste"))
        menu.add_option(category_name, "reporttype", reporttype)

        incpriv = BooleanOption(_("Include private data"), True)
        incpriv.set_help(_("Whether to include private data"))
        menu.add_option(category_name, "incpriv", incpriv)
Exemplo n.º 11
0
    def add_menu_options(self, menu):
        """
        Add options to the menu for the place report.
        """
        category_name = _("Report Options")

        # Reload filters to pick any new ones
        CustomFilters = None
#p        from Filters import CustomFilters, GenericFilter
        from gramps.gen.filters import CustomFilters, GenericFilter
        opt = FilterOption(_("Select using filter"), 0)
        opt.set_help(_("Select places using a filter"))
        filter_list = []
        filter_list.append(GenericFilter())
        filter_list.extend(CustomFilters.get_filters('Place'))
        opt.set_filters(filter_list)
        menu.add_option(category_name, "filter", opt)

        places = PlaceListOption(_("Select places individually"))
        places.set_help(_("List of places to report on"))
        menu.add_option(category_name, "places", places)

        center = EnumeratedListOption(_("Center on"), "Event")
        center.set_items([
                ("Event",   _("Event")),
                ("Person", _("Person"))])
        center.set_help(_("If report is event or person centered"))
        menu.add_option(category_name, "center", center)

        incpriv = BooleanOption(_("Include private data"), True)
        incpriv.set_help(_("Whether to include private data"))
        menu.add_option(category_name, "incpriv", incpriv)
Exemplo n.º 12
0
    def add_menu_options(self, menu):
        """
        Add options to the menu for the ancestor report.
        """
        category_name = _("Report Options")
        
        report_type = EnumeratedListOption(_('Census Selection'), TYPE_PERSON)
        report_type.add_item(TYPE_PERSON, _('By Person'))
        report_type.add_item(TYPE_SOURCE, _('By Source'))
        report_type.add_item(TYPE_BOTH, _('By Person and Source'))
        report_type.add_item(TYPE_ALL, _('All Census records'))
        report_type.set_help(_("The type of report"))
        menu.add_option(category_name, "report_type", report_type)
        
        pid = PersonOption(_("Person"))
        pid.set_help(_("The selected person for the report."))
        menu.add_option(category_name, "pid", pid)

        default = None
        sources = get_census_sources(self.database)
        if len(sources) > 0:
            if len(sources[0]) > 0:
                default = sources[0][0]
        src_handle = EnumeratedListOption(_('Source'), default)
        for source in sources:
            src_handle.add_item(source[0], source[1])
        menu.add_option(category_name, "src_handle", src_handle)
        
        pg_break = BooleanOption(_("Page break after each census."), False)
        pg_break.set_help(_("Start a new page after each census."))
        menu.add_option(category_name, "pg_break", pg_break)
Exemplo n.º 13
0
    def add_menu_options(self, menu):
        """
        Add options to the menu for the marker report.
        """
        category_name = _("Report Options")

        all_tags = []
        for handle in self.__db.get_tag_handles():
            tag = self.__db.get_tag_from_handle(handle)
            all_tags.append(tag.get_name())

        if len(all_tags) > 0:
            tag_option = EnumeratedListOption(_('Tag'), all_tags[0])
            for tag_name in all_tags:
                tag_option.add_item(tag_name, tag_name)
        else:
            tag_option = EnumeratedListOption(_('Tag'), '')
            tag_option.add_item('', '')

        tag_option.set_help(_("The tag to use for the report"))
        menu.add_option(category_name, "tag", tag_option)

        can_group = BooleanOption(_("Group by reference type"), False)
        can_group.set_help(_("Group notes by Family, Person, Place, etc."))
        menu.add_option(category_name, "can_group", can_group)
Exemplo n.º 14
0
    def add_menu_options(self, menu):
        """
        Add options to the menu for the ancestor report.
        """
        category_name = _("Report Options")
        
        report_type = EnumeratedListOption(_('Census Selection'), TYPE_PERSON)
        report_type.add_item(TYPE_PERSON, _('By Person'))
        report_type.add_item(TYPE_SOURCE, _('By Source'))
        report_type.add_item(TYPE_BOTH, _('By Person and Source'))
        report_type.add_item(TYPE_ALL, _('All Census records'))
        report_type.set_help(_("The type of report"))
        menu.add_option(category_name, "report_type", report_type)
        
        pid = PersonOption(_("Person"))
        pid.set_help(_("The selected person for the report."))
        menu.add_option(category_name, "pid", pid)

        default = None
        sources = get_census_sources(self.database)
        if len(sources) > 0:
            if len(sources[0]) > 0:
                default = sources[0][0]
        src_handle = EnumeratedListOption(_('Source'), default)
        for source in sources:
            src_handle.add_item(source[0], source[1])
        menu.add_option(category_name, "src_handle", src_handle)
        
        pg_break = BooleanOption(_("Page break after each census."), False)
        pg_break.set_help(_("Start a new page after each census."))
        menu.add_option(category_name, "pg_break", pg_break)
Exemplo n.º 15
0
    def add_menu_options(self, menu):

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

        self.__filter = FilterOption(_("Person 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)

        attribute_text = StringOption(_("Attribute"), "")
        attribute_value = StringOption(_("Value"), "")

        attribute_text.set_help(_("Attribute type to add or edit"))
        attribute_value.set_help(_("Attribute value to add or edit"))

        menu.add_option(category_name, "attribute_text", attribute_text)
        menu.add_option(category_name, "attribute_value", attribute_value)
        self.__attribute_text = attribute_text
        self.__attribute_value = attribute_value

        remove = BooleanOption(_("Remove"), False)
        remove.set_help(_("Remove attribute type and value set"))
        menu.add_option(category_name, "remove", remove)

        self.__update_filters()
Exemplo n.º 16
0
    def add_menu_options(self, menu):
        """
        Add options to the menu for the place report.
        """
        category_name = _("Report Options")

        # Reload filters to pick any new ones
        CustomFilters = None
        from gramps.gen.filters import CustomFilters, GenericFilter

        opt = FilterOption(_("Select using filter"), 0)
        opt.set_help(_("Select places using a filter"))
        filter_list = []
        filter_list.append(GenericFilter())
        filter_list.extend(CustomFilters.get_filters('Place'))
        opt.set_filters(filter_list)
        menu.add_option(category_name, "filter", opt)

        stdoptions.add_name_format_option(menu, category_name)

        places = PlaceListOption(_("Select places individually"))
        places.set_help(_("List of places to report on"))
        menu.add_option(category_name, "places", places)

        classwidth = EnumeratedListOption(_("Class wdith"), "classwidth")
        classwidth.set_items([("20 Years", _("10 Years")),
                              ("20 Years", _("20 Years"))])
        classwidth.set_help(_("classwidth fpr Analysis"))
        menu.add_option(category_name, "classwidth", classwidth)

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

        stdoptions.add_localization_option(menu, category_name)
Exemplo n.º 17
0
    def add_menu_options(self, menu):
        person_list = PersonListOption('People of interest')
        menu.add_option('People of Interest', 'gidlist', person_list)

        withparents = BooleanOption(('Include ancestors'), False)
        menu.add_option('People of Interest', 'withparents', withparents)

        withchildren = BooleanOption(('Include descendents'), False)
        menu.add_option('People of Interest', 'withchildren', withchildren)

        withspouses = BooleanOption(('Include spouses'), False)
        menu.add_option('People of Interest', 'withspouses', withspouses)

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

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

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

        locale_opt = stdoptions.add_localization_option(menu, 'Report Options')
        stdoptions.add_date_format_option(menu, 'Report Options', locale_opt)
        stdoptions.add_name_format_option(menu, 'Report Options')
Exemplo n.º 18
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)
Exemplo n.º 19
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)
Exemplo n.º 20
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)
Exemplo n.º 21
0
def add_private_data_option(menu, category, default=True):
    """
    Insert an option for deciding whether the information in the
    database marked "private" shall be included in the report

    Since historically, before this option, the entire database was
    used, including private information, the default for this option
    has been set to be True, to include such private information.
    """
    incl_private = BooleanOption(_("Include data marked private"), default)
    incl_private.set_help(_("Whether to include private data"))
    menu.add_option(category, "incl_private", incl_private)
Exemplo n.º 22
0
def add_private_data_option(menu, category, default=True):
    """
    Insert an option for deciding whether the information in the
    database marked "private" shall be included in the report

    Since historically, before this option, the entire database was
    used, including private information, the default for this option
    has been set to be True, to include such private information.
    """
    incl_private = BooleanOption(_("Include data marked private"), default)
    incl_private.set_help(_("Whether to include private data"))
    menu.add_option(category, "incl_private", incl_private)
Exemplo n.º 23
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)
    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()
        rname = "researcher 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)
        
        # Reload filters to pick any new ones
        CustomFilters = None
        from gramps.gen.filters import CustomFilters, GenericFilter

        opt = FilterOption(_("Select using filter"), 0)
        opt.set_help(_("Select places using a filter"))
        filter_list = []
        filter_list.append(GenericFilter())
        filter_list.extend(CustomFilters.get_filters('Source'))
        opt.set_filters(filter_list)
        menu.add_option(category_name, "filter", opt)
        
        showperson = BooleanOption(_("Show persons"), True)
        showperson.set_help(_("Whether to show events and persons mentioned in the note"))
        menu.add_option(category_name, "showperson", showperson)

        sort_by_citation = BooleanOption(_("Sort by Citation"), True)
        sort_by_citation.set_help(_("Whether to sort lines by Citation or Date"))
        menu.add_option(category_name, "sort_by_citation", sort_by_citation)
        
        sort_by_date = BooleanOption(_("Sort by Date"), True)
        sort_by_date.set_help(_("Whether to sort lines by Date or citation"))
        menu.add_option(category_name, "sort_by_date", sort_by_date)
        
        
        placeformat = EnumeratedListOption(_("Place Format"), "Default")
        placeformat.set_items([
                ("default",   _("Default")),
                ("first",   _("First")),
                ("firstplace",   _("Firstplace")),
                ("firstplace-country",   _("Firstplace-Country")),
                ("country",   _("Country")),
                ("long", _("Long"))])
        placeformat.set_help(_("If Placename is given long or short"))
        menu.add_option(category_name, "placeformat", placeformat)
Exemplo n.º 25
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)

        locale_opt = stdoptions.add_localization_option(menu, category_name)
Exemplo n.º 26
0
    def add_menu_options(self, menu):
        """
        Add all menu options to the tool window.
        """
        # generate list for category menu option
        words = [
            _("male"),
            _("female"),
            _("unknown"),
            _("Option"),
            _("single image mode")
        ]
        itm1 = "{} 1: {}".format(words[3], words[4])
        itm2 = "{} 2: {}/{}/{}".format(words[3], words[0], words[1], words[2])
        category_names = [(0, itm1), (1, itm2)]

        # add all menu options
        self.__category = FilterOption(_("Category"), 0)
        text = _("Choose how many images you'd like to use.")
        self.__category.set_help(text)
        menu.add_option(_("Options"), "category", self.__category)
        self.__category.set_items(category_names)
        self.__category.connect('value-changed', self.__update_options)

        self.__media1 = MediaOption(_("Unknown"))
        self.__media1.set_help(_("Image for people with unknown gender."))
        menu.add_option(_("Options"), "media1", self.__media1)

        self.__media2 = MediaOption(_("Male"))
        self.__media2.set_help(_("Image for males."))
        menu.add_option(_("Options"), "media2", self.__media2)

        self.__media3 = MediaOption(_("Female"))
        self.__media3.set_help(_("Image for females"))
        menu.add_option(_("Options"), "media3", self.__media3)

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

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

        self.__remove = BooleanOption(_("Remove images from people"), False)
        txt = _("Remove selected image(s).")
        self.__remove.set_help(txt)
        menu.add_option(_("Options"), "remove", self.__remove)
Exemplo n.º 27
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)
Exemplo n.º 28
0
    def add_menu_options(self, menu):
        """
        Define the options for the menu.
        """
        category_name = _("Tool Options")

        self.__filter = FilterOption(_("Filter"), 0)
        self.__filter.set_help(_("Select the people to sort"))
        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()

        sort_by = EnumeratedListOption(_('Sort by'), 0)
        idx = 0
        for item in _get_sort_functions(Sort(self.__db)):
            sort_by.add_item(idx, item[0])
            idx += 1
        sort_by.set_help(_("Sorting method to use"))
        menu.add_option(category_name, "sort_by", sort_by)

        sort_desc = BooleanOption(_("Sort descending"), False)
        sort_desc.set_help(_("Set the sort order"))
        menu.add_option(category_name, "sort_desc", sort_desc)

        family_events = BooleanOption(_("Include family events"), True)
        family_events.set_help(_("Sort family events of the person"))
        menu.add_option(category_name, "family_events", family_events)
Exemplo n.º 29
0
    def add_menu_options(self, menu):
        """
        Add options to the menu for the place report.
        """
        category_name = _("Report Options")

        # Reload filters to pick any new ones
        CustomFilters = None
        from gramps.gen.filters import CustomFilters, GenericFilter

        opt = FilterOption(_("Select using filter"), 0)
        opt.set_help(_("Select places using a filter"))
        filter_list = []
        filter_list.append(GenericFilter())
        filter_list.extend(CustomFilters.get_filters('Place'))
        opt.set_filters(filter_list)
        menu.add_option(category_name, "filter", opt)

        stdoptions.add_name_format_option(menu, category_name)

        places = PlaceListOption(_("Select places individually"))
        places.set_help(_("List of places to report on"))
        menu.add_option(category_name, "places", places)

        stdoptions.add_place_format_option(menu, category_name)

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

        showgodparents = BooleanOption(_("show godparents"), True)
        showgodparents.set_help(_("Whether to include and show godparents"))
        menu.add_option(category_name, "showgodparents", showgodparents)

        stdoptions.add_localization_option(menu, category_name)
Exemplo n.º 30
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)
Exemplo n.º 31
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)
Exemplo n.º 32
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)
Exemplo n.º 33
0
    def add_menu_options(self, menu):

        category_name = _("Report Options")

        self.__filter = FilterOption(_("Filter"), 0)
        self.__filter.set_help(
            _("Determines what people are included in 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)

        top_size = NumberOption(_("Number of ranks to display"), 3, 1, 100)
        menu.add_option(category_name, "top_size", top_size)

        callname = EnumeratedListOption(_("Use call name"), CALLNAME_DONTUSE)
        callname.set_items([(CALLNAME_DONTUSE, _("Don't use call name")),
                            (CALLNAME_REPLACE,
                             _("Replace first names with call name")),
                            (CALLNAME_UNDERLINE_ADD,
                             _("Underline call name in first names / "
                               "add call name to first name"))])
        menu.add_option(category_name, "callname", callname)

        footer = StringOption(_("Footer text"), "")
        menu.add_option(category_name, "footer", footer)

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

        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)

        p_count = 0
        for (text, varname, default) in RECORDS:
            if varname.startswith('person'):
                p_count += 1
        p_half = p_count // 2
        p_idx = 0
        for (text, varname, default) in RECORDS:
            option = BooleanOption(_(text), default)
            if varname.startswith('person'):
                if p_idx >= p_half:
                    category_name = _("Person 2")
                else:
                    category_name = _("Person 1")
                p_idx += 1
            elif varname.startswith('family'):
                category_name = _("Family")
            menu.add_option(category_name, varname, option)
Exemplo n.º 34
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)
Exemplo n.º 35
0
class PhotoTaggingOptions(MenuOptions):

    def __init__(self):
        MenuOptions.__init__(self)

    def add_menu_options(self, menu):
        category_name = _("Selection")
        self.replace_without_asking = BooleanOption(
                                 _("Replace existing references to the person "
                                   "being assigned without asking"),
                                 REPLACE_WITHOUT_ASKING)

        menu.add_option(category_name, "replace_without_asking",
                        self.replace_without_asking)

        category_name = _("Face detection")
        width, height = MIN_FACE_SIZE
        sensitivity = SENSITIVITY
        self.min_face_width = NumberOption(_("Minimum face width (px)"),
                                           width, 1, 1000, 1)
        self.min_face_height = NumberOption(_("Minimum face height (px)"),
                                            height, 1, 1000, 1)
        self.detect_inside_existing_boxes = BooleanOption(
                                       _("Detect faces inside existing boxes"),
                                       DETECT_INSIDE_EXISTING_BOXES)
        self.sensitivity = NumberOption(_("Sensitivity (1 min .. 20 max)"),
                                        sensitivity, 1, 20, 1)

        menu.add_option(category_name, "min_face_width", self.min_face_width)
        menu.add_option(category_name, "min_face_height", self.min_face_height)
        menu.add_option(category_name, "sensitivity", self.sensitivity)
        menu.add_option(category_name, "detect_inside_existing_boxes",
                        self.detect_inside_existing_boxes)

    def update_settings(self):
        global REPLACE_WITHOUT_ASKING
        global DETECT_INSIDE_EXISTING_BOXES
        global MIN_FACE_SIZE
        global SENSITIVITY
        REPLACE_WITHOUT_ASKING = self.replace_without_asking.get_value()
        DETECT_INSIDE_EXISTING_BOXES = self.detect_inside_existing_boxes.get_value()
        width = self.min_face_width.get_value()
        height = self.min_face_height.get_value()
        MIN_FACE_SIZE = (width, height)
        SENSITIVITY = self.sensitivity.get_value()
        save_config()
Exemplo n.º 36
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)
Exemplo n.º 37
0
 def build_options(self):
     self.add_option(
         NumberOption(_("Max generations"), self.max_generations, 1, 100))
     self.add_option(BooleanOption(_("Show dates"), bool(self.show_dates)))
     elist = EnumeratedListOption(_("Line type"), self.box_mode)
     elist.add_item("UTF", "UTF")
     elist.add_item("ASCII", "ASCII")
     self.add_option(elist)
Exemplo n.º 38
0
class PhotoTaggingOptions(MenuOptions):

    def __init__(self):
        MenuOptions.__init__(self)

    def add_menu_options(self, menu):
        category_name = _("Selection")
        self.replace_without_asking = BooleanOption(
                                 _("Replace existing references to the person "
                                   "being assigned without asking"),
                                 REPLACE_WITHOUT_ASKING)

        menu.add_option(category_name, "replace_without_asking",
                        self.replace_without_asking)

        category_name = _("Face detection")
        width, height = MIN_FACE_SIZE
        sensitivity = SENSITIVITY
        self.min_face_width = NumberOption(_("Minimum face width (px)"),
                                           width, 1, 1000, 1)
        self.min_face_height = NumberOption(_("Minimum face height (px)"),
                                            height, 1, 1000, 1)
        self.detect_inside_existing_boxes = BooleanOption(
                                       _("Detect faces inside existing boxes"),
                                       DETECT_INSIDE_EXISTING_BOXES)
        self.sensitivity = NumberOption(_("Sensitivity (1 min .. 20 max)"),
                                        sensitivity, 1, 20, 1)

        menu.add_option(category_name, "min_face_width", self.min_face_width)
        menu.add_option(category_name, "min_face_height", self.min_face_height)
        menu.add_option(category_name, "sensitivity", self.sensitivity)
        menu.add_option(category_name, "detect_inside_existing_boxes",
                        self.detect_inside_existing_boxes)

    def update_settings(self):
        global REPLACE_WITHOUT_ASKING
        global DETECT_INSIDE_EXISTING_BOXES
        global MIN_FACE_SIZE
        global SENSITIVITY
        REPLACE_WITHOUT_ASKING = self.replace_without_asking.get_value()
        DETECT_INSIDE_EXISTING_BOXES = self.detect_inside_existing_boxes.get_value()
        width = self.min_face_width.get_value()
        height = self.min_face_height.get_value()
        MIN_FACE_SIZE = (width, height)
        SENSITIVITY = self.sensitivity.get_value()
        save_config()
Exemplo n.º 39
0
    def add_menu_options(self, menu):

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

        pid = PersonOption(_("First Relative"))
        pid2 = PersonOption(_("Second Relative"))
        pid.set_help(_("The first person for the relationship calculation."))
        pid2.set_help(
            _("The second  person for the relationship calculation."))
        menu.add_option(category_name, "pid", pid)
        menu.add_option(category_name, "pid2", pid2)

        recurse = EnumeratedListOption(_("Print sheets for"),
                                       self.RECURSE_NONE)
        recurse.set_items([
            (self.RECURSE_NONE, _("Center person only")),
            (self.RECURSE_SIDE,
             _("Center person and descendants in side branches")),
            (self.RECURSE_ALL, _("Center person and all descendants"))
        ])
        menu.add_option(category_name, "recurse", recurse)

        callname = EnumeratedListOption(_("Use call name"),
                                        _Name_CALLNAME_DONTUSE)
        callname.set_items([
            (_Name_CALLNAME_DONTUSE, _("Don't use call name")),
            (_Name_CALLNAME_REPLACE, _("Replace first name with call name")),
            (_Name_CALLNAME_UNDERLINE_ADD,
             _("Underline call name in first name / add call name to first name"
               ))
        ])
        menu.add_option(category_name, "callname", callname)

        placeholder = BooleanOption(
            _("Print placeholders for missing information"), True)
        menu.add_option(category_name, "placeholder", placeholder)

        incl_sources = BooleanOption(_("Include sources"), True)
        menu.add_option(category_name, "incl_sources", incl_sources)

        incl_notes = BooleanOption(_("Include notes"), True)
        menu.add_option(category_name, "incl_notes", incl_notes)
Exemplo n.º 40
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)
Exemplo n.º 41
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)
Exemplo n.º 42
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)
    def add_menu_options(self, menu):
        """ Add the options for this report """
        category_name = _("Report Options")

        title = StringOption(_('Report Title'), _('Title of the Report'))
        title.set_help(_("Title string for the report."))
        menu.add_option(category_name, "title", title)

        subtitle = StringOption(_('Subtitle'), _('Subtitle of the Report'))
        subtitle.set_help(_("Subtitle string for the report."))
        menu.add_option(category_name, "subtitle", subtitle)

        dateinfo = time.localtime(time.time())
        #rname = self.__db.get_researcher().get_name()
        rname = "researcher 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)

        # Reload filters to pick any new ones
        CustomFilters = None
        from gramps.gen.filters import CustomFilters, GenericFilter

        self.__filter = FilterOption(_("Select using filter"), 0)
        self.__filter.set_help(_("Select sources using a filter"))
        filter_list = []
        filter_list.append(GenericFilter())
        filter_list.extend(CustomFilters.get_filters('Source'))
        self.__filter.set_filters(filter_list)
        menu.add_option(category_name, "filter", self.__filter)

        showperson = BooleanOption(_("Show persons"), True)
        showperson.set_help(
            _("Whether to show events and persons mentioned in the note"))
        menu.add_option(category_name, "showperson", showperson)
        locale_opt = stdoptions.add_localization_option(menu, category_name)
        stdoptions.add_date_format_option(menu, category_name, locale_opt)
    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()
        rname = "researcher 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)
        
        # Reload filters to pick any new ones
        CustomFilters = None
#p        from Filters import CustomFilters, GenericFilter
        from gramps.gen.filters import CustomFilters, GenericFilter

        opt = FilterOption(_("Select using filter"), 0)
        opt.set_help(_("Select places using a filter"))
        filter_list = []
        filter_list.append(GenericFilter())
        filter_list.extend(CustomFilters.get_filters('Source'))
        opt.set_filters(filter_list)
        menu.add_option(category_name, "filter", opt)
        
        showinlaw = BooleanOption(_("Show inlaw"), True)
        showinlaw.set_help(_("Whether to show inlaw persons"))
        menu.add_option(category_name, "showinlaw", showinlaw)

        showperson = BooleanOption(_("Show persons"), True)
        showperson.set_help(_("Whether to show events and persons mentioned in the note"))
        menu.add_option(category_name, "showperson", showperson)

        incphotos = BooleanOption(_("Include Photos"), True)
        incphotos.set_help(_("Whether to show photos mentioned in the citation"))
        menu.add_option(category_name, "incphotos", incphotos)
Exemplo n.º 45
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)
Exemplo n.º 46
0
    def add_menu_options(self, menu):
        """
        Add options to the menu for the place report.
        """
        category_name = _("Report Options")

        # Reload filters to pick any new ones
        CustomFilters = None
        from gramps.gen.filters import CustomFilters, GenericFilter

        opt = FilterOption(_("Select using filter"), 0)
        opt.set_help(_("Select places using a filter"))
        filter_list = []
        filter_list.append(GenericFilter())
        filter_list.extend(CustomFilters.get_filters('Place'))
        opt.set_filters(filter_list)
        menu.add_option(category_name, "filter", opt)

        stdoptions.add_name_format_option(menu, category_name)

        places = PlaceListOption(_("Select places individually"))
        places.set_help(_("List of places to report on"))
        menu.add_option(category_name, "places", places)

#        classwidth = EnumeratedListOption(_("Class wdith"), "classwidth")
        classwidth = EnumeratedListOption(_("Class wdith"), 10)

        classwidth.set_items([
                (10, _("10 Years")),
                (20, _("20 Years")),
                (40, _("40 Years")),
                (50, _("50 Years"))])
        classwidth.set_help(_("classwidth fpr Analysis"))
        menu.add_option(category_name, "classwidth", classwidth)

        incpriv = BooleanOption(_("Include private data"), True)
        incpriv.set_help(_("Whether to include private data"))
        menu.add_option(category_name, "incpriv", incpriv)
         
        stdoptions.add_localization_option(menu, category_name)
Exemplo n.º 47
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)
Exemplo n.º 48
0
    def add_menu_options(self, menu):
        """
        Define the options for the menu.
        """
        category_name = _("Tool Options")

        self.__filter = FilterOption(_("Filter"), 0)
        self.__filter.set_help(_("Select the people to sort"))
        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()

        sort_by = EnumeratedListOption(_('Sort by'), 0 )
        idx = 0
        for item in _get_sort_functions(Sort(self.__db)):
            sort_by.add_item(idx, item[0])
            idx += 1
        sort_by.set_help( _("Sorting method to use"))
        menu.add_option(category_name, "sort_by", sort_by)

        sort_desc = BooleanOption(_("Sort descending"), False)
        sort_desc.set_help(_("Set the sort order"))
        menu.add_option(category_name, "sort_desc", sort_desc)

        family_events = BooleanOption(_("Include family events"), True)
        family_events.set_help(_("Sort family events of the person"))
        menu.add_option(category_name, "family_events", family_events)
Exemplo n.º 49
0
    def add_menu_options(self, menu):
        """ Add the options for the text differences report """
        category_name = _("Report Options")
        filename = DestinationOption(_("Family Tree file"), "data.gramps")
        filename.set_help(_("Select a .gpkg or .gramps file"))
        menu.add_option(category_name, "filename", filename)

        show_diff = BooleanOption(_("Show items that are different"), True)
        show_diff.set_help(_("Include items that are different"))
        menu.add_option(category_name, "show_diff", show_diff)

        show_missing = BooleanOption(_("Show items missing from file"), True)
        show_missing.set_help(_("Include items not in file but in database"))
        menu.add_option(category_name, "show_missing", show_missing)

        show_added = BooleanOption(_("Show items added in file"), True)
        show_added.set_help(_("Include items in file but not in database"))
        menu.add_option(category_name, "show_added", show_added)
Exemplo n.º 50
0
    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)
    def add_menu_options(self, menu):
        """ Add the options for this report """
        category_name = _("Report Options")

        title = StringOption(_('Report Title'), _('Title of the Report') )
        title.set_help(_("Title string for the report."))
        menu.add_option(category_name, "title", title)

        subtitle = StringOption(_('Subtitle'), _('Subtitle of the Report') )
        subtitle.set_help(_("Subtitle string for the report."))
        menu.add_option(category_name, "subtitle", subtitle)

        dateinfo = time.localtime(time.time())
        #rname = self.__db.get_researcher().get_name()
        rname = "researcher 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)

        # Reload filters to pick any new ones
        CustomFilters = None
        from gramps.gen.filters import CustomFilters, GenericFilter

        self.__filter = FilterOption(_("Select using filter"), 0)
        self.__filter.set_help(_("Select sources using a filter"))
        filter_list = []
        filter_list.append(GenericFilter())
        filter_list.extend(CustomFilters.get_filters('Source'))
        self.__filter.set_filters(filter_list)
        menu.add_option(category_name, "filter", self.__filter)

        showperson = BooleanOption(_("Show persons"), True)
        showperson.set_help(_("Whether to show events and persons mentioned in the note"))
        menu.add_option(category_name, "showperson", showperson)
        locale_opt = stdoptions.add_localization_option(menu, category_name)
        stdoptions.add_date_format_option(menu, category_name, locale_opt)
Exemplo n.º 52
0
    def add_menu_options(self, menu):

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

        self.__pid = PersonOption(_("Center person"))
        self.__pid.set_help(
            _("The person whose partners and children are printed"))
        menu.add_option(category_name, "pid", self.__pid)

        recurse = EnumeratedListOption(_("Print sheets for"), self.RECURSE_NONE)
        recurse.set_items([
            (self.RECURSE_NONE, _("Center person only")),
            (self.RECURSE_SIDE, _("Center person and descendants in side branches")),
            (self.RECURSE_ALL,  _("Center person and all descendants"))])
        recurse.set_help(_("Whether to include descendants, and which ones."))
        menu.add_option(category_name, "recurse", recurse)

        callname = EnumeratedListOption(_("Use call name"), _Name_CALLNAME_DONTUSE)
        callname.set_items([
            (_Name_CALLNAME_DONTUSE, _("Don't use call name")),
            (_Name_CALLNAME_REPLACE, _("Replace first name with call name")),
            (_Name_CALLNAME_UNDERLINE_ADD, _("Underline call name in first name / add call name to first name"))])
        callname.set_help(_("Whether to include call name, and how."))
        menu.add_option(category_name, "callname", callname)

        placeholder = BooleanOption( _("Print placeholders for missing information"), True)
        placeholder.set_help(
            _("Whether to include fields for missing information."))
        menu.add_option(category_name, "placeholder", placeholder)

        incl_sources = BooleanOption( _("Include sources"), True)
        incl_sources.set_help(_("Whether to include source references."))
        menu.add_option(category_name, "incl_sources", incl_sources)

        incl_notes = BooleanOption( _("Include notes"), True)
        incl_notes.set_help(_("Whether to include notes."))
        menu.add_option(category_name, "incl_notes", incl_notes)
Exemplo n.º 53
0
    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)
Exemplo n.º 54
0
    def add_menu_options(self, menu):
        """
        Add options to the menu for the place report.
        """
        category_name = _("Report Options")

        # Reload filters to pick any new ones
        CustomFilters = None
        from gramps.gen.filters import CustomFilters, GenericFilter

        opt = FilterOption(_("Select using filter"), 0)
        opt.set_help(_("Select places using a filter"))
        filter_list = []
        filter_list.append(GenericFilter())
        filter_list.extend(CustomFilters.get_filters('Place'))
        opt.set_filters(filter_list)
        menu.add_option(category_name, "filter", opt)

        stdoptions.add_name_format_option(menu, category_name)

        places = PlaceListOption(_("Select places individually"))
        places.set_help(_("List of places to report on"))
        menu.add_option(category_name, "places", places)

        placeformat = EnumeratedListOption(_("Place Format"), "Default")
        placeformat.set_items([
                ("default",   _("Default")),
                ("first",   _("First")),
                ("firstplace",   _("Firstplace")),
                ("firstplace-country",   _("Firstplace-Country")),
                ("country",   _("Country")),
                ("long", _("Long"))])
        placeformat.set_help(_("If Placename is given long or short"))
        menu.add_option(category_name, "placeformat", placeformat)

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

        showgodparents = BooleanOption(_("show godparents"), True)
        showgodparents.set_help(_("Whether to include and show godparents"))
        menu.add_option(category_name, "showgodparents", showgodparents)

        stdoptions.add_localization_option(menu, category_name)
Exemplo n.º 55
0
    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()
Exemplo n.º 56
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
        MenuReportOptions.__init__(self, name, dbase)

    def add_menu_options(self, menu):

        # ---------------------
        category_name = _('Report Options')
        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)

        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)

        use_roundedcorners = BooleanOption(_('Use rounded corners'), False)
        use_roundedcorners.set_help(_('Use rounded corners to differentiate '
                                      'between women and men.'))
        add_option("useroundedcorners", use_roundedcorners)

        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)

        stdoptions.add_localization_option(menu, category_name)

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

        stdoptions.add_living_people_option(menu, category_name)

        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"))
        add_option("incid", include_id)

        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)

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

    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)
Exemplo n.º 57
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)