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()
class FamilyLinesOptions(MenuReportOptions): """ Defines all of the controls necessary to configure the FamilyLines report. """ def __init__(self, name, dbase): self.limit_parents = None self.max_parents = None self.limit_children = None self.max_children = None self.include_images = None self.image_location = None self.justyears = None self.include_dates = None MenuReportOptions.__init__(self, name, dbase) def add_menu_options(self, menu): # --------------------- category_name = _('Report Options') add_option = partial(menu.add_option, category_name) # --------------------- followpar = BooleanOption(_('Follow parents to determine ' '"family lines"'), True) followpar.set_help(_('Parents and their ancestors will be ' 'considered when determining "family lines".')) add_option('followpar', followpar) followchild = BooleanOption(_('Follow children to determine ' '"family lines"'), True) followchild.set_help(_('Children will be considered when ' 'determining "family lines".')) add_option('followchild', followchild) remove_extra_people = BooleanOption(_('Try to remove extra ' 'people and families'), True) remove_extra_people.set_help(_('People and families not directly ' 'related to people of interest will ' 'be removed when determining ' '"family lines".')) add_option('removeextra', remove_extra_people) arrow = EnumeratedListOption(_("Arrowhead direction"), 'd') for i in range( 0, len(_ARROWS) ): arrow.add_item(_ARROWS[i]["value"], _ARROWS[i]["name"]) arrow.set_help(_("Choose the direction that the arrows point.")) add_option("arrow", arrow) color = EnumeratedListOption(_("Graph coloring"), "filled") for i in range(len(_COLORS)): color.add_item(_COLORS[i]["value"], _COLORS[i]["name"]) color.set_help(_("Males will be shown with blue, females " "with red, unless otherwise set above for filled. " "If the sex of an individual " "is unknown it will be shown with gray.")) add_option("color", color) roundedcorners = EnumeratedListOption(_("Rounded corners"), '') for i in range( 0, len(_CORNERS) ): roundedcorners.add_item(_CORNERS[i]["value"], _CORNERS[i]["name"]) roundedcorners.set_help(_("Use rounded corners e.g. to differentiate " "between women and men.")) add_option("useroundedcorners", roundedcorners) stdoptions.add_gramps_id_option(menu, category_name, ownline=True) # --------------------- category_name = _('Report Options (2)') add_option = partial(menu.add_option, category_name) # --------------------- stdoptions.add_name_format_option(menu, category_name) stdoptions.add_private_data_option(menu, category_name, default=False) stdoptions.add_living_people_option(menu, category_name) locale_opt = stdoptions.add_localization_option(menu, category_name) stdoptions.add_date_format_option(menu, category_name, locale_opt) # -------------------------------- add_option = partial(menu.add_option, _('People of Interest')) # -------------------------------- person_list = PersonListOption(_('People of interest')) person_list.set_help(_('People of interest are used as a starting ' 'point when determining "family lines".')) add_option('gidlist', person_list) self.limit_parents = BooleanOption(_('Limit the number of ancestors'), False) self.limit_parents.set_help(_('Whether to ' 'limit the number of ancestors.')) add_option('limitparents', self.limit_parents) self.limit_parents.connect('value-changed', self.limit_changed) self.max_parents = NumberOption('', 50, 10, 9999) self.max_parents.set_help(_('The maximum number ' 'of ancestors to include.')) add_option('maxparents', self.max_parents) self.limit_children = BooleanOption(_('Limit the number ' 'of descendants'), False) self.limit_children.set_help(_('Whether to ' 'limit the number of descendants.')) add_option('limitchildren', self.limit_children) self.limit_children.connect('value-changed', self.limit_changed) self.max_children = NumberOption('', 50, 10, 9999) self.max_children.set_help(_('The maximum number ' 'of descendants to include.')) add_option('maxchildren', self.max_children) # -------------------- category_name = _('Include') add_option = partial(menu.add_option, category_name) # -------------------- self.include_dates = BooleanOption(_('Include dates'), True) self.include_dates.set_help(_('Whether to include dates for people ' 'and families.')) add_option('incdates', self.include_dates) self.include_dates.connect('value-changed', self.include_dates_changed) self.justyears = BooleanOption(_("Limit dates to years only"), False) self.justyears.set_help(_("Prints just dates' year, neither " "month or day nor date approximation " "or interval are shown.")) add_option("justyears", self.justyears) include_places = BooleanOption(_('Include places'), True) include_places.set_help(_('Whether to include placenames for people ' 'and families.')) add_option('incplaces', include_places) include_num_children = BooleanOption(_('Include the number of ' 'children'), True) include_num_children.set_help(_('Whether to include the number of ' 'children for families with more ' 'than 1 child.')) add_option('incchildcnt', include_num_children) self.include_images = BooleanOption(_('Include ' 'thumbnail images of people'), True) self.include_images.set_help(_('Whether to ' 'include thumbnail images of people.')) add_option('incimages', self.include_images) self.include_images.connect('value-changed', self.images_changed) self.image_location = EnumeratedListOption(_('Thumbnail location'), 0) self.image_location.add_item(0, _('Above the name')) self.image_location.add_item(1, _('Beside the name')) self.image_location.set_help(_('Where the thumbnail image ' 'should appear relative to the name')) add_option('imageonside', self.image_location) self.image_size = EnumeratedListOption(_('Thumbnail size'), SIZE_NORMAL) self.image_size.add_item(SIZE_NORMAL, _('Normal')) self.image_size.add_item(SIZE_LARGE, _('Large')) self.image_size.set_help(_('Size of the thumbnail image')) add_option('imagesize', self.image_size) # ---------------------------- add_option = partial(menu.add_option, _('Family Colors')) # ---------------------------- surname_color = SurnameColorOption(_('Family colors')) surname_color.set_help(_('Colors to use for various family lines.')) add_option('surnamecolors', surname_color) # ------------------------- add_option = partial(menu.add_option, _('Individuals')) # ------------------------- color_males = ColorOption(_('Males'), '#e0e0ff') color_males.set_help(_('The color to use to display men.')) add_option('colormales', color_males) color_females = ColorOption(_('Females'), '#ffe0e0') color_females.set_help(_('The color to use to display women.')) add_option('colorfemales', color_females) color_unknown = ColorOption(_('Unknown'), '#e0e0e0') color_unknown.set_help(_('The color to use ' 'when the gender is unknown.')) add_option('colorunknown', color_unknown) color_family = ColorOption(_('Families'), '#ffffe0') color_family.set_help(_('The color to use to display families.')) add_option('colorfamilies', color_family) self.limit_changed() self.images_changed() def limit_changed(self): """ Handle the change of limiting parents and children. """ self.max_parents.set_available(self.limit_parents.get_value()) self.max_children.set_available(self.limit_children.get_value()) def images_changed(self): """ Handle the change of including images. """ self.image_location.set_available(self.include_images.get_value()) self.image_size.set_available(self.include_images.get_value()) def include_dates_changed(self): """ Enable/disable menu items if dates are required """ if self.include_dates.get_value(): self.justyears.set_available(True) else: self.justyears.set_available(False)
class RelGraphOptions(MenuReportOptions): """ Defines options and provides handling interface. """ def __init__(self, name, dbase): self.__pid = None self.__filter = None self.__show_relships = None self.__show_ga_gb = None self.__include_images = None self.__image_on_side = None self.__db = dbase self._nf = None self.event_choice = None MenuReportOptions.__init__(self, name, dbase) def add_menu_options(self, menu): ################################ 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 graph")) add_option("filter", self.__filter) self.__filter.connect('value-changed', self.__filter_changed) self.__pid = PersonOption(_("Center Person")) self.__pid.set_help(_("The center person for the report")) menu.add_option(category_name, "pid", self.__pid) self.__pid.connect('value-changed', self.__update_filters) self._nf = stdoptions.add_name_format_option(menu, category_name) self._nf.connect('value-changed', self.__update_filters) self.__update_filters() stdoptions.add_private_data_option(menu, category_name) stdoptions.add_living_people_option(menu, category_name) stdoptions.add_localization_option(menu, category_name) ################################ add_option = partial(menu.add_option, _("Include")) ################################ self.event_choice = EnumeratedListOption(_('Dates and/or Places'), 0) self.event_choice.add_item(0, _('Do not include any dates or places')) self.event_choice.add_item( 1, _('Include (birth, marriage, death) ' 'dates, but no places')) self.event_choice.add_item( 2, _('Include (birth, marriage, death) ' 'dates, and places')) self.event_choice.add_item( 3, _('Include (birth, marriage, death) ' 'dates, and places if no dates')) self.event_choice.add_item( 4, _('Include (birth, marriage, death) ' 'years, but no places')) self.event_choice.add_item( 5, _('Include (birth, marriage, death) ' 'years, and places')) self.event_choice.add_item( 6, _('Include (birth, marriage, death) ' 'places, but no dates')) self.event_choice.add_item( 7, _('Include (birth, marriage, death) ' 'dates and places on same line')) self.event_choice.set_help(_("Whether to include dates and/or places")) add_option("event_choice", self.event_choice) url = BooleanOption(_("Include URLs"), False) url.set_help( _("Include a URL in each graph node so " "that PDF and imagemap files can be " "generated that contain active links " "to the files generated by the 'Narrated " "Web Site' report.")) add_option("url", url) 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.__show_relships = BooleanOption( _("Include relationship to center person"), False) self.__show_relships.set_help( _("Whether to show every person's " "relationship to the center person")) add_option("increlname", self.__show_relships) self.__show_relships.connect('value-changed', self.__show_relships_changed) self.__include_images = BooleanOption( _('Include thumbnail images of people'), False) self.__include_images.set_help( _("Whether to include thumbnails of people.")) add_option("includeImages", self.__include_images) self.__include_images.connect('value-changed', self.__image_changed) self.__image_on_side = EnumeratedListOption(_("Thumbnail Location"), 0) self.__image_on_side.add_item(0, _('Above the name')) self.__image_on_side.add_item(1, _('Beside the name')) self.__image_on_side.set_help( _("Where the thumbnail image should appear relative to the name")) add_option("imageOnTheSide", self.__image_on_side) #occupation = BooleanOption(_("Include occupation"), False) occupation = EnumeratedListOption(_('Include occupation'), 0) occupation.add_item(0, _('Do not include any occupation')) occupation.add_item( 1, _('Include description ' 'of most recent occupation')) occupation.add_item( 2, _('Include date, description and place ' 'of all occupations')) occupation.set_help(_("Whether to include the last occupation")) add_option("occupation", occupation) if __debug__: self.__show_ga_gb = BooleanOption( _("Include relationship " "debugging numbers also"), False) self.__show_ga_gb.set_help( _("Whether to include 'Ga' and 'Gb' " "also, to debug the relationship " "calculator")) add_option("advrelinfo", self.__show_ga_gb) ################################ add_option = partial(menu.add_option, _("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.")) add_option("color", color) 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) 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) # see bug report #2180 roundedcorners = BooleanOption(_("Use rounded corners"), False) roundedcorners.set_help( _("Use rounded corners to differentiate " "between women and men.")) add_option("useroundedcorners", roundedcorners) dashed = BooleanOption( _("Indicate non-birth relationships with dotted lines"), True) dashed.set_help( _("Non-birth relationships will show up " "as dotted lines in the graph.")) add_option("dashed", dashed) showfamily = BooleanOption(_("Show family nodes"), True) showfamily.set_help( _("Families will show up as ellipses, linked " "to parents and children.")) add_option("showfamily", showfamily) def __update_filters(self): """ Update the filter list based on the selected person """ gid = self.__pid.get_value() person = self.__db.get_person_from_gramps_id(gid) nfv = self._nf.get_value() filter_list = ReportUtils.get_person_filters(person, include_single=False, name_format=nfv) self.__filter.set_filters(filter_list) def __filter_changed(self): """ Handle filter change. If the filter is not specific to a person, disable the person option """ filter_value = self.__filter.get_value() if filter_value in [1, 2, 3, 4]: # Filters 1, 2, 3 and 4 rely on the center person self.__pid.set_available(True) elif self.__show_relships and self.__show_relships.get_value(): self.__pid.set_available(True) else: # The rest don't self.__pid.set_available(False) def __image_changed(self): """ Handle thumbnail change. If the image is not to be included, make the image location option unavailable. """ self.__image_on_side.set_available(self.__include_images.get_value()) def __show_relships_changed(self): """ Enable/disable menu items if relationships are required """ if self.__show_ga_gb: self.__show_ga_gb.set_available(self.__show_relships.get_value()) self.__filter_changed()
class RelGraphOptions(MenuReportOptions): """ Defines options and provides handling interface. """ def __init__(self, name, dbase): self.__pid = None self.__filter = None self.__show_relships = None self.__show_ga_gb = None self.__include_images = None self.__image_on_side = None self.__db = dbase self._nf = None self.event_choice = None MenuReportOptions.__init__(self, name, dbase) def add_menu_options(self, menu): ################################ 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 graph")) add_option("filter", self.__filter) self.__filter.connect('value-changed', self.__filter_changed) self.__pid = PersonOption(_("Center Person")) self.__pid.set_help(_("The center person for the report")) menu.add_option(category_name, "pid", self.__pid) self.__pid.connect('value-changed', self.__update_filters) 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(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.")) add_option("color", color) # see bug report #2180 roundedcorners = BooleanOption(_("Use rounded corners"), False) roundedcorners.set_help(_("Use rounded corners 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) ################################ 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) 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, _("Include")) ################################ self.event_choice = EnumeratedListOption(_('Dates and/or Places'), 0) self.event_choice.add_item(0, _('Do not include any dates or places')) self.event_choice.add_item(1, _('Include (birth, marriage, death) ' 'dates, but no places')) self.event_choice.add_item(2, _('Include (birth, marriage, death) ' 'dates, and places')) self.event_choice.add_item(3, _('Include (birth, marriage, death) ' 'dates, and places if no dates')) self.event_choice.add_item(4, _('Include (birth, marriage, death) ' 'years, but no places')) self.event_choice.add_item(5, _('Include (birth, marriage, death) ' 'years, and places')) self.event_choice.add_item(6, _('Include (birth, marriage, death) ' 'places, but no dates')) self.event_choice.add_item(7, _('Include (birth, marriage, death) ' 'dates and places on same line')) self.event_choice.set_help( _("Whether to include dates and/or places")) add_option("event_choice", self.event_choice) url = BooleanOption(_("Include URLs"), False) url.set_help(_("Include a URL in each graph node so " "that PDF and imagemap files can be " "generated that contain active links " "to the files generated by the 'Narrated " "Web Site' report.")) add_option("url", url) self.__show_relships = BooleanOption( _("Include relationship to center person"), False) self.__show_relships.set_help(_("Whether to show every person's " "relationship to the center person")) add_option("increlname", self.__show_relships) self.__show_relships.connect('value-changed', self.__show_relships_changed) self.__include_images = BooleanOption( _('Include thumbnail images of people'), False) self.__include_images.set_help( _("Whether to include thumbnails of people.")) add_option("includeImages", self.__include_images) self.__include_images.connect('value-changed', self.__image_changed) self.__image_on_side = EnumeratedListOption(_("Thumbnail Location"), 0) self.__image_on_side.add_item(0, _('Above the name')) self.__image_on_side.add_item(1, _('Beside the name')) self.__image_on_side.set_help( _("Where the thumbnail image should appear relative to the name")) add_option("imageOnTheSide", self.__image_on_side) #occupation = BooleanOption(_("Include occupation"), False) occupation = EnumeratedListOption(_('Include occupation'), 0) occupation.add_item(0, _('Do not include any occupation')) occupation.add_item(1, _('Include description ' 'of most recent occupation')) occupation.add_item(2, _('Include date, description and place ' 'of all occupations')) occupation.set_help(_("Whether to include the last occupation")) add_option("occupation", occupation) if __debug__: self.__show_ga_gb = BooleanOption(_("Include relationship " "debugging numbers also"), False) self.__show_ga_gb.set_help(_("Whether to include 'Ga' and 'Gb' " "also, to debug the relationship " "calculator")) add_option("advrelinfo", self.__show_ga_gb) ################################ add_option = partial(menu.add_option, _("Graph Style")) ################################ 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) dashed = BooleanOption( _("Indicate non-birth relationships with dotted lines"), True) dashed.set_help(_("Non-birth relationships will show up " "as dotted lines in the graph.")) add_option("dashed", dashed) showfamily = BooleanOption(_("Show family nodes"), True) showfamily.set_help(_("Families will show up as ellipses, linked " "to parents and children.")) add_option("showfamily", showfamily) def __update_filters(self): """ Update the filter list based on the selected person """ gid = self.__pid.get_value() person = self.__db.get_person_from_gramps_id(gid) nfv = self._nf.get_value() filter_list = utils.get_person_filters(person, include_single=False, name_format=nfv) self.__filter.set_filters(filter_list) def __filter_changed(self): """ Handle filter change. If the filter is not specific to a person, disable the person option """ if self.__show_relships and self.__show_relships.get_value(): self.__pid.set_available(True) filter_value = self.__filter.get_value() if filter_value == 0: # "Entire Database" (as "include_single=False") self.__pid.set_available(False) else: # The other filters need a center person (assume custom ones too) self.__pid.set_available(True) def __image_changed(self): """ Handle thumbnail change. If the image is not to be included, make the image location option unavailable. """ self.__image_on_side.set_available(self.__include_images.get_value()) def __show_relships_changed(self): """ Enable/disable menu items if relationships are required """ if self.__show_ga_gb: self.__show_ga_gb.set_available(self.__show_relships.get_value()) self.__filter_changed()
class AncestorTreeOptions(MenuReportOptions): """ Defines options and provides handling interface. """ def __init__(self, name, dbase): self.__db = dbase self.__pid = None self.box_Y_sf = None self.box_shadow_sf = None MenuReportOptions.__init__(self, name, dbase) def get_subject(self): """ Return a string that describes the subject of the report. """ gid = self.__pid.get_value() person = self.__db.get_person_from_gramps_id(gid) return _nd.display(person) def add_menu_options(self, menu): ################## category_name = _("Tree Options") self.__pid = PersonOption(_("Center Person")) self.__pid.set_help(_("The center person for the tree")) menu.add_option(category_name, "pid", self.__pid) stdoptions.add_name_format_option(menu, category_name) stdoptions.add_living_people_option(menu, category_name) stdoptions.add_private_data_option(menu, category_name) siblings = BooleanOption(_('Include siblings of the center person'), False) siblings.set_help( _("Whether to only display the center person or all " "of his/her siblings too")) menu.add_option(category_name, "inc_siblings", siblings) self.max_gen = NumberOption(_("Generations"), 10, 1, 50) self.max_gen.set_help( _("The number of generations to include " "in the tree")) menu.add_option(category_name, "maxgen", self.max_gen) self.fillout = EnumeratedListOption(_("Display unknown\ngenerations"), 0) self.fillout.set_help( _("The number of generations of empty " "boxes that will be displayed")) menu.add_option(category_name, "fill_out", self.fillout) self.max_gen.connect('value-changed', self.__fillout_vals) self.__fillout_vals() compress = BooleanOption(_('Compress tree'), True) compress.set_help( _("Whether to remove any extra blank spaces set " "aside for people that are unknown")) menu.add_option(category_name, "compress_tree", compress) #better to 'Show siblings of\nthe center person #Spouse_disp = EnumeratedListOption(_("Show spouses of\nthe center " # "person"), 0) #Spouse_disp.add_item(0, _("No. Do not show Spouses")) #Spouse_disp.add_item(1, _("Yes, and use the Main Display Format")) #Spouse_disp.add_item(2, _("Yes, and use the Secondary " # "Display Format")) #Spouse_disp.set_help(_("Show spouses of the center person?")) #menu.add_option(category_name, "Spouse_disp", Spouse_disp) ################## category_name = _("Report Options") self.title = EnumeratedListOption(_("Report Title"), 0) self.title.add_item(0, _("Do not include a title")) self.title.add_item(1, _("Include Report Title")) self.title.set_help(_("Choose a title for the report")) menu.add_option(category_name, "report_title", self.title) border = BooleanOption(_('Include a border'), False) border.set_help(_("Whether to make a border around the report.")) menu.add_option(category_name, "inc_border", border) prnnum = BooleanOption(_('Include Page Numbers'), False) prnnum.set_help(_("Whether to print page numbers on each page.")) menu.add_option(category_name, "inc_pagenum", prnnum) stdoptions.add_localization_option(menu, category_name) ################## category_name = _("Display") disp = TextOption( _("Father\nDisplay Format"), ["$n", "%s $b" % _BORN, "-{%s $d}" % _DIED]) disp.set_help(_("Display format for the fathers box.")) menu.add_option(category_name, "father_disp", disp) #Will add when libsubstkeyword supports it. #missing = EnumeratedListOption(_("Replace missing\nplaces\\dates \ # with"), 0) #missing.add_item(0, _("Does not display anything")) #missing.add_item(1, _("Displays '_____'")) #missing.set_help(_("What will print when information is not known")) #menu.add_option(category_name, "miss_val", missing) #category_name = _("Secondary") disp_mom = TextOption( _("Mother\nDisplay Format"), ["$n", "%s $b" % _BORN, "%s $m" % _MARR, "-{%s $d}" % _DIED]) disp_mom.set_help(_("Display format for the mothers box.")) menu.add_option(category_name, "mother_disp", disp_mom) center_disp = EnumeratedListOption( _("Center person uses\n" "which format"), 0) center_disp.add_item(0, _("Use Fathers Display format")) center_disp.add_item(1, _("Use Mothers display format")) center_disp.set_help( _("Which Display format to use the center person")) menu.add_option(category_name, "center_uses", center_disp) incmarr = BooleanOption(_('Include Marriage box'), False) incmarr.set_help( _("Whether to include a separate marital box in the report")) menu.add_option(category_name, "inc_marr", incmarr) marrdisp = StringOption(_("Marriage\nDisplay Format"), "%s $m" % _MARR) marrdisp.set_help(_("Display format for the marital box.")) menu.add_option(category_name, "marr_disp", marrdisp) ################## category_name = _("Size") self.scale = EnumeratedListOption(_("Scale tree to fit"), 0) self.scale.add_item(0, _("Do not scale tree")) self.scale.add_item(1, _("Scale tree to fit page width only")) self.scale.add_item(2, _("Scale tree to fit the size of the page")) self.scale.set_help( _("Whether to scale the tree to fit a specific paper size")) menu.add_option(category_name, "scale_tree", self.scale) self.scale.connect('value-changed', self.__check_blank) if "BKI" not in self.name.split(","): self.__onepage = BooleanOption( _("Resize Page to Fit Tree size\n" "\n" "Note: Overrides options in the 'Paper Option' tab"), False) self.__onepage.set_help( _("Whether to resize the page to fit the size \n" "of the tree. Note: the page will have a \n" "non standard size.\n" "\n" "With this option selected, the following will happen:\n" "\n" "With the 'Do not scale tree' option the page\n" " is resized to the height/width of the tree\n" "\n" "With 'Scale tree to fit page width only' the height of\n" " the page is resized to the height of the tree\n" "\n" "With 'Scale tree to fit the size of the page' the page\n" " is resized to remove any gap in either height or width")) menu.add_option(category_name, "resize_page", self.__onepage) self.__onepage.connect('value-changed', self.__check_blank) else: self.__onepage = None self.box_Y_sf = NumberOption(_("inter-box scale factor"), 1.00, 0.10, 2.00, 0.01) self.box_Y_sf.set_help( _("Make the inter-box spacing bigger or smaller")) menu.add_option(category_name, "box_Yscale", self.box_Y_sf) self.box_shadow_sf = NumberOption(_("box shadow scale factor"), 1.00, 0.00, 2.00, 0.01) # down to 0 self.box_shadow_sf.set_help(_("Make the box shadow bigger or smaller")) menu.add_option(category_name, "shadowscale", self.box_shadow_sf) ################## category_name = _("Replace") repldisp = TextOption( _("Replace Display Format:\n'Replace this'/' with this'"), []) repldisp.set_help(_("i.e.\nUnited States of America/U.S.A")) menu.add_option(category_name, "replace_list", repldisp) ################## category_name = _("Include") self.__blank = BooleanOption(_('Include Blank Pages'), True) self.__blank.set_help(_("Whether to include pages that are blank.")) menu.add_option(category_name, "inc_blank", self.__blank) self.__check_blank() # TODO this code is never used and so I conclude it is for future use # self.__include_images = BooleanOption( # _('Include thumbnail images of people'), False) # self.__include_images.set_help( # _("Whether to include thumbnails of people.")) # menu.add_option(category_name, "includeImages", self.__include_images) #category_name = _("Notes") self.usenote = BooleanOption(_('Include a note'), False) self.usenote.set_help(_("Whether to include a note on " "the report.")) menu.add_option(category_name, "inc_note", self.usenote) self.notedisp = TextOption(_("Note"), []) self.notedisp.set_help(_("Add a note\n\n" "$T inserts today's date")) menu.add_option(category_name, "note_disp", self.notedisp) locales = NoteType(0, 1) self.notelocal = EnumeratedListOption(_("Note Location"), 0) for num, text in locales.note_locals(): self.notelocal.add_item(num, text) self.notelocal.set_help(_("Where to place the note.")) menu.add_option(category_name, "note_place", self.notelocal) def __check_blank(self): if self.__onepage: value = not self.__onepage.get_value() else: value = True off = value and (self.scale.get_value() != 2) self.__blank.set_available(off) def __fillout_vals(self): max_gen = self.max_gen.get_value() old_val = self.fillout.get_value() item_list = [] item_list.append( [0, _("No generations of empty boxes " "for unknown ancestors")]) if max_gen > 1: item_list.append([ 1, _("One Generation of empty boxes " "for unknown ancestors") ]) item_list.extend([ itr, str(itr) + _(" Generations of empty boxes for unknown ancestors") ] for itr in range(2, max_gen)) self.fillout.set_items(item_list) if old_val + 2 > len(item_list): self.fillout.set_value(len(item_list) - 2) def make_default_style(self, default_style): """Make the default output style for the Ancestor Tree.""" ## Paragraph Styles: font = FontStyle() font.set_size(9) font.set_type_face(FONT_SANS_SERIF) para_style = ParagraphStyle() para_style.set_font(font) para_style.set_description( _('The basic style used for the ' 'text display.')) default_style.add_paragraph_style("AC2-Normal", para_style) box_shadow = PT2CM(font.get_size()) * .6 font = FontStyle() font.set_size(9) font.set_type_face(FONT_SANS_SERIF) para_style = ParagraphStyle() para_style.set_font(font) para_style.set_description( _('The basic style used for the ' 'note display.')) default_style.add_paragraph_style("AC2-Note", para_style) font = FontStyle() font.set_size(16) font.set_type_face(FONT_SANS_SERIF) para_style = ParagraphStyle() para_style.set_font(font) para_style.set_alignment(PARA_ALIGN_CENTER) para_style.set_description( _('The basic style used for the ' 'title display.')) default_style.add_paragraph_style("AC2-Title", para_style) ## Draw styles graph_style = GraphicsStyle() graph_style.set_paragraph_style("AC2-Normal") graph_style.set_shadow(1, box_shadow) #shadow set by text size graph_style.set_fill_color((255, 255, 255)) default_style.add_draw_style("AC2-box", graph_style) graph_style = GraphicsStyle() graph_style.set_paragraph_style("AC2-Normal") #graph_style.set_shadow(0, PT2CM(9)) #shadow set by text size graph_style.set_fill_color((255, 255, 255)) default_style.add_draw_style("AC2-fam-box", graph_style) graph_style = GraphicsStyle() graph_style.set_paragraph_style("AC2-Note") graph_style.set_fill_color((255, 255, 255)) default_style.add_draw_style("AC2-note-box", graph_style) graph_style = GraphicsStyle() graph_style.set_paragraph_style("AC2-Title") graph_style.set_color((0, 0, 0)) graph_style.set_fill_color((255, 255, 255)) graph_style.set_line_width(0) default_style.add_draw_style("AC2-Title", graph_style) graph_style = GraphicsStyle() default_style.add_draw_style("AC2-line", graph_style)
class AncestorTreeOptions(MenuReportOptions): """ Defines options and provides handling interface. """ def __init__(self, name, dbase): self.box_Y_sf = None self.box_shadow_sf = None MenuReportOptions.__init__(self, name, dbase) def add_menu_options(self, menu): ################## category_name = _("Tree Options") pid = PersonOption(_("Center Person")) pid.set_help(_("The center person for the tree")) menu.add_option(category_name, "pid", pid) siblings = BooleanOption(_('Include siblings of the center person'), False) siblings.set_help(_("Whether to only display the center person or all " "of his/her siblings too")) menu.add_option(category_name, "inc_siblings", siblings) self.max_gen = NumberOption(_("Generations"), 10, 1, 50) self.max_gen.set_help(_("The number of generations to include " "in the tree")) menu.add_option(category_name, "maxgen", self.max_gen) self.fillout = EnumeratedListOption(_("Display unknown\ngenerations"), 0) self.fillout.set_help(_("The number of generations of empty " "boxes that will be displayed")) menu.add_option(category_name, "fill_out", self.fillout) self.max_gen.connect('value-changed', self.__fillout_vals) self.__fillout_vals() compress = BooleanOption(_('Compress tree'), True) compress.set_help(_("Whether to remove any extra blank spaces set " "aside for people that are unknown")) menu.add_option(category_name, "compress_tree", compress) #better to 'Show siblings of\nthe center person #Spouse_disp = EnumeratedListOption(_("Show spouses of\nthe center " # "person"), 0) #Spouse_disp.add_item( 0, _("No. Do not show Spouses")) #Spouse_disp.add_item( 1, _("Yes, and use the Main Display Format")) #Spouse_disp.add_item( 2, _("Yes, and use the Secondary " # "Display Format")) #Spouse_disp.set_help(_("Show spouses of the center person?")) #menu.add_option(category_name, "Spouse_disp", Spouse_disp) ################## category_name = _("Report Options") self.title = EnumeratedListOption(_("Report Title"), 0) self.title.add_item(0, _("Do not include a title")) self.title.add_item(1, _("Include Report Title")) self.title.set_help(_("Choose a title for the report")) menu.add_option(category_name, "report_title", self.title) border = BooleanOption(_('Include a border'), False) border.set_help(_("Whether to make a border around the report.")) menu.add_option(category_name, "inc_border", border) prnnum = BooleanOption(_('Include Page Numbers'), False) prnnum.set_help(_("Whether to print page numbers on each page.")) menu.add_option(category_name, "inc_pagenum", prnnum) stdoptions.add_private_data_option(menu, category_name) stdoptions.add_name_format_option(menu, category_name) stdoptions.add_localization_option(menu, category_name) ################## category_name = _("Display") disp = TextOption(_("Father\nDisplay Format"), ["$n", "%s $b" %_BORN, "-{%s $d}" %_DIED]) disp.set_help(_("Display format for the fathers box.")) menu.add_option(category_name, "father_disp", disp) #Will add when libsubstkeyword supports it. #missing = EnumeratedListOption(_("Replace missing\nplaces\\dates \ # with"), 0) #missing.add_item( 0, _("Does not display anything")) #missing.add_item( 1, _("Displays '_____'")) #missing.set_help(_("What will print when information is not known")) #menu.add_option(category_name, "miss_val", missing) #category_name = _("Secondary") dispMom = TextOption(_("Mother\nDisplay Format"), ["$n", "%s $b" %_BORN, "%s $m" %_MARR, "-{%s $d}" %_DIED] ) dispMom.set_help(_("Display format for the mothers box.")) menu.add_option(category_name, "mother_disp", dispMom) centerDisp = EnumeratedListOption(_("Center person uses\n" "which format"), 0) centerDisp.add_item(0, _("Use Fathers Display format")) centerDisp.add_item(1, _("Use Mothers display format")) centerDisp.set_help(_("Which Display format to use the center person")) menu.add_option(category_name, "center_uses", centerDisp) incmarr = BooleanOption(_('Include Marriage box'), False) incmarr.set_help( _("Whether to include a separate marital box in the report")) menu.add_option(category_name, "inc_marr", incmarr) marrdisp = StringOption(_("Marriage\nDisplay Format"), "%s $m" % _MARR) marrdisp.set_help(_("Display format for the marital box.")) menu.add_option(category_name, "marr_disp", marrdisp) ################## category_name = _("Size") self.scale = EnumeratedListOption(_("Scale tree to fit"), 0) self.scale.add_item(0, _("Do not scale tree")) self.scale.add_item(1, _("Scale tree to fit page width only")) self.scale.add_item(2, _("Scale tree to fit the size of the page")) self.scale.set_help( _("Whether to scale the tree to fit a specific paper size") ) menu.add_option(category_name, "scale_tree", self.scale) self.scale.connect('value-changed', self.__check_blank) if "BKI" not in self.name.split(","): self.__onepage = BooleanOption(_("Resize Page to Fit Tree size\n" "\n" "Note: Overrides options in the 'Paper Option' tab" ), False) self.__onepage.set_help( _("Whether to resize the page to fit the size \n" "of the tree. Note: the page will have a \n" "non standard size.\n" "\n" "With this option selected, the following will happen:\n" "\n" "With the 'Do not scale tree' option the page\n" " is resized to the height/width of the tree\n" "\n" "With 'Scale tree to fit page width only' the height of\n" " the page is resized to the height of the tree\n" "\n" "With 'Scale tree to fit the size of the page' the page\n" " is resized to remove any gap in either height or width" )) menu.add_option(category_name, "resize_page", self.__onepage) self.__onepage.connect('value-changed', self.__check_blank) else: self.__onepage = None self.box_Y_sf = NumberOption(_("inter-box scale factor"), 1.00, 0.10, 2.00, 0.01) self.box_Y_sf.set_help(_("Make the inter-box spacing bigger or smaller")) menu.add_option(category_name, "box_Yscale", self.box_Y_sf) self.box_shadow_sf = NumberOption(_("box shadow scale factor"), 1.00, 0.00, 2.00, 0.01) # down to 0 self.box_shadow_sf.set_help(_("Make the box shadow bigger or smaller")) menu.add_option(category_name, "shadowscale", self.box_shadow_sf) ################## category_name = _("Replace") repldisp = TextOption( _("Replace Display Format:\n'Replace this'/' with this'"), []) repldisp.set_help(_("i.e.\nUnited States of America/U.S.A")) menu.add_option(category_name, "replace_list", repldisp) ################## category_name = _("Include") self.__blank = BooleanOption(_('Include Blank Pages'), True) self.__blank.set_help(_("Whether to include pages that are blank.")) menu.add_option(category_name, "inc_blank", self.__blank) self.__check_blank() self.__include_images = BooleanOption( _('Include thumbnail images of people'), False) self.__include_images.set_help( _("Whether to include thumbnails of people.")) menu.add_option(category_name, "includeImages", self.__include_images) #category_name = _("Notes") self.usenote = BooleanOption(_('Include a note'), False) self.usenote.set_help(_("Whether to include a note on " "the report.")) menu.add_option(category_name, "inc_note", self.usenote) self.notedisp = TextOption(_("Note"), []) self.notedisp.set_help(_("Add a note\n\n" "$T inserts today's date")) menu.add_option(category_name, "note_disp", self.notedisp) locales = NoteType(0, 1) self.notelocal = EnumeratedListOption(_("Note Location"), 0) for num, text in locales.note_locals(): self.notelocal.add_item(num, text) self.notelocal.set_help(_("Where to place the note.")) menu.add_option(category_name, "note_place", self.notelocal) def __check_blank(self): if self.__onepage: value = not self.__onepage.get_value() else: value = True off = value and (self.scale.get_value() != 2) self.__blank.set_available(off) def __fillout_vals(self): max_gen = self.max_gen.get_value() old_val = self.fillout.get_value() item_list = [] item_list.append([0, _("No generations of empty boxes " "for unknown ancestors")]) if max_gen > 1: item_list.append([1, _("One Generation of empty boxes " "for unknown ancestors")]) item_list.extend([itr, str(itr) + _(" Generations of empty boxes for unknown ancestors")] for itr in range(2, max_gen) ) self.fillout.set_items(item_list) if old_val+2 > len(item_list): self.fillout.set_value(len(item_list) -2) def make_default_style(self, default_style): """Make the default output style for the Ancestor Tree.""" ## Paragraph Styles: font = FontStyle() font.set_size(9) font.set_type_face(FONT_SANS_SERIF) para_style = ParagraphStyle() para_style.set_font(font) para_style.set_description(_('The basic style used for the ' 'text display.')) default_style.add_paragraph_style("AC2-Normal", para_style) box_shadow = PT2CM(font.get_size()) * .6 font = FontStyle() font.set_size(9) font.set_type_face(FONT_SANS_SERIF) para_style = ParagraphStyle() para_style.set_font(font) para_style.set_description(_('The basic style used for the ' 'note display.')) default_style.add_paragraph_style("AC2-Note", para_style) font = FontStyle() font.set_size(16) font.set_type_face(FONT_SANS_SERIF) para_style = ParagraphStyle() para_style.set_font(font) para_style.set_alignment(PARA_ALIGN_CENTER) para_style.set_description(_('The basic style used for the ' 'title display.')) default_style.add_paragraph_style("AC2-Title", para_style) ## Draw styles graph_style = GraphicsStyle() graph_style.set_paragraph_style("AC2-Normal") graph_style.set_shadow(1, box_shadow) #shadow set by text size graph_style.set_fill_color((255, 255, 255)) default_style.add_draw_style("AC2-box", graph_style) graph_style = GraphicsStyle() graph_style.set_paragraph_style("AC2-Normal") #graph_style.set_shadow(0, PT2CM(9)) #shadow set by text size graph_style.set_fill_color((255, 255, 255)) default_style.add_draw_style("AC2-fam-box", graph_style) graph_style = GraphicsStyle() graph_style.set_paragraph_style("AC2-Note") graph_style.set_fill_color((255, 255, 255)) default_style.add_draw_style("AC2-note-box", graph_style) # TODO - Why is this here twice? #graph_style = GraphicsStyle() #graph_style.set_paragraph_style("AC2-Title") #graph_style.set_color((0, 0, 0)) #graph_style.set_fill_color((255, 255, 255)) #graph_style.set_line_width(0) #default_style.add_draw_style("AC2-Title", graph_style) graph_style = GraphicsStyle() default_style.add_draw_style("AC2-line", graph_style)
class FamilyGroupOptions(MenuReportOptions): """ Defines options and provides handling interface. """ def __init__(self, name, dbase): self.__db = dbase self.__fid = None self.__filter = None self.__recursive = None self.__generations = None self._nf = None MenuReportOptions.__init__(self, name, dbase) def get_subject(self): """ Return a string that describes the subject of the report. """ return self.__filter.get_filter().get_name() def add_menu_options(self, menu): ########################## category_name = _("Report Options") add_option = partial(menu.add_option, category_name) ########################## self.__filter = FilterOption(_("Filter"), 0) self.__filter.set_help( _("Select the filter to be applied to the report.")) add_option("filter", self.__filter) self.__filter.connect('value-changed', self.__filter_changed) self.__fid = FamilyOption(_("Center Family")) self.__fid.set_help(_("The center family for the filter")) add_option("family_id", self.__fid) self.__fid.connect('value-changed', self.__update_filters) self.__recursive = BooleanOption(_('Recursive (down)'), False) self.__recursive.set_help(_("Create reports for all descendants " "of this family.")) add_option("recursive", self.__recursive) self.__recursive.connect('value-changed', self.__recursive_changed) ########################## 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_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) ########################## add_option = partial(menu.add_option, _("Include")) ########################## inc_par_mar = BooleanOption(_("Parent Marriage"), True) inc_par_mar.set_help( _("Whether to include marriage information for parents.")) add_option("incParMar", inc_par_mar) inc_par_events = BooleanOption(_("Parent Events"), False) inc_par_events.set_help(_("Whether to include events for parents.")) add_option("incParEvents", inc_par_events) inc_par_addr = BooleanOption(_("Parent Addresses"), False) inc_par_addr.set_help(_("Whether to include addresses for parents.")) add_option("incParAddr", inc_par_addr) inc_par_notes = BooleanOption(_("Parent Notes"), False) inc_par_notes.set_help(_("Whether to include notes for parents.")) add_option("incParNotes", inc_par_notes) incattrs = BooleanOption(_("Parent Attributes"), False) incattrs.set_help(_("Whether to include attributes.")) add_option("incattrs", incattrs) inc_par_names = BooleanOption(_("Alternate Parent Names"), False) inc_par_names.set_help( _("Whether to include alternate names for parents.")) add_option("incParNames", inc_par_names) ########################## category_name = _("Include (2)") add_option = partial(menu.add_option, category_name) ########################## stdoptions.add_gramps_id_option(menu, category_name) inc_fam_notes = BooleanOption(_("Family Notes"), False) inc_fam_notes.set_help(_("Whether to include notes for families.")) add_option("incFamNotes", inc_fam_notes) inc_rel_dates = BooleanOption(_("Dates of Relatives"), False) inc_rel_dates.set_help(_("Whether to include dates for relatives " "(father, mother, spouse).")) add_option("incRelDates", inc_rel_dates) inc_chi_mar = BooleanOption(_("Children Marriages"), True) inc_chi_mar.set_help( _("Whether to include marriage information for children.")) add_option("incChiMar", inc_chi_mar) self.__generations = BooleanOption(_("Generation numbers " "(recursive only)"), False) self.__generations.set_help(_("Whether to include the generation " "on each report (recursive only).")) add_option("generations", self.__generations) missinginfo = BooleanOption(_("Print fields for missing " "information"), True) missinginfo.set_help(_("Whether to include fields for missing " "information.")) add_option("missinginfo", missinginfo) def __update_filters(self): """ Update the filter list based on the selected family """ fid = self.__fid.get_value() family = self.__db.get_family_from_gramps_id(fid) nfv = self._nf.get_value() filter_list = utils.get_family_filters(self.__db, family, include_single=True, name_format=nfv) self.__filter.set_filters(filter_list) def __filter_changed(self): """ Handle filter change. If the filter is not family-specific, disable the family option """ filter_value = self.__filter.get_value() if filter_value == 1: # "Entire Database" (as "include_single=True") self.__fid.set_available(False) else: # The other filters need a center family (assume custom ones too) self.__fid.set_available(True) # only allow recursion if the center family is the only family if self.__recursive and filter_value == 0: self.__recursive.set_available(True) elif self.__recursive: self.__recursive.set_value(False) self.__recursive.set_available(False) def __recursive_changed(self): """ Handle recursive change. """ recursive_value = self.__recursive.get_value() self.__generations.set_available(recursive_value) def make_default_style(self, default_style): """Make default output style for the Family Group Report.""" para = ParagraphStyle() #Paragraph Styles font = FontStyle() font.set_size(4) para.set_font(font) default_style.add_paragraph_style('FGR-blank', para) font = FontStyle() font.set_type_face(FONT_SANS_SERIF) font.set_size(16) font.set_bold(1) para = ParagraphStyle() para.set_font(font) para.set_alignment(PARA_ALIGN_CENTER) para.set_header_level(1) para.set_description(_("The style used for the title.")) default_style.add_paragraph_style('FGR-Title', para) font = FontStyle() font.set_type_face(FONT_SERIF) font.set_size(10) font.set_bold(0) para = ParagraphStyle() para.set_font(font) para.set_description(_('The basic style used for the text display.')) default_style.add_paragraph_style('FGR-Normal', para) para = ParagraphStyle() font = FontStyle() font.set_type_face(FONT_SERIF) font.set_size(10) font.set_bold(0) para.set_font(font) para.set(lmargin=0.0) para.set_top_margin(0.0) para.set_bottom_margin(0.0) para.set_description(_('The basic style used for the note display.')) default_style.add_paragraph_style("FGR-Note", para) font = FontStyle() font.set_type_face(FONT_SANS_SERIF) font.set_size(10) font.set_bold(1) para = ParagraphStyle() para.set_font(font) para.set_description( _('The style used for the text related to the children.')) default_style.add_paragraph_style('FGR-ChildText', para) font = FontStyle() font.set_type_face(FONT_SANS_SERIF) font.set_size(12) font.set_bold(1) para = ParagraphStyle() para.set_font(font) para.set_header_level(3) para.set_description(_("The style used for the parent's name")) default_style.add_paragraph_style('FGR-ParentName', para) #Table Styles cell = TableCellStyle() cell.set_padding(0.2) cell.set_top_border(1) cell.set_bottom_border(1) cell.set_right_border(1) cell.set_left_border(1) default_style.add_cell_style('FGR-ParentHead', cell) cell = TableCellStyle() cell.set_padding(0.1) cell.set_bottom_border(1) cell.set_left_border(1) cell.set_right_border(1) # for RTL default_style.add_cell_style('FGR-TextContents', cell) cell = TableCellStyle() cell.set_padding(0.1) cell.set_bottom_border(0) cell.set_left_border(1) cell.set_right_border(1) # for RTL cell.set_padding(0.1) default_style.add_cell_style('FGR-TextChild1', cell) cell = TableCellStyle() cell.set_padding(0.1) cell.set_bottom_border(1) cell.set_left_border(1) cell.set_right_border(1) # for RTL cell.set_padding(0.1) default_style.add_cell_style('FGR-TextChild2', cell) cell = TableCellStyle() cell.set_padding(0.1) cell.set_bottom_border(1) cell.set_right_border(1) cell.set_left_border(1) default_style.add_cell_style('FGR-TextContentsEnd', cell) cell = TableCellStyle() cell.set_padding(0.2) cell.set_bottom_border(1) cell.set_right_border(1) cell.set_left_border(1) default_style.add_cell_style('FGR-ChildName', cell) table = TableStyle() table.set_width(100) table.set_columns(3) table.set_column_width(0, 20) table.set_column_width(1, 40) table.set_column_width(2, 40) default_style.add_table_style('FGR-ParentTable', table) table = TableStyle() table.set_width(100) table.set_columns(4) table.set_column_width(0, 7) table.set_column_width(1, 18) table.set_column_width(2, 35) table.set_column_width(3, 40) default_style.add_table_style('FGR-ChildTable', table)
class RelGraphOptions(MenuReportOptions): """ Defines options and provides handling interface. """ def __init__(self, name, dbase): self.__pid = None self.__filter = None self.__show_relships = None self.__show_GaGb = None self.__include_images = None self.__image_on_side = None self.__db = dbase MenuReportOptions.__init__(self, name, dbase) def add_menu_options(self, menu): ################################ 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 graph")) add_option("filter", self.__filter) self.__filter.connect('value-changed', self.__filter_changed) self.__pid = PersonOption(_("Center Person")) self.__pid.set_help(_("The center person for the report")) add_option("pid", self.__pid) self.__pid.connect('value-changed', self.__update_filters) stdoptions.add_name_format_option(menu, category_name) self.__update_filters() self.incdate = BooleanOption( _("Include Birth, Marriage and Death dates"), True) self.incdate.set_help( _("Include the dates that the individual was " "born, got married and/or died in the graph labels.")) add_option("incdate", self.incdate) self.incdate.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) use_place = BooleanOption(_("Use place when no date"), True) use_place.set_help( _("When no birth, marriage, or death date is " "available, the correspondent place field " "will be used.")) add_option("use_place", use_place) url = BooleanOption(_("Include URLs"), False) url.set_help( _("Include a URL in each graph node so " "that PDF and imagemap files can be " "generated that contain active links " "to the files generated by the 'Narrated " "Web Site' report.")) add_option("url", url) incid = BooleanOption(_("Include IDs"), False) incid.set_help(_("Include individual and family IDs.")) add_option("incid", incid) self.__show_relships = BooleanOption( _("Include relationship to center person"), False) self.__show_relships.set_help( _("Whether to show every " "person's relationship to the center person")) add_option("increlname", self.__show_relships) self.__show_relships.connect('value-changed', self.__show_relships_changed) if __debug__: self.__show_GaGb = BooleanOption( _("Include relationship " "debugging numbers also"), False) self.__show_GaGb.set_help( _("Whether to include 'Ga' and 'Gb' " "also, to debug the relationship calculator")) add_option("advrelinfo", self.__show_GaGb) self.__include_images = BooleanOption( _('Include thumbnail images of people'), False) self.__include_images.set_help( _("Whether to include thumbnails of people.")) add_option("includeImages", self.__include_images) self.__include_images.connect('value-changed', self.__image_changed) self.__image_on_side = EnumeratedListOption(_("Thumbnail Location"), 0) self.__image_on_side.add_item(0, _('Above the name')) self.__image_on_side.add_item(1, _('Beside the name')) self.__image_on_side.set_help( _("Where the thumbnail image should appear " "relative to the name")) add_option("imageOnTheSide", self.__image_on_side) stdoptions.add_localization_option(menu, category_name) ################################ add_option = partial(menu.add_option, _("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.")) add_option("color", color) 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) 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) roundedcorners = BooleanOption( # see bug report #2180 _("Use rounded corners"), False) roundedcorners.set_help( _("Use rounded corners to differentiate " "between women and men.")) add_option("useroundedcorners", roundedcorners) dashed = BooleanOption( _("Indicate non-birth relationships with dotted lines"), True) dashed.set_help( _("Non-birth relationships will show up " "as dotted lines in the graph.")) add_option("dashed", dashed) showfamily = BooleanOption(_("Show family nodes"), True) showfamily.set_help( _("Families will show up as ellipses, linked " "to parents and children.")) add_option("showfamily", showfamily) def __update_filters(self): """ Update the filter list based on the selected person """ gid = self.__pid.get_value() person = self.__db.get_person_from_gramps_id(gid) filter_list = ReportUtils.get_person_filters(person, False) self.__filter.set_filters(filter_list) def __include_dates_changed(self): """ Enable/disable menu items if dates are required """ if self.incdate.get_value(): self.justyears.set_available(True) else: self.justyears.set_available(False) def __filter_changed(self): """ Handle filter change. If the filter is not specific to a person, disable the person option """ filter_value = self.__filter.get_value() if filter_value in [1, 2, 3, 4]: # Filters 1, 2, 3 and 4 rely on the center person self.__pid.set_available(True) elif self.__show_relships and self.__show_relships.get_value(): self.__pid.set_available(True) else: # The rest don't self.__pid.set_available(False) def __image_changed(self): """ Handle thumbnail change. If the image is not to be included, make the image location option unavailable. """ self.__image_on_side.set_available(self.__include_images.get_value()) def __show_relships_changed(self): """ Enable/disable menu items if relationships are required """ if self.__show_GaGb: self.__show_GaGb.set_available(self.__show_relships.get_value()) self.__filter_changed()
class TAMexportOptions(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 MenuReportOptions.__init__(self, name, dbase) def add_menu_options(self, menu): # --------------------- category_name = _('Report Options') add_option = partial(menu.add_option, category_name) # --------------------- add_option( 'followpar', Option(_('Follow parents to determine ' '"family lines"'), True)) add_option( 'followchild', Option(_('Follow children to determine ' '"family lines"'), True)) stdoptions.add_name_format_option(menu, category_name) # no use for places so far... #stdoptions.add_place_format_option(menu, category_name) stdoptions.add_private_data_option(menu, category_name, default=False) stdoptions.add_living_people_option(menu, category_name) # disable 'living_people' until we actually repect its value self.menu.get_option_by_name('living_people').set_available(False) locale_opt = stdoptions.add_localization_option(menu, category_name) stdoptions.add_date_format_option(menu, category_name, locale_opt) self.include_dates = BooleanOption(_('Include dates'), True) self.include_dates.set_help(_('Whether to include dates for people.')) add_option('incdates', self.include_dates) self.include_dates.connect('value-changed', self.includedates_changed) # -------------------------------- add_option = partial(menu.add_option, _('Edge people')) # -------------------------------- person_list = PersonListOption(_('Edge people')) person_list.set_help( _('Edge people are used as boundaries. ' 'They will not be traversed when determining the full "family".') ) add_option('edgelist', person_list) self.edgelist = person_list self.limit_parents = BooleanOption(_('Limit the number of ancestors'), False) self.limit_parents.set_help( _('Whether to ' 'limit the number of ancestor generations.')) add_option('limitparents', self.limit_parents) self.limit_parents.connect('value-changed', self.limit_changed) self.max_parents = NumberOption('', 50, 0, 9999) self.max_parents.set_help( _('The maximum number ' 'of ancestor generations 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 descendant generations.')) add_option('limitchildren', self.limit_children) self.limit_children.connect('value-changed', self.limit_changed) self.max_children = NumberOption('', 50, 0, 9999) self.max_children.set_help( _('The maximum number ' 'of descendant generations to include.')) add_option('maxchildren', self.max_children) # -------------------------------- add_option = partial(menu.add_option, _('Interesting people')) # -------------------------------- add_option('gidlist', Option(_('Some people'), " ")) # sometimes we don't want to list living people includeall_people = BooleanOption(_('Include all people'), False) includeall_people.set_help(_('Mark all people as interesting.')) add_option('allpeople', includeall_people) includeall_people.connect('value-changed', self.includeallpeople_changed) 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) person_list = PersonListOption(_('Interesting people')) person_list.set_help( _('People whose families to include ' 'apart from the "Main Person".')) add_option('interestlist', person_list) # -------------------- add_option = partial(menu.add_option, _('Include')) # -------------------- self.limit_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 includedates_changed(self): date_option = self.menu.get_option_by_name('date_format') if not date_option: return date_option.set_available(self.include_dates.get_value()) def includeallpeople_changed(self): allpeople = self.menu.get_option_by_name('allpeople') if not allpeople: return removeextra = self.menu.get_option_by_name('removeextra') if not removeextra: return removeextra.set_available(not allpeople.get_value())
class ReportOptions(MenuReportOptions): """Report options for Media Report""" def __init__(self, name, dbase): MenuReportOptions.__init__(self, name, dbase) def add_menu_options(self, menu): """Add the options to the report option menu""" head = StringOption(_("Heading"), "") menu.add_option(_("Report Options"), "head", head) media = MediaOption(_("Media")) media.set_help(_("Select a media file for this report")) menu.add_option(_("Report Options"), "mid", media) self.note = NoteOption(_("Custom note")) self.note.set_help(_("Select a note for this report")) menu.add_option(_("Report Options"), "note", self.note) self.incl_note = BooleanOption(_("Include custom note"), False) self.incl_note.set_help(_("The custom note will be included")) menu.add_option(_("Report Options"), "incl_note", self.incl_note) self.incl_note.connect('value-changed', self.__update_custom_note_opt) incl_pers = BooleanOption(_("Include referenced people"), False) incl_pers.set_help(_("Referenced people will be included")) menu.add_option(_("Report Options"), "incl_pers", incl_pers) incl_data = BooleanOption(_("Include media data"), False) incl_data.set_help(_("Tags, notes and attributes will be included")) menu.add_option(_("Report Options"), "incl_data", incl_data) media_w = NumberOption(_("Media width"), 100, 10, 100, 10) media_w.set_help( _("Maximum media width in % of available " "page width.")) menu.add_option(_("Report Options"), "media_w", media_w) media_h = NumberOption(_("Media height"), 100, 10, 100, 10) media_h.set_help( _("Maximum media height in % of available page " "height.")) menu.add_option(_("Report Options"), "media_h", media_h) def __update_custom_note_opt(self): self.note.set_available(False) if self.incl_note.get_value(): self.note.set_available(True) def make_default_style(self, default_style): """Define the default styling.""" para = ParagraphStyle() default_style.add_paragraph_style("Default", para) font = FontStyle() font.set(size=16, bold=1) para.set_font(font) para.set_header_level(1) para.set_top_margin(0.25) para.set_bottom_margin(0.25) para.set_alignment(PARA_ALIGN_CENTER) default_style.add_paragraph_style("Heading", para) font = FontStyle() font.set(size=12, bold=1) para.set_font(font) para.set_alignment(PARA_ALIGN_LEFT) default_style.add_paragraph_style("Heading2", para) cell = TableCellStyle() default_style.add_cell_style("cell", cell) tbl = TableStyle() tbl.set_width(100) tbl.set_columns(4) tbl.set_column_width(0, 20) tbl.set_column_width(1, 30) tbl.set_column_width(2, 20) tbl.set_column_width(3, 30) default_style.add_table_style('tbl', tbl) tbl = TableStyle() tbl.set_width(100) tbl.set_columns(2) tbl.set_column_width(0, 50) tbl.set_column_width(1, 50) default_style.add_table_style('tbl2', tbl) tbl = TableStyle() tbl.set_width(100) tbl.set_columns(1) tbl.set_column_width(0, 100) default_style.add_table_style('tbl3', tbl)
class IndivCompleteOptions(MenuReportOptions): """ Defines options and provides handling interface. """ def __init__(self, name, dbase): self.__db = dbase self.__pid = None self.__filter = None self.__cites = None self.__incsrcnotes = None self._nf = None MenuReportOptions.__init__(self, name, dbase) def get_subject(self): """ Return a string that describes the subject of the report. """ return self.__filter.get_filter().get_name() def add_menu_options(self, menu): ################################ category_name = _("Report Options") ################################ self.__filter = FilterOption(_("Filter"), 0) self.__filter.set_help( _("Select the filter to be applied to the report.")) menu.add_option(category_name, "filter", self.__filter) self.__filter.connect('value-changed', self.__filter_changed) self.__pid = PersonOption(_("Filter Person")) self.__pid.set_help(_("The center person for the filter.")) menu.add_option(category_name, "pid", self.__pid) self.__pid.connect('value-changed', self.__update_filters) self._nf = stdoptions.add_name_format_option(menu, category_name) self._nf.connect('value-changed', self.__update_filters) self.__update_filters() stdoptions.add_private_data_option(menu, category_name) stdoptions.add_living_people_option(menu, category_name) sort = BooleanOption(_("List events chronologically"), True) sort.set_help(_("Whether to sort events into chronological order.")) menu.add_option(category_name, "sort", sort) pageben = BooleanOption(_("Page break before end notes"), False) pageben.set_help( _("Whether to start a new page before the end notes.")) menu.add_option(category_name, "pageben", pageben) stdoptions.add_localization_option(menu, category_name) ################################ category_name = _("Include") ################################ self.__cites = BooleanOption(_("Include Source Information"), True) self.__cites.set_help(_("Whether to cite sources.")) menu.add_option(category_name, "cites", self.__cites) self.__cites.connect('value-changed', self.__sources_changed) self.__incsrcnotes = BooleanOption(_("Include sources notes"), False) self.__incsrcnotes.set_help( _("Whether to include source notes in the Endnotes section. " "Only works if Include sources is selected.")) menu.add_option(category_name, "incsrcnotes", self.__incsrcnotes) self.__incsrcnotes.connect('value-changed', self.__sources_changed) self.__sources_changed() images = BooleanOption(_("Include Photo/Images from Gallery"), True) images.set_help(_("Whether to include images.")) menu.add_option(category_name, "images", images) attributes = BooleanOption(_("Include Attributes"), True) attributes.set_help(_("Whether to include attributes.")) menu.add_option(category_name, "incl_attrs", attributes) census = BooleanOption(_("Include Census Events"), True) census.set_help(_("Whether to include Census Events.")) menu.add_option(category_name, "incl_census", census) grampsid = BooleanOption(_("Include Gramps ID"), False) grampsid.set_help(_("Whether to include Gramps ID next to names.")) menu.add_option(category_name, "grampsid", grampsid) incl_notes = BooleanOption(_("Include Notes"), True) incl_notes.set_help(_("Whether to include Person and Family Notes.")) menu.add_option(category_name, "incl_notes", incl_notes) tags = BooleanOption(_("Include Tags"), True) tags.set_help(_("Whether to include tags.")) menu.add_option(category_name, "incl_tags", tags) ################################ category_name = _("Sections") ################################ opt = BooleanListOption(_("Event groups")) opt.set_help(_("Check if a separate section is required.")) for section in SECTION_LIST: if section != SECTION_LIST[0]: opt.add_button(_(section), True) menu.add_option(category_name, "sections", opt) def __update_filters(self): """ Update the filter list based on the selected person """ gid = self.__pid.get_value() person = self.__db.get_person_from_gramps_id(gid) nfv = self._nf.get_value() filter_list = utils.get_person_filters(person, include_single=True, name_format=nfv) self.__filter.set_filters(filter_list) def __filter_changed(self): """ Handle filter change. If the filter is not specific to a person, disable the person option """ filter_value = self.__filter.get_value() if filter_value in [0, 2, 3, 4, 5]: # Filters 0, 2, 3, 4 and 5 rely on the center person self.__pid.set_available(True) else: # The rest don't self.__pid.set_available(False) def __sources_changed(self): """ If Endnotes are not enabled, disable sources in the Endnotes. """ cites_value = self.__cites.get_value() if cites_value: self.__incsrcnotes.set_available(True) else: self.__incsrcnotes.set_available(False) def make_default_style(self, default_style): """Make the default output style for the Individual Complete Report.""" # Paragraph Styles font = FontStyle() font.set_bold(1) font.set_type_face(FONT_SANS_SERIF) font.set_size(16) para = ParagraphStyle() para.set_alignment(PARA_ALIGN_CENTER) para.set_top_margin(utils.pt2cm(8)) para.set_bottom_margin(utils.pt2cm(8)) para.set_font(font) para.set_description(_("The style used for the title of the page.")) default_style.add_paragraph_style("IDS-Title", para) font = FontStyle() font.set_bold(1) font.set_type_face(FONT_SANS_SERIF) font.set_size(12) font.set_italic(1) para = ParagraphStyle() para.set_font(font) para.set_top_margin(utils.pt2cm(3)) para.set_bottom_margin(utils.pt2cm(3)) para.set_description(_("The style used for category labels.")) default_style.add_paragraph_style("IDS-TableTitle", para) font = FontStyle() font.set_bold(1) font.set_type_face(FONT_SANS_SERIF) font.set_size(12) para = ParagraphStyle() para.set_font(font) para.set_top_margin(utils.pt2cm(3)) para.set_bottom_margin(utils.pt2cm(3)) para.set_description(_("The style used for the spouse's name.")) default_style.add_paragraph_style("IDS-Spouse", para) font = FontStyle() font.set_size(12) para = ParagraphStyle() para.set_font(font) para.set_top_margin(utils.pt2cm(3)) para.set_bottom_margin(utils.pt2cm(3)) para.set_description(_('The basic style used for the text display.')) default_style.add_paragraph_style("IDS-Normal", para) font = FontStyle() font.set_size(12) font.set_italic(1) para = ParagraphStyle() para.set_font(font) para.set_top_margin(utils.pt2cm(3)) para.set_bottom_margin(utils.pt2cm(3)) para.set_description(_('The style used for the section headers.')) default_style.add_paragraph_style("IDS-Section", para) font = FontStyle() font.set_size(8) para = ParagraphStyle() para.set_alignment(PARA_ALIGN_RIGHT) para.set_font(font) para.set_top_margin(utils.pt2cm(3)) para.set_bottom_margin(utils.pt2cm(3)) para.set_description(_('A style used for image facts.')) default_style.add_paragraph_style("IDS-ImageNote", para) font = FontStyle() font.set_size(8) para = ParagraphStyle() para.set_alignment(PARA_ALIGN_CENTER) para.set_font(font) para.set_top_margin(utils.pt2cm(3)) para.set_bottom_margin(utils.pt2cm(3)) para.set_description(_('A style used for image captions.')) default_style.add_paragraph_style("IDS-ImageCaptionCenter", para) # Table Styles tbl = TableStyle() tbl.set_width(100) tbl.set_columns(2) tbl.set_column_width(0, 20) tbl.set_column_width(1, 80) default_style.add_table_style("IDS-IndTable", tbl) tbl = TableStyle() tbl.set_width(100) tbl.set_columns(2) tbl.set_column_width(0, 50) tbl.set_column_width(1, 50) default_style.add_table_style("IDS-ParentsTable", tbl) cell = TableCellStyle() cell.set_top_border(1) cell.set_bottom_border(1) default_style.add_cell_style("IDS-TableHead", cell) cell = TableCellStyle() default_style.add_cell_style("IDS-NormalCell", cell) cell = TableCellStyle() cell.set_longlist(1) default_style.add_cell_style("IDS-ListCell", cell) tbl = TableStyle() tbl.set_width(100) tbl.set_columns(3) tbl.set_column_width(0, 20) tbl.set_column_width(1, 50) tbl.set_column_width(2, 30) default_style.add_table_style('IDS-PersonTable', tbl) tbl = TableStyle() tbl.set_width(100) tbl.set_columns(2) tbl.set_column_width(0, 20) tbl.set_column_width(1, 80) default_style.add_table_style('IDS-PersonTable2', tbl) tbl = TableStyle() tbl.set_width(100) tbl.set_columns(5) tbl.set_column_width(0, 22) # Type tbl.set_column_width(1, 22) # Date tbl.set_column_width(2, 16) # Status tbl.set_column_width(3, 22) # Temple tbl.set_column_width(4, 18) # Place default_style.add_table_style('IDS-OrdinanceTable', tbl) tbl = TableStyle() tbl.set_width(100) tbl.set_columns(6) tbl.set_column_width(0, 20) # empty tbl.set_column_width(1, 18) # Type tbl.set_column_width(2, 18) # Date tbl.set_column_width(3, 14) # Status tbl.set_column_width(4, 18) # Temple tbl.set_column_width(5, 12) # Place default_style.add_table_style('IDS-OrdinanceTable2', tbl) tbl = TableStyle() tbl.set_width(100) tbl.set_columns(3) tbl.set_column_width(0, 33) tbl.set_column_width(1, 33) tbl.set_column_width(2, 34) default_style.add_table_style("IDS-GalleryTable", tbl) Endnotes.add_endnote_styles(default_style)
class ReportOptions(MenuReportOptions): """Heatmap report options.""" def __init__(self, name, dbase): self.db = dbase MenuReportOptions.__init__(self, name, dbase) def add_menu_options(self, menu): """Create menu options.""" # ------------------- # GENERAL options tab # ------------------- self.get_person_filters(menu) fltr = EnumeratedListOption(_("Filter"), 0) fltr.set_items(menu.filter_list) menu.add_option(_("General"), "fltr", fltr) pers_id = PersonOption(_("Person")) menu.add_option(_("General"), "pers_id", pers_id) filter_list2 = [(0, _("OpenStreetMap")), (1, _("Stamen Terrain")), (2, _("Stamen Toner")), (3, _("Stamen Watercolor")), (4, _("CartoDB Positron")), (5, _("CartoDB DarkMatter"))] tiles = EnumeratedListOption(_("Map tiles"), 0) tiles.set_items(filter_list2) menu.add_option(_("General"), "tiles", tiles) radius = NumberOption(_("Point size"), 15, 1, 50) radius.set_help(_("Set the size of the heatmap points.\nDefault: 15")) menu.add_option(_("General"), "radius", radius) path = DestinationOption(_("File path"), "") path.set_directory_entry(True) menu.add_option(_("General"), "path", path) txt = _("For the file name only english letters A-Z, a-z and " "numbers 0-9 as well as the characters space, underline and " "hypen are allowed. The file name also has to " "start and end with an alphanumeric character." "The file extention '.html' is added by the report.") file_name = StringOption(_("File name"), "") file_name.set_help(txt) menu.add_option(_("General"), "name", file_name) # ------------------- # ADVANCED options tab # ------------------- self.enable_start = BooleanOption(_("Enable custom start position"), False) self.enable_start.set_help( _("Enabling will force the map open at your custom " "start position and zoom.")) menu.add_option(_("Advanced"), "enable_start", self.enable_start) self.enable_start.connect('value-changed', self.update_start_options) self.start_lat = StringOption(_("Start latitude"), "50.0") self.start_lat.set_help( _("Set custom start position latitude\nDefault: 50.0")) menu.add_option(_("Advanced"), "start_lat", self.start_lat) self.start_lon = StringOption(_("Start longitude"), "10.0") self.start_lon.set_help( _("Set custom start position longitude\nDefault: 10.0")) menu.add_option(_("Advanced"), "start_lon", self.start_lon) self.start_zoom = NumberOption(_("Start zoom"), 5, 1, 18) self.start_zoom.set_help( _("Set the value for the starting zoom\nDefault: 5")) menu.add_option(_("Advanced"), "start_zoom", self.start_zoom) # ------------------- # LIMITS options tab # ------------------- self.enable_limits = BooleanOption(_("Enable map limits"), False) self.enable_limits.set_help( _("Enabling map limits forces the user to stay in a predefined part" " of the map.")) menu.add_option(_("Limits"), "enable_limits", self.enable_limits) self.enable_limits.connect('value-changed', self.update_limit_options) self.min_zoom = NumberOption(_("Min. zoom"), 1, 1, 18) self.min_zoom.set_help(_("Set minimal zoom value\nDefault: 1")) menu.add_option(_("Limits"), "min_zoom", self.min_zoom) self.max_zoom = NumberOption(_("Max. zoom"), 18, 1, 18) self.max_zoom.set_help(_("Set maximum zoom value.\nDefault: 18")) menu.add_option(_("Limits"), "max_zoom", self.max_zoom) self.lat1 = StringOption(_("Upper left corner latitude"), "") self.lat1.set_help(_("Set latitude for upper left corner map limit.")) menu.add_option(_("Limits"), "lat1", self.lat1) self.lon1 = StringOption(_("Upper left corner longitude"), "") self.lon1.set_help(_("Set longitude for upper left corner map limit.")) menu.add_option(_("Limits"), "lon1", self.lon1) self.lat2 = StringOption(_("Lower right corner latitude"), "") self.lat2.set_help(_("Set latitude for lower right corner map limit.")) menu.add_option(_("Limits"), "lat2", self.lat2) self.lon2 = StringOption(_("Lower right corner longitude"), "") self.lon2.set_help( _("Set longitude for lower right corner map limit.")) menu.add_option(_("Limits"), "lon2", self.lon2) self.render_border = BooleanOption(_("Render custom map limit border"), False) self.render_border.set_help( _("Enabling will render the map limit border")) menu.add_option(_("Limits"), "render_border", self.render_border) def update_limit_options(self): """Update menu options for limit option tab.""" self.min_zoom.set_available(False) self.max_zoom.set_available(False) self.lat1.set_available(False) self.lon1.set_available(False) self.lat2.set_available(False) self.lon2.set_available(False) self.render_border.set_available(False) value = self.enable_limits.get_value() if value: self.min_zoom.set_available(True) self.max_zoom.set_available(True) self.lat1.set_available(True) self.lon1.set_available(True) self.lat2.set_available(True) self.lon2.set_available(True) self.render_border.set_available(True) def update_start_options(self): """Update menu options for start option tab.""" self.start_zoom.set_available(False) self.start_lat.set_available(False) self.start_lon.set_available(False) value = self.enable_start.get_value() if value: self.start_zoom.set_available(True) self.start_lat.set_available(True) self.start_lon.set_available(True) @staticmethod def get_person_filters(menu): """Get menu option filter list of custon and generic filters.""" custom = CustomFilters.get_filters("Person") menu.filter_list = [(0, _("Ancestors of <selected person>")), (1, _("Descendants of <selected person>"))] for item in enumerate([x.get_name() for x in custom], start=2): menu.filter_list.append(item) @staticmethod def make_default_style(default_style): """Define the default styling.""" para = ParagraphStyle() default_style.add_paragraph_style("Default", para)