Merge branch 'master' of github.com:gramps-project/gramps
This commit is contained in:
commit
6110fc7612
@ -90,10 +90,16 @@ before_script:
|
||||
- export PYTHONPATH=meta
|
||||
# set module exclusions. --exclude=TestUser because of older version of mock
|
||||
# without configure_mock
|
||||
- export EXCLUDE="--exclude=TestcaseGenerator --exclude=vcard"
|
||||
- export EXCLUDE="--exclude=TestcaseGenerator"
|
||||
# --exclude=merge_ref_test"
|
||||
# set GRAMPS_RESOURCES for locale, data,image and documentation
|
||||
- export GRAMPS_RESOURCES=.
|
||||
# Install addons
|
||||
- mkdir -p ~/.gramps/gramps50/plugins/
|
||||
- wget https://github.com/gramps-project/addons/raw/master/gramps50/download/CliMerge.addon.tgz
|
||||
- tar -C ~/.gramps/gramps50/plugins -xzf CliMerge.addon.tgz
|
||||
- wget https://github.com/gramps-project/addons/raw/master/gramps50/download/ExportRaw.addon.tgz
|
||||
- tar -C ~/.gramps/gramps50/plugins -xzf ExportRaw.addon.tgz
|
||||
|
||||
script:
|
||||
# Ignore the virtualenv entirely. Use nosetests3, python3 (3.4.0) and coverage
|
||||
|
@ -331,12 +331,14 @@ class CLIManager:
|
||||
recent_files(filename, name)
|
||||
self.file_loaded = True
|
||||
|
||||
def do_reg_plugins(self, dbstate, uistate):
|
||||
def do_reg_plugins(self, dbstate, uistate, rescan=False):
|
||||
"""
|
||||
Register the plugins at initialization time.
|
||||
"""
|
||||
self._pmgr.reg_plugins(PLUGINS_DIR, dbstate, uistate)
|
||||
self._pmgr.reg_plugins(PLUGINS_DIR, dbstate, uistate, rescan=rescan)
|
||||
self._pmgr.reg_plugins(USER_PLUGINS, dbstate, uistate, load_on_reg=True)
|
||||
if rescan: # supports updated plugin installs
|
||||
self._pmgr.reload_plugins()
|
||||
|
||||
def startcli(errors, argparser):
|
||||
"""
|
||||
|
@ -77,14 +77,13 @@ class Test(unittest.TestCase):
|
||||
# This tests the fix for bug #1331-1334
|
||||
# read trivial gedcom input, write gedcom output
|
||||
def test2_exec_CLI(self):
|
||||
pyexec = sys.executable
|
||||
ifile = min1r
|
||||
ofile = out_ged
|
||||
gcmd = "Gramps.py -i %s -e %s" % (ifile, ofile)
|
||||
process = subprocess.Popen("%s %s" % (pyexec, gcmd),
|
||||
gcmd = [sys.executable, "Gramps.py", "-i", ifile, "-e", ofile]
|
||||
process = subprocess.Popen(gcmd,
|
||||
stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE, shell=True)
|
||||
stderr=subprocess.PIPE)
|
||||
result_str, err_str = process.communicate()
|
||||
self.assertEqual(process.returncode, 0,
|
||||
"executed CLI command %r" % gcmd)
|
||||
@ -110,14 +109,13 @@ class Test(unittest.TestCase):
|
||||
f.write("garbage")
|
||||
|
||||
# ~same as test 2
|
||||
pyexec = sys.executable
|
||||
ifile = min1r
|
||||
ofile = out_ged
|
||||
gcmd = "Gramps.py -i %s -e %s" % (ifile, ofile)
|
||||
process = subprocess.Popen("%s %s" % (pyexec, gcmd),
|
||||
gcmd = [sys.executable, "Gramps.py", "-i", ifile, "-e", ofile]
|
||||
process = subprocess.Popen(gcmd,
|
||||
stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE, shell=True)
|
||||
stderr=subprocess.PIPE)
|
||||
result_str, err_str = process.communicate()
|
||||
self.assertEqual(process.returncode, 0,
|
||||
"executed CLI command %r" % gcmd)
|
||||
|
@ -44,10 +44,10 @@ _SPINNER = ['|', '/', '-', '\\']
|
||||
# User class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class User(user.User):
|
||||
class User(user.UserBase):
|
||||
"""
|
||||
This class provides a means to interact with the user via CLI.
|
||||
It implements the interface in :class:`.gen.user.User`
|
||||
It implements the interface in :class:`.gen.user.UserBase`
|
||||
"""
|
||||
def __init__(self, callback=None, error=None,
|
||||
auto_accept=False, quiet=False,
|
||||
@ -58,7 +58,7 @@ class User(user.User):
|
||||
:param error: If given, notify_error delegates to this callback
|
||||
:type error: function(title, error)
|
||||
"""
|
||||
user.User.__init__(self, callback, error, uistate, dbstate)
|
||||
user.UserBase.__init__(self, callback, error, uistate, dbstate)
|
||||
self.steps = 0;
|
||||
self.current_step = 0;
|
||||
self._input = input
|
||||
@ -169,7 +169,7 @@ class User(user.User):
|
||||
:type warning: str
|
||||
:returns: none
|
||||
"""
|
||||
self._fileout.write("%s %s" % (title, warning))
|
||||
self._fileout.write("%s\n%s\n" % (title, warning))
|
||||
|
||||
def notify_error(self, title, error=""):
|
||||
"""
|
||||
|
@ -23,7 +23,7 @@
|
||||
#
|
||||
|
||||
"""
|
||||
This package implements access to GRAMPS configuration.
|
||||
This package implements access to Gramps configuration.
|
||||
"""
|
||||
|
||||
#---------------------------------------------------------------
|
||||
|
@ -41,9 +41,9 @@ import uuid
|
||||
#-------------------------------------------------------------------------
|
||||
from .git_revision import get_git_revision
|
||||
from .constfunc import get_env_var
|
||||
from gramps.version import VERSION, VERSION_TUPLE, major_version
|
||||
from gramps.gen.utils.resourcepath import ResourcePath
|
||||
from gramps.gen.utils.grampslocale import GrampsLocale
|
||||
from ..version import VERSION, VERSION_TUPLE, major_version
|
||||
from .utils.resourcepath import ResourcePath
|
||||
from .utils.grampslocale import GrampsLocale
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -97,14 +97,20 @@ except:
|
||||
from ._dateutils import *
|
||||
from ._grampslocale import (codeset, tformat)
|
||||
|
||||
# set GRAMPS_RESOURCES then: python3 -m gramps.gen.datehandler.__init__
|
||||
if __name__ == "__main__":
|
||||
from ._datedisplay import DateDisplay
|
||||
m = 0
|
||||
for l,d in LANG_TO_DISPLAY.items():
|
||||
if len(l) != 2:
|
||||
date_handlers = sorted(LANG_TO_DISPLAY.items())
|
||||
for l,d in date_handlers:
|
||||
if len(l) != 2 and l not in ('zh_TW'): # Chinese has two date_handlers
|
||||
continue
|
||||
if l.upper() == l and (l.lower(),d) in date_handlers:
|
||||
continue # don't need to see the upper-case variant also
|
||||
m = max(m, len(d.formats))
|
||||
print("{}: {} {} own dg: {}".format(
|
||||
print("{}: {} {} own-f:{} own-dc:{} own-dg:{}".format(
|
||||
l, len(d.formats), d.formats,
|
||||
d.formats != DateDisplay.formats,
|
||||
d._display_calendar != DateDisplay._display_calendar,
|
||||
d._display_gregorian != DateDisplay._display_gregorian))
|
||||
print("MAX: ", m)
|
||||
|
@ -33,7 +33,7 @@ import re
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from ..lib.date import Date
|
||||
|
@ -33,7 +33,7 @@ import re
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from ..lib.date import Date
|
||||
|
@ -66,6 +66,7 @@ class DateParserSL(DateParser):
|
||||
'ca.' : Date.MOD_ABOUT,
|
||||
'približno' : Date.MOD_ABOUT,
|
||||
'pribl.' : Date.MOD_ABOUT,
|
||||
'~' : Date.MOD_ABOUT,
|
||||
}
|
||||
|
||||
quality_to_int = {
|
||||
|
@ -44,6 +44,10 @@ from . import _grampslocale
|
||||
from ..utils.grampslocale import GrampsLocale
|
||||
from ._datestrings import DateStrings
|
||||
|
||||
# _T_ is a gramps-defined keyword -- see po/update_po.py and po/genpot.sh
|
||||
def _T_(value): # enable deferred translations (see Python docs 22.1.3.4)
|
||||
return value
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# DateDisplay
|
||||
@ -53,33 +57,31 @@ class DateDisplay:
|
||||
"""
|
||||
Base date display class.
|
||||
"""
|
||||
_locale = GrampsLocale(lang='en_US', languages='en')
|
||||
|
||||
_tformat = _grampslocale.tformat
|
||||
|
||||
_ = _grampslocale.glocale.translation.sgettext
|
||||
formats = (
|
||||
# format 0 - must always be ISO
|
||||
_("YYYY-MM-DD (ISO)"),
|
||||
_T_("YYYY-MM-DD (ISO)"),
|
||||
|
||||
# format # 1 - must always be locale-preferred numerical format
|
||||
# such as YY.MM.DD, MM-DD-YY, or whatever your locale prefers.
|
||||
# This should be the format that is used under the locale by
|
||||
# strftime() for '%x'.
|
||||
# You may translate this as "Numerical", "System preferred", or similar.
|
||||
_("date format|Numerical"),
|
||||
_T_("date format|Numerical"),
|
||||
|
||||
# Full month name, day, year
|
||||
_("Month Day, Year"),
|
||||
_T_("Month Day, Year"),
|
||||
|
||||
# Abbreviated month name, day, year
|
||||
_("MON DAY, YEAR"),
|
||||
_T_("MON DAY, YEAR"),
|
||||
|
||||
# Day, full month name, year
|
||||
_("Day Month Year"),
|
||||
_T_("Day Month Year"),
|
||||
|
||||
# Day, abbreviated month name, year
|
||||
_("DAY MON YEAR")
|
||||
_T_("DAY MON YEAR")
|
||||
)
|
||||
"""
|
||||
.. note:: Will be overridden if a locale-specific date displayer exists.
|
||||
@ -90,7 +92,6 @@ class DateDisplay:
|
||||
This ``formats`` must agree with
|
||||
:meth:`~_display_calendar`/:meth:`~_display_gregorian`.
|
||||
"""
|
||||
del _
|
||||
|
||||
newyear = ("", "Mar1", "Mar25", "Sep1")
|
||||
|
||||
@ -728,4 +729,4 @@ class DateDisplayEn(DateDisplay):
|
||||
|
||||
display = DateDisplay.display_formatted
|
||||
|
||||
_locale = DateDisplay._locale # normally set in register_datehandler
|
||||
_locale = GrampsLocale(languages='en') # no register_datehandler here
|
||||
|
@ -46,7 +46,7 @@ from ._dateparser import DateParser
|
||||
from ._datedisplay import DateDisplay, DateDisplayEn
|
||||
from ..constfunc import win
|
||||
from ..const import GRAMPS_LOCALE as glocale
|
||||
from gramps.gen.utils.grampslocale import GrampsLocale
|
||||
from ..utils.grampslocale import GrampsLocale
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -84,7 +84,7 @@ LANG_TO_DISPLAY = {
|
||||
'en_GB' : DateDisplayEn,
|
||||
'English_United States' : DateDisplayEn,
|
||||
'ko_KR' : DateDisplay,
|
||||
'nb_NO' : DateDisplay,
|
||||
'nb_NO' : DateDisplay, # TODO this's in _date_nb, why here?
|
||||
}
|
||||
|
||||
def register_datehandler(locales,parse_class,display_class):
|
||||
|
@ -251,7 +251,7 @@ class DateStrings:
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from ..utils.grampslocale import GrampsLocale
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
from ..const import GRAMPS_LOCALE as glocale
|
||||
from ._grampslocale import (_deprecated_long_months as old_long,
|
||||
_deprecated_short_months as old_short,
|
||||
_deprecated_long_days as old_days)
|
||||
|
@ -34,6 +34,7 @@ import time
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from ..const import GRAMPS_LOCALE as glocale
|
||||
from ..lib.date import Date
|
||||
from . import LANG_TO_DISPLAY, LANG, parser, displayer
|
||||
|
||||
@ -42,14 +43,22 @@ from . import LANG_TO_DISPLAY, LANG, parser, displayer
|
||||
# Convenience functions
|
||||
#
|
||||
#--------------------------------------------------------------
|
||||
def get_date_formats():
|
||||
def get_date_formats(flocale=glocale):
|
||||
"""
|
||||
Return the list of supported formats for date parsers and displayers.
|
||||
The UI language formats will be used unless another locale is fed in.
|
||||
|
||||
:param flocale: allow deferred translation of date formats
|
||||
:type flocale: a :class:`.GrampsLocale` instance
|
||||
"""
|
||||
# trans_text is a defined keyword (see po/update_po.py, po/genpot.sh)
|
||||
trans_text = flocale.translation.sgettext
|
||||
try:
|
||||
return LANG_TO_DISPLAY[LANG].formats
|
||||
return tuple(trans_text(fmt)
|
||||
for fmt in LANG_TO_DISPLAY[flocale.lang].formats)
|
||||
except:
|
||||
return LANG_TO_DISPLAY["C"].formats
|
||||
return tuple(trans_text(fmt)
|
||||
for fmt in LANG_TO_DISPLAY['C'].formats)
|
||||
|
||||
def set_format(value):
|
||||
try:
|
||||
|
@ -21,7 +21,7 @@
|
||||
#
|
||||
|
||||
import locale
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
from ..const import GRAMPS_LOCALE as glocale
|
||||
|
||||
"""
|
||||
Some OS environments do not support the locale.nl_langinfo() method
|
||||
|
@ -30,8 +30,8 @@ from ...lib.date import Date
|
||||
|
||||
class DateDisplayTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
from .._datedisplay import DateDisplay
|
||||
self.display = DateDisplay()
|
||||
from .._datedisplay import DateDisplayEn
|
||||
self.display = DateDisplayEn()
|
||||
self.display_RU = GrampsLocale(lang='ru').date_displayer
|
||||
|
||||
def assert_map_key_val(self, m, k, v):
|
||||
|
@ -74,12 +74,6 @@ class DbReadBase:
|
||||
self.basedb = self
|
||||
self.__feature = {} # {"feature": VALUE, ...}
|
||||
|
||||
def get_table_func(self, table=None, func=None):
|
||||
"""
|
||||
Base implementation of get_table_func.
|
||||
"""
|
||||
return None
|
||||
|
||||
def get_feature(self, feature):
|
||||
"""
|
||||
Databases can implement certain features or not. The default is
|
||||
|
@ -63,10 +63,10 @@ from functools import wraps
|
||||
# Gramps libraries
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.db.base import DbReadBase
|
||||
from gramps.gen.db.dbconst import DBLOGNAME
|
||||
from gramps.gen.errors import HandleError
|
||||
from gramps.gen.utils.callback import Callback
|
||||
from .base import DbReadBase
|
||||
from .dbconst import DBLOGNAME
|
||||
from ..errors import HandleError
|
||||
from ..utils.callback import Callback
|
||||
|
||||
LOG = logging.getLogger(DBLOGNAME)
|
||||
|
||||
|
@ -25,8 +25,8 @@
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import URL_WIKISTRING, URL_MANUAL_PAGE
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
from ..const import URL_WIKISTRING, URL_MANUAL_PAGE
|
||||
from ..const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
|
@ -41,24 +41,23 @@ import glob
|
||||
# Gramps Modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gramps.gen.db import (DbReadBase, DbWriteBase, DbUndo, DBLOGNAME,
|
||||
DBUNDOFN, KEY_TO_CLASS_MAP, REFERENCE_KEY,
|
||||
PERSON_KEY, FAMILY_KEY, CITATION_KEY,
|
||||
SOURCE_KEY, EVENT_KEY, MEDIA_KEY,
|
||||
PLACE_KEY, REPOSITORY_KEY, NOTE_KEY, TAG_KEY)
|
||||
from gramps.gen.errors import HandleError
|
||||
from gramps.gen.utils.callback import Callback
|
||||
from gramps.gen.updatecallback import UpdateCallback
|
||||
from gramps.gen.db.bookmarks import DbBookmarks
|
||||
from gramps.gen.db import exceptions
|
||||
from . import (DbReadBase, DbWriteBase, DbUndo, DBLOGNAME, DBUNDOFN,
|
||||
KEY_TO_CLASS_MAP, REFERENCE_KEY, PERSON_KEY, FAMILY_KEY,
|
||||
CITATION_KEY, SOURCE_KEY, EVENT_KEY, MEDIA_KEY, PLACE_KEY,
|
||||
REPOSITORY_KEY, NOTE_KEY, TAG_KEY)
|
||||
from ..errors import HandleError
|
||||
from ..utils.callback import Callback
|
||||
from ..updatecallback import UpdateCallback
|
||||
from .bookmarks import DbBookmarks
|
||||
from . import exceptions
|
||||
|
||||
from gramps.gen.utils.id import create_id
|
||||
from gramps.gen.lib.researcher import Researcher
|
||||
from gramps.gen.lib import (Tag, Media, Person, Family, Source, Citation, Event,
|
||||
Place, Repository, Note, NameOriginType)
|
||||
from gramps.gen.lib.genderstats import GenderStats
|
||||
from gramps.gen.config import config
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
from ..utils.id import create_id
|
||||
from ..lib.researcher import Researcher
|
||||
from ..lib import (Tag, Media, Person, Family, Source, Citation, Event,
|
||||
Place, Repository, Note, NameOriginType)
|
||||
from ..lib.genderstats import GenderStats
|
||||
from ..config import config
|
||||
from ..const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
LOG = logging.getLogger(DBLOGNAME)
|
||||
@ -255,7 +254,7 @@ class DbGenericUndo(DbUndo):
|
||||
else:
|
||||
sql = "INSERT INTO %s (handle, blob_data) VALUES (?, ?)" % table
|
||||
self.db.dbapi.execute(sql, [handle, pickle.dumps(data)])
|
||||
obj = self.db.get_table_func(cls)["class_func"].create(data)
|
||||
obj = self.db._get_table_func(cls)["class_func"].create(data)
|
||||
self.db._update_secondary_values(obj)
|
||||
|
||||
def undo_signals(self, data, handle, obj_key, emit, signal_root):
|
||||
@ -672,7 +671,6 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
touch(filename)
|
||||
|
||||
# Save metadata
|
||||
self._txn_begin()
|
||||
self._set_metadata('name_formats', self.name_formats)
|
||||
self._set_metadata('researcher', self.owner)
|
||||
|
||||
@ -723,7 +721,6 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
self._set_metadata('omap_index', self.omap_index)
|
||||
self._set_metadata('rmap_index', self.rmap_index)
|
||||
self._set_metadata('nmap_index', self.nmap_index)
|
||||
self._txn_commit()
|
||||
|
||||
self._close()
|
||||
self.db_is_open = False
|
||||
@ -764,7 +761,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def get_table_func(self, table=None, func=None):
|
||||
def _get_table_func(self, table=None, func=None):
|
||||
"""
|
||||
Private implementation of get_table_func.
|
||||
"""
|
||||
@ -775,16 +772,45 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
elif func in self.__tables[table].keys():
|
||||
return self.__tables[table][func]
|
||||
else:
|
||||
return super().get_table_func(table, func)
|
||||
return None
|
||||
|
||||
def get_table_names(self):
|
||||
"""Return a list of valid table names."""
|
||||
return list(self.get_table_func())
|
||||
return list(self._get_table_func())
|
||||
|
||||
def get_table_metadata(self, table_name):
|
||||
"""Return the metadata for a valid table name."""
|
||||
if table_name in self.get_table_func():
|
||||
return self.get_table_func(table_name)
|
||||
if table_name in self._get_table_func():
|
||||
return self._get_table_func(table_name)
|
||||
return None
|
||||
|
||||
def get_from_name_and_handle(self, table_name, handle):
|
||||
"""
|
||||
Returns a gen.lib object (or None) given table_name and
|
||||
handle.
|
||||
|
||||
Examples:
|
||||
|
||||
>>> self.get_from_name_and_handle("Person", "a7ad62365bc652387008")
|
||||
>>> self.get_from_name_and_handle("Media", "c3434653675bcd736f23")
|
||||
"""
|
||||
if table_name in self._get_table_func() and handle:
|
||||
return self._get_table_func(table_name, "handle_func")(handle)
|
||||
return None
|
||||
|
||||
def get_from_name_and_gramps_id(self, table_name, gramps_id):
|
||||
"""
|
||||
Returns a gen.lib object (or None) given table_name and
|
||||
Gramps ID.
|
||||
|
||||
Examples:
|
||||
|
||||
>>> self.get_from_name_and_gramps_id("Person", "I00002")
|
||||
>>> self.get_from_name_and_gramps_id("Family", "F056")
|
||||
>>> self.get_from_name_and_gramps_id("Media", "M00012")
|
||||
"""
|
||||
if table_name in self._get_table_func():
|
||||
return self._get_table_func(table_name, "gramps_id_func")(gramps_id)
|
||||
return None
|
||||
|
||||
def _txn_begin(self):
|
||||
@ -889,7 +915,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
|
||||
def set_person_id_prefix(self, val):
|
||||
"""
|
||||
Set the naming template for GRAMPS Person ID values.
|
||||
Set the naming template for Gramps Person ID values.
|
||||
|
||||
The string is expected to be in the form of a simple text string, or
|
||||
in a format that contains a C/Python style format string using %d,
|
||||
@ -900,7 +926,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
|
||||
def set_citation_id_prefix(self, val):
|
||||
"""
|
||||
Set the naming template for GRAMPS Citation ID values.
|
||||
Set the naming template for Gramps Citation ID values.
|
||||
|
||||
The string is expected to be in the form of a simple text string, or
|
||||
in a format that contains a C/Python style format string using %d,
|
||||
@ -911,7 +937,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
|
||||
def set_source_id_prefix(self, val):
|
||||
"""
|
||||
Set the naming template for GRAMPS Source ID values.
|
||||
Set the naming template for Gramps Source ID values.
|
||||
|
||||
The string is expected to be in the form of a simple text string, or
|
||||
in a format that contains a C/Python style format string using %d,
|
||||
@ -922,7 +948,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
|
||||
def set_media_id_prefix(self, val):
|
||||
"""
|
||||
Set the naming template for GRAMPS Media ID values.
|
||||
Set the naming template for Gramps Media ID values.
|
||||
|
||||
The string is expected to be in the form of a simple text string, or
|
||||
in a format that contains a C/Python style format string using %d,
|
||||
@ -933,7 +959,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
|
||||
def set_place_id_prefix(self, val):
|
||||
"""
|
||||
Set the naming template for GRAMPS Place ID values.
|
||||
Set the naming template for Gramps Place ID values.
|
||||
|
||||
The string is expected to be in the form of a simple text string, or
|
||||
in a format that contains a C/Python style format string using %d,
|
||||
@ -944,7 +970,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
|
||||
def set_family_id_prefix(self, val):
|
||||
"""
|
||||
Set the naming template for GRAMPS Family ID values. The string is
|
||||
Set the naming template for Gramps Family ID values. The string is
|
||||
expected to be in the form of a simple text string, or in a format
|
||||
that contains a C/Python style format string using %d, such as F%d
|
||||
or F%04d.
|
||||
@ -954,7 +980,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
|
||||
def set_event_id_prefix(self, val):
|
||||
"""
|
||||
Set the naming template for GRAMPS Event ID values.
|
||||
Set the naming template for Gramps Event ID values.
|
||||
|
||||
The string is expected to be in the form of a simple text string, or
|
||||
in a format that contains a C/Python style format string using %d,
|
||||
@ -965,7 +991,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
|
||||
def set_repository_id_prefix(self, val):
|
||||
"""
|
||||
Set the naming template for GRAMPS Repository ID values.
|
||||
Set the naming template for Gramps Repository ID values.
|
||||
|
||||
The string is expected to be in the form of a simple text string, or
|
||||
in a format that contains a C/Python style format string using %d,
|
||||
@ -976,7 +1002,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
|
||||
def set_note_id_prefix(self, val):
|
||||
"""
|
||||
Set the naming template for GRAMPS Note ID values.
|
||||
Set the naming template for Gramps Note ID values.
|
||||
|
||||
The string is expected to be in the form of a simple text string, or
|
||||
in a format that contains a C/Python style format string using %d,
|
||||
@ -1258,135 +1284,48 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
#
|
||||
################################################################
|
||||
|
||||
def get_event_from_handle(self, handle):
|
||||
def _get_from_handle(self, obj_key, obj_class, handle):
|
||||
if isinstance(handle, bytes):
|
||||
handle = str(handle, "utf-8")
|
||||
if handle is None:
|
||||
raise HandleError('Handle is None')
|
||||
if not handle:
|
||||
raise HandleError('Handle is empty')
|
||||
data = self.get_raw_event_data(handle)
|
||||
data = self.get_raw_data(obj_key, handle)
|
||||
if data:
|
||||
return Event.create(data)
|
||||
return obj_class.create(data)
|
||||
else:
|
||||
raise HandleError('Handle %s not found' % handle)
|
||||
|
||||
def get_event_from_handle(self, handle):
|
||||
return self._get_from_handle(EVENT_KEY, Event, handle)
|
||||
|
||||
def get_family_from_handle(self, handle):
|
||||
if isinstance(handle, bytes):
|
||||
handle = str(handle, "utf-8")
|
||||
if handle is None:
|
||||
raise HandleError('Handle is None')
|
||||
if not handle:
|
||||
raise HandleError('Handle is empty')
|
||||
data = self.get_raw_family_data(handle)
|
||||
if data:
|
||||
return Family.create(data)
|
||||
else:
|
||||
raise HandleError('Handle %s not found' % handle)
|
||||
return self._get_from_handle(FAMILY_KEY, Family, handle)
|
||||
|
||||
def get_repository_from_handle(self, handle):
|
||||
if isinstance(handle, bytes):
|
||||
handle = str(handle, "utf-8")
|
||||
if handle is None:
|
||||
raise HandleError('Handle is None')
|
||||
if not handle:
|
||||
raise HandleError('Handle is empty')
|
||||
data = self.get_raw_repository_data(handle)
|
||||
if data:
|
||||
return Repository.create(data)
|
||||
else:
|
||||
raise HandleError('Handle %s not found' % handle)
|
||||
return self._get_from_handle(REPOSITORY_KEY, Repository, handle)
|
||||
|
||||
def get_person_from_handle(self, handle):
|
||||
if isinstance(handle, bytes):
|
||||
handle = str(handle, "utf-8")
|
||||
if handle is None:
|
||||
raise HandleError('Handle is None')
|
||||
if not handle:
|
||||
raise HandleError('Handle is empty')
|
||||
data = self.get_raw_person_data(handle)
|
||||
if data:
|
||||
return Person.create(data)
|
||||
else:
|
||||
raise HandleError('Handle %s not found' % handle)
|
||||
return self._get_from_handle(PERSON_KEY, Person, handle)
|
||||
|
||||
def get_place_from_handle(self, handle):
|
||||
if isinstance(handle, bytes):
|
||||
handle = str(handle, "utf-8")
|
||||
if handle is None:
|
||||
raise HandleError('Handle is None')
|
||||
if not handle:
|
||||
raise HandleError('Handle is empty')
|
||||
data = self.get_raw_place_data(handle)
|
||||
if data:
|
||||
return Place.create(data)
|
||||
else:
|
||||
raise HandleError('Handle %s not found' % handle)
|
||||
return self._get_from_handle(PLACE_KEY, Place, handle)
|
||||
|
||||
def get_citation_from_handle(self, handle):
|
||||
if isinstance(handle, bytes):
|
||||
handle = str(handle, "utf-8")
|
||||
if handle is None:
|
||||
raise HandleError('Handle is None')
|
||||
if not handle:
|
||||
raise HandleError('Handle is empty')
|
||||
data = self.get_raw_citation_data(handle)
|
||||
if data:
|
||||
return Citation.create(data)
|
||||
else:
|
||||
raise HandleError('Handle %s not found' % handle)
|
||||
return self._get_from_handle(CITATION_KEY, Citation, handle)
|
||||
|
||||
def get_source_from_handle(self, handle):
|
||||
if isinstance(handle, bytes):
|
||||
handle = str(handle, "utf-8")
|
||||
if handle is None:
|
||||
raise HandleError('Handle is None')
|
||||
if not handle:
|
||||
raise HandleError('Handle is empty')
|
||||
data = self.get_raw_source_data(handle)
|
||||
if data:
|
||||
return Source.create(data)
|
||||
else:
|
||||
raise HandleError('Handle %s not found' % handle)
|
||||
return self._get_from_handle(SOURCE_KEY, Source, handle)
|
||||
|
||||
def get_note_from_handle(self, handle):
|
||||
if isinstance(handle, bytes):
|
||||
handle = str(handle, "utf-8")
|
||||
if handle is None:
|
||||
raise HandleError('Handle is None')
|
||||
if not handle:
|
||||
raise HandleError('Handle is empty')
|
||||
data = self.get_raw_note_data(handle)
|
||||
if data:
|
||||
return Note.create(data)
|
||||
else:
|
||||
raise HandleError('Handle %s not found' % handle)
|
||||
return self._get_from_handle(NOTE_KEY, Note, handle)
|
||||
|
||||
def get_media_from_handle(self, handle):
|
||||
if isinstance(handle, bytes):
|
||||
handle = str(handle, "utf-8")
|
||||
if handle is None:
|
||||
raise HandleError('Handle is None')
|
||||
if not handle:
|
||||
raise HandleError('Handle is empty')
|
||||
data = self.get_raw_media_data(handle)
|
||||
if data:
|
||||
return Media.create(data)
|
||||
else:
|
||||
raise HandleError('Handle %s not found' % handle)
|
||||
return self._get_from_handle(MEDIA_KEY, Media, handle)
|
||||
|
||||
def get_tag_from_handle(self, handle):
|
||||
if isinstance(handle, bytes):
|
||||
handle = str(handle, "utf-8")
|
||||
if handle is None:
|
||||
raise HandleError('Handle is None')
|
||||
if not handle:
|
||||
raise HandleError('Handle is empty')
|
||||
data = self.get_raw_tag_data(handle)
|
||||
if data:
|
||||
return Tag.create(data)
|
||||
else:
|
||||
raise HandleError('Handle %s not found' % handle)
|
||||
return self._get_from_handle(TAG_KEY, Tag, handle)
|
||||
|
||||
################################################################
|
||||
#
|
||||
@ -1627,7 +1566,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
"""
|
||||
Iterate over items in a class.
|
||||
"""
|
||||
cursor = self.get_table_func(class_.__name__, "cursor_func")
|
||||
cursor = self._get_table_func(class_.__name__, "cursor_func")
|
||||
for data in cursor():
|
||||
yield class_.create(data[1])
|
||||
|
||||
@ -1820,93 +1759,61 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
#
|
||||
################################################################
|
||||
|
||||
def add_person(self, person, trans, set_gid=True):
|
||||
if not person.handle:
|
||||
person.handle = create_id()
|
||||
if (not person.gramps_id) and set_gid:
|
||||
person.gramps_id = self.find_next_person_gramps_id()
|
||||
if not person.gramps_id:
|
||||
def _add_base(self, obj, trans, set_gid, find_func, commit_func):
|
||||
if not obj.handle:
|
||||
obj.handle = create_id()
|
||||
if (not obj.gramps_id) and set_gid:
|
||||
obj.gramps_id = find_func()
|
||||
if (not obj.gramps_id):
|
||||
# give it a random value for the moment:
|
||||
person.gramps_id = str(random.random())
|
||||
self.commit_person(person, trans)
|
||||
return person.handle
|
||||
obj.gramps_id = str(random.random())
|
||||
commit_func(obj, trans)
|
||||
return obj.handle
|
||||
|
||||
def add_person(self, person, trans, set_gid=True):
|
||||
return self._add_base(person, trans, set_gid,
|
||||
self.find_next_person_gramps_id,
|
||||
self.commit_person)
|
||||
|
||||
def add_family(self, family, trans, set_gid=True):
|
||||
if not family.handle:
|
||||
family.handle = create_id()
|
||||
if (not family.gramps_id) and set_gid:
|
||||
family.gramps_id = self.find_next_family_gramps_id()
|
||||
if not family.gramps_id:
|
||||
# give it a random value for the moment:
|
||||
family.gramps_id = str(random.random())
|
||||
self.commit_family(family, trans)
|
||||
return family.handle
|
||||
|
||||
def add_citation(self, citation, trans, set_gid=True):
|
||||
if not citation.handle:
|
||||
citation.handle = create_id()
|
||||
if (not citation.gramps_id) and set_gid:
|
||||
citation.gramps_id = self.find_next_citation_gramps_id()
|
||||
if not citation.gramps_id:
|
||||
# give it a random value for the moment:
|
||||
citation.gramps_id = str(random.random())
|
||||
self.commit_citation(citation, trans)
|
||||
return citation.handle
|
||||
|
||||
def add_source(self, source, trans, set_gid=True):
|
||||
if not source.handle:
|
||||
source.handle = create_id()
|
||||
if (not source.gramps_id) and set_gid:
|
||||
source.gramps_id = self.find_next_source_gramps_id()
|
||||
if not source.gramps_id:
|
||||
# give it a random value for the moment:
|
||||
source.gramps_id = str(random.random())
|
||||
self.commit_source(source, trans)
|
||||
return source.handle
|
||||
|
||||
def add_repository(self, repository, trans, set_gid=True):
|
||||
if not repository.handle:
|
||||
repository.handle = create_id()
|
||||
if (not repository.gramps_id) and set_gid:
|
||||
repository.gramps_id = self.find_next_repository_gramps_id()
|
||||
if not repository.gramps_id:
|
||||
# give it a random value for the moment:
|
||||
repository.gramps_id = str(random.random())
|
||||
self.commit_repository(repository, trans)
|
||||
return repository.handle
|
||||
|
||||
def add_note(self, note, trans, set_gid=True):
|
||||
if not note.handle:
|
||||
note.handle = create_id()
|
||||
if (not note.gramps_id) and set_gid:
|
||||
note.gramps_id = self.find_next_note_gramps_id()
|
||||
if not note.gramps_id:
|
||||
# give it a random value for the moment:
|
||||
note.gramps_id = str(random.random())
|
||||
self.commit_note(note, trans)
|
||||
return note.handle
|
||||
|
||||
def add_place(self, place, trans, set_gid=True):
|
||||
if not place.handle:
|
||||
place.handle = create_id()
|
||||
if (not place.gramps_id) and set_gid:
|
||||
place.gramps_id = self.find_next_place_gramps_id()
|
||||
if not place.gramps_id:
|
||||
# give it a random value for the moment:
|
||||
place.gramps_id = str(random.random())
|
||||
self.commit_place(place, trans)
|
||||
return place.handle
|
||||
return self._add_base(family, trans, set_gid,
|
||||
self.find_next_family_gramps_id,
|
||||
self.commit_family)
|
||||
|
||||
def add_event(self, event, trans, set_gid=True):
|
||||
if not event.handle:
|
||||
event.handle = create_id()
|
||||
if (not event.gramps_id) and set_gid:
|
||||
event.gramps_id = self.find_next_event_gramps_id()
|
||||
if not event.gramps_id:
|
||||
# give it a random value for the moment:
|
||||
event.gramps_id = str(random.random())
|
||||
self.commit_event(event, trans)
|
||||
return event.handle
|
||||
return self._add_base(event, trans, set_gid,
|
||||
self.find_next_event_gramps_id,
|
||||
self.commit_event)
|
||||
|
||||
def add_place(self, place, trans, set_gid=True):
|
||||
return self._add_base(place, trans, set_gid,
|
||||
self.find_next_place_gramps_id,
|
||||
self.commit_place)
|
||||
|
||||
def add_repository(self, repository, trans, set_gid=True):
|
||||
return self._add_base(repository, trans, set_gid,
|
||||
self.find_next_repository_gramps_id,
|
||||
self.commit_repository)
|
||||
|
||||
def add_source(self, source, trans, set_gid=True):
|
||||
return self._add_base(source, trans, set_gid,
|
||||
self.find_next_source_gramps_id,
|
||||
self.commit_source)
|
||||
|
||||
def add_citation(self, citation, trans, set_gid=True):
|
||||
return self._add_base(citation, trans, set_gid,
|
||||
self.find_next_citation_gramps_id,
|
||||
self.commit_citation)
|
||||
|
||||
def add_media(self, media, trans, set_gid=True):
|
||||
return self._add_base(media, trans, set_gid,
|
||||
self.find_next_media_gramps_id,
|
||||
self.commit_media)
|
||||
|
||||
def add_note(self, note, trans, set_gid=True):
|
||||
return self._add_base(note, trans, set_gid,
|
||||
self.find_next_note_gramps_id,
|
||||
self.commit_note)
|
||||
|
||||
def add_tag(self, tag, trans):
|
||||
if not tag.handle:
|
||||
@ -1914,23 +1821,6 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
self.commit_tag(tag, trans)
|
||||
return tag.handle
|
||||
|
||||
def add_media(self, obj, transaction, set_gid=True):
|
||||
"""
|
||||
Add a Media to the database, assigning internal IDs if they have
|
||||
not already been defined.
|
||||
|
||||
If not set_gid, then gramps_id is not set.
|
||||
"""
|
||||
if not obj.handle:
|
||||
obj.handle = create_id()
|
||||
if (not obj.gramps_id) and set_gid:
|
||||
obj.gramps_id = self.find_next_media_gramps_id()
|
||||
if not obj.gramps_id:
|
||||
# give it a random value for the moment:
|
||||
obj.gramps_id = str(random.random())
|
||||
self.commit_media(obj, transaction)
|
||||
return obj.handle
|
||||
|
||||
################################################################
|
||||
#
|
||||
# commit_* methods
|
||||
@ -2507,35 +2397,6 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
self.emit('note-rebuild')
|
||||
self.emit('tag-rebuild')
|
||||
|
||||
def get_from_name_and_handle(self, table_name, handle):
|
||||
"""
|
||||
Returns a gen.lib object (or None) given table_name and
|
||||
handle.
|
||||
|
||||
Examples:
|
||||
|
||||
>>> self.get_from_name_and_handle("Person", "a7ad62365bc652387008")
|
||||
>>> self.get_from_name_and_handle("Media", "c3434653675bcd736f23")
|
||||
"""
|
||||
if table_name in self.get_table_func() and handle:
|
||||
return self.get_table_func(table_name, "handle_func")(handle)
|
||||
return None
|
||||
|
||||
def get_from_name_and_gramps_id(self, table_name, gramps_id):
|
||||
"""
|
||||
Returns a gen.lib object (or None) given table_name and
|
||||
Gramps ID.
|
||||
|
||||
Examples:
|
||||
|
||||
>>> self.get_from_name_and_gramps_id("Person", "I00002")
|
||||
>>> self.get_from_name_and_gramps_id("Family", "F056")
|
||||
>>> self.get_from_name_and_gramps_id("Media", "M00012")
|
||||
"""
|
||||
if table_name in self.get_table_func():
|
||||
return self.get_table_func(table_name, "gramps_id_func")(gramps_id)
|
||||
return None
|
||||
|
||||
def get_save_path(self):
|
||||
return self._directory
|
||||
|
||||
|
@ -172,7 +172,7 @@ def __index_surname(surn_list):
|
||||
pa/matronymic not as they change for every generation!
|
||||
returns a byte string
|
||||
"""
|
||||
from gramps.gen.lib import NameOriginType
|
||||
from ..lib import NameOriginType
|
||||
if surn_list:
|
||||
surn = " ".join([x[0] for x in surn_list if not (x[3][0] in [
|
||||
NameOriginType.PATRONYMIC, NameOriginType.MATRONYMIC])])
|
||||
|
@ -42,8 +42,8 @@ from .db import DbReadBase
|
||||
from .proxy.proxybase import ProxyDbBase
|
||||
from .utils.callback import Callback
|
||||
from .config import config
|
||||
from gramps.gen.db.dbconst import DBLOGNAME
|
||||
from gramps.gen.db.dummydb import DummyDb
|
||||
from .db.dbconst import DBLOGNAME
|
||||
from .db.dummydb import DummyDb
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -19,7 +19,7 @@
|
||||
#
|
||||
|
||||
"""
|
||||
Package providing filtering framework for GRAMPS.
|
||||
Package providing filtering framework for Gramps.
|
||||
"""
|
||||
|
||||
#SystemFilters = None
|
||||
|
@ -21,7 +21,7 @@
|
||||
#
|
||||
|
||||
"""
|
||||
Package providing filtering framework for GRAMPS.
|
||||
Package providing filtering framework for Gramps.
|
||||
"""
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
@ -19,7 +19,7 @@
|
||||
#
|
||||
|
||||
"""
|
||||
Package providing filtering framework for GRAMPS.
|
||||
Package providing filtering framework for Gramps.
|
||||
"""
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
|
@ -19,11 +19,9 @@
|
||||
#
|
||||
|
||||
"""
|
||||
Package providing filtering framework for GRAMPS.
|
||||
Package providing filtering framework for Gramps.
|
||||
"""
|
||||
|
||||
from gramps.gen.constfunc import win
|
||||
|
||||
class SearchFilter:
|
||||
def __init__(self, func, text, invert):
|
||||
self.func = func
|
||||
@ -31,10 +29,7 @@ class SearchFilter:
|
||||
self.invert = invert
|
||||
|
||||
def match(self, handle, db):
|
||||
if win():
|
||||
return self.invert ^ (self.func(handle).upper().find(str(self.text)) != -1)
|
||||
else:
|
||||
return self.invert ^ (self.func(handle).upper().find(self.text) != -1)
|
||||
return self.invert ^ (self.func(handle).upper().find(self.text) != -1)
|
||||
|
||||
class ExactSearchFilter(SearchFilter):
|
||||
def __init__(self, func, text, invert):
|
||||
|
@ -21,7 +21,7 @@
|
||||
#
|
||||
|
||||
"""
|
||||
Package providing filter rules for GRAMPS.
|
||||
Package providing filter rules for Gramps.
|
||||
|
||||
The following filters are provided in gen.filters.rules.
|
||||
|
||||
|
@ -33,10 +33,10 @@ import time
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from . import Rule
|
||||
from ...errors import FilterError
|
||||
from ...const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from . import Rule
|
||||
from gramps.gen.errors import FilterError
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -40,7 +40,7 @@ from . import Rule
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class HasGrampsId(Rule):
|
||||
"""Rule that checks for an object with a specific GRAMPS ID."""
|
||||
"""Rule that checks for an object with a specific Gramps ID."""
|
||||
|
||||
labels = [ _('ID:') ]
|
||||
name = 'Object with <Id>'
|
||||
|
@ -24,9 +24,9 @@
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from . import Rule
|
||||
from ...const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# "People marked public"
|
||||
|
@ -33,10 +33,10 @@ LOG = logging.getLogger(".filter")
|
||||
#-------------------------------------------------------------------------
|
||||
# we need global variableCustomFilters, so we need to query gramps.gen.filters
|
||||
# when we need this variable, not import it at the start!
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
import gramps.gen.filters
|
||||
from . import Rule
|
||||
from ...const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -21,7 +21,7 @@
|
||||
#
|
||||
|
||||
"""
|
||||
Package providing filter rules for GRAMPS.
|
||||
Package providing filter rules for Gramps.
|
||||
"""
|
||||
|
||||
from ._hascitation import HasCitation
|
||||
|
@ -40,7 +40,7 @@ from .. import HasGrampsId
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class HasIdOf(HasGrampsId):
|
||||
"""Rule that checks for a citation with a specific GRAMPS ID"""
|
||||
"""Rule that checks for a citation with a specific Gramps ID"""
|
||||
|
||||
name = _('Citation with <Id>')
|
||||
description = _("Matches a citation with a specified Gramps ID")
|
||||
|
@ -41,7 +41,7 @@ from .._hasgrampsid import HasGrampsId
|
||||
#-------------------------------------------------------------------------
|
||||
class HasSourceIdOf(HasGrampsId):
|
||||
"""Rule that checks for a citation with a source which has a specific
|
||||
GRAMPS ID"""
|
||||
Gramps ID"""
|
||||
|
||||
name = _('Citation with Source <Id>')
|
||||
description = _("Matches a citation with a source with a specified Gramps "
|
||||
|
@ -41,7 +41,7 @@ from .._regexpidbase import RegExpIdBase
|
||||
#-------------------------------------------------------------------------
|
||||
class RegExpIdOf(RegExpIdBase):
|
||||
"""
|
||||
Rule that checks for a citation whose GRAMPS ID
|
||||
Rule that checks for a citation whose Gramps ID
|
||||
matches regular expression.
|
||||
"""
|
||||
|
||||
|
@ -41,7 +41,7 @@ from .._regexpidbase import RegExpIdBase
|
||||
#-------------------------------------------------------------------------
|
||||
class RegExpSourceIdOf(RegExpIdBase):
|
||||
"""
|
||||
Rule that checks for a citation whose GRAMPS ID
|
||||
Rule that checks for a citation whose Gramps ID
|
||||
matches regular expression.
|
||||
"""
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
#
|
||||
|
||||
"""
|
||||
Package providing filter rules for GRAMPS.
|
||||
Package providing filter rules for Gramps.
|
||||
"""
|
||||
|
||||
from .._haseventbase import HasEventBase as HasEvent
|
||||
|
@ -18,20 +18,14 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Standard Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from .. import Rule
|
||||
from ....const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -39,7 +39,7 @@ from .. import HasGrampsId
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class HasIdOf(HasGrampsId):
|
||||
"""Rule that checks for a family with a specific GRAMPS ID"""
|
||||
"""Rule that checks for a family with a specific Gramps ID"""
|
||||
|
||||
name = _('Event with <Id>')
|
||||
description = _("Matches an event with a specified Gramps ID")
|
||||
|
@ -40,7 +40,7 @@ from .._regexpidbase import RegExpIdBase
|
||||
#-------------------------------------------------------------------------
|
||||
class RegExpIdOf(RegExpIdBase):
|
||||
"""
|
||||
Rule that checks for an event whose GRAMPS ID
|
||||
Rule that checks for an event whose Gramps ID
|
||||
matches regular expression.
|
||||
"""
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
#
|
||||
|
||||
"""
|
||||
Package providing filter rules for GRAMPS.
|
||||
Package providing filter rules for Gramps.
|
||||
"""
|
||||
|
||||
from ._searchfathername import SearchFatherName
|
||||
|
@ -40,7 +40,7 @@ from ._memberbase import child_base
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class ChildHasIdOf(RegExpIdBase):
|
||||
"""Rule that checks for a person with a specific GRAMPS ID"""
|
||||
"""Rule that checks for a person with a specific Gramps ID"""
|
||||
|
||||
labels = [ _('Person ID:') ]
|
||||
name = _('Families having child with Id containing <text>')
|
||||
|
@ -40,7 +40,7 @@ from ._memberbase import father_base
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class FatherHasIdOf(RegExpIdBase):
|
||||
"""Rule that checks for a person with a specific GRAMPS ID"""
|
||||
"""Rule that checks for a person with a specific Gramps ID"""
|
||||
|
||||
labels = [ _('Person ID:') ]
|
||||
name = _('Families having father with Id containing <text>')
|
||||
|
@ -39,7 +39,7 @@ from .. import HasGrampsId
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class HasIdOf(HasGrampsId):
|
||||
"""Rule that checks for a family with a specific GRAMPS ID"""
|
||||
"""Rule that checks for a family with a specific Gramps ID"""
|
||||
|
||||
name = _('Family with <Id>')
|
||||
description = _("Matches a family with a specified Gramps ID")
|
||||
|
@ -30,9 +30,9 @@
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from .. import Rule
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from ....lib.childreftype import ChildRefType
|
||||
from ....const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -40,7 +40,7 @@ from ._memberbase import mother_base
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class MotherHasIdOf(RegExpIdBase):
|
||||
"""Rule that checks for a person with a specific GRAMPS ID"""
|
||||
"""Rule that checks for a person with a specific Gramps ID"""
|
||||
|
||||
labels = [ _('Person ID:') ]
|
||||
name = _('Families having mother with Id containing <text>')
|
||||
|
@ -40,7 +40,7 @@ from .._regexpidbase import RegExpIdBase
|
||||
#-------------------------------------------------------------------------
|
||||
class RegExpIdOf(RegExpIdBase):
|
||||
"""
|
||||
Rule that checks for a family whose GRAMPS ID
|
||||
Rule that checks for a family whose Gramps ID
|
||||
matches regular expression.
|
||||
"""
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
#
|
||||
|
||||
"""
|
||||
Package providing filter rules for GRAMPS.
|
||||
Package providing filter rules for Gramps.
|
||||
"""
|
||||
|
||||
from ._allmedia import AllMedia
|
||||
|
@ -39,7 +39,7 @@ from .. import HasGrampsId
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class HasIdOf(HasGrampsId):
|
||||
"""Rule that checks for a media object with a specific GRAMPS ID"""
|
||||
"""Rule that checks for a media object with a specific Gramps ID"""
|
||||
|
||||
name = _('Media object with <Id>')
|
||||
description = _("Matches a media object with a specified Gramps ID")
|
||||
|
@ -40,7 +40,7 @@ from .._regexpidbase import RegExpIdBase
|
||||
#-------------------------------------------------------------------------
|
||||
class RegExpIdOf(RegExpIdBase):
|
||||
"""
|
||||
Rule that checks for a media object whose GRAMPS ID
|
||||
Rule that checks for a media object whose Gramps ID
|
||||
matches regular expression.
|
||||
"""
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
#
|
||||
|
||||
"""
|
||||
Package providing filter rules for GRAMPS.
|
||||
Package providing filter rules for Gramps.
|
||||
"""
|
||||
|
||||
from ._allnotes import AllNotes
|
||||
|
@ -39,7 +39,7 @@ from .. import HasGrampsId
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class HasIdOf(HasGrampsId):
|
||||
"""Rule that checks for a note with a specific GRAMPS ID"""
|
||||
"""Rule that checks for a note with a specific Gramps ID"""
|
||||
|
||||
name = _('Note with <Id>')
|
||||
description = _("Matches a note with a specified Gramps ID")
|
||||
|
@ -31,7 +31,7 @@
|
||||
#-------------------------------------------------------------------------
|
||||
from ....lib.notetype import NoteType
|
||||
from .. import Rule
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
from ....const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
|
@ -40,7 +40,7 @@ from .._regexpidbase import RegExpIdBase
|
||||
#-------------------------------------------------------------------------
|
||||
class RegExpIdOf(RegExpIdBase):
|
||||
"""
|
||||
Rule that checks for a note whose GRAMPS ID
|
||||
Rule that checks for a note whose Gramps ID
|
||||
matches regular expression.
|
||||
"""
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
#
|
||||
|
||||
"""
|
||||
Package providing filter rules for GRAMPS.
|
||||
Package providing filter rules for Gramps.
|
||||
"""
|
||||
|
||||
from ._disconnected import Disconnected
|
||||
|
@ -39,7 +39,7 @@ from .. import HasGrampsId
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class HasIdOf(HasGrampsId):
|
||||
"""Rule that checks for a person with a specific GRAMPS ID"""
|
||||
"""Rule that checks for a person with a specific Gramps ID"""
|
||||
|
||||
name = _('Person with <Id>')
|
||||
description = _("Matches person with a specified Gramps ID")
|
||||
|
@ -18,14 +18,6 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Standard Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from ....const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps modules
|
||||
@ -33,7 +25,9 @@ _ = glocale.translation.sgettext
|
||||
#-------------------------------------------------------------------------
|
||||
from .. import Rule
|
||||
from ....lib.nameorigintype import NameOriginType
|
||||
from gramps.gen.soundex import soundex
|
||||
from ....soundex import soundex
|
||||
from ....const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
|
@ -39,7 +39,7 @@ from .. import Rule
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class MatchIdOf(Rule):
|
||||
"""Rule that checks for a person with a specific GRAMPS ID"""
|
||||
"""Rule that checks for a person with a specific Gramps ID"""
|
||||
|
||||
labels = [ _('ID:') ]
|
||||
name = _('Person with <Id>')
|
||||
|
@ -39,7 +39,7 @@ from .._regexpidbase import RegExpIdBase
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class RegExpIdOf(RegExpIdBase):
|
||||
"""Rule that checks for a person whose GRAMPS ID
|
||||
"""Rule that checks for a person whose Gramps ID
|
||||
matches regular expression.
|
||||
"""
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
#
|
||||
|
||||
"""
|
||||
Package providing filter rules for GRAMPS.
|
||||
Package providing filter rules for Gramps.
|
||||
"""
|
||||
|
||||
from ._allplaces import AllPlaces
|
||||
|
@ -39,7 +39,7 @@ from .. import HasGrampsId
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class HasIdOf(HasGrampsId):
|
||||
"""Rule that checks for a place with a specific GRAMPS ID"""
|
||||
"""Rule that checks for a place with a specific Gramps ID"""
|
||||
|
||||
name = _('Place with <Id>')
|
||||
description = _("Matches a place with a specified Gramps ID")
|
||||
|
@ -40,7 +40,7 @@ from .._regexpidbase import RegExpIdBase
|
||||
#-------------------------------------------------------------------------
|
||||
class RegExpIdOf(RegExpIdBase):
|
||||
"""
|
||||
Rule that checks for a place whose GRAMPS ID
|
||||
Rule that checks for a place whose Gramps ID
|
||||
matches regular expression.
|
||||
"""
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
#
|
||||
|
||||
"""
|
||||
Package providing filter rules for GRAMPS.
|
||||
Package providing filter rules for Gramps.
|
||||
"""
|
||||
|
||||
from ._allrepos import AllRepos
|
||||
|
@ -39,7 +39,7 @@ from .. import HasGrampsId
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class HasIdOf(HasGrampsId):
|
||||
"""Rule that checks for a repo with a specific GRAMPS ID"""
|
||||
"""Rule that checks for a repo with a specific Gramps ID"""
|
||||
|
||||
name = _('Repository with <Id>')
|
||||
description = _("Matches a repository with a specified Gramps ID")
|
||||
|
@ -40,7 +40,7 @@ from .._regexpidbase import RegExpIdBase
|
||||
#-------------------------------------------------------------------------
|
||||
class RegExpIdOf(RegExpIdBase):
|
||||
"""
|
||||
Rule that checks for a repo whose GRAMPS ID
|
||||
Rule that checks for a repo whose Gramps ID
|
||||
matches regular expression.
|
||||
"""
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
#
|
||||
|
||||
"""
|
||||
Package providing filter rules for GRAMPS.
|
||||
Package providing filter rules for Gramps.
|
||||
"""
|
||||
|
||||
from .._hassourcebase import HasSourceBase as HasSource
|
||||
|
@ -39,7 +39,7 @@ from .. import HasGrampsId
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class HasIdOf(HasGrampsId):
|
||||
"""Rule that checks for a source with a specific GRAMPS ID"""
|
||||
"""Rule that checks for a source with a specific Gramps ID"""
|
||||
|
||||
name = _('Source with <Id>')
|
||||
description = _("Matches a source with a specified Gramps ID")
|
||||
|
@ -40,7 +40,7 @@ from .._regexpidbase import RegExpIdBase
|
||||
#-------------------------------------------------------------------------
|
||||
class RegExpIdOf(RegExpIdBase):
|
||||
"""
|
||||
Rule that checks for a source whose GRAMPS ID
|
||||
Rule that checks for a source whose Gramps ID
|
||||
matches regular expression.
|
||||
"""
|
||||
|
||||
|
@ -24,12 +24,12 @@ Unittest that tests event-specific filter rules
|
||||
import unittest
|
||||
import os
|
||||
|
||||
from gramps.gen.db.utils import import_as_dict
|
||||
from gramps.cli.user import User
|
||||
from gramps.gen.filters import GenericFilterFactory
|
||||
from gramps.gen.const import DATA_DIR
|
||||
from ....db.utils import import_as_dict
|
||||
from ....filters import GenericFilterFactory
|
||||
from ....const import DATA_DIR
|
||||
from ....user import User
|
||||
|
||||
from gramps.gen.filters.rules.event import (
|
||||
from ..event import (
|
||||
AllEvents, HasType, HasIdOf, HasGallery, RegExpIdOf, HasCitation, HasNote,
|
||||
HasNoteRegexp, HasReferenceCountOf, HasSourceCount, EventPrivate,
|
||||
MatchesSourceConfidence, HasAttribute, HasData, ChangedSince, HasTag,
|
||||
|
@ -24,12 +24,12 @@ Unittest that tests family-specific filter rules
|
||||
import unittest
|
||||
import os
|
||||
|
||||
from gramps.gen.db.utils import import_as_dict
|
||||
from gramps.cli.user import User
|
||||
from gramps.gen.filters import GenericFilterFactory
|
||||
from gramps.gen.const import DATA_DIR
|
||||
from ....db.utils import import_as_dict
|
||||
from ....filters import GenericFilterFactory
|
||||
from ....const import DATA_DIR
|
||||
from ....user import User
|
||||
|
||||
from gramps.gen.filters.rules.family import (
|
||||
from ..family import (
|
||||
AllFamilies, HasRelType, HasGallery, HasIdOf, HasLDS, HasNote, RegExpIdOf,
|
||||
HasNoteRegexp, HasReferenceCountOf, HasSourceCount, HasSourceOf,
|
||||
HasCitation, FamilyPrivate, HasEvent, HasAttribute, IsBookmarked,
|
||||
|
@ -24,12 +24,12 @@ Unittest that tests media-specific filter rules
|
||||
import unittest
|
||||
import os
|
||||
|
||||
from gramps.gen.db.utils import import_as_dict
|
||||
from gramps.cli.user import User
|
||||
from gramps.gen.filters import GenericFilterFactory
|
||||
from gramps.gen.const import DATA_DIR
|
||||
from ....db.utils import import_as_dict
|
||||
from ....filters import GenericFilterFactory
|
||||
from ....const import DATA_DIR
|
||||
from ....user import User
|
||||
|
||||
from gramps.gen.filters.rules.media import (
|
||||
from ..media import (
|
||||
AllMedia, HasIdOf, RegExpIdOf, HasCitation, HasNoteRegexp,
|
||||
HasNoteMatchingSubstringOf, HasReferenceCountOf, HasSourceCount,
|
||||
HasSourceOf, MediaPrivate, MatchesSourceConfidence, HasMedia,
|
||||
|
@ -24,12 +24,12 @@ Unittest that tests note-specific filter rules
|
||||
import unittest
|
||||
import os
|
||||
|
||||
from gramps.gen.db.utils import import_as_dict
|
||||
from gramps.cli.user import User
|
||||
from gramps.gen.filters import GenericFilterFactory
|
||||
from gramps.gen.const import DATA_DIR
|
||||
from ....db.utils import import_as_dict
|
||||
from ....filters import GenericFilterFactory
|
||||
from ....const import DATA_DIR
|
||||
from ....user import User
|
||||
|
||||
from gramps.gen.filters.rules.note import (
|
||||
from ..note import (
|
||||
AllNotes, HasIdOf, RegExpIdOf, HasNote, MatchesRegexpOf,
|
||||
HasReferenceCountOf, NotePrivate, ChangedSince, HasTag, HasType)
|
||||
|
||||
|
@ -24,12 +24,12 @@ Unittest that tests person-specific filter rules
|
||||
import unittest
|
||||
import os
|
||||
|
||||
from gramps.gen.db.utils import import_as_dict
|
||||
from gramps.cli.user import User
|
||||
from gramps.gen.filters import GenericFilter
|
||||
from gramps.gen.const import DATA_DIR
|
||||
from ....db.utils import import_as_dict
|
||||
from ....filters import GenericFilter
|
||||
from ....const import DATA_DIR
|
||||
from ....user import User
|
||||
|
||||
from gramps.gen.filters.rules.person import (
|
||||
from ..person import (
|
||||
Disconnected, Everyone, FamilyWithIncompleteEvent, HasAlternateName,
|
||||
HasCommonAncestorWith, HasNickname, HasUnknownGender, HasSourceOf,
|
||||
HaveAltFamilies, HaveChildren, IncompleteNames, IsBookmarked,
|
||||
|
@ -24,12 +24,12 @@ Unittest that tests place-specific filter rules
|
||||
import unittest
|
||||
import os
|
||||
|
||||
from gramps.gen.db.utils import import_as_dict
|
||||
from gramps.cli.user import User
|
||||
from gramps.gen.filters import GenericFilterFactory
|
||||
from gramps.gen.const import DATA_DIR
|
||||
from ....db.utils import import_as_dict
|
||||
from ....filters import GenericFilterFactory
|
||||
from ....const import DATA_DIR
|
||||
from ....user import User
|
||||
|
||||
from gramps.gen.filters.rules.place import (
|
||||
from ..place import (
|
||||
AllPlaces, HasCitation, HasGallery, HasIdOf, RegExpIdOf, HasNote,
|
||||
HasNoteRegexp, HasReferenceCountOf, HasSourceCount, HasSourceOf,
|
||||
PlacePrivate, MatchesSourceConfidence, HasData, HasNoLatOrLon,
|
||||
|
@ -24,12 +24,12 @@ Unittest that tests repository-specific filter rules
|
||||
import unittest
|
||||
import os
|
||||
|
||||
from gramps.gen.db.utils import import_as_dict
|
||||
from gramps.cli.user import User
|
||||
from gramps.gen.filters import GenericFilterFactory
|
||||
from gramps.gen.const import DATA_DIR
|
||||
from ....db.utils import import_as_dict
|
||||
from ....filters import GenericFilterFactory
|
||||
from ....const import DATA_DIR
|
||||
from ....user import User
|
||||
|
||||
from gramps.gen.filters.rules.repository import (
|
||||
from ..repository import (
|
||||
AllRepos, HasIdOf, RegExpIdOf, HasNoteRegexp, HasReferenceCountOf,
|
||||
RepoPrivate, ChangedSince, MatchesNameSubstringOf, HasTag)
|
||||
|
||||
|
@ -30,12 +30,11 @@ def get_git_revision(path=""):
|
||||
Return the short commit hash of the latest commit.
|
||||
"""
|
||||
stdout = ""
|
||||
command = "git log -1 --format=%h"
|
||||
command = ['git', 'log', '-1', '--format=%h', path]
|
||||
try:
|
||||
proc = subprocess.Popen(
|
||||
"{} \"{}\"".format(command, path),
|
||||
shell=True,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
proc = subprocess.Popen(command,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
(stdout, stderr) = proc.communicate()
|
||||
except OSError:
|
||||
return "" # subprocess failed
|
||||
|
@ -44,6 +44,8 @@ from .datebase import DateBase
|
||||
from .tagbase import TagBase
|
||||
from .attrbase import SrcAttributeBase
|
||||
from .citationbase import IndirectCitationBase
|
||||
from ..const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
LOG = logging.getLogger(".citation")
|
||||
|
||||
@ -92,51 +94,46 @@ class Citation(MediaBase, NoteBase, SrcAttributeBase, IndirectCitationBase,
|
||||
from .date import Date
|
||||
return {
|
||||
"type": "object",
|
||||
"title": _("Citation"),
|
||||
"properties": {
|
||||
"_class": {"enum": [cls.__name__]},
|
||||
"handle": {"type": "string",
|
||||
"maxLength": 50},
|
||||
"gramps_id": {"type": "string"},
|
||||
"date": {"oneOf": [{"type": "null"}, Date.get_schema()]},
|
||||
"page": {"type": "string"},
|
||||
"maxLength": 50,
|
||||
"title": _("Handle")},
|
||||
"gramps_id": {"type": "string",
|
||||
"title": _("Gramps ID")},
|
||||
"date": {"oneOf": [{"type": "null"}, Date.get_schema()],
|
||||
"title": _("Date")},
|
||||
"page": {"type": "string",
|
||||
"title": _("Page")},
|
||||
"confidence": {"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 4},
|
||||
"maximum": 4,
|
||||
"title": _("Confidence")},
|
||||
"source_handle": {"type": "string",
|
||||
"maxLength": 50},
|
||||
"maxLength": 50,
|
||||
"title": _("Source")},
|
||||
"note_list": {"type": "array",
|
||||
"items": {"type": "string",
|
||||
"maxLength": 50}},
|
||||
"maxLength": 50},
|
||||
"title": _("Notes")},
|
||||
"media_list": {"type": "array",
|
||||
"items": MediaRef.get_schema()},
|
||||
"items": MediaRef.get_schema(),
|
||||
"title": _("Media")},
|
||||
"srcattr_list": {"type": "array",
|
||||
"items": SrcAttribute.get_schema()},
|
||||
"change": {"type": "integer"},
|
||||
"items": SrcAttribute.get_schema(),
|
||||
"title": _("Source Attributes")},
|
||||
"change": {"type": "integer",
|
||||
"title": _("Last changed")},
|
||||
"tag_list": {"type": "array",
|
||||
"items": {"type": "string",
|
||||
"maxLength": 50}},
|
||||
"private": {"type": "boolean"}
|
||||
"maxLength": 50},
|
||||
"title": _("Tags")},
|
||||
"private": {"type": "boolean",
|
||||
"title": _("Private")}
|
||||
}
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def get_labels(cls, _):
|
||||
return {
|
||||
"_class": _("Citation"),
|
||||
"handle": _("Handle"),
|
||||
"gramps_id": _("Gramps ID"),
|
||||
"date": _("Date"),
|
||||
"page": _("Page"),
|
||||
"confidence": _("Confidence"),
|
||||
"source_handle": _("Source"),
|
||||
"note_list": _("Notes"),
|
||||
"media_list": _("Media"),
|
||||
"srcattribute_list": _("Source Attributes"),
|
||||
"change": _("Last changed"),
|
||||
"tag_list": _("Tags"),
|
||||
"private": _("Private"),
|
||||
}
|
||||
|
||||
def serialize(self, no_text_date=False):
|
||||
"""
|
||||
Convert the object to a serialized tuple of data.
|
||||
|
@ -31,13 +31,6 @@ CitationBase class for Gramps.
|
||||
#-------------------------------------------------------------------------
|
||||
import logging
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from .handle import Handle
|
||||
|
||||
LOG = logging.getLogger(".citation")
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
|
@ -46,6 +46,8 @@ from .datebase import DateBase
|
||||
from .placebase import PlaceBase
|
||||
from .tagbase import TagBase
|
||||
from .eventtype import EventType
|
||||
from ..const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
LOG = logging.getLogger(".citation")
|
||||
|
||||
@ -131,53 +133,47 @@ class Event(CitationBase, NoteBase, MediaBase, AttributeBase,
|
||||
from .mediaref import MediaRef
|
||||
return {
|
||||
"type": "object",
|
||||
"title": _("Event"),
|
||||
"properties": {
|
||||
"_class": {"enum": [cls.__name__]},
|
||||
"handle": {"type": "string",
|
||||
"maxLength": 50},
|
||||
"gramps_id": {"type": "string"},
|
||||
"maxLength": 50,
|
||||
"title": _("Handle")},
|
||||
"gramps_id": {"type": "string",
|
||||
"title": _("Gramps ID")},
|
||||
"type": EventType.get_schema(),
|
||||
"date": {"oneOf": [{"type": "null"}, Date.get_schema()]},
|
||||
"description": {"type": "string"},
|
||||
"date": {"oneOf": [{"type": "null"}, Date.get_schema()],
|
||||
"title": _("Date")},
|
||||
"description": {"type": "string",
|
||||
"title": _("Description")},
|
||||
"place": {"type": ["string", "null"],
|
||||
"maxLength": 50},
|
||||
"maxLength": 50,
|
||||
"title": _("Place")},
|
||||
"citation_list": {"type": "array",
|
||||
"items": {"type": "string",
|
||||
"maxLength": 50}},
|
||||
"maxLength": 50},
|
||||
"title": _("Citations")},
|
||||
"note_list": {"type": "array",
|
||||
"items": {"type": "string",
|
||||
"maxLength": 50}},
|
||||
"maxLength": 50},
|
||||
"title": _("Notes")},
|
||||
"media_list": {"type": "array",
|
||||
"items": MediaRef.get_schema()},
|
||||
"items": MediaRef.get_schema(),
|
||||
"title": _("Media")},
|
||||
"attribute_list": {"type": "array",
|
||||
"items": Attribute.get_schema()},
|
||||
"change": {"type": "integer"},
|
||||
"items": Attribute.get_schema(),
|
||||
"title": _("Media")},
|
||||
"change": {"type": "integer",
|
||||
"title": _("Last changed")},
|
||||
"tag_list": {"type": "array",
|
||||
"items": {"type": "string",
|
||||
"maxLength": 50}},
|
||||
"private": {"type": "boolean"},
|
||||
"maxLength": 50},
|
||||
"title": _("Tags")},
|
||||
"private": {"type": "boolean",
|
||||
"title": _("Private")},
|
||||
}
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def get_labels(cls, _):
|
||||
return {
|
||||
"_class": _("Event"),
|
||||
"handle": _("Handle"),
|
||||
"gramps_id": _("Gramps ID"),
|
||||
"type": _("Type"),
|
||||
"date": _("Date"),
|
||||
"description": _("Description"),
|
||||
"place": _("Place"),
|
||||
"citation_list": _("Citations"),
|
||||
"note_list": _("Notes"),
|
||||
"media_list": _("Media"),
|
||||
"attribute_list": _("Attributes"),
|
||||
"change": _("Last changed"),
|
||||
"tag_list": _("Tags"),
|
||||
"private": _("Private"),
|
||||
}
|
||||
|
||||
def unserialize(self, data):
|
||||
"""
|
||||
Convert the data held in a tuple created by the serialize method
|
||||
|
@ -39,6 +39,8 @@ from .refbase import RefBase
|
||||
from .eventroletype import EventRoleType
|
||||
from .const import IDENTICAL, EQUAL, DIFFERENT
|
||||
from .citationbase import IndirectCitationBase
|
||||
from ..const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -90,37 +92,25 @@ class EventRef(PrivacyBase, NoteBase, AttributeBase, RefBase,
|
||||
from .attribute import Attribute
|
||||
return {
|
||||
"type": "object",
|
||||
"title": _("Event reference"),
|
||||
"properties": {
|
||||
"_class": {"enum": [cls.__name__]},
|
||||
"private": {"type": "boolean"},
|
||||
"private": {"type": "boolean",
|
||||
"title": _("Private")},
|
||||
"note_list": {"type": "array",
|
||||
"items": {"type": "string",
|
||||
"maxLength": 50}},
|
||||
"maxLength": 50},
|
||||
"title": _("Notes")},
|
||||
"attribute_list": {"type": "array",
|
||||
"items": Attribute.get_schema()},
|
||||
"items": Attribute.get_schema(),
|
||||
"title": _("Attributes")},
|
||||
"ref": {"type": "string",
|
||||
"maxLength": 50},
|
||||
"maxLength": 50,
|
||||
"title": _("Event")},
|
||||
"role": EventRoleType.get_schema(),
|
||||
}
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def get_labels(cls, _):
|
||||
"""
|
||||
Given a translation function, returns the labels for
|
||||
each field of this object.
|
||||
|
||||
:returns: Returns a dict containing the fields to labels.
|
||||
:rtype: dict
|
||||
"""
|
||||
return {
|
||||
"private": _("Private"),
|
||||
"note_list": _("Notes"),
|
||||
"attribute_list": _("Attributes"),
|
||||
"ref": _("Event"),
|
||||
"role": _("Role"),
|
||||
}
|
||||
|
||||
def unserialize(self, data):
|
||||
"""
|
||||
Convert a serialized tuple of data to an object.
|
||||
|
@ -49,6 +49,8 @@ from .tagbase import TagBase
|
||||
from .childref import ChildRef
|
||||
from .familyreltype import FamilyRelType
|
||||
from .const import IDENTICAL, EQUAL, DIFFERENT
|
||||
from ..const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
LOG = logging.getLogger(".citation")
|
||||
|
||||
@ -140,61 +142,55 @@ class Family(CitationBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
|
||||
from .attribute import Attribute
|
||||
return {
|
||||
"type": "object",
|
||||
"title": _("Family"),
|
||||
"properties": {
|
||||
"_class": {"enum": [cls.__name__]},
|
||||
"handle": {"type": "string",
|
||||
"maxLength": 50},
|
||||
"gramps_id": {"type": "string"},
|
||||
"maxLength": 50,
|
||||
"title": _("Handle")},
|
||||
"gramps_id": {"type": "string",
|
||||
"title": _("Gramps ID")},
|
||||
"father_handle": {"type": ["string", "null"],
|
||||
"maxLength": 50},
|
||||
"maxLength": 50,
|
||||
"title": _("Father")},
|
||||
"mother_handle": {"type": ["string", "null"],
|
||||
"maxLength": 50},
|
||||
"maxLength": 50,
|
||||
"title": _("Mother")},
|
||||
"child_ref_list": {"type": "array",
|
||||
"items": ChildRef.get_schema()},
|
||||
"items": ChildRef.get_schema(),
|
||||
"title": _("Children")},
|
||||
"type": FamilyRelType.get_schema(),
|
||||
"event_ref_list": {"type": "array",
|
||||
"items": EventRef.get_schema()},
|
||||
"items": EventRef.get_schema(),
|
||||
"title": _("Events")},
|
||||
"media_list": {"type": "array",
|
||||
"items": MediaRef.get_schema()},
|
||||
"items": MediaRef.get_schema(),
|
||||
"title": _("Media")},
|
||||
"attribute_list": {"type": "array",
|
||||
"items": Attribute.get_schema()},
|
||||
"items": Attribute.get_schema(),
|
||||
"title": _("Attributes")},
|
||||
"lds_ord_list": {"type": "array",
|
||||
"items": LdsOrd.get_schema()},
|
||||
"items": LdsOrd.get_schema(),
|
||||
"title": _("LDS ordinances")},
|
||||
"citation_list": {"type": "array",
|
||||
"items": {"type": "string",
|
||||
"maxLength": 50}},
|
||||
"maxLength": 50},
|
||||
"title": _("Citations")},
|
||||
"note_list": {"type": "array",
|
||||
"items": {"type": "string",
|
||||
"maxLength": 50}},
|
||||
"change": {"type": "integer"},
|
||||
"maxLength": 50},
|
||||
"title": _("Notes")},
|
||||
"change": {"type": "integer",
|
||||
"title": _("Last changed")},
|
||||
"tag_list": {"type": "array",
|
||||
"items": {"type": "string",
|
||||
"maxLength": 50}},
|
||||
"private": {"type": "boolean"}
|
||||
"maxLength": 50},
|
||||
"title": _("Tags")},
|
||||
"private": {"type": "boolean",
|
||||
"title": _("Private")}
|
||||
}
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def get_labels(cls, _):
|
||||
return {
|
||||
"_class": _("Family"),
|
||||
"handle": _("Handle"),
|
||||
"gramps_id": _("Gramps ID"),
|
||||
"father_handle": _("Father"),
|
||||
"mother_handle": _("Mother"),
|
||||
"child_ref_list": _("Children"),
|
||||
"type": _("Relationship"),
|
||||
"event_ref_list": _("Events"),
|
||||
"media_list": _("Media"),
|
||||
"attribute_list": _("Attributes"),
|
||||
"lds_ord_list": _("LDS ordinances"),
|
||||
"citation_list": _("Citations"),
|
||||
"note_list": _("Notes"),
|
||||
"change": _("Last changed"),
|
||||
"tag_list": _("Tags"),
|
||||
"private": _("Private"),
|
||||
}
|
||||
|
||||
def unserialize(self, data):
|
||||
"""
|
||||
Convert the data held in a tuple created by the serialize method
|
||||
|
@ -218,20 +218,14 @@ class GrampsType(object, metaclass=GrampsTypeMeta):
|
||||
"""
|
||||
return {
|
||||
"type": "object",
|
||||
"title": _("Type"),
|
||||
"properties": {
|
||||
"_class": {"enum": [cls.__name__]},
|
||||
"string": {"type": "string"},
|
||||
"string": {"type": "string",
|
||||
"title": _("Type")},
|
||||
}
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def get_labels(cls, _):
|
||||
return {
|
||||
"_class": _("Family Relationship"),
|
||||
"value": _("Family Relationship"),
|
||||
"string": _("Family Relationship"),
|
||||
}
|
||||
|
||||
def unserialize(self, data):
|
||||
"""Convert a serialized tuple of data to an object."""
|
||||
self.__value, self.__string = data
|
||||
|
@ -1,55 +0,0 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2013 Doug Blank <doug.blank@gmail.com>
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
class HandleClass(str):
|
||||
def __init__(self, handle):
|
||||
super(HandleClass, self).__init__()
|
||||
|
||||
def join(self, database, handle):
|
||||
return database.get_table_func(self.classname,"handle_func")(handle)
|
||||
|
||||
@classmethod
|
||||
def get_schema(cls):
|
||||
from gramps.gen.lib import (Person, Family, Event, Place, Source,
|
||||
Media, Repository, Note, Citation, Tag)
|
||||
tables = {
|
||||
"Person": Person,
|
||||
"Family": Family,
|
||||
"Event": Event,
|
||||
"Place": Place,
|
||||
"Source": Source,
|
||||
"Media": Media,
|
||||
"Repository": Repository,
|
||||
"Note": Note,
|
||||
"Citation": Citation,
|
||||
"Tag": Tag,
|
||||
}
|
||||
return tables[cls.classname].get_schema()
|
||||
|
||||
def Handle(_classname, handle):
|
||||
if handle is None:
|
||||
return None
|
||||
class MyHandleClass(HandleClass):
|
||||
"""
|
||||
Class created to have classname attribute.
|
||||
"""
|
||||
classname = _classname
|
||||
h = MyHandleClass(handle)
|
||||
return h
|
@ -45,6 +45,8 @@ from .notebase import NoteBase
|
||||
from .datebase import DateBase
|
||||
from .attrbase import AttributeBase
|
||||
from .tagbase import TagBase
|
||||
from ..const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
LOG = logging.getLogger(".citation")
|
||||
|
||||
@ -129,57 +131,45 @@ class Media(CitationBase, NoteBase, DateBase, AttributeBase,
|
||||
from .date import Date
|
||||
return {
|
||||
"type": "object",
|
||||
"title": _("Media"),
|
||||
"properties": {
|
||||
"_class": {"enum": [cls.__name__]},
|
||||
"handle": {"type": "string",
|
||||
"maxLength": 50},
|
||||
"gramps_id": {"type": "string"},
|
||||
"path": {"type": "string"},
|
||||
"mime": {"type": "string"},
|
||||
"desc": {"type": "string"},
|
||||
"checksum": {"type": "string"},
|
||||
"maxLength": 50,
|
||||
"title": _("Handle")},
|
||||
"gramps_id": {"type": "string",
|
||||
"title": _("Gramps ID")},
|
||||
"path": {"type": "string",
|
||||
"title": _("Path")},
|
||||
"mime": {"type": "string",
|
||||
"title": _("MIME")},
|
||||
"desc": {"type": "string",
|
||||
"title": _("Description")},
|
||||
"checksum": {"type": "string",
|
||||
"title": _("Checksum")},
|
||||
"attribute_list": {"type": "array",
|
||||
"items": Attribute.get_schema()},
|
||||
"items": Attribute.get_schema(),
|
||||
"title": _("Attributes")},
|
||||
"citation_list": {"type": "array",
|
||||
"items": {"type": "string",
|
||||
"maxLength": 50}},
|
||||
"maxLength": 50},
|
||||
"title": _("Citations")},
|
||||
"note_list": {"type": "array",
|
||||
"items": {"type": "string"}},
|
||||
"change": {"type": "integer"},
|
||||
"date": {"oneOf": [{"type": "null"}, Date.get_schema()]},
|
||||
"items": {"type": "string"},
|
||||
"title": _("Notes")},
|
||||
"change": {"type": "integer",
|
||||
"title": _("Last changed")},
|
||||
"date": {"oneOf": [{"type": "null"}, Date.get_schema()],
|
||||
"title": _("Date")},
|
||||
"tag_list": {"type": "array",
|
||||
"items": {"type": "string",
|
||||
"maxLength": 50}},
|
||||
"private": {"type": "boolean"}
|
||||
"maxLength": 50},
|
||||
"title": _("Tags")},
|
||||
"private": {"type": "boolean",
|
||||
"title": _("Private")}
|
||||
}
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def get_labels(cls, _):
|
||||
"""
|
||||
Given a translation function, returns the labels for
|
||||
each field of this object.
|
||||
|
||||
:returns: Returns a dict containing the fields to labels.
|
||||
:rtype: dict
|
||||
"""
|
||||
return {
|
||||
"_class": _("Media"),
|
||||
"handle": _("Media"),
|
||||
"gramps_id": _("Gramps ID"),
|
||||
"path": _("Path"),
|
||||
"mime": _("MIME"),
|
||||
"desc": _("Description"),
|
||||
"checksum": _("Checksum"),
|
||||
"attribute_list": _("Attributes"),
|
||||
"citation_list": _("Citations"),
|
||||
"note_list": _("Notes"),
|
||||
"change": _("Last changed"),
|
||||
"date": _("Date"),
|
||||
"tag_list": _("Tags"),
|
||||
"private": _("Private"),
|
||||
}
|
||||
|
||||
def unserialize(self, data):
|
||||
"""
|
||||
Convert the data held in a tuple created by the serialize method
|
||||
|
@ -40,7 +40,7 @@ from .surnamebase import SurnameBase
|
||||
from .nametype import NameType
|
||||
from .const import IDENTICAL, EQUAL, DIFFERENT
|
||||
from .date import Date
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
from ..const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -129,27 +129,6 @@ class Name(SecondaryObject, PrivacyBase, SurnameBase, CitationBase, NoteBase,
|
||||
self.group_as, self.sort_as, self.display_as, self.call,
|
||||
self.nick, self.famnick)
|
||||
|
||||
@classmethod
|
||||
def get_labels(cls, _):
|
||||
return {
|
||||
"_class": _("Name"),
|
||||
"private": _("Private"),
|
||||
"citation_list": _("Citations"),
|
||||
"note_list": _("Notes"),
|
||||
"date": _("Date"),
|
||||
"first_name": _("Given name"),
|
||||
"surname_list": _("Surnames"),
|
||||
"suffix": _("Suffix"),
|
||||
"title": _("Title"),
|
||||
"type": _("Type"),
|
||||
"group_as": _("Group as"),
|
||||
"sort_as": _("Sort as"),
|
||||
"display_as": _("Display as"),
|
||||
"call": _("Call name"),
|
||||
"nick": _("Nick name"),
|
||||
"famnick": _("Family nick name"),
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def get_schema(cls):
|
||||
"""
|
||||
@ -161,28 +140,43 @@ class Name(SecondaryObject, PrivacyBase, SurnameBase, CitationBase, NoteBase,
|
||||
from .surname import Surname
|
||||
return {
|
||||
"type": "object",
|
||||
"title": _("Name"),
|
||||
"properties": {
|
||||
"_class": {"enum": [cls.__name__]},
|
||||
"private": {"type": "boolean"},
|
||||
"private": {"type": "boolean",
|
||||
"title": _("Private")},
|
||||
"citation_list": {"type": "array",
|
||||
"items": {"type": "string",
|
||||
"maxLength": 50}},
|
||||
"maxLength": 50},
|
||||
"title": _("Citations")},
|
||||
"note_list": {"type": "array",
|
||||
"items": {"type": "string",
|
||||
"maxLength": 50}},
|
||||
"date": {"oneOf": [{"type": "null"}, Date.get_schema()]},
|
||||
"first_name": {"type": "string"},
|
||||
"maxLength": 50},
|
||||
"title": _("Notes")},
|
||||
"date": {"oneOf": [{"type": "null"}, Date.get_schema()],
|
||||
"title": _("Date")},
|
||||
"first_name": {"type": "string",
|
||||
"title": _("Given name")},
|
||||
"surname_list": {"type": "array",
|
||||
"items": Surname.get_schema()},
|
||||
"suffix": {"type": "string"},
|
||||
"title": {"type": "string"},
|
||||
"items": Surname.get_schema(),
|
||||
"title": _("Surnames")},
|
||||
"suffix": {"type": "string",
|
||||
"title": _("Suffix")},
|
||||
"title": {"type": "string",
|
||||
"title": _("Title")},
|
||||
"type": NameType.get_schema(),
|
||||
"group_as": {"type": "string"},
|
||||
"sort_as": {"type": "integer"},
|
||||
"display_as": {"type": "integer"},
|
||||
"call": {"type": "string"},
|
||||
"nick": {"type": "string"},
|
||||
"famnick": {"type": "string"}
|
||||
"group_as": {"type": "string",
|
||||
"title": _("Group as")},
|
||||
"sort_as": {"type": "integer",
|
||||
"title": _("Sort as")},
|
||||
"display_as": {"type": "integer",
|
||||
"title": _("Display as")},
|
||||
"call": {"type": "string",
|
||||
"title": _("Call name")},
|
||||
"nick": {"type": "string",
|
||||
"title": _("Nick name")},
|
||||
"famnick": {"type": "string",
|
||||
"title": _("Family nick name")}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,10 +34,12 @@ from .tagbase import TagBase
|
||||
from .notetype import NoteType
|
||||
from .styledtext import StyledText
|
||||
from .styledtexttagtype import StyledTextTagType
|
||||
from ..const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Class for notes used throughout the majority of GRAMPS objects
|
||||
# Class for notes used throughout the majority of Gramps objects
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class Note(BasicPrimaryObject):
|
||||
@ -104,35 +106,29 @@ class Note(BasicPrimaryObject):
|
||||
"""
|
||||
return {
|
||||
"type": "object",
|
||||
"title": _("Note"),
|
||||
"properties": {
|
||||
"_class": {"enum": [cls.__name__]},
|
||||
"handle": {"type": "string",
|
||||
"maxLength": 50},
|
||||
"gramps_id": {"type": "string"},
|
||||
"maxLength": 50,
|
||||
"title": ("Handle")},
|
||||
"gramps_id": {"type": "string",
|
||||
"title": _("Gramps ID")},
|
||||
"text": StyledText.get_schema(),
|
||||
"format": {"type": "integer"},
|
||||
"format": {"type": "integer",
|
||||
"title": _("Format")},
|
||||
"type": NoteType.get_schema(),
|
||||
"change": {"type": "integer"},
|
||||
"change": {"type": "integer",
|
||||
"title": _("Last changed")},
|
||||
"tag_list": {"type": "array",
|
||||
"items": {"type": "string",
|
||||
"maxLength": 50}},
|
||||
"private": {"type": "boolean"}
|
||||
"maxLength": 50},
|
||||
"title": _("Tags")},
|
||||
"private": {"type": "boolean",
|
||||
"title": _("Private")}
|
||||
}
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def get_labels(cls, _):
|
||||
return {
|
||||
"handle": _("Handle"),
|
||||
"gramps_id": _("Gramps ID"),
|
||||
"text": _("Text"),
|
||||
"format": _("Format"),
|
||||
"type": _("Type"),
|
||||
"change": _("Last changed"),
|
||||
"tag_list": _("Tags"),
|
||||
"private": _("Private"),
|
||||
}
|
||||
|
||||
def unserialize(self, data):
|
||||
"""Convert a serialized tuple of data to an object.
|
||||
|
||||
|
@ -23,8 +23,6 @@
|
||||
NoteBase class for Gramps.
|
||||
"""
|
||||
|
||||
from .handle import Handle
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# NoteBase class
|
||||
|
@ -156,33 +156,6 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase,
|
||||
[pr.serialize() for pr in self.person_ref_list] # 20
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def get_labels(cls, _):
|
||||
return {
|
||||
"handle": _("Handle"),
|
||||
"gramps_id": _("Gramps ID"),
|
||||
"gender": _("Gender"),
|
||||
"primary_name": _("Primary name"),
|
||||
"alternate_names": _("Alternate names"),
|
||||
"death_ref_index": _("Death reference index"),
|
||||
"birth_ref_index": _("Birth reference index"),
|
||||
"event_ref_list": _("Event references"),
|
||||
"family_list": _("Families"),
|
||||
"parent_family_list": _("Parent families"),
|
||||
"media_list": _("Media"),
|
||||
"address_list": _("Addresses"),
|
||||
"attribute_list": _("Attributes"),
|
||||
"urls": _("Urls"),
|
||||
"lds_ord_list": _("LDS ordinances"),
|
||||
"citation_list": _("Citations"),
|
||||
"note_list": _("Notes"),
|
||||
"change": _("Last changed"),
|
||||
"tag_list": _("Tags"),
|
||||
"private": _("Private"),
|
||||
"person_ref_list": _("Person references"),
|
||||
"probably_alive": _("Probably alive"),
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def get_schema(cls):
|
||||
"""
|
||||
@ -197,50 +170,71 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase,
|
||||
from .ldsord import LdsOrd
|
||||
return {
|
||||
"type": "object",
|
||||
"title": _("Person"),
|
||||
"properties": {
|
||||
"_class": {"enum": [cls.__name__]},
|
||||
"handle": {"type": "string",
|
||||
"maxLength": 50},
|
||||
"gramps_id": {"type": "string"},
|
||||
"maxLength": 50,
|
||||
"title": _("Handle")},
|
||||
"gramps_id": {"type": "string",
|
||||
"title": _("Gramps ID")},
|
||||
"gender": {"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 2},
|
||||
"maximum": 2,
|
||||
"title": _("Gender")},
|
||||
"primary_name": Name.get_schema(),
|
||||
"alternate_names": {"type": "array",
|
||||
"items": Name.get_schema()},
|
||||
"death_ref_index": {"type": "integer"},
|
||||
"birth_ref_index": {"type": "integer"},
|
||||
"items": Name.get_schema(),
|
||||
"title": _("Alternate names")},
|
||||
"death_ref_index": {"type": "integer",
|
||||
"title": _("Death reference index")},
|
||||
"birth_ref_index": {"type": "integer",
|
||||
"title": _("Birth reference index")},
|
||||
"event_ref_list": {"type": "array",
|
||||
"items": EventRef.get_schema()},
|
||||
"items": EventRef.get_schema(),
|
||||
"title": _("Event references")},
|
||||
"family_list": {"type": "array",
|
||||
"items": {"type": "string",
|
||||
"maxLength": 50}},
|
||||
"maxLength": 50},
|
||||
"title": _("Families")},
|
||||
"parent_family_list": {"type": "array",
|
||||
"items": {"type": "string",
|
||||
"maxLength": 50}},
|
||||
"maxLength": 50},
|
||||
"title": _("Parent families")},
|
||||
"media_list": {"type": "array",
|
||||
"items": MediaRef.get_schema()},
|
||||
"items": MediaRef.get_schema(),
|
||||
"title": _("Media")},
|
||||
"address_list": {"type": "array",
|
||||
"items": Address.get_schema()},
|
||||
"items": Address.get_schema(),
|
||||
"title": _("Addresses")},
|
||||
"attribute_list": {"type": "array",
|
||||
"items": Attribute.get_schema()},
|
||||
"items": Attribute.get_schema(),
|
||||
"title": _("Attributes")},
|
||||
"urls": {"type": "array",
|
||||
"items": Url.get_schema()},
|
||||
"items": Url.get_schema(),
|
||||
"title": _("Urls")},
|
||||
"lds_ord_list": {"type": "array",
|
||||
"items": LdsOrd.get_schema()},
|
||||
"items": LdsOrd.get_schema(),
|
||||
"title": _("LDS ordinances")},
|
||||
"citation_list": {"type": "array",
|
||||
"items": {"type": "string",
|
||||
"maxLength": 50}},
|
||||
"maxLength": 50},
|
||||
"title": _("Citations")},
|
||||
"note_list": {"type": "array",
|
||||
"items": {"type": "string",
|
||||
"maxLength": 50}},
|
||||
"change": {"type": "integer"},
|
||||
"maxLength": 50},
|
||||
"title": _("Notes")},
|
||||
"change": {"type": "integer",
|
||||
"title": _("Last changed")},
|
||||
"tag_list": {"type": "array",
|
||||
"items": {"type": "string",
|
||||
"maxLength": 50}},
|
||||
"private": {"type": "boolean"},
|
||||
"maxLength": 50},
|
||||
"title": _("Tags")},
|
||||
"private": {"type": "boolean",
|
||||
"title": _("Private")},
|
||||
"person_ref_list": {"type": "array",
|
||||
"items": PersonRef.get_schema()}
|
||||
"items": PersonRef.get_schema(),
|
||||
"title": _("Person references")}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,8 @@ from .mediabase import MediaBase
|
||||
from .urlbase import UrlBase
|
||||
from .tagbase import TagBase
|
||||
from .location import Location
|
||||
from ..const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -118,28 +120,6 @@ class Place(CitationBase, NoteBase, MediaBase, UrlBase, PrimaryObject):
|
||||
self.change, TagBase.serialize(self), self.private)
|
||||
|
||||
@classmethod
|
||||
def get_labels(cls, _):
|
||||
return {
|
||||
"handle": _("Handle"),
|
||||
"gramps_id": _("Gramps ID"),
|
||||
"title": _("Title"),
|
||||
"long": _("Longitude"),
|
||||
"lat": _("Latitude"),
|
||||
"placeref_list": _("Places"),
|
||||
"name": _("Name"),
|
||||
"alt_names": _("Alternate Names"),
|
||||
"place_type": _("Type"),
|
||||
"code": _("Code"),
|
||||
"alt_loc": _("Alternate Locations"),
|
||||
"urls": _("URLs"),
|
||||
"media_list": _("Media"),
|
||||
"citation_list": _("Citations"),
|
||||
"note_list": _("Notes"),
|
||||
"change": _("Last changed"),
|
||||
"tag_list": _("Tags"),
|
||||
"private": _("Private")
|
||||
}
|
||||
@classmethod
|
||||
def get_schema(cls):
|
||||
"""
|
||||
Returns the JSON Schema for this class.
|
||||
@ -151,38 +131,55 @@ class Place(CitationBase, NoteBase, MediaBase, UrlBase, PrimaryObject):
|
||||
from .mediaref import MediaRef
|
||||
return {
|
||||
"type": "object",
|
||||
"title": _("Place"),
|
||||
"properties": {
|
||||
"_class": {"enum": [cls.__name__]},
|
||||
"handle": {"type": "string",
|
||||
"maxLength": 50},
|
||||
"gramps_id": {"type": "string"},
|
||||
"title": {"type": "string"},
|
||||
"long": {"type": "string"},
|
||||
"lat": {"type": "string"},
|
||||
"maxLength": 50,
|
||||
"title": _("Handle")},
|
||||
"gramps_id": {"type": "string",
|
||||
"title": _("Gramps ID")},
|
||||
"title": {"type": "string",
|
||||
"title": _("Title")},
|
||||
"long": {"type": "string",
|
||||
"title": _("Longitude")},
|
||||
"lat": {"type": "string",
|
||||
"title": _("Latitude")},
|
||||
"placeref_list": {"type": "array",
|
||||
"items": PlaceRef.get_schema()},
|
||||
"items": PlaceRef.get_schema(),
|
||||
"title": _("Places")},
|
||||
"name": PlaceName.get_schema(),
|
||||
"alt_names": {"type": "array",
|
||||
"items": PlaceName.get_schema()},
|
||||
"items": PlaceName.get_schema(),
|
||||
"title": _("Alternate Names")},
|
||||
"place_type": PlaceType.get_schema(),
|
||||
"code": {"type": "string"},
|
||||
"code": {"type": "string",
|
||||
"title": _("Code")},
|
||||
"alt_loc": {"type": "array",
|
||||
"items": Location.get_schema()},
|
||||
"items": Location.get_schema(),
|
||||
"title": _("Alternate Locations")},
|
||||
"urls": {"type": "array",
|
||||
"items": Url.get_schema()},
|
||||
"items": Url.get_schema(),
|
||||
"title": _("URLs")},
|
||||
"media_list": {"type": "array",
|
||||
"items": MediaRef.get_schema()},
|
||||
"items": MediaRef.get_schema(),
|
||||
"title": _("Media")},
|
||||
"citation_list": {"type": "array",
|
||||
"items": {"type": "string",
|
||||
"maxLength": 50}},
|
||||
"maxLength": 50},
|
||||
"title": _("Citations")},
|
||||
"note_list": {"type": "array",
|
||||
"items": {"type": "string",
|
||||
"maxLength": 50}},
|
||||
"change": {"type": "integer"},
|
||||
"maxLength": 50},
|
||||
"title": _("Notes")},
|
||||
"change": {"type": "integer",
|
||||
"title": _("Last changed")},
|
||||
"tag_list": {"type": "array",
|
||||
"items": {"type": "string",
|
||||
"maxLength": 50}},
|
||||
"private": {"type": "boolean"}
|
||||
"maxLength": 50},
|
||||
"title": _("Tags")},
|
||||
"private": {"type": "boolean",
|
||||
"title": _("Private")}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,8 @@ from .urlbase import UrlBase
|
||||
from .tagbase import TagBase
|
||||
from .repotype import RepositoryType
|
||||
from .citationbase import IndirectCitationBase
|
||||
from ..const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -69,21 +71,6 @@ class Repository(NoteBase, AddressBase, UrlBase, IndirectCitationBase,
|
||||
UrlBase.serialize(self),
|
||||
self.change, TagBase.serialize(self), self.private)
|
||||
|
||||
@classmethod
|
||||
def get_labels(cls, _):
|
||||
return {
|
||||
"handle": _("Handle"),
|
||||
"gramps_id": _("Gramps ID"),
|
||||
"type": _("Type"),
|
||||
"name": _("Name"),
|
||||
"note_list": _("Notes"),
|
||||
"address_list": _("Addresses"),
|
||||
"urls": _("URLs"),
|
||||
"change": _("Last changed"),
|
||||
"tag_list": _("Tags"),
|
||||
"private": _("Private")
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def get_schema(cls):
|
||||
"""
|
||||
@ -96,25 +83,35 @@ class Repository(NoteBase, AddressBase, UrlBase, IndirectCitationBase,
|
||||
from .url import Url
|
||||
return {
|
||||
"type": "object",
|
||||
"title": _("Repository"),
|
||||
"properties": {
|
||||
"_class": {"enum": [cls.__name__]},
|
||||
"handle": {"type": "string",
|
||||
"maxLength": 50},
|
||||
"gramps_id": {"type": "string"},
|
||||
"maxLength": 50,
|
||||
"title": _("Handle")},
|
||||
"gramps_id": {"type": "string",
|
||||
"title": _("Gramps ID")},
|
||||
"type": RepositoryType.get_schema(),
|
||||
"name": {"type": "string"},
|
||||
"name": {"type": "string",
|
||||
"title": _("Name")},
|
||||
"note_list": {"type": "array",
|
||||
"items": {"type": "string",
|
||||
"maxLength": 50}},
|
||||
"maxLength": 50},
|
||||
"title": _("Notes")},
|
||||
"address_list": {"type": "array",
|
||||
"items": Address.get_schema()},
|
||||
"items": Address.get_schema(),
|
||||
"title": _("Addresses")},
|
||||
"urls": {"type": "array",
|
||||
"items": Url.get_schema()},
|
||||
"change": {"type": "integer"},
|
||||
"items": Url.get_schema(),
|
||||
"title": _("URLs")},
|
||||
"change": {"type": "integer",
|
||||
"title": _("Last changed")},
|
||||
"tag_list": {"type": "array",
|
||||
"items": {"type": "string",
|
||||
"maxLength": 50}},
|
||||
"private": {"type": "boolean"}
|
||||
"maxLength": 50},
|
||||
"title": _("Tags")},
|
||||
"private": {"type": "boolean",
|
||||
"title": _("Private")}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,27 +69,3 @@ class SecondaryObject(BaseObject):
|
||||
Should be overwritten by objects that inherit from this class.
|
||||
"""
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def get_labels(cls, _):
|
||||
"""
|
||||
Return labels.
|
||||
"""
|
||||
return {}
|
||||
|
||||
def get_label(self, field, _):
|
||||
"""
|
||||
Get the associated label given a field name of this object.
|
||||
"""
|
||||
chain = field.split(".")
|
||||
path = self
|
||||
for part in chain[:-1]:
|
||||
if hasattr(path, part):
|
||||
path = getattr(path, part)
|
||||
else:
|
||||
path = path[int(part)]
|
||||
labels = path.get_labels(_)
|
||||
if chain[-1] in labels:
|
||||
return labels[chain[-1]]
|
||||
else:
|
||||
raise Exception("%s has no such label: '%s'" % (self, field))
|
||||
|
@ -39,6 +39,8 @@ from .attrbase import SrcAttributeBase
|
||||
from .reporef import RepoRef
|
||||
from .const import DIFFERENT, EQUAL, IDENTICAL
|
||||
from .citationbase import IndirectCitationBase
|
||||
from ..const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -79,24 +81,6 @@ class Source(MediaBase, NoteBase, SrcAttributeBase, IndirectCitationBase,
|
||||
TagBase.serialize(self), # 11
|
||||
self.private) # 12
|
||||
|
||||
@classmethod
|
||||
def get_labels(cls, _):
|
||||
return {
|
||||
"handle": _("Handle"),
|
||||
"gramps_id": _("Gramps ID"),
|
||||
"title": _("Title"),
|
||||
"author": _("Author"),
|
||||
"pubinfo": _("Publication info"),
|
||||
"note_list": _("Notes"),
|
||||
"media_list": _("Media"),
|
||||
"abbrev": _("Abbreviation"),
|
||||
"change": _("Last changed"),
|
||||
"srcattr_list": _("Source Attributes"),
|
||||
"reporef_list": _("Repositories"),
|
||||
"tag_list": _("Tags"),
|
||||
"private": _("Private")
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def get_schema(cls):
|
||||
"""
|
||||
@ -110,29 +94,43 @@ class Source(MediaBase, NoteBase, SrcAttributeBase, IndirectCitationBase,
|
||||
from .mediaref import MediaRef
|
||||
return {
|
||||
"type": "object",
|
||||
"title": _("Source"),
|
||||
"properties": {
|
||||
"_class": {"enum": [cls.__name__]},
|
||||
"handle": {"type": "string",
|
||||
"maxLength": 50},
|
||||
"gramps_id": {"type": "string"},
|
||||
"title": {"type": "string"},
|
||||
"author": {"type": "string"},
|
||||
"pubinfo": {"type": "string"},
|
||||
"maxLength": 50,
|
||||
"title": _("Handle")},
|
||||
"gramps_id": {"type": "string",
|
||||
"title": _("Gramps ID")},
|
||||
"title": {"type": "string",
|
||||
"title": _("Title")},
|
||||
"author": {"type": "string",
|
||||
"title": _("Author")},
|
||||
"pubinfo": {"type": "string",
|
||||
"title": _("Publication info")},
|
||||
"note_list": {"type": "array",
|
||||
"items": {"type": "string",
|
||||
"maxLength": 50}},
|
||||
"maxLength": 50},
|
||||
"title": _("Notes")},
|
||||
"media_list": {"type": "array",
|
||||
"items": MediaRef.get_schema()},
|
||||
"abbrev": {"type": "string"},
|
||||
"change": {"type": "integer"},
|
||||
"items": MediaRef.get_schema(),
|
||||
"title": _("Media")},
|
||||
"abbrev": {"type": "string",
|
||||
"title": _("Abbreviation")},
|
||||
"change": {"type": "integer",
|
||||
"title": _("Last changed")},
|
||||
"srcattr_list": {"type": "array",
|
||||
"items": SrcAttribute.get_schema()},
|
||||
"items": SrcAttribute.get_schema(),
|
||||
"title": _("Source Attributes")},
|
||||
"reporef_list": {"type": "array",
|
||||
"items": RepoRef.get_schema()},
|
||||
"items": RepoRef.get_schema(),
|
||||
"title": _("Repositories")},
|
||||
"tag_list": {"type": "array",
|
||||
"items": {"type": "string",
|
||||
"maxLength": 50}},
|
||||
"private": {"type": "boolean"}
|
||||
"maxLength": 50},
|
||||
"title": _("Tags")},
|
||||
"private": {"type": "boolean",
|
||||
"title": _("Private")}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
#
|
||||
|
||||
"""
|
||||
Source Attribute class for GRAMPS.
|
||||
Source Attribute class for Gramps.
|
||||
"""
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
|
@ -28,6 +28,8 @@
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from .styledtexttag import StyledTextTag
|
||||
from ..const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -299,21 +301,17 @@ class StyledText:
|
||||
"""
|
||||
return {
|
||||
"type": "object",
|
||||
"title": _("Styled Text"),
|
||||
"properties": {
|
||||
"_class": {"enum": [cls.__name__]},
|
||||
"string": {"type": "string"},
|
||||
"string": {"type": "string",
|
||||
"title": _("Text")},
|
||||
"tags": {"type": "array",
|
||||
"items": StyledTextTag.get_schema()}
|
||||
"items": StyledTextTag.get_schema(),
|
||||
"title": _("Styled Text Tags")}
|
||||
}
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def get_labels(cls, _):
|
||||
return {
|
||||
"string": _("Text"),
|
||||
"tags": _("Styled Text Tags"),
|
||||
}
|
||||
|
||||
def unserialize(self, data):
|
||||
"""
|
||||
Convert a serialized tuple of data to an object.
|
||||
|
@ -32,6 +32,8 @@ Surname class for Gramps.
|
||||
from .secondaryobj import SecondaryObject
|
||||
from .nameorigintype import NameOriginType
|
||||
from .const import IDENTICAL, EQUAL, DIFFERENT
|
||||
from ..const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -82,27 +84,21 @@ class Surname(SecondaryObject):
|
||||
"""
|
||||
return {
|
||||
"type": "object",
|
||||
"title": _("Surname"),
|
||||
"properties": {
|
||||
"_class": {"enum": [cls.__name__]},
|
||||
"surname": {"type": "string"},
|
||||
"prefix": {"type": "string"},
|
||||
"primary": {"type": "boolean"},
|
||||
"surname": {"type": "string",
|
||||
"title": _("Surname")},
|
||||
"prefix": {"type": "string",
|
||||
"title": _("Prefix")},
|
||||
"primary": {"type": "boolean",
|
||||
"title": _("Primary")},
|
||||
"origintype": NameOriginType.get_schema(),
|
||||
"connector": {"type": "string"}
|
||||
"connector": {"type": "string",
|
||||
"title": _("Connector")}
|
||||
}
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def get_labels(cls, _):
|
||||
return {
|
||||
"_class": _("Surname"),
|
||||
"surname": _("Surname"),
|
||||
"prefix": _("Prefix"),
|
||||
"primary": _("Primary"),
|
||||
"origintype": _("Origin type"),
|
||||
"connector": _("Connector")
|
||||
}
|
||||
|
||||
def is_empty(self):
|
||||
"""
|
||||
Indicate if the surname is empty.
|
||||
|
@ -37,7 +37,7 @@ import time
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from .baseobj import BaseObject
|
||||
from gramps.gen.errors import HandleError
|
||||
from ..errors import HandleError
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -148,13 +148,6 @@ class TableObject(BaseObject):
|
||||
"""
|
||||
return self.handle
|
||||
|
||||
@classmethod
|
||||
def get_labels(cls, _):
|
||||
"""
|
||||
Return labels.
|
||||
"""
|
||||
return {}
|
||||
|
||||
@classmethod
|
||||
def get_schema(cls):
|
||||
"""
|
||||
|
@ -29,6 +29,8 @@ Tag object for Gramps.
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from .tableobj import TableObject
|
||||
from ..const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -110,32 +112,25 @@ class Tag(TableObject):
|
||||
"""
|
||||
return {
|
||||
"type": "object",
|
||||
"title": _("Tag"),
|
||||
"properties": {
|
||||
"_class": {"enum": [cls.__name__]},
|
||||
"handle": {"type": "string",
|
||||
"maxLength": 50},
|
||||
"name": {"type": "string"},
|
||||
"maxLength": 50,
|
||||
"title": _("Handle")},
|
||||
"name": {"type": "string",
|
||||
"title": _("Name")},
|
||||
"color": {"type": "string",
|
||||
"maxLength": 13},
|
||||
"maxLength": 13,
|
||||
"title": _("Color")},
|
||||
"priority": {"type": "integer",
|
||||
"minimum": 0},
|
||||
"change": {"type": "integer"}
|
||||
"minimum": 0,
|
||||
"title": _("Priority")},
|
||||
"change": {"type": "integer",
|
||||
"title": _("Last changed")}
|
||||
}
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def get_labels(cls, _):
|
||||
"""
|
||||
Return the label for fields
|
||||
"""
|
||||
return {
|
||||
"handle": _("Handle"),
|
||||
"name": _("Name"),
|
||||
"color": _("Color"),
|
||||
"priority": _("Priority"),
|
||||
"change": _("Last changed"),
|
||||
}
|
||||
|
||||
def get_text_data_list(self):
|
||||
"""
|
||||
Return the list of all textual attributes of the object.
|
||||
|
@ -22,8 +22,6 @@
|
||||
TagBase class for Gramps.
|
||||
"""
|
||||
|
||||
from .handle import Handle
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# TagBase class
|
||||
|
@ -30,7 +30,7 @@ from .. import (Person, Family, Event, Place, Repository, Source, Citation,
|
||||
from ..serialize import to_json
|
||||
from ...db.utils import import_as_dict
|
||||
from ...const import DATA_DIR
|
||||
from gramps.cli.user import User
|
||||
from ...user import User
|
||||
|
||||
TEST_DIR = os.path.abspath(os.path.join(DATA_DIR, "tests"))
|
||||
EXAMPLE = os.path.join(TEST_DIR, "example.gramps")
|
||||
|
@ -26,9 +26,9 @@ import os
|
||||
from .. import (Person, Family, Event, Source, Place, Citation,
|
||||
Repository, Media, Note, Tag)
|
||||
from ..serialize import to_json, from_json
|
||||
from gramps.gen.db.utils import import_as_dict
|
||||
from gramps.cli.user import User
|
||||
from gramps.gen.const import DATA_DIR
|
||||
from ...db.utils import import_as_dict
|
||||
from ...const import DATA_DIR
|
||||
from ...user import User
|
||||
|
||||
TEST_DIR = os.path.abspath(os.path.join(DATA_DIR, "tests"))
|
||||
EXAMPLE = os.path.join(TEST_DIR, "example.gramps")
|
||||
@ -114,9 +114,9 @@ def generate_case(obj):
|
||||
#setattr(DatabaseCheck, name, test2)
|
||||
|
||||
db = import_as_dict(EXAMPLE, User())
|
||||
for table in db.get_table_func():
|
||||
for handle in db.get_table_func(table,"handles_func")():
|
||||
obj = db.get_table_func(table,"handle_func")(handle)
|
||||
for table in db.get_table_names():
|
||||
for handle in db.get_table_metadata(table)["handles_func"]():
|
||||
obj = db.get_table_metadata(table)["handle_func"](handle)
|
||||
generate_case(obj)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user