Merge branch 'master' into geps/gep-032-database-backend

This commit is contained in:
Doug Blank
2015-05-30 07:11:45 -04:00
26 changed files with 5687 additions and 5855 deletions

View File

@@ -41,7 +41,7 @@ master_doc = 'index'
# General information about the project.
project = u'Gramps'
copyright = u'2014, Gramps project'
copyright = u'2015, Gramps project'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the

View File

@@ -41,7 +41,7 @@ master_doc = 'cs'
# General information about the project.
project = u'Gramps'
copyright = u'2014, Gramps project'
copyright = u'2015, Gramps project'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the

View File

@@ -41,7 +41,7 @@ master_doc = 'fr'
# General information about the project.
project = u'Gramps'
copyright = u'2014, Gramps project'
copyright = u'2015, Gramps project'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the

View File

@@ -41,7 +41,7 @@ master_doc = 'nl'
# General information about the project.
project = u'Gramps'
copyright = u'2014, Gramps project'
copyright = u'2015, Gramps project'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the

View File

@@ -41,7 +41,7 @@ master_doc = 'pl'
# General information about the project.
project = u'Gramps'
copyright = u'2014, Gramps project'
copyright = u'2015, Gramps project'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the

View File

@@ -41,7 +41,7 @@ master_doc = 'pt_BR'
# General information about the project.
project = u'Gramps'
copyright = u'2014, Gramps project'
copyright = u'2015, Gramps project'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the

View File

@@ -41,7 +41,7 @@ master_doc = 'sv'
# General information about the project.
project = u'Gramps'
copyright = u'2014, Gramps project'
copyright = u'2015, Gramps project'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the

10
debian/control vendored
View File

@@ -15,27 +15,27 @@ Standards-Version: 3.9.5
Vcs-Git: git://anonscm.debian.org/collab-maint/gramps.git
Vcs-browser: http://anonscm.debian.org/gitweb/?p=collab-maint/gramps.git
Homepage: http://www.gramps-project.org/
X-Python-Version: >= 2.7
X-Python-Version: >= 3.0
Package: python-gramps
Architecture: all
Depends:
gir1.2-gtk-3.0,
librsvg2-2,
python-gi,
python-gi-cairo,
python3-gi,
python3-gi-cairo,
xdg-utils,
${misc:Depends},
${python:Depends}
Recommends:
graphviz,
libosmgpsmap-1.0-0-dev,
python-pyicu
python3-pyicu
Suggests:
fonts-freefont-ttf,
gir1.2-gexiv2-0.4,
gir1.2-gtk-gtkspell3-3.0,
python-pil,
python3-pil,
rcs
Description: Genealogical research program
GRAMPS is an Open Source genealogy program written in Python, using

18
debian/rules vendored
View File

@@ -5,32 +5,32 @@ export DH_VERBOSE=1
export DH_OPTIONS=-v
%:
dh $@ --with python2
dh $@ --with python3
# Override auto test because upstream do not use the standard unittest discover
override_dh_auto_test:
# Override of auto_build
override_dh_auto_build:
python setup.py build
python3 setup.py build
# Override of auto_install to remove information from package
override_dh_auto_install:
#dh_auto_install
# Remove duplicate copyright information
#rm $(CURDIR)/debian/python-gramps/usr/share/doc/gramps/COPYING
#rm $(CURDIR)/debian/python3-gramps/usr/share/doc/gramps/COPYING
# Remove install file as it is not needed by package users
#rm $(CURDIR)/debian/python-gramps/usr/share/doc/gramps/INSTALL
#rm $(CURDIR)/debian/python3-gramps/usr/share/doc/gramps/INSTALL
# Remove duplicate license information
#rm $(CURDIR)/debian/python-gramps/usr/share/doc/gramps/LICENSE
python setup.py install --root=debian/python-gramps --install-layout=deb
#rm $(CURDIR)/debian/python3-gramps/usr/share/doc/gramps/LICENSE
python3 setup.py install --root=debian/python3-gramps --install-layout=deb
# Make css style sheets and png icons non-executable
override_dh_fixperms:
dh_fixperms
chmod a-x $(CURDIR)/debian/python-gramps/usr/share/gramps/css/Web_*.css
chmod a-x $(CURDIR)/debian/python-gramps/usr/share/gramps/images/22x22/gramps*.png
chmod a-x $(CURDIR)/debian/python-gramps/usr/share/gramps/images/16x16/gramps*.png
chmod a-x $(CURDIR)/debian/python3-gramps/usr/share/gramps/css/Web_*.css
chmod a-x $(CURDIR)/debian/python3-gramps/usr/share/gramps/images/22x22/gramps*.png
chmod a-x $(CURDIR)/debian/python3-gramps/usr/share/gramps/images/16x16/gramps*.png
# Avoid compressing COPYING file so that it can appear in the "About" dialog
override_dh_compress:

View File

@@ -22,9 +22,9 @@
# Slovenian version 2010 by Bernard Banko, based on croatian one by Josip
"""
Slovenian-specific classes for parsing and displaying dates.
Slovenian-specific classes for parsing and displaying dates - new framework.
"""
from __future__ import unicode_literals
#-------------------------------------------------------------------------
#
# Python modules
@@ -51,79 +51,6 @@ class DateParserSL(DateParser):
"""
Converts a text string into a Date object
"""
month_to_int = DateParser.month_to_int
month_to_int["januar"] = 1
month_to_int["januarja"] = 1
month_to_int["januarjem"] = 1
month_to_int["jan"] = 1
month_to_int["i"] = 1
month_to_int["februar"] = 2
month_to_int["februarjem"] = 2
month_to_int["februarja"] = 2
month_to_int["feb"] = 2
month_to_int["ii"] = 2
month_to_int["mar"] = 3
month_to_int["marcem"] = 3
month_to_int["marec"] = 3
month_to_int["marca"] = 3
month_to_int["iii"] = 3
month_to_int["apr"] = 4
month_to_int["april"] = 4
month_to_int["aprilom"] = 4
month_to_int["aprila"] = 4
month_to_int["iv"] = 4
month_to_int["maj"] = 5
month_to_int["maja"] = 5
month_to_int["majem"] = 5
month_to_int["v"] = 5
month_to_int["jun"] = 6
month_to_int["junij"] = 6
month_to_int["junijem"] = 6
month_to_int["junija"] = 6
month_to_int["vi"] = 6
month_to_int["jul"] = 7
month_to_int["julij"] = 7
month_to_int["julijem"] = 7
month_to_int["julija"] = 7
month_to_int["vii"] = 7
month_to_int["avg"] = 8
month_to_int["avgust"] = 8
month_to_int["avgustom"] = 8
month_to_int["avgusta"] = 8
month_to_int["viii"] = 8
month_to_int["sep"] = 9
month_to_int["sept"] = 9
month_to_int["september"] = 9
month_to_int["septembrom"] = 9
month_to_int["septembra"] = 9
month_to_int["ix"] = 9
month_to_int["okt"] = 10
month_to_int["oktober"] = 10
month_to_int["oktobrom"] = 10
month_to_int["oktobra"] = 10
month_to_int["x"] = 10
month_to_int["nov"] = 11
month_to_int["november"] = 11
month_to_int["novembrom"] = 11
month_to_int["novembra"] = 11
month_to_int["xi"] = 11
month_to_int["dec"] = 12
month_to_int["december"] = 12
month_to_int["decembrom"] = 12
month_to_int["decembra"] = 12
month_to_int["xii"] = 12
modifier_to_int = {
'pred' : Date.MOD_BEFORE,
@@ -136,31 +63,18 @@ class DateParserSL(DateParser):
'cca.' : Date.MOD_ABOUT,
'cca' : Date.MOD_ABOUT,
'circa' : Date.MOD_ABOUT,
'ca.' : Date.MOD_ABOUT,
}
calendar_to_int = {
'gregorijanski' : Date.CAL_GREGORIAN,
'greg.' : Date.CAL_GREGORIAN,
'julijanski' : Date.CAL_JULIAN,
'jul.' : Date.CAL_JULIAN,
'hebrejski' : Date.CAL_HEBREW,
'hebr.' : Date.CAL_HEBREW,
'islamski' : Date.CAL_ISLAMIC,
'isl.' : Date.CAL_ISLAMIC,
'francoski republikanski': Date.CAL_FRENCH,
'franc.' : Date.CAL_FRENCH,
'perzijski' : Date.CAL_PERSIAN,
'perz. ' : Date.CAL_PERSIAN,
'švedski' : Date.CAL_SWEDISH,
'šved.' : Date.CAL_SWEDISH,
'ca.' : Date.MOD_ABOUT,
'približno' : Date.MOD_ABOUT,
'pribl.' : Date.MOD_ABOUT,
}
quality_to_int = {
'približno' : Date.QUAL_ESTIMATED,
'pribl.' : Date.QUAL_ESTIMATED,
'izračunano' : Date.QUAL_CALCULATED,
'izrač.' : Date.QUAL_CALCULATED,
'ocenjeno' : Date.QUAL_ESTIMATED,
'oc.' : Date.QUAL_ESTIMATED,
'po oceni' : Date.QUAL_ESTIMATED,
'izračunano' : Date.QUAL_CALCULATED,
'izrač.' : Date.QUAL_CALCULATED,
'po izračunu': Date.QUAL_CALCULATED,
}
bce = ["pred našim štetjem", "pred Kristusom",
@@ -170,6 +84,7 @@ class DateParserSL(DateParser):
"""
compiles regular expression strings for matching dates
"""
DateParser.init_strings(self)
# match 'Day. MONTH year.' format with or without dots
self._text2 = re.compile('(\d+)?\.?\s*?%s\.?\s*((\d+)(/\d+)?)?\s*\.?$'
@@ -194,116 +109,11 @@ class DateDisplaySL(DateDisplay):
"""
Slovenian language date display class.
"""
long_months = ( "", "januarja", "februarja", "marca","aprila",
"maja", "junija", "julija", "avgusta", "septembra",
"oktobra", "novembra", "decembra"
)
short_months = ( "", "jan", "feb", "mar", "apr", "maj", "jun",
"jul", "avg", "sep", "okt", "nov", "dec"
)
calendar = (
"", "julijanski", "hebrejski",
"francoski republikanski", "perzijski", "islamski",
"švedski"
)
# TODO fix BUG 7064: non-Gregorian calendars wrongly use BCE notation for negative dates
# not refactoring _bce_str into base class because it'll be gone under #7064
_bce_str = "%s pr.Kr."
_mod_str = ("", "pred ", "po ", "okrog ", "", "", "")
_qual_str = ("", "približno ", "izračunano ")
_bce_str = "%s p.n.š."
formats = (
"ISO (leto-mm-dd)",
"številčno",
"dan. mes. leto",
"dan. mesec leto"
)
# this definition must agree with its "_display_gregorian" method
def _display_gregorian(self, date_val):
"""
display gregorian calendar date in different format
"""
# this must agree with its locale-specific "formats" definition
year = self._slash_year(date_val[2], date_val[3])
if self.format == 0:
return self.display_iso(date_val)
elif self.format == 1:
# day. month_number. year
if date_val[3]:
return self.display_iso(date_val)
else:
if date_val[0] == 0 and date_val[1] == 0:
value = str(date_val[2])
else:
value = self._tformat.replace('%m', str(date_val[1]))
value = value.replace('%d', str(date_val[0]))
value = value.replace('%Y', str(date_val[2]))
value = value.replace('-', '. ')
elif self.format == 2:
# day. month_abbreviation. year
if date_val[0] == 0:
if date_val[1] == 0:
value = year
else:
value = "%s. %s" % (self.short_months[date_val[1]], year)
else:
value = "%d. %s. %s" % (date_val[0],
self.short_months[date_val[1]], year)
else:
# day. month_name year
if date_val[0] == 0:
if date_val[1] == 0:
value = "%s." % year
else:
value = "%s %s" % (self.long_months[date_val[1]], year)
else:
value = "%d. %s %s" % (
date_val[0],self.long_months[date_val[1]], year)
if date_val[2] < 0:
return self._bce_str % value
else:
return value
def display(self, date):
"""
Return a text string representing the date.
"""
mod = date.get_modifier()
cal = date.get_calendar()
qual = date.get_quality()
start = date.get_start_date()
newyear = date.get_new_year()
qual_str = self._qual_str[qual]
if mod == Date.MOD_TEXTONLY:
return date.get_text()
elif start == Date.EMPTY:
return ""
elif mod == Date.MOD_SPAN:
d_1 = self.display_cal[cal](start)
d_2 = self.display_cal[cal](date.get_stop_date())
scal = self.format_extras(cal, newyear)
return "%sod %s do %s%s" % (qual_str, d_1, d_2, scal)
elif mod == Date.MOD_RANGE:
d_1 = self.display_cal[cal](start)
d_2 = self.display_cal[cal](date.get_stop_date())
scal = self.format_extras(cal, newyear)
date_string = "%smed %s in %s%s" % (qual_str, d_1, d_2, scal)
date_string = date_string.replace("a ","em ") #to correct declination
date_string = date_string.replace("lem ","lom ")
date_string = date_string.replace("rem ","rom ")
date_string = date_string.replace("tem ","tom ")
return date_string
else:
text = self.display_cal[date.get_calendar()](start)
scal = self.format_extras(cal, newyear)
date_string = "%s%s%s%s" % (qual_str, self._mod_str[mod], text, scal)
return date_string
display = DateDisplay.display_formatted
#-------------------------------------------------------------------------
#

View File

@@ -314,6 +314,8 @@ class Place(CitationBase, NoteBase, MediaBase, UrlBase, PrimaryObject):
:param name: name to assign to the Place
:type name: PlaceName
"""
if not isinstance(name, PlaceName):
raise ValueError("Place.set_name(name) requires a PlaceName()")
self.name = name
def get_name(self):

View File

@@ -45,7 +45,7 @@ class PlaceName(SecondaryObject, DateBase):
This class is for keeping information about place names.
"""
def __init__(self, source=None):
def __init__(self, source=None, **kwargs):
"""
Create a new PlaceName instance, copying from the source if present.
"""
@@ -56,6 +56,11 @@ class PlaceName(SecondaryObject, DateBase):
else:
self.value = ''
self.lang = ''
for key in kwargs:
if key in ["value", "lang"]:
setattr(self, key, kwargs[key])
else:
raise AttributeError("PlaceName does not have property '%s'" % key)
def serialize(self):
"""

View File

@@ -849,7 +849,7 @@ class SimpleAccess(object):
:return: list of repositories in the database
:rtype: list
"""
return self.__all_objects(self.dbase.get_repsoitory_cursor,
return self.__all_objects(self.dbase.get_repository_cursor,
self.dbase.get_repository_from_handle)
def all_media(self):

View File

@@ -635,12 +635,18 @@ class ClipText(ClipWrapper):
def __init__(self, dbstate, obj):
super(ClipText, self).__init__(dbstate, obj)
self._type = _("Text")
self._pickle = self._obj
if isinstance(self._obj, bytes):
self._pickle = str(self._obj, "utf-8")
else:
self._pickle = self._obj
self.refresh()
def refresh(self):
self._title = _("Text")
self._value = self._obj
if isinstance(self._obj, bytes):
self._value = str(self._obj, "utf-8")
else:
self._value = self._obj
class ClipMediaObj(ClipHandleWrapper):
@@ -1139,7 +1145,7 @@ class ClipboardListView(object):
def object_pixbuf(self, column, cell, model, node, user_data=None):
o = model.get_value(node, 1)
if o._dbid != self.dbstate.db.get_dbid():
if o._dbid is not None and o._dbid != self.dbstate.db.get_dbid():
if isinstance(o.__class__.UNAVAILABLE_ICON, str):
cell.set_property('icon-name',
o.__class__.UNAVAILABLE_ICON)

View File

@@ -571,7 +571,7 @@ class DbManager(CLIDbManager):
_("Remove the '%s' Family Tree?") % self.data_to_delete[0],
_("Removing this Family Tree will permanently destroy the data."),
_("Remove Family Tree"),
self.__really_delete_db)
self.__really_delete_db, parent=self.top)
else:
rev = self.data_to_delete[0]
parent = store[(path[0],)][0]
@@ -583,7 +583,7 @@ class DbManager(CLIDbManager):
_("Removing this version will prevent you from "
"extracting it in the future."),
_("Remove version"),
self.__really_delete_version)
self.__really_delete_version, parent=self.top)
def __really_delete_db(self):
"""

View File

@@ -102,20 +102,21 @@ primary data for the merged place.</property>
</packing>
</child>
<child>
<object class="GtkButtonBox" id="vbuttonbox1">
<object class="GtkBox" id="vbox3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="margin_top">6</property>
<property name="margin_bottom">6</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkRadioButton" id="handle_btn1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">center</property>
<property name="draw_indicator">True</property>
<child>
<object class="GtkLabel" id="label_handle_btn1">
<property name="width_request">300</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="wrap">True</property>
@@ -133,12 +134,10 @@ primary data for the merged place.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">center</property>
<property name="draw_indicator">True</property>
<property name="group">handle_btn1</property>
<child>
<object class="GtkLabel" id="label_handle_btn2">
<property name="width_request">300</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="wrap">True</property>
@@ -155,7 +154,6 @@ primary data for the merged place.</property>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">5</property>
<property name="position">2</property>
</packing>
</child>
@@ -206,11 +204,11 @@ primary data for the merged place.</property>
<child>
<object class="GtkRadioButton" id="title_btn1">
<property name="label" translatable="yes">Title:</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="no_show_all">True</property>
<property name="halign">start</property>
<property name="use_underline">True</property>
<property name="halign">center</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -221,11 +219,11 @@ primary data for the merged place.</property>
<child>
<object class="GtkRadioButton" id="title_btn2">
<property name="label" translatable="yes">Title:</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="no_show_all">True</property>
<property name="halign">start</property>
<property name="use_underline">True</property>
<property name="halign">center</property>
<property name="draw_indicator">True</property>
<property name="group">title_btn1</property>
</object>
@@ -240,8 +238,8 @@ primary data for the merged place.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">start</property>
<property name="use_underline">True</property>
<property name="halign">center</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -255,8 +253,8 @@ primary data for the merged place.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">start</property>
<property name="use_underline">True</property>
<property name="halign">center</property>
<property name="draw_indicator">True</property>
<property name="group">lat_btn1</property>
</object>
@@ -271,8 +269,8 @@ primary data for the merged place.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">start</property>
<property name="use_underline">True</property>
<property name="halign">center</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -286,8 +284,8 @@ primary data for the merged place.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">start</property>
<property name="use_underline">True</property>
<property name="halign">center</property>
<property name="draw_indicator">True</property>
<property name="group">long_btn1</property>
</object>
@@ -302,8 +300,8 @@ primary data for the merged place.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">start</property>
<property name="use_underline">True</property>
<property name="halign">center</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -317,8 +315,8 @@ primary data for the merged place.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">start</property>
<property name="use_underline">True</property>
<property name="halign">center</property>
<property name="draw_indicator">True</property>
<property name="group">gramps_btn1</property>
</object>
@@ -329,8 +327,8 @@ primary data for the merged place.</property>
</child>
<child>
<object class="GtkEntry" id="title1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="no_show_all">True</property>
<property name="hexpand">True</property>
<property name="editable">False</property>
</object>
@@ -341,8 +339,8 @@ primary data for the merged place.</property>
</child>
<child>
<object class="GtkEntry" id="title2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="no_show_all">True</property>
<property name="hexpand">True</property>
<property name="editable">False</property>
</object>
@@ -425,13 +423,13 @@ primary data for the merged place.</property>
</child>
<child>
<object class="GtkRadioButton" id="name_btn1">
<property name="label" translatable="yes">place|Name:</property>
<property name="label" translatable="yes" context="place">Name:</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">start</property>
<property name="relief">half</property>
<property name="use_underline">True</property>
<property name="halign">start</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
@@ -442,13 +440,13 @@ primary data for the merged place.</property>
</child>
<child>
<object class="GtkRadioButton" id="name_btn2">
<property name="label" translatable="yes">place|Name:</property>
<property name="label" translatable="yes" context="place">Name:</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">start</property>
<property name="relief">half</property>
<property name="use_underline">True</property>
<property name="halign">start</property>
<property name="draw_indicator">True</property>
<property name="group">name_btn1</property>
</object>
@@ -489,9 +487,9 @@ primary data for the merged place.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">start</property>
<property name="relief">half</property>
<property name="use_underline">True</property>
<property name="halign">start</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
@@ -506,9 +504,9 @@ primary data for the merged place.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">start</property>
<property name="relief">half</property>
<property name="use_underline">True</property>
<property name="halign">start</property>
<property name="draw_indicator">True</property>
<property name="group">type_btn1</property>
</object>
@@ -549,9 +547,9 @@ primary data for the merged place.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">start</property>
<property name="relief">half</property>
<property name="use_underline">True</property>
<property name="halign">start</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
@@ -566,8 +564,8 @@ primary data for the merged place.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="halign">start</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<property name="group">code_btn1</property>
</object>
@@ -619,7 +617,7 @@ primary data for the merged place.</property>
<object class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Alternate locations, sources, urls, media objects and notes of both places will be combined.</property>
<property name="label" translatable="yes">Alternative names, sources, urls, media objects and notes of both places will be combined.</property>
<property name="wrap">True</property>
</object>
<packing>

View File

@@ -41,6 +41,8 @@ from gramps.gen.const import URL_MANUAL_PAGE
from ..display import display_help
from ..managedwindow import ManagedWindow
from gramps.gen.merge import MergePlaceQuery
from gramps.gen.display.place import displayer as place_displayer
from gramps.gen.config import config
#-------------------------------------------------------------------------
#
@@ -76,15 +78,20 @@ class MergePlace(ManagedWindow):
_("Merge Places"))
# Detailed selection widgets
title1 = self.pl1.get_title()
title2 = self.pl2.get_title()
entry1 = self.get_widget("title1")
entry2 = self.get_widget("title2")
entry1.set_text(title1)
entry2.set_text(title2)
if entry1.get_text() == entry2.get_text():
for widget_name in ('title1', 'title2', 'title_btn1', 'title_btn2'):
self.get_widget(widget_name).set_sensitive(False)
if config.get('preferences.place-title'):
title1 = self.pl1.get_title()
title2 = self.pl2.get_title()
entry1 = self.get_widget("title1")
entry2 = self.get_widget("title2")
entry1.set_text(title1)
entry2.set_text(title2)
if entry1.get_text() == entry2.get_text():
for widget_name in ('title1', 'title2',
'title_btn1', 'title_btn2'):
self.get_widget(widget_name).set_sensitive(False)
for widget_name in ('title1', 'title2',
'title_btn1', 'title_btn2'):
self.get_widget(widget_name).show()
for widget_name in ('name_btn1', 'name_btn2'):
self.get_widget(widget_name).set_label(PLACE_NAME)
@@ -140,6 +147,8 @@ class MergePlace(ManagedWindow):
self.get_widget(widget_name).set_sensitive(False)
# Main window widgets that determine which handle survives
title1 = place_displayer.display(database, self.pl1)
title2 = place_displayer.display(database, self.pl2)
rbutton1 = self.get_widget("handle_btn1")
rbutton_label1 = self.get_widget("label_handle_btn1")
rbutton_label2 = self.get_widget("label_handle_btn2")

View File

@@ -44,9 +44,10 @@ from gi.repository import Gtk
# GRAMPS modules
#
#-------------------------------------------------------------------------
from gramps.gen.lib.placetype import PlaceType
from gramps.gen.lib import Place, PlaceType
from gramps.gen.datehandler import format_time
from gramps.gen.utils.place import conv_lat_lon
from gramps.gen.display.place import displayer as place_displayer
from .flatbasemodel import FlatBaseModel
from .treebasemodel import TreeBaseModel
@@ -115,7 +116,9 @@ class PlaceBaseModel(object):
return len(self.fmap)+1
def column_title(self, data):
return str(data[2])
place = Place()
place.unserialize(data)
return place_displayer.display(self.db, place)
def column_name(self, data):
return str(data[6][0])

View File

@@ -47,11 +47,11 @@ from gramps.gen.const import GRAMPS_LOCALE as glocale
from gramps.gen.utils.libformatting import ImportInfo
_ = glocale.translation.gettext
ngettext = glocale.translation.ngettext # else "nearby" comments are ignored
from gramps.gen.errors import GedcomError
from gramps.gen.errors import GedcomError, GrampsImportError
from gramps.gen.lib import (Attribute, AttributeType, ChildRef, Citation,
Date, DateError, Event, EventRef, EventRoleType, EventType,
Family, FamilyRelType, Name, NameType, Note, Person, PersonRef,
Place, Source)
Place, Source, LdsOrd)
from gramps.gen.db import DbTxn
from gramps.gen.constfunc import conv_to_unicode
from html.entities import name2codepoint
@@ -71,6 +71,73 @@ _cal_map = {
'F' : Date.CAL_FRENCH,
}
pevents_map = {
"#birt" : EventType.BIRTH, #Epers_Birth
"#bapt" : EventType.BAPTISM, #Epers_Baptism
"#deat" : EventType.DEATH, #Epers_Death
"#buri" : EventType.BURIAL, #Epers_Burial
"#crem" : EventType.CREMATION,
"#acco" : EventType((EventType.CUSTOM, _('Accomplishment'))) ,
"#acqu" : EventType((EventType.CUSTOM, _('Acquisition'))),
"#adhe" : EventType((EventType.CUSTOM, _('Adhesion'))),
"#awar" : EventType((EventType.CUSTOM, _('Award'))),
"#bapl" : LdsOrd.BAPTISM, #Epers_BaptismLDS
"#barm" : EventType.BAR_MITZVAH, #Epers_BarMitzvah
"#basm" : EventType.BAS_MITZVAH, #Epers_BatMitzvah
"#bles" : EventType.BLESS, #Epers_Benediction
"#cens" : EventType.CENSUS,
"#chgn" : EventType((EventType.CUSTOM, _('Change Name'))),
"#circ" : EventType((EventType.CUSTOM, _('Circumcision'))),
"#conf" : EventType.CONFIRMATION, #Epers_Confirmation
"#conl" : LdsOrd.CONFIRMATION, #Epers_ConfirmationLDS
"#degr" : EventType.DEGREE,
"#demm" : EventType((EventType.CUSTOM, _('Military Demobilisation'))),
"#dist" : EventType((EventType.CUSTOM, _('Award'))),
"#dotl" : LdsOrd.ENDOWMENT, #Epers_DotationLDS
"#educ" : EventType.EDUCATION, #Epers_Education
"#elec" : EventType.ELECTED, #Epers_Election
"#emig" : EventType.EMIGRATION,
"#endl" : EventType((EventType.CUSTOM, _('Dotation'))),
"#exco" : EventType((EventType.CUSTOM, _('Excommunication'))),
"#fcom" : EventType.FIRST_COMMUN,
"#flkl" : EventType((EventType.CUSTOM, _('LDS Family Link'))),
"#fune" : EventType((EventType.CUSTOM, _('Funeral'))),
"#grad" : EventType.GRADUATION,
"#hosp" : EventType((EventType.CUSTOM, _('Hospitalisation'))),
"#illn" : EventType((EventType.CUSTOM, _('Illness'))),
"#immi" : EventType.IMMIGRATION,
"#lpas" : EventType((EventType.CUSTOM, _('List Passenger'))),
"#mdis" : EventType((EventType.CUSTOM, _('Military Distinction'))),
"#mobm" : EventType((EventType.CUSTOM, _('Militaty Mobilisation'))),
"#mpro" : EventType((EventType.CUSTOM, _('Military Promotion'))),
"#mser" : EventType.MILITARY_SERV, #Epers_MilitaryService
"#natu" : EventType.NATURALIZATION, #Epers_Naturalisation
"#occu" : EventType.OCCUPATION, #Epers_Occupation
"#ordn" : EventType.ORDINATION, #Epers_Ordination
"#prop" : EventType.PROPERTY, #Epers_Property
"#resi" : EventType.RESIDENCE, #Epers_Residence
"#reti" : EventType.RETIREMENT,
"#slgc" : EventType((EventType.CUSTOM, _('LDS Seal to child'))), #Epers_ScellentChildLDS
"#slgp" : LdsOrd.SEAL_TO_PARENTS, #Epers_ScellentParentLDS
"#slgs" : LdsOrd.SEAL_TO_SPOUSE,
"#vteb" : EventType((EventType.CUSTOM, _('Sold property'))), #Epers_VenteBien
"#will" : EventType.WILL, #Epers_Will
}
fevents_map = {
"#marr" : EventType.MARRIAGE, #Efam_Marriage
"#nmar" : EventType.NUM_MARRIAGES,
"#nmen" : EventType((EventType.CUSTOM, _('No mention'))), #Efam_NoMention
"#enga" : EventType.ENGAGEMENT, #Efam_Engage
"#div" : EventType.DIVORCE,
"#sep" : EventType((EventType.CUSTOM, _('Separated'))), #Efam_Separated
"#anul" : EventType.ANNULMENT, #Efam_Annulation
"#marb" : EventType.MARR_BANNS, #Efam_MarriageBann
"#marc" : EventType.MARR_CONTR, #Efam_MarriageContract)
"#marl" : EventType.MARR_LIC, #Efam_MarriageLicense)
"#resi" : EventType.RESIDENCE, #Efam_Residence)
}
#-------------------------------------------------------------------------
#
#
@@ -99,18 +166,26 @@ def importData(database, filename, user):
#-------------------------------------------------------------------------
# For a description of the file format see
# http://cristal.inria.fr/~ddr/GeneWeb/en/gwformat.htm
# https://github.com/geneanet/geneweb/issues/315
#-------------------------------------------------------------------------
class GeneWebParser(object):
def __init__(self, dbase, file):
self.db = dbase
if file: # Unit tests can create the parser w/o underlying file
self.f = open(file, "rU")
self.f = open(file, "rUb")
self.filename = file
self.encoding = 'iso-8859-1'
self.gwplus = False
def get_next_line(self):
self.lineno += 1
line = self.f.readline()
try:
line = conv_to_unicode(line)
except GrampsImportError as err:
self.errmsg(str(err))
if line:
try:
line = str(line.strip())
@@ -150,7 +225,13 @@ class GeneWebParser(object):
fields = line.split(" ")
LOG.debug("LINE: %s" %line)
if fields[0] == "fam":
if fields[0] == "gwplus":
self.gwplus = True
self.encoding = 'utf-8'
elif fields[0] == "encoding:":
self.encoding = fields[1]
elif fields[0] == "fam":
self.current_mode = "fam"
self.read_family_line(line,fields)
elif fields[0] == "rel":
@@ -172,12 +253,18 @@ class GeneWebParser(object):
self.read_family_comment(line,fields)
elif fields[0] == "notes":
self.read_person_notes_lines(line,fields)
elif fields[0] == "fevt" and self.current_mode == "fam":
#self.read_fevent_line(self.get_next_line())
pass
elif fields[0] == "pevt":
#self.read_pevent_line(self.get_next_line(), fields)
pass
elif fields[0] == "notes-db":
self.read_database_notes_lines(line,fields)
elif fields[0] == "pages-ext" or "wizard-note":
pass
elif fields[0] == "end":
self.current_mode = None
elif fields[0] == "encoding:":
self.encoding = fields[1]
else:
LOG.warning("parse_geneweb_file(): Token >%s< unknown. line %d skipped: %s" %
(fields[0],self.lineno,line))
@@ -855,7 +942,7 @@ class GeneWebParser(object):
self.db.add_event(event,self.trans)
self.db.commit_event(event,self.trans)
return event
def get_or_create_person(self,firstname,lastname):
person = None
mykey = firstname+lastname
@@ -896,6 +983,155 @@ class GeneWebParser(object):
self.db.commit_citation(citation, self.trans)
return citation
def read_fevent_line(self, event):
if fevents_map.get(event[0:5]) == None:
return #need to fix custom event types not in the map
fev = None
# get events for the current family
for evr in self.current_family.get_event_ref_list():
ev = self.db.get_event_from_handle(evr.get_reference_handle())
if ev.get_type() == fevents_map.get(event[0:5]):
fev = ev # found. Need to also check EventRef role
return
if not fev: # No event found create a new one
if evr.get_role() != EventRoleType(EventRoleType.FAMILY):
continue
else:
LOG.info((ev.get_type(), self.current_family.handle))
self.new_gwplus_fevent(event)
while True:
line = self.get_next_line()
if line and line[0:5] in fevents_map:
self.new_gwplus_fevent(line)
elif line and line[0:4] == "wit:":
continue
else:
self.current_mode = None
#self.db.commit_family(self.current_family,self.trans)
break
def read_pevent_line(self, event, fields):
name = fields[2] + fields[1]
try:
self.person = self.ikeys[name]
# check key on {ikey}
except:
self.person = "(TO_CHECK: %s)" % fields[1:]
#GrampsImportError()
lastname = fields[1]
firstname = fields[2]
self.current_person = self.get_or_create_person(firstname, lastname)
#name = Name()
#name.set_type(NameType(NameType.BIRTH))
#name.set_first_name(firstname)
#surname_obj = name.get_primary_surname()
#surname_obj.set_surname(surname)
#self.current_person.set_primary_name(name)
if pevents_map.get(event[0:5]) == None:
return #need to fix custom event types not in the map
self.current_event = None
# get events for the current person
for evr in self.current_person.get_event_ref_list():
ev = self.db.get_event_from_handle(evr.get_reference_handle())
if ev.get_type() == pevents_map.get(event[0:5]):
self.current_event = ev # found. Need to also check EventRef role
if not self.current_event: # No event found create a new one
self.current_event = self.new_gwplus_pevent(event)
while True:
line = self.get_next_line()
if line and line[0:5] in pevents_map:
self.current_mode = "person_event"
self.current_event = self.new_gwplus_pevent(line)
elif line and line[0:4] == "note":
n = Note()
n.set(line[5:])
self.db.add_note(n, self.trans)
if self.current_event:
self.current_event.add_note(n.handle)
self.db.commit_event(self.current_event, self.trans)
else:
print('note', n.handle)
else:
self.current_mode = None
#self.db.commit_person(self.current_person,self.trans)
break
def new_gwplus_fevent(self, line):
source = place = note = type = None
date = self.parse_date(self.decode(line[6:]))
idx = 0
LOG.info((line, fevents_map.get(line[0:5])))
type = fevents_map.get(line[0:5])
data = line.split()
date = self.parse_date(self.decode(line[6:]))
for part in data:
idx += 1
if part == "#p":
place = self.get_or_create_place(self.decode(data[idx]))
if part == "#s":
source = self.get_or_create_source(self.decode(data[idx]))
self.current_event = self.create_event(type, None, None, None, None)
print('new event', self.current_event.handle)
if date:
print(date)
self.current_event.set_date_object(date)
if place:
print('place', place.handle)
self.current_event.set_place_handle(place.get_handle())
if source:
print('source', source.handle)
self.current_event.add_citation(source.get_handle())
self.db.commit_event(self.current_event, self.trans)
nev_ref = EventRef()
nev_ref.set_reference_handle(self.current_event.get_handle())
self.current_family.add_event_ref(nev_ref)
self.db.commit_family(self.current_family, self.trans)
return self.current_event
def new_gwplus_pevent(self, line):
source = place = note = type = None
date = self.parse_date(self.decode(line[6:]))
idx = 0
LOG.info((self.person, line, pevents_map.get(line[0:5])))
type = pevents_map.get(line[0:5])
data = line.split()
date = self.parse_date(self.decode(line[6:]))
for part in data:
idx += 1
if part == "#p":
place = self.get_or_create_place(self.decode(data[idx]))
if part == "#s":
source = self.get_or_create_source(self.decode(data[idx]))
self.current_event = self.create_event(type, None, None, None, None)
print('new event', self.current_event.handle)
if date:
print(date)
self.current_event.set_date_object(date)
if place:
print('place', place.handle)
self.current_event.set_place_handle(place.get_handle())
if source:
print('source', source.handle)
self.current_event.add_citation(source.get_handle())
self.db.commit_event(self.current_event, self.trans)
nev_ref = EventRef()
nev_ref.set_reference_handle(self.current_event.get_handle())
self.current_person.add_event_ref(nev_ref)
self.db.commit_person(self.current_person, self.trans)
return self.current_event
def decode(self,s):
s = s.replace('_',' ')
charref_re = re.compile('(&#)(x?)([0-9a-zA-Z]+)(;)')

View File

@@ -1,246 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkListStore" id="model1">
<columns>
<!-- column-name gchararray -->
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">- default -</col>
</row>
</data>
</object>
<object class="GtkDialog" id="phpgedview">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">phpGedView import</property>
<property name="window_position">mouse</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox" id="vbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="hbuttonbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="button1">
<property name="label">gtk-cancel</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="ok_button">
<property name="label">gtk-apply</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="activate" handler="on_ok_button_activate" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="table2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">12</property>
<property name="row_spacing">9</property>
<property name="column_spacing">9</property>
<child>
<object class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">phpGedView import</property>
<property name="justify">center</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="url_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="width_chars">25</property>
<property name="text" translatable="yes">http://</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="username_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="editable">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="password_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="editable">False</property>
<property name="visibility">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="file_combo">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="model">model1</property>
<child>
<object class="GtkCellRendererText" id="renderer1"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label10">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">File:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label11">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Username:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label12">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Password:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="version_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="halign">start</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">URL:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkProgressBar" id="progressbar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="pulse_step">0.10000000149</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">6</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">5</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="-6">button1</action-widget>
<action-widget response="-10">ok_button</action-widget>
</action-widgets>
</object>
</interface>

View File

@@ -1,433 +0,0 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2005 Donald N. Allingham, Martin Hawlisch
#
# 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.
#
"Download a GEDCOM file from a phpGedView server"
import http.client as hcl
from urllib.request import Request, urlopen
from urllib.error import URLError
from gi.repository import Gtk
import os
from tempfile import mkstemp
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
from gramps.gui.glade import Glade
import gramps.plugins.lib.libgedcom as libgedcom
#
# Interface to phpGedView
#
# See http://phpgedview.sourceforge.net/racp.php
#
class PHPGedViewConnector(object):
TYPE_INDI = 1
TYPE_FAM = 2
TYPE_SOUR = 3
TYPE_REPO = 4
TYPE_NOTE = 5
TYPE_OBJE = 6
TYPE_OTHER = 7
TYPE_ALL = 99
POS_NEW = 1
POS_FIRST = 2
POS_NEXT = 3
POS_PREV = 4
POS_LAST = 5
POS_ALL = 6
type_trans = {
TYPE_INDI: "INDI",
TYPE_FAM: "FAM",
TYPE_SOUR: "SOUR",
TYPE_REPO: "REPO",
TYPE_NOTE: "NOTE",
TYPE_OBJE: "OBJE",
TYPE_OTHER: "OTHER",
}
pos_trans = {
POS_NEW: "new",
POS_FIRST: "first",
POS_NEXT: "next",
POS_PREV: "prev",
POS_LAST: "last",
POS_ALL: "all",
}
def __init__(self,url,progressbar_cb=None):
self.url = url
self.sessionname = None
self.sessionid = None
self.connected = False
self.progressbar_cb = progressbar_cb
def update_progressbar(self,text=None,pos=0,max=0):
if self.progressbar_cb:
self.progressbar_cb(text,pos,max)
def get_version(self):
response = self.fetch_url_to_array( [("action","version",),])
if response and response[0] == "SUCCESS":
version = response[1]
return version
return None
def list_gedcoms(self):
response = self.fetch_url_to_array( [("action","listgedcoms",),])
if response and response[0] == "SUCCESS":
gedcoms = []
for i in range(1,len(response)):
if not response[i].strip():
break
gedcoms.append(response[i].split("\t"))
return gedcoms
return None
def connect_to_gedcom(self, filename=None, username=None, password=None):
self.gedname = None
params = []
params.append( ("action","connect",))
if filename:
params.append( ("ged",filename,))
if username:
params.append( ("username",username,))
if password:
params.append( ("password",password,))
response = self.fetch_url_to_array( params)
if response and response[0] == "SUCCESS":
session = response[1].split("\t")
self.sessionname = session[0]
self.sessionid = session[1]
self.connected = True
if filename:
self.gedname = filename
return True
return False
def list_xrefs(self, type = TYPE_ALL, pos=POS_ALL, xref=None):
result = []
types = []
if type == self.TYPE_ALL:
types.extend(self.type_trans)
else:
types.append(type)
for entry in types:
request = []
request.append( ("action", "getxref"))
request.append( ("type", self.type_trans[entry]))
request.append( ("position", self.pos_trans[pos]))
if xref:
request.append( ("xref", xref))
result_part = self.fetch_url_to_array( request)
if result_part[0] == "SUCCESS":
for x in range(1,len(result_part)):
txt = result_part[x]
if txt:
txt = txt.strip()
if len(txt) > 0:
result.append( txt)
else:
break
else:
break
return result
def get_records(self, xref):
if not xref or len(xref) == 0:
return None
# merge xref list to a semicolon separated string
xref_str = ""
try:
for x in xref:
xref_str += x+";"
except TypeError:
xref_str = xref
result = []
request = []
request.append( ("action", "get"))
request.append( ("xref", xref_str))
result_part = self.fetch_url_to_array( request)
#print result_part
if result_part[0] == "SUCCESS":
for x in range(1,len(result_part)):
txt = result_part[x].strip()
if txt and txt != "":
result.append( txt)
return result
def fetch_full_gedcom( self, outfile=None):
print(outfile)
if outfile is None:
gedname = self.gedname
if not gedname:
gedname = "temp.ged"
filenameparts = gedname.split(".")
(outfiled, outfilename) = mkstemp("."+filenameparts[1],filenameparts[0]+"_")
outfile = os.fdopen(outfiled,"w")
else:
outfilename = outfile.name
print(outfile)
outfile.write("0 HEAD\n")
outfile.write("1 SOUR phpGedView\n")
outfile.write("2 VERS %s\n" % self.get_version())
outfile.write("2 NAME phpGedView\n")
outfile.write("2 DATA %s\n" % self.url)
outfile.write("1 CHAR UTF-8\n")
outfile.write("1 GEDC\n")
outfile.write("2 VERS 5.5\n")
outfile.write("2 FORM LINEAGE-LINKED\n")
outfile.write("1 NOTE Dowloaded using GRAMPS PHPGedViewConnector\n")
self.update_progressbar(_("Fetching index list..."))
steps = ( self.TYPE_INDI,
self.TYPE_FAM,
self.TYPE_SOUR,
self.TYPE_REPO,
self.TYPE_NOTE,
self.TYPE_OBJE
)
xref_list = []
i = 0
for type in steps:
self.update_progressbar( _("Fetching index list..."), i, len(steps))
xref_list += self.list_xrefs( type)
i += 1
self.update_progressbar( _("Fetching records..."))
i = 0
junk_size = 100
for i in range(len(xref_list)/junk_size+1):
self.update_progressbar( _("Fetching records..."), i*junk_size, len(xref_list))
record = self.get_records(xref_list[i*junk_size:(i+1)*junk_size])
if record:
for r in record:
outfile.write(r+"\n")
outfile.flush()
i += 1
outfile.write("0 TRLR\n")
outfile.flush()
outfile.close()
return outfilename
def get_variable(self, name="PEDIGREE_ROOT_ID"):
if not name:
return None
result = []
request = []
request.append( ("action", "getvar"))
request.append( ("var", name))
result_part = self.fetch_url_to_array( request)
if result_part[0] == "SUCCESS":
for x in range(1,len(result_part)):
txt = result_part[x].strip()
if txt and txt != "":
result.append( txt)
return result
def fetch_url_to_array(self, params):
request_url = self.url + "gdbi.php?"
for param in params:
request_url += "%s=%s&" % (param)
if self.sessionname and self.sessionid:
request_url += "%s=%s&" % (self.sessionname,self.sessionid)
print("fetching %s" % request_url)
request = Request(request_url)
request.add_header("User-Agent", "Mozilla 1.2 (Win 98 jp)")
f = urlopen(request)
result = []
line = f.readline()
while line:
result.append(line.strip())
line = f.readline()
if len(result) > 0:
return result
return None
#
# Wrapper that uses the PHPGedViewConnector to download
# the GEDCOM file and import it into the database.
#
class phpGedViewImporter(object):
def __init__(self, database):
self.db = database
self.url = None
self.connector = None
top = Glade("phpgedview.glade")
self.url_entry = top.get_object('url_entry')
self.version_label = top.get_object('version_label')
self.version_label.set_text("")
self.file_combo = top.get_object('file_combo')
self.file_combo.hide()
self.username_entry = top.get_object('username_entry')
self.username_entry.hide()
self.password_entry = top.get_object('password_entry')
self.password_entry.hide()
self.ok_button = top.get_object('ok_button')
self.ok_button.connect("activate", self.on_next_pressed_cb)
self.ok_button.connect("button_release_event", self.on_next_pressed_cb)
self.progressbar = top.get_object('progressbar')
self.dialog = top.toplevel
self.dialog.show()
def filter_url(self, url):
if url[:7] != "http://":
url = "http://"+url
if url[-1:] != "/":
url = url + "/"
print(url)
return url
def update_progressbar(self,text,step=0,max=0):
self.progressbar.set_text(text)
if max > 0:
self.progressbar.set_fraction( 1.0 * step / max)
else:
self.progressbar.set_fraction( 0.0)
while Gtk.events_pending():
Gtk.main_iteration()
def on_next_pressed_cb(self, widget, event=None, data=None):
if event:
print(event.type)
if not self.url or self.url != self.url_entry.get_text():
# url entered the first time or url changed
self.url = self.filter_url( self.url_entry.get_text())
if self.validate_server():
self.url_entry.set_text( self.url)
else:
self.update_progressbar(_("Logging in..."))
if self.connector.connect_to_gedcom(self.file_combo.get_active_text(), self.username_entry.get_text(), self.password_entry.get_text()):
self.update_progressbar( _("Fetching GEDCOM..."))
fn = self.connector.fetch_full_gedcom()
self.update_progressbar( _("Importing GEDCOM..."))
libgedcom.GedcomParser.importData(self.db, fn)
# done. bye.
self.dialog.destroy()
else:
self.version_label.set_text(_("Error: login failed"))
self.update_progressbar( _("done."))
return 1
def validate_server(self):
try:
self.update_progressbar(_("Connecting..."))
self.connector = PHPGedViewConnector(self.url,self.update_progressbar)
self.update_progressbar(_("Get version..."))
version = self.connector.get_version()
if version:
self.version_label.set_text(_("Version %s") % version)
self.update_progressbar(_("Reading file list..."))
files = self.connector.list_gedcoms()
list_store = self.file_combo.get_model()
list_store.clear()
for file in files:
list_store.append([file[0],])
self.file_combo.show()
self.username_entry.show()
self.password_entry.show()
return True
except (ValueError, URLError, hcl.InvalidURL) as e:
print(e)
self.version_label.set_text(_("Error: Invalid URL"))
self.update_progressbar(_("done."))
return False
# TODO: This should go into PHPGedViewConnector
def filter_url( url):
url = url.split("?")[0] # strip params
if url[-1:] == "/": # strip trailing slash
url = url[:-1]
if url[-4:] in (".php",".htm") or url[-5:] in (".html"): # strip script name
idx = url.rfind("/")
if idx > 1:
url = url[:idx]
if url[:7] != "http://": # add protocol
url = "http://"+url
if url[-1:] != "/": # readd trailing slash
url = url + "/"
return url
## # for Testing
## if __name__ == "__main__":
## def dummy_progress( text,pos=0,max=0):
## if max > 0:
## percent = pos*100/max
## print "%s: %d%%" % (text,percent)
## else:
## print text
## try:
## f = open("/tmp/sites.txt")
## l = f.readline()
## while l:
## l = filter_url(l.strip())
## print l
## try:
## c = PHPGedViewConnector(l,dummy_progress)
## c.connect_to_gedcom()
## v = c.get_version()
## if v:
## print("%s\t\t%s" % (v,l))
## c.fetch_full_gedcom()
## except KeyboardInterrupt:
## exit
## l = f.readline()
## except IOError:
## phpGedViewImporter(None)
## Gtk.main()
## else:
## #-------------------------------------------------------------------------
## #
## #
## #
## #-------------------------------------------------------------------------
## def phpGedViewImporterCaller(database,active_person,callback,parent=None):
## phpGedViewImporter(database)
## register_tool(
## phpGedViewImporterCaller,
## _("Import the gedcom from a phpGedView driven website"),
## category=_("Import"),
## description=_("phpGedView is an open source web application that generates dynamic webpages"
## " out of a GEDCOM file. This plugin uses the gedcom access protocol to"
## " retrieve the gedcom file from the webserver.")
## )

View File

@@ -50,7 +50,7 @@ from gramps.gen.lib import (Address, Attribute, AttributeType, ChildRef,
ChildRefType, Citation, Date, Event, EventRef, EventRoleType,
EventType, Family, FamilyRelType, GrampsType, LdsOrd, Location,
MediaObject, MediaRef, Name, NameOriginType, NameType, Note,
NoteType, Person, PersonRef, Place, PlaceType, PlaceRef,
NoteType, Person, PersonRef, Place, PlaceType, PlaceRef, PlaceName,
RepoRef, Repository, RepositoryType, Source, SourceMediaType,
SrcAttribute, SrcAttributeType, Surname, Tag, Url, UrlType)
from gramps.gen.lib.addressbase import AddressBase
@@ -194,6 +194,7 @@ class TestcaseGenerator(tool.BatchTool):
def init_gui(self,uistate):
title = "%s - Gramps" % _("Generate testcases")
self.top = Gtk.Dialog(title, parent=uistate.window)
self.window = uistate.window
self.top.set_default_size(400,150)
self.top.vbox.set_spacing(5)
label = Gtk.Label(label='<span size="larger" weight="bold">%s</span>' % _("Generate testcases"))
@@ -1670,7 +1671,7 @@ class TestcaseGenerator(tool.BatchTool):
if isinstance(o, Place):
o.set_title(self.rand_text(self.LONG))
o.set_name(self.rand_text(self.SHORT))
o.set_name(PlaceName(value=self.rand_text(self.SHORT)))
o.set_code(self.rand_text(self.SHORT))
if randint(0, 1) == 1:
if randint(0, 4) == 1:

View File

@@ -353,7 +353,6 @@ gramps/gui/dialog.py
gramps/gui/displaystate.py
gramps/gui/editors/addmedia.py
gramps/gui/editors/displaytabs/addrembedlist.py
gramps/gui/editors/displaytabs/altnameembedlist.py
gramps/gui/editors/displaytabs/attrembedlist.py
gramps/gui/editors/displaytabs/backreflist.py
gramps/gui/editors/displaytabs/backrefmodel.py
@@ -371,6 +370,7 @@ gramps/gui/editors/displaytabs/namemodel.py
gramps/gui/editors/displaytabs/notetab.py
gramps/gui/editors/displaytabs/personeventembedlist.py
gramps/gui/editors/displaytabs/personrefembedlist.py
gramps/gui/editors/displaytabs/placenameembedlist.py
gramps/gui/editors/displaytabs/placerefembedlist.py
gramps/gui/editors/displaytabs/repoembedlist.py
gramps/gui/editors/displaytabs/srcattrembedlist.py
@@ -442,6 +442,7 @@ gramps/gui/glade/editnote.glade
gramps/gui/glade/editperson.glade
gramps/gui/glade/editpersonref.glade
gramps/gui/glade/editplace.glade
gramps/gui/glade/editplacename.glade
gramps/gui/glade/editplaceref.glade
gramps/gui/glade/editreporef.glade
gramps/gui/glade/editrepository.glade
@@ -660,6 +661,7 @@ gramps/plugins/textreport/endoflinereport.py
gramps/plugins/textreport/familygroup.py
gramps/plugins/textreport/indivcomplete.py
gramps/plugins/textreport/kinshipreport.py
gramps/plugins/textreport/notelinkreport.py
gramps/plugins/textreport/numberofancestorsreport.py
gramps/plugins/textreport/placereport.py
gramps/plugins/textreport/recordsreport.py
@@ -690,8 +692,6 @@ gramps/plugins/tool/ownereditor.glade
gramps/plugins/tool/ownereditor.py
gramps/plugins/tool/patchnames.glade
gramps/plugins/tool/patchnames.py
gramps/plugins/tool/phpgedview.glade
gramps/plugins/tool/phpgedviewconnector.py
gramps/plugins/tool/populatesources.py
gramps/plugins/tool/rebuild.py
gramps/plugins/tool/rebuildgenderstat.py

1471
po/fr.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

7651
po/sl.po

File diff suppressed because it is too large Load Diff