def __init__(self, label): """ @param label: A friendly label to be applied to this option. Example: "Center Person" @type label: string @param value: A Gramps ID of a person for this option. Example: "p11" @type value: string @return: nothing """ StringOption.__init__(self, label, "")
def __init__(self, label): """ @param label: A friendly label to be applied to this option. Example: "Title Note" @type label: string @param value: A Gramps ID of a note for this option. Example: "n11" @type value: string @return: nothing """ StringOption.__init__(self, label, "")
def __init__(self, label): """ @param label: A friendly label to be applied to this option. Example: "Image" @type label: string @param value: A Gramps ID of a media object for this option. Example: "m11" @type value: string @return: nothing """ StringOption.__init__(self, label, "")
def __init__(self, label, value): """ @param label: A friendly label to be applied to this option. Example: "File Name" @type label: string @param value: A default destination for this option. Example: "/home/username/Desktop/" Example: "/home/username/Desktop/report.pdf" @type value: string @param is_directory: Specifies whether the destination is a directory or a file. @type value: bool @return: nothing """ StringOption.__init__(self, label, value) self.__is_directory = False self.__extension = ""
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 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)
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) self.__update_filters() 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) footer = StringOption(_("Footer text"), "") menu.add_option(category_name, "footer", footer) for (text, varname, default) in RECORDS: option = BooleanOption(text, default) if varname.startswith('person'): category_name = _("Person Records") elif varname.startswith('family'): category_name = _("Family Records") menu.add_option(category_name, varname, option)
def add_menu_options(self, menu): """ Add the options for the graphical calendar """ add_option = partial(menu.add_option, _("Report Options")) year = NumberOption(_("Year of calendar"), time.localtime()[0], 1000, 3000) year.set_help(_("Year of calendar")) add_option("year", year) self.__filter = FilterOption(_("Filter"), 0) self.__filter.set_help( _("Select filter to restrict people that appear on calendar")) add_option("filter", self.__filter) 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) self.__update_filters() # We must figure out the value of the first option before we can # create the EnumeratedListOption fmt_list = _nd.get_name_format() name_format = EnumeratedListOption(_("Name format"), fmt_list[0][0]) 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")) add_option("name_format", name_format) country = EnumeratedListOption(_("Country for holidays"), 0) holiday_table = libholiday.HolidayTable() countries = holiday_table.get_countries() countries.sort() if (len(countries) == 0 or (len(countries) > 0 and countries[0] != '')): countries.insert(0, '') count = 0 for c in countries: country.add_item(count, c) count += 1 country.set_help(_("Select the country to see associated holidays")) add_option("country", country) start_dow = EnumeratedListOption(_("First day of week"), 1) for count in range(1, 8): # conversion between gramps numbering (sun=1) and iso numbering (mon=1) of weekdays below start_dow.add_item((count + 5) % 7 + 1, GrampsLocale.long_days[count].capitalize()) start_dow.set_help( _("Select the first day of the week for the calendar")) add_option("start_dow", start_dow) maiden_name = EnumeratedListOption(_("Birthday surname"), "own") maiden_name.add_item( "spouse_first", _("Wives use husband's surname (from first family listed)")) maiden_name.add_item( "spouse_last", _("Wives use husband's surname (from last family listed)")) maiden_name.add_item("own", _("Wives use their own surname")) maiden_name.set_help(_("Select married women's displayed surname")) add_option("maiden_name", maiden_name) alive = BooleanOption(_("Include only living people"), True) alive.set_help(_("Include only living people in the calendar")) add_option("alive", alive) birthdays = BooleanOption(_("Include birthdays"), True) birthdays.set_help(_("Include birthdays in the calendar")) add_option("birthdays", birthdays) anniversaries = BooleanOption(_("Include anniversaries"), True) anniversaries.set_help(_("Include anniversaries in the calendar")) add_option("anniversaries", anniversaries) category_name = _("Text Options") add_option = partial(menu.add_option, _("Text Options")) text1 = StringOption(_("Text Area 1"), _("My Calendar")) text1.set_help(_("First line of text at bottom of calendar")) add_option("text1", text1) text2 = StringOption(_("Text Area 2"), _("Produced with Gramps")) text2.set_help(_("Second line of text at bottom of calendar")) add_option("text2", text2) text3 = StringOption( _("Text Area 3"), "http://gramps-project.org/", ) text3.set_help(_("Third line of text at bottom of calendar")) add_option("text3", text3)
def add_menu_options(self, menu): """ Add the options for this report """ category_name = _("Report Options") title = StringOption(_('book|Title'), _('Title of the Book')) title.set_help(_("Title string for the book.")) menu.add_option(category_name, "title", title) subtitle = StringOption(_('Subtitle'), _('Subtitle of the Book')) subtitle.set_help(_("Subtitle string for the book.")) menu.add_option(category_name, "subtitle", subtitle) dateinfo = time.localtime(time.time()) rname = self.__db.get_researcher().get_name() footer_string = _('Copyright %(year)d %(name)s') % { 'year': dateinfo[0], 'name': rname } footer = StringOption(_('Footer'), footer_string) footer.set_help(_("Footer string for the page.")) menu.add_option(category_name, "footer", footer) imgid = MediaOption(_('Image')) imgid.set_help(_("Gramps ID of the media object to use as an image.")) menu.add_option(category_name, "imgid", imgid) imgsize = NumberOption(_('Image Size'), 0, 0, 20, 0.1) imgsize.set_help( _("Size of the image in cm. A value of 0 indicates " "that the image should be fit to the page.")) menu.add_option(category_name, "imgsize", imgsize)
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 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)
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) 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(_('Co_mpress 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 the Main Display Format")) #Spouse_disp.add_item( 2, _("Yes, and use the the Secondary " # "Display Format")) #Spouse_disp.set_help(_("Show spouses of the center person?")) #menu.add_option(category_name, "Spouse_disp", Spouse_disp) 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) ################## 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) 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 ################## category_name = _("Include") 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) 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() #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)