Merge branch 'gramps50'

This commit is contained in:
Nick Hall 2017-06-15 16:44:15 +01:00
commit dfc9dde32d
16 changed files with 103 additions and 263 deletions

View File

@ -42,7 +42,7 @@ The following packages are **STRONGLY RECOMMENDED** to be installed:
Used to show maps in the geography view.
It may be osmgpsmap, osm-gps-map, or python-osmgpsmap,
but the Python bindings for this must also be present.
but the Python bindings for this must also be present, so gir1.2-osmgpsmap-1.0.
Without this the GeoView will not be active, see
https://gramps-project.org/wiki/index.php?title=Gramps_4.2_Wiki_Manual_-_Categories#Geography_Category
@ -50,7 +50,7 @@ The following packages are **STRONGLY RECOMMENDED** to be installed:
Enable creation of graphs using Graphviz engine.
Without this, three reports cannot be run.
Obtain it from: http://www.graphviz.org
Obtain it from: http://www.graphviz.org or try graphviz and python3-pygraphviz from your packages.
* **PyICU**
@ -109,7 +109,7 @@ Prerequistes required for the following Addons to work:
* **Family Sheet** - Requires: PIL (Python Imaging Library) or PILLOW.
( https://gramps-project.org/wiki/index.php?title=Family_Sheet )
* **Graph View** - Requires: PyGoocanvas and Goocanvas.
* **Graph View** - Requires: PyGoocanvas and Goocanvas (python-pygoocanvas, gir1.2-goocanvas-2.0).
( https://gramps-project.org/wiki/index.php?title=Graph_View )
* **PedigreeChart** - Can optionally use - numpy if installed

View File

@ -49,145 +49,15 @@ class DateParserCZ(DateParser):
"""
Converts a text string into a Date object
"""
month_to_int = DateParser.month_to_int
month_to_int["leden"] = 1
month_to_int["ledna"] = 1
month_to_int["lednu"] = 1
month_to_int["led"] = 1
month_to_int["I"] = 1
month_to_int["i"] = 1
month_to_int["únor"] = 2
month_to_int["února"] = 2
month_to_int["únoru"] = 2
month_to_int["ún"] = 2
month_to_int["II"] = 2
month_to_int["ii"] = 2
month_to_int["březen"] = 3
month_to_int["března"] = 3
month_to_int["březnu"] = 3
month_to_int["bře"] = 3
month_to_int["III"] = 3
month_to_int["iii"] = 3
month_to_int["duben"] = 4
month_to_int["dubna"] = 4
month_to_int["dubnu"] = 4
month_to_int["dub"] = 4
month_to_int["IV"] = 4
month_to_int["iv"] = 4
month_to_int["květen"] = 5
month_to_int["května"] = 5
month_to_int["květnu"] = 5
month_to_int["V"] = 5
month_to_int["v"] = 5
month_to_int["červen"] = 6
month_to_int["června"] = 6
month_to_int["červnu"] = 6
month_to_int["čer"] = 6
month_to_int["vi"] = 6
month_to_int["červenec"] = 7
month_to_int["července"] = 7
month_to_int["červenci"] = 7
month_to_int["čvc"] = 7
month_to_int["VII"] = 7
month_to_int["vii"] = 7
month_to_int["srpen"] = 8
month_to_int["srpna"] = 8
month_to_int["srpnu"] = 8
month_to_int["srp"] = 8
month_to_int["VIII"] = 8
month_to_int["viii"] = 8
month_to_int["září"] = 9
month_to_int["zář"] = 9
month_to_int["IX"] = 9
month_to_int["ix"] = 9
month_to_int["říjen"] = 10
month_to_int["října"] = 10
month_to_int["říjnu"] = 10
month_to_int["říj"] = 10
month_to_int["X"] = 10
month_to_int["x"] = 10
month_to_int["listopad"] = 11
month_to_int["listopadu"] = 11
month_to_int["lis"] = 11
month_to_int["XI"] = 11
month_to_int["xi"] = 11
month_to_int["prosinec"] = 12
month_to_int["prosince"] = 12
month_to_int["prosinci"] = 12
month_to_int["pro"] = 12
month_to_int["XII"] = 12
month_to_int["xii"] = 12
modifier_to_int = {
'před' : Date.MOD_BEFORE,
'do' : Date.MOD_BEFORE,
'po' : Date.MOD_AFTER,
'asi' : Date.MOD_ABOUT,
'kolem' : Date.MOD_ABOUT,
'přibl.' : Date.MOD_ABOUT,
}
calendar_to_int = {
'gregoriánský' : Date.CAL_GREGORIAN,
'greg.' : Date.CAL_GREGORIAN,
'g' : Date.CAL_GREGORIAN,
'juliánský' : Date.CAL_JULIAN,
'jul.' : Date.CAL_JULIAN,
'j' : Date.CAL_JULIAN,
'hebrejský' : Date.CAL_HEBREW,
'hebr.' : Date.CAL_HEBREW,
'h' : Date.CAL_HEBREW,
'islámský' : Date.CAL_ISLAMIC,
'isl.' : Date.CAL_ISLAMIC,
'i' : Date.CAL_ISLAMIC,
'francouzský republikánský' : Date.CAL_FRENCH,
'fr.' : Date.CAL_FRENCH,
'perský' : Date.CAL_PERSIAN,
'per.' : Date.CAL_PERSIAN,
'p' : Date.CAL_PERSIAN,
'švédský' : Date.CAL_SWEDISH,
'sve.' : Date.CAL_SWEDISH,
's' : Date.CAL_SWEDISH,
}
quality_to_int = {
'přibližně' : Date.QUAL_ESTIMATED,
'odhadem' : Date.QUAL_ESTIMATED,
'odh.' : Date.QUAL_ESTIMATED,
'vypočteno' : Date.QUAL_CALCULATED,
'vypočtené' : Date.QUAL_CALCULATED,
'vyp.' : Date.QUAL_CALCULATED,
}
bce = ["před naším letopočtem", "před Kristem",
"př. n. l.", "př. Kr."] + DateParser.bce
def dhformat_changed(self):
""" Allow overriding so a subclass can modify it """
# bug 9739 grampslocale.py gets '%-d.%-m.%Y' -- makes it be '%/d.%/m.%Y'
self.dhformat = self.dhformat.replace('/', '') # so counteract that
def init_strings(self):
DateParser.init_strings(self)
self._text2 = re.compile('(\d+)?\.?\s+?%s\.?\s*((\d+)(/\d+)?)?\s*$'
% self._mon_str, re.IGNORECASE)
self._span = re.compile(
"(od)\s+(?P<start>.+)\s+(do)\s+(?P<stop>.+)",
re.IGNORECASE)
self._range = re.compile(
"(mezi)\s+(?P<start>.+)\s+(a)\s+(?P<stop>.+)",
re.IGNORECASE)
#-------------------------------------------------------------------------
#
# Czech display
@ -197,25 +67,6 @@ class DateDisplayCZ(DateDisplay):
"""
Czech language date display class.
"""
long_months = ( "", "leden", "únor", "březen", "duben", "květen",
"červen", "červenec", "srpen", "září", "říjen",
"listopad", "prosinec" )
short_months = ( "", "led", "úno", "bře", "dub", "kvě", "čer",
"čvc", "srp", "zář", "říj", "lis", "pro" )
calendar = (
"", "juliánský", "hebrejský",
"francouzský republikánský", "perský", "islámský",
"švédský"
)
_mod_str = ("", "před ", "po ", "kolem ", "", "", "")
_qual_str = ("", "přibližně ", "vypočteno ")
bce = ["před naším letopočtem", "před Kristem",
"př. n. l.", "př. Kr."] + DateParser.bce
display = DateDisplay.display_formatted
@ -225,58 +76,6 @@ class DateDisplayCZ(DateDisplay):
# bug 9537 grampslocale.py gets '%-d.%-m.%Y' -- makes it be '%/d.%/m.%Y'
self.dhformat = self.dhformat.replace('/', '') # so counteract that
self.formats = (
"ISO (rrrr-mm-dd)",
"numerický",
"měsíc den, Rok",
"měs den, Rok",
"den. měsíc rok",
"den. měs rok"
)
# this must agree with DateDisplayEn's "formats" definition
# (since no locale-specific _display_gregorian exists, here)
def orig_display(self, date): # unused: only here for historical reference
"""
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_NONE:
# date_decl_string = self.display_cal[cal](start)
# date_decl_string = date_decl_string.replace("den ", "dna ")
# date_decl_string = date_decl_string.replace("or ", "ora ")
# date_decl_string = date_decl_string.replace("en ", "na ")
# date_decl_string = date_decl_string.replace("ad ", "adu ")
# date_decl_string = date_decl_string.replace("ec ", "ce ")
# return date_decl_string
elif mod == Date.MOD_SPAN:
dat1 = self.display_cal[cal](start)
dat2 = self.display_cal[cal](date.get_stop_date())
scal = self.format_extras(cal, newyear)
return "%s%s %s %s %s%s" % (qual_str, 'od', dat1,
'do', dat2, scal)
elif mod == Date.MOD_RANGE:
dat1 = self.display_cal[cal](start)
dat2 = self.display_cal[cal](date.get_stop_date())
scal = self.format_extras(cal, newyear)
return "%s%s %s %s %s%s" % (qual_str, 'mezi',
dat1, 'a', dat2, scal)
else:
text = self.display_cal[date.get_calendar()](start)
scal = self.format_extras(cal, newyear)
return "%s%s%s%s" % (qual_str, self._mod_str[mod],
text, scal)
#-------------------------------------------------------------------------
#

View File

@ -1765,9 +1765,9 @@ class Date:
"""
Return True if the date contains no information (empty text).
"""
return (self.modifier == Date.MOD_TEXTONLY and not self.text) or \
(self.get_start_date() == Date.EMPTY
and self.get_stop_date() == Date.EMPTY)
return not((self.modifier == Date.MOD_TEXTONLY and self.text)
or self.get_start_date() != Date.EMPTY
or self.get_stop_date() != Date.EMPTY)
def is_compound(self):
"""

View File

@ -536,5 +536,42 @@ class Test_set_newyear(BaseDateTest):
except DateError:
self.assertTrue(should_raise, message)
#-------------------------------------------------------------------------
#
# EmptyDateTest
#
#-------------------------------------------------------------------------
class EmptyDateTest(BaseDateTest):
"""
Tests for empty dates.
"""
def test_empty(self):
d = Date()
self.assertTrue(d.is_empty())
def test_text_only_empty(self):
d = Date()
d.set(text='First of Jan',
modifier=Date.MOD_TEXTONLY)
self.assertFalse(d.is_empty())
def test_single_empty(self):
d = Date()
d.set(value=(1, 1, 1900, False),
modifier=Date.MOD_NONE)
self.assertFalse(d.is_empty())
def test_range_empty(self):
d = Date()
d.set(value=(1, 1, 1900, False, 1, 1, 1910, False),
modifier=Date.MOD_RANGE)
self.assertFalse(d.is_empty())
def test_span_empty(self):
d = Date()
d.set(value=(1, 1, 1900, False, 1, 1, 1910, False),
modifier=Date.MOD_SPAN)
self.assertFalse(d.is_empty())
if __name__ == "__main__":
unittest.main()

View File

@ -1314,54 +1314,57 @@ class ClipboardListView:
# Just select the first match.
wrapper_class = self._target_type_to_wrapper_class_map[
str(possible_wrappers[0])]
o = wrapper_class(self.dbstate, sel_data)
if title:
o._title = title
if value:
o._value = value
if dbid:
o._dbid = dbid
if dbname:
o._dbname = dbname
try:
o = wrapper_class(self.dbstate, sel_data)
if title:
o._title = title
if value:
o._value = value
if dbid:
o._dbid = dbid
if dbname:
o._dbname = dbname
# If the wrapper object is a subclass of ClipDropList then
# the drag data was a list of objects and we need to decode
# all of them.
if isinstance(o,ClipDropList):
o_list = o.get_objects()
else:
o_list = [o]
for o in o_list:
if o.__class__.DRAG_TARGET is None:
continue
data = [o.__class__.DRAG_TARGET.drag_type, o, None,
o._type, o._value, o._dbid, o._dbname]
contains = model_contains(model, data)
if ((context.action if hasattr(context, "action") else context.get_actions())
!= Gdk.DragAction.MOVE) and contains:
continue
drop_info = widget.get_dest_row_at_pos(x, y)
if drop_info:
path, position = drop_info
node = model.get_iter(path)
if (position == Gtk.TreeViewDropPosition.BEFORE
or position == Gtk.TreeViewDropPosition.INTO_OR_BEFORE):
model.insert_before(node, data)
else:
model.insert_after(node, data)
# If the wrapper object is a subclass of ClipDropList then
# the drag data was a list of objects and we need to decode
# all of them.
if isinstance(o,ClipDropList):
o_list = o.get_objects()
else:
model.append(data)
o_list = [o]
for o in o_list:
if o.__class__.DRAG_TARGET is None:
continue
data = [o.__class__.DRAG_TARGET.drag_type, o, None,
o._type, o._value, o._dbid, o._dbname]
contains = model_contains(model, data)
if ((context.action if hasattr(context, "action") else context.get_actions())
!= Gdk.DragAction.MOVE) and contains:
continue
drop_info = widget.get_dest_row_at_pos(x, y)
if drop_info:
path, position = drop_info
node = model.get_iter(path)
if (position == Gtk.TreeViewDropPosition.BEFORE
or position == Gtk.TreeViewDropPosition.INTO_OR_BEFORE):
model.insert_before(node, data)
else:
model.insert_after(node, data)
else:
model.append(data)
# FIXME: there is one bug here: if you multi-select and drop
# on self, then it moves the first, and copies the rest.
# FIXME: there is one bug here: if you multi-select and drop
# on self, then it moves the first, and copies the rest.
if ((context.action if hasattr(context, "action") else context.get_actions()) ==
Gdk.DragAction.MOVE):
context.finish(True, True, time)
if ((context.action if hasattr(context, "action") else context.get_actions()) ==
Gdk.DragAction.MOVE):
context.finish(True, True, time)
# remember time for double drop workaround.
self._previous_drop_time = realTime
return o_list
# remember time for double drop workaround.
self._previous_drop_time = realTime
return o_list
except EOFError:
return None
# proxy methods to provide access to the real widget functions.

View File

@ -107,7 +107,8 @@ from .managedwindow import ManagedWindow
#-------------------------------------------------------------------------
if is_quartz():
try:
gi.require_version('GtkosApplication', '1.0')
import gi
gi.require_version('GtkosxApplication', '1.0')
from gi.repository import GtkosxApplication as QuartzApp
_GTKOSXAPPLICATION = True
except:

View File

@ -118,7 +118,7 @@ class RelCalc(tool.Tool, ManagedWindow):
self.textbuffer = Gtk.TextBuffer()
self.text.set_buffer(self.textbuffer)
self.model = PersonTreeModel(self.db)
self.model = PersonTreeModel(self.db, uistate)
self.tree.set_model(self.model)
self.tree.connect('key-press-event', self._key_press)

View File

@ -12,7 +12,7 @@ msgstr ""
"PO-Revision-Date: 2014-06-29 15:50+0300\n"
"Last-Translator: Munzir Taha (منذر طه) <munzirtaha@gmail.com>\n"
"Language-Team: Arabic <>\n"
"Language: en_US\n"
"Language: ar\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

View File

@ -15,7 +15,7 @@ msgstr ""
"PO-Revision-Date: 2014-04-20 11:10+0100\n"
"Last-Translator: Julio Sánchez <jsanchez@users.sourceforge.com>\n"
"Language-Team: \n"
"Language: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

View File

@ -12,7 +12,7 @@ msgstr ""
"PO-Revision-Date: 2014-03-24 20:15+0300\n"
"Last-Translator: Igal Shapira <igal.shapira@gmail.com>\n"
"Language-Team: he <igal.shapira@gmail.com>\n"
"Language: \n"
"Language: he\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

View File

@ -15,7 +15,7 @@ msgstr ""
"PO-Revision-Date: 2013-03-03 10:02+0100\n"
"Last-Translator: \n"
"Language-Team: Portuguese <>\n"
"Language: pt\n"
"Language: pt_PT\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

View File

@ -12,7 +12,7 @@ msgstr ""
"PO-Revision-Date: 2003-03-03 09:54+0100\n"
"Last-Translator: Radu Bogdan Mare <bogdan_mare@web.de>\n"
"Language-Team: romanian <ro@li.org>\n"
"Language: \n"
"Language: ro\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

View File

@ -13,7 +13,7 @@ msgstr ""
"PO-Revision-Date: 2014-05-23 15:34+0100\n"
"Last-Translator: Ondrej Krč-Jediný <hou at centrum dot sk>\n"
"Language-Team: <sk-i18n@linux.sk>\n"
"Language: \n"
"Language: sk\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

View File

@ -21,7 +21,7 @@ msgstr ""
"PO-Revision-Date: 2008-11-13 21:00+0100\n"
"Last-Translator: Vlora Jakupi <vlorajak@hotmail.com>\n"
"Language-Team: \n"
"Language: \n"
"Language: sq\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

View File

@ -10,7 +10,7 @@ msgstr ""
"PO-Revision-Date: 2008-09-08 20:44+0200\n"
"Last-Translator: Vlada Perić <vlada.peric@gmail.com>\n"
"Language-Team: Serbian Latin <>\n"
"Language: \n"
"Language: sr_Latn\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

View File

@ -12,7 +12,7 @@ msgstr ""
"PO-Revision-Date: 2012-02-29 23:03+0700\n"
"Last-Translator: De Tran <trande@gmail.com>\n"
"Language-Team: VIETNAMESE <quangde@sevuon.com>\n"
"Language: \n"
"Language: vi\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"