Esempio n. 1
0
    def add_menu_options(self, menu):
        """ Add the options for this report """
        category_name = _("Report Options")

        title = StringOption(_("book|Title"), _("Title of the Book"))
        title.set_help(_("Title string for the book."))
        menu.add_option(category_name, "title", title)

        subtitle = StringOption(_("Subtitle"), _("Subtitle of the Book"))
        subtitle.set_help(_("Subtitle string for the book."))
        menu.add_option(category_name, "subtitle", subtitle)

        dateinfo = time.localtime(time.time())
        rname = self.__db.get_researcher().get_name()
        footer_string = _("Copyright %(year)d %(name)s") % {"year": dateinfo[0], "name": rname}
        footer = StringOption(_("Footer"), footer_string)
        footer.set_help(_("Footer string for the page."))
        menu.add_option(category_name, "footer", footer)

        imgid = MediaOption(_("Image"))
        imgid.set_help(_("Gramps ID of the media object to use as an image."))
        menu.add_option(category_name, "imgid", imgid)

        imgsize = NumberOption(_("Image Size"), 0, 0, 20, 0.1)
        imgsize.set_help(
            _("Size of the image in cm. A value of 0 indicates " "that the image should be fit to the page.")
        )
        menu.add_option(category_name, "imgsize", imgsize)
Esempio n. 2
0
    def add_menu_options(self, menu):
        """ Add the options for this report """
        category_name = _("Report Options")

        self.__title = StringOption(_('book|Title'), _('Title of the Book'))
        self.__title.set_help(_("Title string for the book."))
        menu.add_option(category_name, "title", self.__title)

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

        dateinfo = time.localtime(time.time())
        rname = self.__db.get_researcher().get_name()
        footer_string = _('Copyright %(year)d %(name)s') % {
            'year': dateinfo[0],
            'name': rname
        }
        footer = StringOption(_('Footer'), footer_string)
        footer.set_help(_("Footer string for the page."))
        menu.add_option(category_name, "footer", footer)

        imgid = MediaOption(_('Image'))
        imgid.set_help(_("Gramps ID of the media object to use as an image."))
        menu.add_option(category_name, "imgid", imgid)

        imgsize = NumberOption(_('Image Size'), 0, 0, 20, 0.1)
        imgsize.set_help(
            _("Size of the image in cm. A value of 0 indicates "
              "that the image should be fit to the page."))
        menu.add_option(category_name, "imgsize", imgsize)
Esempio n. 3
0
    def add_menu_options(self, menu):
        """Add the options to the report option menu"""
        head = StringOption(_("Heading"), "")
        menu.add_option(_("Report Options"), "head", head)

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

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

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

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

        incl_data = BooleanOption(_("Include media data"), False)
        incl_data.set_help(_("Tags, notes and attributes will be included"))
        menu.add_option(_("Report Options"), "incl_data", incl_data)
Esempio n. 4
0
    def add_menu_options(self, menu):
        """
        Add all menu options to the tool window.
        """
        # generate list for category menu option
        words = [
            _("male"),
            _("female"),
            _("unknown"),
            _("Option"),
            _("single image mode")
        ]
        itm1 = "{} 1: {}".format(words[3], words[4])
        itm2 = "{} 2: {}/{}/{}".format(words[3], words[0], words[1], words[2])
        category_names = [(0, itm1), (1, itm2)]

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

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

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

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

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

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

        self.__remove = BooleanOption(_("Remove images from people"), False)
        txt = _("Remove selected image(s).")
        self.__remove.set_help(txt)
        menu.add_option(_("Options"), "remove", self.__remove)
Esempio n. 5
0
class AvatarGeneratorOptions(MenuToolOptions):
    def __init__(self, name, person_id=None, dbstate=None):
        self.__db = dbstate.get_database()
        MenuToolOptions.__init__(self, name, person_id, dbstate)

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

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

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

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

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

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

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

        self.__remove = BooleanOption(_("Remove images from people"), False)
        txt = _("Remove selected image(s).")
        self.__remove.set_help(txt)
        menu.add_option(_("Options"), "remove", self.__remove)

    def __update_filters(self):
        """
        Update 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.__person_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.__person_filter.get_value()
        if filter_value in [1, 2, 3, 4]:
            self.__pid.set_available(True)
        else:
            self.__pid.set_available(False)

    def __update_options(self):
        """
        Update the availability of media options in the menu depending on
        what the user selects in menu option"category".
        """
        self.__media2.set_available(False)
        self.__media3.set_available(False)
        if self.__category.get_value() == 1:
            self.__media2.set_available(True)
            self.__media3.set_available(True)