addons-source icon indicating copy to clipboard operation
addons-source copied to clipboard

Initial version of FamilyTree DNA gramplet

Open GaryGriffin opened this issue 1 year ago • 6 comments

New gramplet to collect data from FamilyTreeDNA site and import haplogroups and DNA Segments. Creates association for each match and uploads info

GaryGriffin avatar Sep 15 '24 18:09 GaryGriffin

The .gpr.py file is not compatible with 5.1 (even if you change the target version). It uses incompatible attributes and values for 5.1 register.py module.

Here is a cross-compatible registration file that should require no modification. The help_url has been re-targeted for a URL that follows the wiki's naming conventions. There are commented items for future development needs (remembering that 5.1 cannot parse secure http URLs. Also the Author eMailing address points at the Discourse discussion. :

# encoding:utf-8
#
# Gramps plugin- an addon gramplet for
# the Gramps GTK+/GNOME based genealogy program
#
# Copyright (C) 2024-       Gary Griffin
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#

# ------------------------------------------------------------------------
#
# Gramps Plugin Registration (metadata and configuration information)
#    a sidecar to the file identified below as the fname (filename)
#    see https://gramps-project.org/wiki/index.php/Gramps_Glossary#addon
#
# ------------------------------------------------------------------------

# See https://www.gramps-project.org/wiki/index.php/Gramplets

from gramps.version import major_version, VERSION_TUPLE

if VERSION_TUPLE < (5, 2, 0):
    additional_args = {
        "status": STABLE, # required
#        "help_url": "Gramplets",#secure http not supported in these versions
    }
else:
    additional_args = {
        "status": STABLE, # required, supports new values
        "audience": EXPERT,
        "maintainers": ["Gary Griffin",
            "Gramps Bugtracker"],
        "maintainers_email": ["",
            "https://gramps-project.org/bugs"],
#        "help_url": "https://github.com/emyoulation/experimental-addons-source",
#        "requires_mod": ['svgwrite'],
#        "requires_gi": [('GooCanvas', '2.0,3.0')],
#        "requires_exe": ['dot'],
    }

# ------------------------------------------------------------------------
#
# Register Gramplet
#
# ------------------------------------------------------------------------

register(GRAMPLET, # uppercase
        id="FamilyTree DNA Import Gramplet",
        name=_("FamilyTree DNA"),
        description=_("Gramplet to import "
            "FamilyFinder dna data from FamilyTree"
        ), # optional
        navtypes=["Person","Dashboard"], # optional
        authors=["Gary Griffin"], # optional
        authors_email=["https://gramps.discourse.group/t/6070"], # optional
        fname="ftdna_import.py",
        height=375,
        detached_width=510, # optional
        detached_height=480, # optional
        expand=True, # optional
        gramplet='FamilyTreeDNA',
        gramplet_title=_("FamilyTree DNA"),
        version = '1.0.20',
        gramps_target_version=major_version,
        help_url="Addon:FamilyTree_DNA",
        include_in_listing = True,
        **additional_args,
        )

emyoulation avatar Sep 15 '24 20:09 emyoulation

Attempted image

631761_Family_Finder_Matches_2024-09-15a.csv 1.4MB (edited in LibreOffice calc to have a few "GRAMPSID=" in the 1st line of Notes) 631761_Chromosome_Browser_Results_20240915.csv 316.8kb

4139201: ERROR: grampsapp.py: line 188: Unhandled exception
Traceback (most recent call last):
  File "/home/districtsupport/.gramps/gramps52/plugins/FamilyTreeDNA/ftdna_import.py", line 158, in __import_ftdna_data
    count = self.__add_associations()
            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/districtsupport/.gramps/gramps52/plugins/FamilyTreeDNA/ftdna_import.py", line 254, in __add_associations
    match_handle = match_person.get_handle()
                   ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_handle'

emyoulation avatar Sep 15 '24 21:09 emyoulation

I dont want to move to a multi-release syntax for the gpr file until it is a general move of all addons. Lets keep this 5.2 only since I do want the 'expert' mode.

GaryGriffin avatar Sep 15 '24 22:09 GaryGriffin

I understand that choice. The multi-release Registration system is... a bit of a plumber's nightmare.

However, please change the help_url target.

help_url="Addon:FamilyTree_DNA",

emyoulation avatar Sep 16 '24 00:09 emyoulation

Can you have different File Chooser titles when selecting the "Family Finder Matches" and the "Chromosome Browser" Results? Both currently have dialog titled "Select a File"

Alternatively, perhaps you could have a default name filter ( Chromosome.csv and Family-Finder.csv ) in the File Chooser dialog?

It is easy to lose track of which file needs to be specified. Particularly since the 2 files are going to typically be saved in the same folder and alphabetical sort of the default naming ( kitNumber_Family_Finder_Matches_yyyy-mm-dd.csv and kitNumber_Chromosome_Browser_Results_yyyymmdd.csv) will puts them in reverse order in the selection dialog.

emyoulation avatar Sep 16 '24 18:09 emyoulation

The Mac does not have a title for the File Chooser. So this is a blind change. See if it works for you.

GaryGriffin avatar Sep 16 '24 18:09 GaryGriffin