コード例 #1
0
ファイル: differences.py プロジェクト: SNoiraud/addons-source
    def add_menu_options(self, menu):
        """ Add the options for the text differences report """
        category_name = _("Report Options")
        filename = DestinationOption(_("Family Tree file"), "data.gramps")
        filename.set_help(_("Select a .gpkg or .gramps file"))
        menu.add_option(category_name, "filename", filename)

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

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

        show_added = BooleanOption(_("Show items added in file"), True)
        show_added.set_help(_("Include items in file but not in database"))
        menu.add_option(category_name, "show_added", show_added)
コード例 #2
0
ファイル: differences.py プロジェクト: prculley/addons-source
    def add_menu_options(self, menu):
        """ Add the options for the text differences report """
        category_name = _("Report Options")
        filename = DestinationOption(_("Family Tree file"), "data.gramps")
        filename.set_help(_("Select a .gpkg or .gramps file"))
        menu.add_option(category_name, "filename", filename)

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

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

        show_added = BooleanOption(_("Show items added in file"), True)
        show_added.set_help(_("Include items in file but not in database"))
        menu.add_option(category_name, "show_added", show_added)
コード例 #3
0
    def add_menu_options(self, menu):
        """
        Add options to the menu for the ancestral fan chart report.
        """
        category_name = _("Ancestral Fan Chart Options")

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

        # We must figure out the value of the first option before we can
        # create the EnumeratedListOption
        fmt_list = global_name_display.get_name_format()
        name_format = EnumeratedListOption(_("Name format"), 0)
        name_format.add_item(0, _("Default"))
        for num, name, fmt_str, act in fmt_list:
            name_format.add_item(num, name)
        name_format.set_help(_("Select the format to display names"))
        menu.add_option(category_name, "name_format", name_format)

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

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

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

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

        dest_file = StringOption(_("Filename"), "AncestralFanchart.html")
        dest_file.set_help(_("The destination file name for html content."))
        menu.add_option(category_name, "dest_file", dest_file)
コード例 #4
0
    def add_menu_options(self, menu):
        """
        Add options to the menu for the ancestral fan chart report.
        """
        category_name = _("Ancestral Fan Chart Options")

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

        # We must figure out the value of the first option before we can
        # create the EnumeratedListOption
        fmt_list = global_name_display.get_name_format()
        name_format = EnumeratedListOption(_("Name format"), 0)
        name_format.add_item(0, _("Default"))
        for num, name, fmt_str, act in fmt_list:
            name_format.add_item(num, name)
        name_format.set_help(_("Select the format to display names"))
        menu.add_option(category_name, "name_format", name_format)

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

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

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

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

        dest_file = StringOption(_("Filename"), "AncestralFanchart.html")
        dest_file.set_help(_("The destination file name for html content."))
        menu.add_option(category_name, "dest_file", dest_file)
コード例 #5
0
    def add_menu_options(self, menu):
        """
        Add options to the menu for the ancestral collapsible tree report.
        """
        category_name = _("Ancestral Collapsible Tree Options")

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

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

        # We must figure out the value of the first option before we can
        # create the EnumeratedListOption
        fmt_list = global_name_display.get_name_format()
        name_format = EnumeratedListOption(_("Name format"), 0)
        name_format.add_item(0, _("Default"))
        for num, name, fmt_str, act in fmt_list:
            name_format.add_item(num, name)
        name_format.set_help(_("Select the format to display names"))
        menu.add_option(category_name, "name_format", name_format)

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

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

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

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

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

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

        dest_file = StringOption(_("Filename"), "AncestralCollapsible.html")
        dest_file.set_help(_("The destination file name for html content."))
        menu.add_option(category_name, "dest_file", dest_file)
コード例 #6
0
    def add_menu_options(self, menu):
        """ Add options to the menu for the ancestral fan chart report. """
        # ---------------------------- *
        category_general = _("General")

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        scale_x = StringOption(
            _("Number of pixel between left border and scale"), "10"
        )
        scale_x.set_help(_("Number of pixel between left border and scale"))
        menu.add_option(category_size, "scale_x", scale_x)
コード例 #7
0
    def add_menu_options(self, menu):
        """
        Add options to the menu for the ancestral collapsible tree report.
        """
        category_name = _("Ancestral Collapsible Tree Options")

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

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

        # We must figure out the value of the first option before we can
        # create the EnumeratedListOption
        fmt_list = global_name_display.get_name_format()
        name_format = EnumeratedListOption(_("Name format"), 0)
        name_format.add_item(0, _("Default"))
        for num, name, fmt_str, act in fmt_list:
            name_format.add_item(num, name)
        name_format.set_help(_("Select the format to display names"))
        menu.add_option(category_name, "name_format", name_format)

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

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

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

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

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

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

        dest_file = StringOption(_("Filename"), "AncestralCollapsible.html")
        dest_file.set_help(_("The destination file name for html content."))
        menu.add_option(category_name, "dest_file", dest_file)
コード例 #8
0
    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)