Compare commits
363 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 562fdbb06a | |||
| f83f4c8451 | |||
| 838f3adba7 | |||
| 7d15137109 | |||
| c210a14acc | |||
| 92c5cceea3 | |||
| 5eea9ca023 | |||
| 19bfd81a9b | |||
| 296d7557b7 | |||
| 3eea6dc8dc | |||
| d7200b028a | |||
| a79e8f8860 | |||
| fa60e78ee2 | |||
| 46979f512d | |||
| 1231c01b05 | |||
| bdf97fabd0 | |||
| a8a8b41210 | |||
| 1091c221ba | |||
| ccfe2230ef | |||
| e3bfa40a70 | |||
| 1bb2a2fec0 | |||
| 77cf544636 | |||
| 33daf99b33 | |||
| 20b3131237 | |||
| 1a11e6ba36 | |||
| 2dd4eb7526 | |||
| be37e4cc45 | |||
| f668c23cf2 | |||
| 90c0f43c9d | |||
| 5819fa672e | |||
| 40f7314699 | |||
| e942c940fa | |||
| 9c0f5a96ef | |||
| e01b04e117 | |||
| e3e6a36f3b | |||
| 74968f9b5a | |||
| 200b4f3015 | |||
| 35763a3c29 | |||
| 8996d04cb9 | |||
| 36b418ec65 | |||
| 62d1419a83 | |||
| 89cf7676e1 | |||
| 22b13fc772 | |||
| 7150429195 | |||
| 741eedcbe1 | |||
| a1ae8852cf | |||
| 9bc4a82007 | |||
| a414670cec | |||
| c1487b1e59 | |||
| 5af7f07875 | |||
| 8708c60f33 | |||
| a87b267515 | |||
| 0884741057 | |||
| f2f4d5974c | |||
| b72ae432e7 | |||
| 13e1d5420e | |||
| f5a8db75c2 | |||
| bdd110de18 | |||
| 8b198624ef | |||
| 8f0bcd136b | |||
| 5e275bedfd | |||
| 5791d2d0d3 | |||
| 01aa78127e | |||
| 10342a03cc | |||
| 1fd757e6fa | |||
| 8af1f7e6f5 | |||
| 41d752a75b | |||
| 783619455f | |||
| 6e50919487 | |||
| 7a9fe58b48 | |||
| 69f1ec0508 | |||
| a8aea11b07 | |||
| 09f20eaf9f | |||
| a4ca60e98f | |||
| 12e19ef445 | |||
| a12f166b09 | |||
| 170d7e4cdb | |||
| 328a9d329d | |||
| 277e91a1ca | |||
| 6ca6765458 | |||
| bced98bd71 | |||
| b5cd86498b | |||
| 7045418dec | |||
| a5b5842ec3 | |||
| 20b39325b6 | |||
| cbade510a9 | |||
| 82d7d7db9a | |||
| f3d110f7ec | |||
| 6968dcdf97 | |||
| 243d02a6f5 | |||
| 1aa71cceaa | |||
| d8b100757f | |||
| 80a6b71e13 | |||
| dfa36127f8 | |||
| f17a5125f3 | |||
| c58ca7575b | |||
| 4f1943b180 | |||
| b147cb2ca3 | |||
| 3a4a01ba9e | |||
| f84de89864 | |||
| adc4608ba5 | |||
| fd363c528b | |||
| e60da9001a | |||
| b2ea7dea08 | |||
| eea46c8875 | |||
| 4f44f6f98f | |||
| 62358e931b | |||
| a7319dac47 | |||
| dc0cd05ef8 | |||
| 76e66f6104 | |||
| b94008e412 | |||
| 2acc96fa62 | |||
| dcca22245c | |||
| 27ff0c989e | |||
| 0df382465c | |||
| 28f2bc8bac | |||
| 58e7af6ddf | |||
| e0adfcbb7b | |||
| bc0ce2aada | |||
| 9e7e513b13 | |||
| e43da1a226 | |||
| cd036d3ec7 | |||
| a162c6796e | |||
| 2e8b234b94 | |||
| 5f51aeeb63 | |||
| 4742d33e26 | |||
| f0ece22743 | |||
| 62b29c6e61 | |||
| c6688c8927 | |||
| 38a6412aa5 | |||
| 7244448c51 | |||
| 5705dfe107 | |||
| cd53f3a842 | |||
| d5ccbb092d | |||
| 3affb0a3fd | |||
| 028e5caf03 | |||
| 8dd881dc2f | |||
| c0bf571c62 | |||
| 3b5508d997 | |||
| 77455f2776 | |||
| 5ca248aa14 | |||
| d1b9344373 | |||
| 081c300b75 | |||
| 35d494f49e | |||
| 658284d692 | |||
| 900edf379c | |||
| 4ceee5b350 | |||
| 3154bbaa50 | |||
| e3147bc8a5 | |||
| 9fcf2bf560 | |||
| 626e1ec24d | |||
| 9bc9cf6a47 | |||
| 94efebf36c | |||
| f91eb31d88 | |||
| 03d5e3f4bc | |||
| 5bc355ad0c | |||
| 47ff14af65 | |||
| 60a4ce9f4a | |||
| 959693bc84 | |||
| 395e46aaab | |||
| c0b534fe1d | |||
| bdd3a553c0 | |||
| 3418ac3bd2 | |||
| aff06c9b49 | |||
| bf7182ed8f | |||
| dc5cfb7f91 | |||
| ea9df739a4 | |||
| e6f6d5d00c | |||
| 77d3cf1967 | |||
| e80a74d72a | |||
| 1baf7070a3 | |||
| f1e2d15ebb | |||
| a8ab3b5f4e | |||
| 403bea5f2c | |||
| ca3dba5dd9 | |||
| 3f87bdec6e | |||
| 848114ea4e | |||
| ef37b3c6a6 | |||
| 0fe26ef415 | |||
| 2f9341dcb8 | |||
| 77f96037fa | |||
| 1cb6f2f3c8 | |||
| 43fa619ebc | |||
| db4e0aafb8 | |||
| 09e9872206 | |||
| 796b778bf0 | |||
| 174886e40a | |||
| dd1f244d24 | |||
| 0f7623be22 | |||
| 1a27f856c5 | |||
| d3993f57ff | |||
| af788956aa | |||
| 96efc4ee45 | |||
| 359192efb0 | |||
| 8e841be786 | |||
| 9d207fd48f | |||
| 924acb11ff | |||
| e035fe57e6 | |||
| 985e42abe2 | |||
| 8bd6a16cf0 | |||
| 16f468654a | |||
| 6aef60a421 | |||
| ec50af2785 | |||
| c0f2ed96b2 | |||
| 8b7e7aed4e | |||
| c5e1ee690d | |||
| f08d4825e7 | |||
| c414e34ceb | |||
| 3fb1e0fd4a | |||
| ae8ba555eb | |||
| 479e70f835 | |||
| c796db53c5 | |||
| 84898abaaf | |||
| 2f983fade2 | |||
| f6a8fd888a | |||
| 1c1da5a8ea | |||
| 4679718cc2 | |||
| a52072d79e | |||
| c8a48b4b0e | |||
| f479381bfd | |||
| 33de80e6fd | |||
| 46c9eb079c | |||
| 1df64c2609 | |||
| 9aa00be403 | |||
| 3096db842c | |||
| 86474a1cf6 | |||
| fa246bc681 | |||
| 546e39d530 | |||
| 3b24bfc971 | |||
| 3e6fa30d60 | |||
| c1137c79e5 | |||
| e7749890f7 | |||
| 8a03b75b27 | |||
| bf9a7efe37 | |||
| 4e4a95926a | |||
| 09069234d4 | |||
| 2cba6ed51c | |||
| ab0ed284f1 | |||
| 8b24f681cb | |||
| 1ac68fb63d | |||
| 531f089f10 | |||
| aff081d139 | |||
| 4f821bc75c | |||
| 6eb47e400c | |||
| 80a748109a | |||
| 140ce8077d | |||
| 81aaf690f3 | |||
| 65ac980dae | |||
| 6bb686ec2d | |||
| 0894288476 | |||
| 8cf2831c51 | |||
| e52db3c15d | |||
| 8edf5690a4 | |||
| 37697f48a0 | |||
| 9c15d167b4 | |||
| bf4295b5b3 | |||
| 1eb50ff295 | |||
| 0698a42f8e | |||
| b3929af419 | |||
| 32f9ff1863 | |||
| 777c929f88 | |||
| e39dedb453 | |||
| fc3ed649f1 | |||
| dce76ae6fe | |||
| 285c5e429c | |||
| 724e09dfc9 | |||
| c09f8e4950 | |||
| 4bbc5c08f3 | |||
| a31d95bd28 | |||
| 02dc2ce868 | |||
| 3d19491f40 | |||
| c7d490f469 | |||
| 4690a03256 | |||
| a35db4f70a | |||
| 42f5c62154 | |||
| 7e456e996c | |||
| e0b02e80af | |||
| 51a9075613 | |||
| 51abf16ddb | |||
| 945f6e5b9f | |||
| e7edfbdc0a | |||
| 3e81d9dd88 | |||
| cfbb494612 | |||
| 52d5fbd042 | |||
| f0e156a112 | |||
| 839b2ee4de | |||
| 4beb29464a | |||
| c3ffffd943 | |||
| 15fc4fdf0f | |||
| 90c1f95ac5 | |||
| 713344f2f8 | |||
| 1f17db49c2 | |||
| 9e40603988 | |||
| 44f970baa8 | |||
| dceb900362 | |||
| 1110c18ae1 | |||
| e3f9f97864 | |||
| 10bd447ed5 | |||
| bc9cdd3896 | |||
| a36690aa26 | |||
| 1db7cd2051 | |||
| 2ff12bdbcf | |||
| 904cb8cf16 | |||
| d0d8fd4af1 | |||
| 102189d77a | |||
| bbaec4b5ed | |||
| 2cfa9299d4 | |||
| 515b9525dd | |||
| a393d793fc | |||
| aa8e6754c5 | |||
| bd937a1842 | |||
| a40d4c4482 | |||
| 7376843595 | |||
| 8a40eeafe6 | |||
| 42138f0c2e | |||
| bdfce6bf1b | |||
| 8b463b8aae | |||
| 2d8dab099b | |||
| 5cba134809 | |||
| 1f41eddfea | |||
| 38c9e2800c | |||
| eea4d3e0c9 | |||
| 4442a74690 | |||
| 5688c351f1 | |||
| cbc5b831b7 | |||
| c69eba2e4e | |||
| 9c6d5ea86b | |||
| d323b5013f | |||
| 953a0ac8b5 | |||
| 1019617d0f | |||
| 6c1b155953 | |||
| 6a1d059e53 | |||
| 5f318a93b3 | |||
| 03e1ef85fc | |||
| b931b9aa9b | |||
| ff0cf470c5 | |||
| 18cebd92dd | |||
| 3430c34988 | |||
| 380490c6a2 | |||
| 4a25ab7a25 | |||
| 8812e82f49 | |||
| 96471a964b | |||
| 29ff7a386b | |||
| 2c7e58e187 | |||
| 1ff33d6377 | |||
| 5ff5769845 | |||
| 997cd04fe2 | |||
| 45be6866ad | |||
| a5ac1da9fd | |||
| d67271a2cf | |||
| 2fb7a5e048 | |||
| 5f69c64971 | |||
| 602aa8c1bd | |||
| 0c270f4862 | |||
| 053efc5f75 | |||
| ff705565a4 | |||
| b41598c645 | |||
| b1d2ca5dc4 | |||
| 4a8414e5c8 | |||
| 6bfe45f079 | |||
| 38d8332970 | |||
| 97eff89616 | |||
| 2ae3583c3a |
@@ -1,3 +1,45 @@
|
||||
Version 3.2.6 -- the "So far, so good." bug fix release.
|
||||
* fix memory leaks
|
||||
* fix corrupted reports
|
||||
* fix crash in cramplets
|
||||
* fix gedcom import and export
|
||||
* import speed improvements
|
||||
* NarrativeWeb fixes
|
||||
* prevent corrupting databases
|
||||
* many translation updates
|
||||
* other changes; see the changelog and the 3.2.6 roadmap: http://www.gramps-project.org/bugs/roadmap_page.php?version_id=23
|
||||
|
||||
Version 3.2.5 -- the "I intend to live forever" bug fix release.
|
||||
* fix Gramps so it again runs with Python 2.5
|
||||
* write all notes and sources to gedcom files
|
||||
* cli fixes
|
||||
* GeneWeb and LegacyGedcom fixes
|
||||
* NarrativeWeb fixes
|
||||
* memory leak fixes
|
||||
* various other small fixes
|
||||
* many translation updates
|
||||
|
||||
Version 3.2.4 -- the "Tententen" bug fix release.
|
||||
* fix a crash on newer distro's after an export is finished
|
||||
* styled notes cleanup and consistency improvement (nar web behaves like the pdf/html output of reports)
|
||||
* newlines in styled notes are written as newlines so users can make simple lists
|
||||
* many NarrativeWeb fixes
|
||||
* gedcom output fixes
|
||||
* non latin character fixes (mainly for windows)
|
||||
* recursive filter fixes
|
||||
* undo fixes
|
||||
* many translation updates
|
||||
|
||||
Version 3.2.3 -- the "I used to eat there. Really good noodles." release.
|
||||
* Bug fixes:
|
||||
-> several GLADE fixes
|
||||
-> several GEDCOM fixes (both export and import)
|
||||
-> several crash fixes
|
||||
-> encoding fix (Windows only)
|
||||
-> privacy/living fixes
|
||||
-> updates to NarrativeWeb and the css stylsheets
|
||||
* Translation updates: bg, ca, de, es, fr, he, nb, nl, pl, sk, sv
|
||||
|
||||
Version 3.2.2 -- the "Mea navis aëricumbens anguillis abundat" release.
|
||||
* This release is a quick fix to a problem introduced by NarrativeWeb in the previous release.
|
||||
* Also includes a few small fixes and translation updates to hr and it.
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ dnl May need to run automake && aclocal first
|
||||
|
||||
AC_PREREQ(2.57)
|
||||
dnl NOTE: arg to macro below becomes the "VERSION"
|
||||
AC_INIT(gramps, 3.2.2, [gramps-bugs@lists.sourceforge.net])
|
||||
AC_INIT(gramps, 3.2.7, [gramps-bugs@lists.sourceforge.net])
|
||||
AC_CONFIG_SRCDIR(configure.in)
|
||||
AM_INIT_AUTOMAKE([1.6.3 foreign])
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@ Source: gramps
|
||||
Section: gnome
|
||||
Priority: optional
|
||||
Maintainer: Stéphane Charette <stephanecharette@gmail.com>
|
||||
Build-Depends-Indep: libxml-parser-perl, python-gtk2, gettext, libgconf2-dev, python-central (>= 0.5.6), python, intltool
|
||||
Build-Depends-Indep: libxml-parser-perl, python-gtk2, gettext, python-central (>= 0.5.6), python, intltool
|
||||
Build-Depends: debhelper (>= 7)
|
||||
Standards-Version: 3.8.3
|
||||
Homepage: http://www.gramps-project.org/
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
#########################################
|
||||
The :class:`RelationshipCalculator` Class
|
||||
#########################################
|
||||
|
||||
Contents:
|
||||
|
||||
.. automodule:: Relationship
|
||||
.. autoclass:: RelationshipCalculator
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
+1817
-1499
File diff suppressed because it is too large
Load Diff
+3320
-3598
File diff suppressed because it is too large
Load Diff
+6
-16
@@ -22,28 +22,14 @@
|
||||
|
||||
""" Unittest for testing POTFILES.in and Makefile contents """
|
||||
|
||||
# PYTHONPATH=/../src python po_test.py
|
||||
|
||||
import unittest
|
||||
import os
|
||||
import glob
|
||||
from test import test_util
|
||||
test_util.path_append_parent()
|
||||
|
||||
excluded_files = ["src/DataViews/_MapView.py",
|
||||
"src/plugins/PHPGedViewConnector.py",
|
||||
"src/plugins/phpgedview.glade",
|
||||
"src/plugins/Ancestors.py",
|
||||
"src/plugins/DesGraph.py",
|
||||
"src/plugins/FtmStyleAncestors.py",
|
||||
"src/plugins/FtmStyleDescendants.py",
|
||||
"src/plugins/IndivSummary.py",
|
||||
"src/date_test.py",
|
||||
"src/plugins/CmdRef.py",
|
||||
"src/plugins/DumpGenderStats.py",
|
||||
"src/plugins/Eval.py",
|
||||
"src/plugins/Leak.py",
|
||||
"src/plugins/TestcaseGenerator.py"
|
||||
]
|
||||
|
||||
def get_potfile(filename):
|
||||
fp = open(filename, "r")
|
||||
retvals = []
|
||||
@@ -53,6 +39,10 @@ def get_potfile(filename):
|
||||
fp.close()
|
||||
return retvals
|
||||
|
||||
# POTFILES.skip
|
||||
|
||||
excluded_files = get_potfile("../POTFILES.skip")
|
||||
|
||||
class TestPOT(unittest.TestCase):
|
||||
potfiles = get_potfile("../POTFILES.in")
|
||||
count = 1
|
||||
|
||||
+5555
-3162
File diff suppressed because it is too large
Load Diff
@@ -126,6 +126,7 @@ class Bookmarks :
|
||||
self.uistate.uimanager.remove_ui(self.active)
|
||||
self.uistate.uimanager.remove_action_group(self.action_group)
|
||||
self.action_group = gtk.ActionGroup('Bookmarks')
|
||||
self.uistate.uimanager.ensure_update()
|
||||
self.active = DISABLED
|
||||
|
||||
def redraw_and_report_change(self):
|
||||
|
||||
+4
-1
@@ -62,7 +62,7 @@ import gtk
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.ggettext import sgettext as _
|
||||
from gen.lib import Date
|
||||
from gen.lib.date import Date, NextYear
|
||||
import DateHandler
|
||||
import const
|
||||
import GrampsDisplay
|
||||
@@ -150,6 +150,9 @@ class DateEdit(object):
|
||||
# if text could not be parsed it is assumed invalid
|
||||
if self.date_obj.get_modifier() == Date.MOD_TEXTONLY:
|
||||
return ValidationError(_('Bad Date'))
|
||||
elif (self.date_obj.to_calendar(calendar_name=Date.CAL_GREGORIAN) >>
|
||||
NextYear()):
|
||||
return ValidationError(_('Date more than one year in the future'))
|
||||
|
||||
def invoke_date_editor(self, obj):
|
||||
"""
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
# but that is not necessarily portable.
|
||||
# If not using GNU make, then list all .py files individually
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@/DateHandler
|
||||
|
||||
pkgdata_PYTHON = \
|
||||
pkgpython_PYTHON = \
|
||||
_Date_bg.py\
|
||||
_Date_ca.py\
|
||||
_Date_cs.py\
|
||||
@@ -22,6 +20,7 @@ pkgdata_PYTHON = \
|
||||
_Date_pt.py\
|
||||
_Date_ru.py\
|
||||
_Date_sk.py\
|
||||
_Date_sl.py\
|
||||
_Date_sr.py\
|
||||
_Date_sv.py\
|
||||
_DateDisplay.py\
|
||||
@@ -31,7 +30,7 @@ pkgdata_PYTHON = \
|
||||
__init__.py
|
||||
|
||||
pkgpyexecdir = @pkgpyexecdir@/DateHandler
|
||||
pkgpythondir = @pkgpythondir@/DateHandler
|
||||
pkgpythondir = $(datadir)/@PACKAGE@/DateHandler
|
||||
|
||||
# Clean up all the byte-compiled files
|
||||
MOSTLYCLEANFILES = *pyc *pyo
|
||||
@@ -49,4 +48,4 @@ docs:
|
||||
|
||||
pycheck:
|
||||
(export PYTHONPATH=$(GRAMPS_PY_MODPATH); \
|
||||
pychecker $(pkgdata_PYTHON));
|
||||
pychecker $(pkgpython_PYTHON));
|
||||
|
||||
@@ -96,18 +96,20 @@ def julian_valid(date_tuple):
|
||||
|
||||
def swedish_valid(date_tuple):
|
||||
""" Checks if date_tuple is a valid date in Swedish Calendar """
|
||||
valid = gregorian_valid(date_tuple)
|
||||
# not sure how <= and >= works with tuples???
|
||||
valid_J = julian_valid(date_tuple)
|
||||
date_tuple = (date_tuple[2], date_tuple[1], date_tuple[0])
|
||||
if date_tuple <= (1700, 2, 28):
|
||||
valid = False
|
||||
if date_tuple == (1700, 2, 29): # leapday 1700 was skipped
|
||||
valid = False
|
||||
if date_tuple == (1712, 2, 30): # extra day was inserted 1712
|
||||
valid = True
|
||||
if date_tuple >= (1712, 3, 1): # back to julian
|
||||
valid = False
|
||||
return valid
|
||||
# Swedish calendar starts as Julian 1700-03-01 and ends 1712-03-01 as Julian
|
||||
if date_tuple >= (1700, 2, 29) and date_tuple < (1712, 3, 1):
|
||||
if date_tuple == (1712, 2, 30): # extra day was inserted 1712, not valid Julian
|
||||
return True
|
||||
if valid_J:
|
||||
if date_tuple == (1700, 2, 29): # leapday 1700 was skipped
|
||||
return False
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
|
||||
def french_valid(date_tuple):
|
||||
""" Checks if date_tuple is a valid date in French Calendar """
|
||||
@@ -216,7 +218,7 @@ class DateParser(object):
|
||||
"januari" : 1, "februari" : 2,
|
||||
"mars" : 3, "april" : 4,
|
||||
"maj" : 5, "juni" : 6,
|
||||
"juli" : 7, "augisti" : 8,
|
||||
"juli" : 7, "augusti" : 8,
|
||||
"september" : 9, "oktober" : 10,
|
||||
"november" : 11, "december" : 12,
|
||||
}
|
||||
|
||||
@@ -116,18 +116,17 @@ class DateDisplayCA(DateDisplay):
|
||||
"""
|
||||
Catalan language date display class.
|
||||
"""
|
||||
# TODO: Translate these month strings:
|
||||
long_months = ( u"", u"January", u"February", u"March", u"April", u"May",
|
||||
u"June", u"July", u"August", u"September", u"October",
|
||||
u"November", u"December" )
|
||||
long_months = ( u"", u"Gener", u"Febrer", u"Març", u"Abril", u"Maig",
|
||||
u"Juny", u"Juliol", u"Agost", u"Setembre", u"Octubre",
|
||||
u"Novembre", u"Desembre" )
|
||||
|
||||
short_months = ( u"", u"Jan", u"Feb", u"Mar", u"Apr", u"May", u"Jun",
|
||||
u"Jul", u"Aug", u"Sep", u"Oct", u"Nov", u"Dec" )
|
||||
short_months = ( u"", u"Gen", u"Feb", u"Mar", u"Abr", u"Mai", u"Jun",
|
||||
u"Jul", u"Ago", u"Set", u"Oct", u"Nov", u"Des" )
|
||||
|
||||
calendar = (
|
||||
"", u"Julià", u"Hebreu",
|
||||
u"Revolucionari", u"Persa", u"Islàmic",
|
||||
u"Swedish"
|
||||
u"Suec"
|
||||
)
|
||||
|
||||
_mod_str = ("", u"abans de ", u"després de ", u"cap a ", "", "", "")
|
||||
|
||||
@@ -102,18 +102,17 @@ class DateDisplayCZ(DateDisplay):
|
||||
"""
|
||||
Czech language date display class.
|
||||
"""
|
||||
# TODO: Translate these month strings:
|
||||
long_months = ( u"", u"January", u"February", u"March", u"April", u"May",
|
||||
u"June", u"July", u"August", u"September", u"October",
|
||||
u"November", u"December" )
|
||||
long_months = ( u"", u"Leden", u"Únor", u"Březen", u"Duben", u"Květen",
|
||||
u"Červen", u"červenec", u"Srpen", u"Září", u"Říjen",
|
||||
u"Listopad", u"Prosinec" )
|
||||
|
||||
short_months = ( u"", u"Jan", u"Feb", u"Mar", u"Apr", u"May", u"Jun",
|
||||
u"Jul", u"Aug", u"Sep", u"Oct", u"Nov", u"Dec" )
|
||||
short_months = ( u"", u"Led", u"Úno", u"Bře", u"Dub", u"Kvě", u"čer",
|
||||
u"Čvc", u"Srp", u"Zář", u"Říj", u"Lis", u"Pro" )
|
||||
|
||||
calendar = (
|
||||
"", u"juliánský", u"hebrejský",
|
||||
u"republikánský", u"perský", u"islámský",
|
||||
u"swedish"
|
||||
u"švédský"
|
||||
)
|
||||
|
||||
_mod_str = ("", u"před ", u"po ", u"kolem ", "", "", "")
|
||||
|
||||
@@ -116,13 +116,13 @@ class DateDisplayFI(DateDisplay):
|
||||
"""
|
||||
Finnish language date display class.
|
||||
"""
|
||||
# TODO: Translate these month strings:
|
||||
long_months = ( u"", u"January", u"February", u"March", u"April", u"May",
|
||||
u"June", u"July", u"August", u"September", u"October",
|
||||
u"November", u"December" )
|
||||
long_months = (u"", u"Tammikuu", u"Helmikuu", u"Maaliskuu", u"Huhtikuu",
|
||||
u"Toukokuu", u"Kesäkuu", u"Heinäkuu", u"Elokuu",
|
||||
u"Syyskuu", u"Lokakuu", u"Marraskuu", u"Joulukuu")
|
||||
|
||||
short_months = ( u"", u"Jan", u"Feb", u"Mar", u"Apr", u"May", u"Jun",
|
||||
u"Jul", u"Aug", u"Sep", u"Oct", u"Nov", u"Dec" )
|
||||
short_months = (u"", u"Tammi", u"Helmi", u"Maali", u"Huhti", u"Touko",
|
||||
u"Kesäk", u"Heinä", u"Eloku", u"Syysk", u"Lokak", u"Marra",
|
||||
u"Joulu")
|
||||
|
||||
calendar = ("",
|
||||
u"juliaaninen",
|
||||
|
||||
+129
-13
@@ -48,6 +48,59 @@ from _DateHandler import register_datehandler
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class DateParserLT(DateParser):
|
||||
"""
|
||||
Convert a text string into a Date object. If the date cannot be
|
||||
converted, the text string is assigned.
|
||||
"""
|
||||
|
||||
month_to_int = DateParser.month_to_int
|
||||
|
||||
# Custom months not the same as long months
|
||||
|
||||
month_to_int[u"sausis"] = 1
|
||||
month_to_int[u"vasaris"] = 2
|
||||
month_to_int[u"kovas"] = 3
|
||||
month_to_int[u"balandis"] = 4
|
||||
month_to_int[u"gegužė"] = 5
|
||||
month_to_int[u"gegužis"] = 5
|
||||
month_to_int[u"birželis"] = 6
|
||||
month_to_int[u"liepa"] = 7
|
||||
month_to_int[u"rugpjūtis"] = 8
|
||||
month_to_int[u"rugsėjis"] = 9
|
||||
month_to_int[u"spalis"] = 10
|
||||
month_to_int[u"lapkritis"] = 11
|
||||
month_to_int[u"gruodis"] = 12
|
||||
|
||||
# For not full months
|
||||
|
||||
month_to_int[u"saus"] = 1
|
||||
month_to_int[u"vasa"] = 2
|
||||
month_to_int[u"vasar"] = 2
|
||||
month_to_int[u"bala"] = 4
|
||||
month_to_int[u"balan"] = 4
|
||||
month_to_int[u"baland"] = 4
|
||||
month_to_int[u"gegu"] = 5
|
||||
month_to_int[u"geguž"] = 5
|
||||
month_to_int[u"birž"] = 6
|
||||
month_to_int[u"birže"] = 6
|
||||
month_to_int[u"biržel"] = 6
|
||||
month_to_int[u"liep"] = 7
|
||||
month_to_int[u"rugp"] = 8
|
||||
month_to_int[u"rugpj"] = 8
|
||||
month_to_int[u"rugpjū"] = 8
|
||||
month_to_int[u"rugpjūt"] = 8
|
||||
month_to_int[u"rugs"] = 9
|
||||
month_to_int[u"rugsė"] = 9
|
||||
month_to_int[u"rugsėj"] = 9
|
||||
month_to_int[u"rugsėjis"] = 9
|
||||
month_to_int[u"spal"] = 10
|
||||
month_to_int[u"lapk"] = 11
|
||||
month_to_int[u"lapkr"] = 11
|
||||
month_to_int[u"lapkri"] = 11
|
||||
month_to_int[u"lapkrit"] = 11
|
||||
month_to_int[u"gru"] = 12
|
||||
month_to_int[u"gruo"] = 12
|
||||
month_to_int[u"gruod"] = 12
|
||||
|
||||
modifier_to_int = {
|
||||
u'prieš' : Date.MOD_BEFORE,
|
||||
@@ -64,11 +117,11 @@ class DateParserLT(DateParser):
|
||||
u'h' : Date.CAL_HEBREW,
|
||||
u'islamo' : Date.CAL_ISLAMIC,
|
||||
u'i' : Date.CAL_ISLAMIC,
|
||||
u'prancuzų respublikos': Date.CAL_FRENCH,
|
||||
u'prancūzų respublikos': Date.CAL_FRENCH,
|
||||
u'r' : Date.CAL_FRENCH,
|
||||
u'persų' : Date.CAL_PERSIAN,
|
||||
u'p' : Date.CAL_PERSIAN,
|
||||
u'swedish' : Date.CAL_SWEDISH,
|
||||
u'švedų' : Date.CAL_SWEDISH,
|
||||
u's' : Date.CAL_SWEDISH,
|
||||
}
|
||||
|
||||
@@ -92,6 +145,27 @@ class DateParserLT(DateParser):
|
||||
('|'.join(_range_1), '|'.join(_range_2)),
|
||||
re.IGNORECASE)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# FIXME: oficial long date format (ex, 2011 m. vasario 4 d.)
|
||||
# is not recognized correctly:
|
||||
# with self._text2 - day is recognized as year, year - as day
|
||||
# with self._iso - month not recognized, day recognized,
|
||||
# year increased by 1, date treated as double
|
||||
# TODO: in _DateParser.py in _parse_calendar modify groups
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# # gregorian and julian
|
||||
#
|
||||
# self._text2 = re.compile('(\d+)?\s*?m\.?\s*?%s\.?\s*((\d+)(/\d+)?)?\s*?d?\.?' %
|
||||
# self._mon_str, re.IGNORECASE)
|
||||
#
|
||||
# self._iso = re.compile('(\d+)(/\d+)?\s*?m?\.?\s+?%s\.?\s*((\d+))?\s*?d?\.?' %
|
||||
# self._mon_str, re.IGNORECASE)
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Lithuanian displayer
|
||||
@@ -101,21 +175,25 @@ class DateDisplayLT(DateDisplay):
|
||||
"""
|
||||
Lithuanian language date display class.
|
||||
"""
|
||||
# TODO: Translate these month strings:
|
||||
long_months = ( u"", u"January", u"February", u"March", u"April", u"May",
|
||||
u"June", u"July", u"August", u"September", u"October",
|
||||
u"November", u"December" )
|
||||
|
||||
long_months = ( u"", u"sausio", u"vasario", u"kovo", u"balandžio", u"gegužės",
|
||||
u"birželio", u"liepos", u"rugpjūčio", u"rugsėjo", u"spalio",
|
||||
u"lapkričio", u"gruodžio" )
|
||||
|
||||
short_months = ( u"", u"Jan", u"Feb", u"Mar", u"Apr", u"May", u"Jun",
|
||||
u"Jul", u"Aug", u"Sep", u"Oct", u"Nov", u"Dec" )
|
||||
long_months_vardininkas = ( u"", u"sausis", u"vasaris", u"kovas", u"balandis", u"gegužė",
|
||||
u"birželis", u"liepa", u"rugpjūtis", u"rugsėjis", u"spalis",
|
||||
u"lapkritis", u"gruodis" )
|
||||
|
||||
short_months = ( u"", u"Sau", u"Vas", u"Kov", u"Bal", u"Geg", u"Bir",
|
||||
u"Lie", u"Rgp", u"Rgs", u"Spa", u"Lap", u"Grd" )
|
||||
|
||||
calendar = (
|
||||
u"", u"julijaus",
|
||||
u"hebrajų",
|
||||
u"prancuzų respublikos",
|
||||
u"prancūzų respublikos",
|
||||
u"persų",
|
||||
u"islamo",
|
||||
u"swedish"
|
||||
u"švedų"
|
||||
)
|
||||
|
||||
_mod_str = (u"",
|
||||
@@ -127,9 +205,47 @@ class DateDisplayLT(DateDisplay):
|
||||
_qual_str = (u"", u"apytikriai ", u"apskaičiuota ")
|
||||
|
||||
formats = (
|
||||
"YYYY-MM-DD (ISO)", "Skaitmeninis", "Mėnuo Diena, Metai",
|
||||
"Mėn DD, YYYY", "Diena Mėnuo Metai", "DD Mėn YYYY"
|
||||
)
|
||||
"mmmm-MM-DD (ISO)", "mmmm m. mėnesio diena d.", "Mėn diena, metai")
|
||||
|
||||
def _display_gregorian(self, date_val):
|
||||
"""
|
||||
display gregorian calendar date in different format
|
||||
"""
|
||||
year = self._slash_year(date_val[2], date_val[3])
|
||||
value = self.display_iso(date_val)
|
||||
|
||||
if self.format == 0:
|
||||
return self.display_iso(date_val)
|
||||
elif self.format == 1:
|
||||
|
||||
# mmmm m. mėnesio diena d. (YYYY m. month DD d.)
|
||||
|
||||
if date_val[0] == 0:
|
||||
if date_val[1] == 0:
|
||||
value = year
|
||||
else:
|
||||
value = "%s m. %s" % (year, self.long_months_vardininkas[date_val[1]])
|
||||
else:
|
||||
value = "%s m. %s %d d." % (year, self.long_months[date_val[1]],
|
||||
date_val[0])
|
||||
elif self.format == 2:
|
||||
|
||||
# MON Day, 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 = "%s %d, %s" % (self.short_months[date_val[1]],
|
||||
date_val[0], year)
|
||||
|
||||
|
||||
if date_val[2] < 0:
|
||||
return self._bce_str % value
|
||||
else:
|
||||
return value
|
||||
|
||||
def display(self, date):
|
||||
"""
|
||||
|
||||
+51
-17
@@ -20,6 +20,7 @@
|
||||
#
|
||||
|
||||
# Polish version 2007 by Piotr Czubaszek
|
||||
# Updated in 2010 by Łukasz Rymarczyk
|
||||
|
||||
"""
|
||||
Polish-specific classes for parsing and displaying dates.
|
||||
@@ -85,7 +86,31 @@ class DateParserPL(DateParser):
|
||||
month_to_int[u"grudzień"] = 12
|
||||
month_to_int[u"gru"] = 12
|
||||
month_to_int[u"XII"] = 12
|
||||
|
||||
# Alternative forms: declined nouns
|
||||
month_to_int[u"stycznia"] = 1
|
||||
month_to_int[u"lutego"] = 2
|
||||
month_to_int[u"marca"] = 3
|
||||
month_to_int[u"kwietnia"] = 4
|
||||
month_to_int[u"maja"] = 5
|
||||
month_to_int[u"czerwca"] = 6
|
||||
month_to_int[u"lipca"] = 7
|
||||
month_to_int[u"sierpnia"] = 8
|
||||
month_to_int[u"września"] = 9
|
||||
month_to_int[u"października"] = 10
|
||||
month_to_int[u"listopada"] = 11
|
||||
month_to_int[u"grudnia"] = 12
|
||||
# Alternative forms: nouns without polish accent letters
|
||||
# (misspellings sometimes used in emails)
|
||||
month_to_int[u"styczen"] = 1
|
||||
month_to_int[u"kwiecien"] = 4
|
||||
month_to_int[u"sierpien"] = 8
|
||||
month_to_int[u"wrzesien"] = 9
|
||||
month_to_int[u"pazdziernik"] = 10
|
||||
month_to_int[u"grudzien"] = 12
|
||||
month_to_int[u"wrzesnia"] = 9
|
||||
month_to_int[u"pazdziernika"] = 10
|
||||
month_to_int[u"paz"] = 10
|
||||
|
||||
modifier_to_int = {
|
||||
u'przed' : Date.MOD_BEFORE,
|
||||
u'po' : Date.MOD_AFTER,
|
||||
@@ -93,26 +118,34 @@ class DateParserPL(DateParser):
|
||||
u'ok.' : Date.MOD_ABOUT,
|
||||
u'circa' : Date.MOD_ABOUT,
|
||||
u'ca.' : Date.MOD_ABOUT,
|
||||
# Alternative forms: misspellings sometimes used in emails
|
||||
u'okolo' : Date.MOD_ABOUT,
|
||||
u'ok' : Date.MOD_ABOUT,
|
||||
}
|
||||
|
||||
calendar_to_int = {
|
||||
u'gregoriański' : Date.CAL_GREGORIAN,
|
||||
u'gregoriański' : Date.CAL_GREGORIAN,
|
||||
u'greg.' : Date.CAL_GREGORIAN,
|
||||
u'juliański' : Date.CAL_JULIAN,
|
||||
u'juliański' : Date.CAL_JULIAN,
|
||||
u'jul.' : Date.CAL_JULIAN,
|
||||
u'hebrajski' : Date.CAL_HEBREW,
|
||||
u'hebr.' : Date.CAL_HEBREW,
|
||||
u'islamski' : Date.CAL_ISLAMIC,
|
||||
u'islamski' : Date.CAL_ISLAMIC,
|
||||
u'isl.' : Date.CAL_ISLAMIC,
|
||||
u'francuski republikański': Date.CAL_FRENCH,
|
||||
u'franc.' : Date.CAL_FRENCH,
|
||||
u'perski' : Date.CAL_PERSIAN,
|
||||
u'swedish' : Date.CAL_SWEDISH,
|
||||
u's' : Date.CAL_SWEDISH,
|
||||
u'perski' : Date.CAL_PERSIAN,
|
||||
u'szwedzki' : Date.CAL_SWEDISH,
|
||||
u's' : Date.CAL_SWEDISH,
|
||||
# Alternative forms: nouns without polish accent letters
|
||||
# (misspellings sometimes used in emails)
|
||||
u'gregorianski' : Date.CAL_GREGORIAN,
|
||||
u'julianski' : Date.CAL_JULIAN,
|
||||
u'francuski republikanski': Date.CAL_FRENCH,
|
||||
}
|
||||
|
||||
quality_to_int = {
|
||||
u'szacowany' : Date.QUAL_ESTIMATED,
|
||||
u'szacowany' : Date.QUAL_ESTIMATED,
|
||||
u'szac.' : Date.QUAL_ESTIMATED,
|
||||
u'obliczony' : Date.QUAL_CALCULATED,
|
||||
u'obl.' : Date.QUAL_CALCULATED,
|
||||
@@ -123,11 +156,12 @@ class DateParserPL(DateParser):
|
||||
|
||||
def init_strings(self):
|
||||
DateParser.init_strings(self)
|
||||
self._span = re.compile("(od)\s+(?P<start>.+)\s+(do)\s+(?P<stop>.+)",re.IGNORECASE)
|
||||
self._range = re.compile(u"(między)\s+(?P<start>.+)\s+(a)\s+(?P<stop>.+)", re.IGNORECASE)
|
||||
self._span = re.compile("(od)\s+(?P<start>.+)\s+(do)\s+(?P<stop>.+)", re.IGNORECASE)
|
||||
# Also handle a common mistakes
|
||||
self._range = re.compile(u"((?:po)?mi(?:ę|e)dzy)\s+(?P<start>.+)\s+(a)\s+(?P<stop>.+)", re.IGNORECASE)
|
||||
self._text2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' % self._mon_str,
|
||||
re.IGNORECASE)
|
||||
self._jtext2= re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' % self._jmon_str,
|
||||
self._jtext2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' % self._jmon_str,
|
||||
re.IGNORECASE)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@@ -139,13 +173,13 @@ class DateDisplayPL(DateDisplay):
|
||||
"""
|
||||
Polish language date display class.
|
||||
"""
|
||||
# TODO: Translate these month strings:
|
||||
long_months = ( u"", u"January", u"February", u"March", u"April", u"May",
|
||||
u"June", u"July", u"August", u"September", u"October",
|
||||
u"November", u"December" )
|
||||
|
||||
long_months = ( u"", u"Styczeń", u"Luty", u"Marzec", u"Kwiecień", u"Maj",
|
||||
u"Czerwiec", u"Lipiec", u"Sierpień", u"Wrzesień", u"Październik",
|
||||
u"Listopad", u"Grudzień" )
|
||||
|
||||
short_months = ( u"", u"Jan", u"Feb", u"Mar", u"Apr", u"May", u"Jun",
|
||||
u"Jul", u"Aug", u"Sep", u"Oct", u"Nov", u"Dec" )
|
||||
short_months = ( u"", u"Sty", u"Lut", u"Mar", u"Kwi", u"Maj", u"Cze",
|
||||
u"Lip", u"Sie", u"Wrz", u"Paź", u"Lis", u"Gru" )
|
||||
|
||||
calendar = (
|
||||
"", u"juliański", u"hebrajski",
|
||||
|
||||
+56
-57
@@ -187,13 +187,12 @@ class DateDisplayRU(DateDisplay):
|
||||
"""
|
||||
Russian language date display class.
|
||||
"""
|
||||
# TODO: Translate these month strings:
|
||||
long_months = ( u"", u"January", u"February", u"March", u"April", u"May",
|
||||
u"June", u"July", u"August", u"September", u"October",
|
||||
u"November", u"December" )
|
||||
long_months = ( u"", u"января", u"февраля", u"марта", u"апреля", u"мая",
|
||||
u"июня", u"июля", u"августа", u"сентября", u"октября",
|
||||
u"ноября", u"декабря" )
|
||||
|
||||
short_months = ( u"", u"Jan", u"Feb", u"Mar", u"Apr", u"May", u"Jun",
|
||||
u"Jul", u"Aug", u"Sep", u"Oct", u"Nov", u"Dec" )
|
||||
short_months = ( u"", u"янв", u"фев", u"мар", u"апр", u"мая", u"июн",
|
||||
u"июл", u"авг", u"сен", u"окт", u"ноя", u"дек" )
|
||||
|
||||
calendar = (
|
||||
u"",
|
||||
@@ -202,7 +201,7 @@ class DateDisplayRU(DateDisplay):
|
||||
u"республиканский",
|
||||
u"персидский",
|
||||
u"исламский",
|
||||
u"Swedish"
|
||||
u"шведский"
|
||||
)
|
||||
|
||||
_mod_str = (
|
||||
@@ -222,65 +221,65 @@ class DateDisplayRU(DateDisplay):
|
||||
)
|
||||
|
||||
hebrew = ( u"",
|
||||
u"Тишрей",
|
||||
u"Хешван",
|
||||
u"Кислев",
|
||||
u"Тевет",
|
||||
u"Шеват",
|
||||
u"Адар",
|
||||
u"Адар бет",
|
||||
u"Нисан",
|
||||
u"Ияр",
|
||||
u"Сиван",
|
||||
u"Таммуз",
|
||||
u"Ав",
|
||||
u"Элул",
|
||||
u"тишрея",
|
||||
u"хешвана",
|
||||
u"кислева",
|
||||
u"тевета",
|
||||
u"шевата",
|
||||
u"адара",
|
||||
u"адар бета",
|
||||
u"нисана",
|
||||
u"ияра",
|
||||
u"сивана",
|
||||
u"таммуза",
|
||||
u"ава",
|
||||
u"элула",
|
||||
)
|
||||
|
||||
islamic = ( u"",
|
||||
u"Мухаррам",
|
||||
u"Сафар",
|
||||
u"Раби-аль-авваль",
|
||||
u"Раби-ассани",
|
||||
u"Джумада-аль-уля",
|
||||
u"Джумада-аль-ахира",
|
||||
u"Раджаб",
|
||||
u"Шаабан",
|
||||
u"Рамадан",
|
||||
u"Шавваль",
|
||||
u"Зуль-каада",
|
||||
u"Зуль-хиджжа",
|
||||
u"мухаррама",
|
||||
u"сафара",
|
||||
u"раби-аль-авваля",
|
||||
u"раби-ассани",
|
||||
u"джумада-аль-уля",
|
||||
u"джумада-аль-ахира",
|
||||
u"раджаба",
|
||||
u"шаабана",
|
||||
u"рамадана",
|
||||
u"шаввальа",
|
||||
u"зуль-каада",
|
||||
u"зуль-хиджжа",
|
||||
)
|
||||
|
||||
persian = ( u"",
|
||||
u"Фарвардин",
|
||||
u"Урдбихишт",
|
||||
u"Хурдад",
|
||||
u"Тир",
|
||||
u"Мурдад",
|
||||
u"Шахривар",
|
||||
u"Михр",
|
||||
u"Абан",
|
||||
u"Азар",
|
||||
u"Дай",
|
||||
u"Бахман",
|
||||
u"Исфаидармуз",
|
||||
u"фарвардина",
|
||||
u"урдбихишта",
|
||||
u"хурдада",
|
||||
u"тира",
|
||||
u"мурдада",
|
||||
u"шахривара",
|
||||
u"михра",
|
||||
u"абана",
|
||||
u"азара",
|
||||
u"дайа",
|
||||
u"бахмана",
|
||||
u"исфаидармуза",
|
||||
)
|
||||
|
||||
french = ( u"",
|
||||
u"Вандемьер",
|
||||
u"Брюмер",
|
||||
u"Фример",
|
||||
u"Нивоз",
|
||||
u"Плювиоз",
|
||||
u"Вантоз",
|
||||
u"Жерминаль",
|
||||
u"Флореаль",
|
||||
u"Прериаль",
|
||||
u"Мессидор",
|
||||
u"Термидор",
|
||||
u"Фрюктидор",
|
||||
u"Дополнит."
|
||||
u"вандемьера",
|
||||
u"брюмера",
|
||||
u"фримера",
|
||||
u"нивоза",
|
||||
u"плювиоза",
|
||||
u"вантоза",
|
||||
u"жерминаля",
|
||||
u"флореаля",
|
||||
u"прериаля",
|
||||
u"мессидора",
|
||||
u"термидора",
|
||||
u"фрюктидора",
|
||||
u"дополнит."
|
||||
)
|
||||
|
||||
def display(self, date):
|
||||
|
||||
@@ -0,0 +1,313 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2004-2007 Donald N. Allingham
|
||||
#
|
||||
# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
# Slovenian version 2010 by Bernard Banko, based on croatian one by Josip
|
||||
|
||||
"""
|
||||
Slovenian-specific classes for parsing and displaying dates.
|
||||
"""
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import re
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.lib import Date
|
||||
from _DateParser import DateParser
|
||||
from _DateDisplay import DateDisplay
|
||||
from _DateHandler import register_datehandler
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Slovenian parser
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class DateParserSL(DateParser):
|
||||
"""
|
||||
Converts a text string into a Date object
|
||||
"""
|
||||
month_to_int = DateParser.month_to_int
|
||||
|
||||
month_to_int[u"januar"] = 1
|
||||
month_to_int[u"januarja"] = 1
|
||||
month_to_int[u"januarjem"] = 1
|
||||
month_to_int[u"jan"] = 1
|
||||
month_to_int[u"i"] = 1
|
||||
|
||||
month_to_int[u"februar"] = 2
|
||||
month_to_int[u"februarjem"] = 2
|
||||
month_to_int[u"februarja"] = 2
|
||||
month_to_int[u"feb"] = 2
|
||||
month_to_int[u"ii"] = 2
|
||||
|
||||
month_to_int[u"mar"] = 3
|
||||
month_to_int[u"marcem"] = 3
|
||||
month_to_int[u"marec"] = 3
|
||||
month_to_int[u"marca"] = 3
|
||||
month_to_int[u"iii"] = 3
|
||||
|
||||
month_to_int[u"apr"] = 4
|
||||
month_to_int[u"april"] = 4
|
||||
month_to_int[u"aprilom"] = 4
|
||||
month_to_int[u"aprila"] = 4
|
||||
month_to_int[u"iv"] = 4
|
||||
|
||||
month_to_int[u"maj"] = 5
|
||||
month_to_int[u"maja"] = 5
|
||||
month_to_int[u"majem"] = 5
|
||||
month_to_int[u"v"] = 5
|
||||
|
||||
month_to_int[u"jun"] = 6
|
||||
month_to_int[u"junij"] = 6
|
||||
month_to_int[u"junijem"] = 6
|
||||
month_to_int[u"junija"] = 6
|
||||
month_to_int[u"vi"] = 6
|
||||
|
||||
month_to_int[u"jul"] = 7
|
||||
month_to_int[u"julij"] = 7
|
||||
month_to_int[u"julijem"] = 7
|
||||
month_to_int[u"julija"] = 7
|
||||
month_to_int[u"vii"] = 7
|
||||
|
||||
month_to_int[u"avg"] = 8
|
||||
month_to_int[u"avgust"] = 8
|
||||
month_to_int[u"avgustom"] = 8
|
||||
month_to_int[u"avgusta"] = 8
|
||||
month_to_int[u"viii"] = 8
|
||||
|
||||
month_to_int[u"sep"] = 9
|
||||
month_to_int[u"sept"] = 9
|
||||
month_to_int[u"september"] = 9
|
||||
month_to_int[u"septembrom"] = 9
|
||||
month_to_int[u"septembra"] = 9
|
||||
month_to_int[u"ix"] = 9
|
||||
|
||||
month_to_int[u"okt"] = 10
|
||||
month_to_int[u"oktober"] = 10
|
||||
month_to_int[u"oktobrom"] = 10
|
||||
month_to_int[u"oktobra"] = 10
|
||||
month_to_int[u"x"] = 10
|
||||
|
||||
month_to_int[u"nov"] = 11
|
||||
month_to_int[u"november"] = 11
|
||||
month_to_int[u"novembrom"] = 11
|
||||
month_to_int[u"novembra"] = 11
|
||||
month_to_int[u"xi"] = 11
|
||||
|
||||
month_to_int[u"dec"] = 12
|
||||
month_to_int[u"december"] = 12
|
||||
month_to_int[u"decembrom"] = 12
|
||||
month_to_int[u"decembra"] = 12
|
||||
month_to_int[u"xii"] = 12
|
||||
|
||||
modifier_to_int = {
|
||||
u'pred' : Date.MOD_BEFORE,
|
||||
u'pr.' : Date.MOD_BEFORE,
|
||||
u'po' : Date.MOD_AFTER,
|
||||
u'okoli' : Date.MOD_ABOUT,
|
||||
u'okrog' : Date.MOD_ABOUT,
|
||||
u'okr.' : Date.MOD_ABOUT,
|
||||
u'ok.' : Date.MOD_ABOUT,
|
||||
u'cca.' : Date.MOD_ABOUT,
|
||||
u'cca' : Date.MOD_ABOUT,
|
||||
u'circa' : Date.MOD_ABOUT,
|
||||
u'ca.' : Date.MOD_ABOUT,
|
||||
}
|
||||
|
||||
calendar_to_int = {
|
||||
u'gregorijanski' : Date.CAL_GREGORIAN,
|
||||
u'greg.' : Date.CAL_GREGORIAN,
|
||||
u'julijanski' : Date.CAL_JULIAN,
|
||||
u'jul.' : Date.CAL_JULIAN,
|
||||
u'hebrejski' : Date.CAL_HEBREW,
|
||||
u'hebr.' : Date.CAL_HEBREW,
|
||||
u'islamski' : Date.CAL_ISLAMIC,
|
||||
u'isl.' : Date.CAL_ISLAMIC,
|
||||
u'francoski republikanski': Date.CAL_FRENCH,
|
||||
u'franc.' : Date.CAL_FRENCH,
|
||||
u'perzijski' : Date.CAL_PERSIAN,
|
||||
u'perz. ' : Date.CAL_PERSIAN,
|
||||
u'švedski' : Date.CAL_SWEDISH,
|
||||
u'šved.' : Date.CAL_SWEDISH,
|
||||
}
|
||||
|
||||
quality_to_int = {
|
||||
u'približno' : Date.QUAL_ESTIMATED,
|
||||
u'pribl.' : Date.QUAL_ESTIMATED,
|
||||
u'izračunano' : Date.QUAL_CALCULATED,
|
||||
u'izrač.' : Date.QUAL_CALCULATED,
|
||||
}
|
||||
|
||||
bce = ["pred našim štetjem", "pred Kristusom",
|
||||
"p.n.š.", "p. n. š.", "pr.Kr.", "pr. Kr."] + DateParser.bce
|
||||
|
||||
def init_strings(self):
|
||||
"""
|
||||
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*\.?$'
|
||||
% self._mon_str, re.IGNORECASE)
|
||||
# match Day.Month.Year.
|
||||
self._numeric = re.compile("((\d+)[/\.-])?\s*((\d+)[/\.-])?\s*(\d+)\.?$")
|
||||
|
||||
self._span = re.compile("od\s+(?P<start>.+)\s+do\s+(?P<stop>.+)",
|
||||
re.IGNORECASE)
|
||||
self._range = re.compile(
|
||||
u"med\s+(?P<start>.+)\s+in\s+(?P<stop>.+)",
|
||||
re.IGNORECASE)
|
||||
self._jtext2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?'\
|
||||
% self._jmon_str, re.IGNORECASE)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Slovenian display
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class DateDisplaySL(DateDisplay):
|
||||
"""
|
||||
Slovenian language date display class.
|
||||
"""
|
||||
long_months = ( u"", u"januarja", u"februarja", u"marca",u"aprila",
|
||||
u"maja", u"junija", u"julija", u"avgusta", u"septembra",
|
||||
u"oktobra", u"novembra", u"decembra"
|
||||
)
|
||||
|
||||
short_months = ( u"", u"jan", u"feb", u"mar", u"apr", u"maj", u"jun",
|
||||
u"jul", u"avg", u"sep", u"okt", u"nov", u"dec"
|
||||
)
|
||||
|
||||
calendar = (
|
||||
"", u"julijanski", u"hebrejski",
|
||||
u"francoski republikanski", u"perzijski", u"islamski",
|
||||
u"švedski"
|
||||
)
|
||||
|
||||
_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"
|
||||
)
|
||||
|
||||
def _display_gregorian(self, date_val):
|
||||
"""
|
||||
display gregorian calendar date in different format
|
||||
"""
|
||||
year = self._slash_year(date_val[2], date_val[3])
|
||||
if self.format == 0:
|
||||
return self.display_iso(date_val)
|
||||
elif self.format == 1:
|
||||
# D. M. YYYY
|
||||
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:
|
||||
# D. mon. YYYY
|
||||
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:
|
||||
# D. month YYYY
|
||||
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 u""
|
||||
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 u"%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 = u"%smed %s in %s%s" % (qual_str, d_1, d_2, scal)
|
||||
date_string = date_string.replace(u"a ",u"em ") #to correct declination
|
||||
date_string = date_string.replace(u"lem ",u"lom ")
|
||||
date_string = date_string.replace(u"rem ",u"rom ")
|
||||
date_string = date_string.replace(u"tem ",u"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
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Register classes
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
register_datehandler(("sl", "SL", "sl_SI", "slovenščina", "slovenian", "Slovenian",
|
||||
"sl_SI.UTF8", "sl_SI.UTF-8", "sl_SI.utf-8", "sl_SI.utf8"),
|
||||
DateParserSL, DateDisplaySL)
|
||||
@@ -45,6 +45,7 @@ import _Date_pl
|
||||
import _Date_pt
|
||||
import _Date_ru
|
||||
import _Date_sk
|
||||
import _Date_sl
|
||||
import _Date_sr
|
||||
import _Date_sv
|
||||
|
||||
|
||||
+18
-7
@@ -307,19 +307,30 @@ class WarnHandler(RotateHandler):
|
||||
self.button = button
|
||||
button.on_clicked(self.display)
|
||||
self.timer = None
|
||||
self.last_line = '-1'
|
||||
|
||||
def emit(self, record):
|
||||
if self.timer:
|
||||
gobject.source_remove(self.timer)
|
||||
gobject.timeout_add(180*1000, self._clear)
|
||||
if self.timer is None:
|
||||
#check every 3 minutes if warn button can disappear
|
||||
self.timer = gobject.timeout_add(3*60*1000, self._check_clear)
|
||||
RotateHandler.emit(self, record)
|
||||
self.button.show()
|
||||
|
||||
def _check_clear(self):
|
||||
new_last_line = self.get_buffer()[-1]
|
||||
if self.last_line == new_last_line:
|
||||
#buffer has not changed for 3 minutes, let's clear it:
|
||||
self._clear()
|
||||
return False
|
||||
else:
|
||||
self.last_line = new_last_line
|
||||
return True
|
||||
|
||||
def _clear(self):
|
||||
self.button.hide()
|
||||
self.set_capacity(self._capacity)
|
||||
self.last_line = '-1'
|
||||
self.timer = None
|
||||
return False
|
||||
|
||||
def display(self, obj):
|
||||
obj.hide()
|
||||
@@ -329,7 +340,6 @@ class WarnHandler(RotateHandler):
|
||||
buf = msg.get_buffer()
|
||||
for i in self.get_formatted_log():
|
||||
buf.insert_at_cursor(i + '\n')
|
||||
self.set_capacity(self._capacity)
|
||||
top.run()
|
||||
top.destroy()
|
||||
|
||||
@@ -413,7 +423,7 @@ class DisplayState(gen.utils.Callback):
|
||||
navigation type and group.
|
||||
"""
|
||||
history = self.get_history(nav_type, nav_group)
|
||||
return history.present()
|
||||
return history.present() if history else None
|
||||
|
||||
def set_active(self, handle, nav_type, nav_group=0):
|
||||
"""
|
||||
@@ -421,7 +431,8 @@ class DisplayState(gen.utils.Callback):
|
||||
the given handle.
|
||||
"""
|
||||
history = self.get_history(nav_type, nav_group)
|
||||
history.push(handle)
|
||||
if history:
|
||||
history.push(handle)
|
||||
|
||||
def set_sensitive(self, state):
|
||||
self.window.set_sensitive(state)
|
||||
|
||||
+26
-12
@@ -3,6 +3,7 @@
|
||||
#
|
||||
# Copyright (C) 2004-2007 Donald N. Allingham
|
||||
# Copyright (C) 2008 Brian G. Matherly
|
||||
# Copyright (C) 2008 Benny Malengier
|
||||
# Contribution 2009 by Brad Crittenden <brad [AT] bradcrittenden.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
@@ -92,6 +93,7 @@ class ExportAssistant(gtk.Assistant, ManagedWindow.ManagedWindow) :
|
||||
|
||||
"""
|
||||
|
||||
#override predefined do_xxx signal handlers
|
||||
__gsignals__ = {"apply": "override", "cancel": "override",
|
||||
"close": "override", "prepare": "override"}
|
||||
|
||||
@@ -164,6 +166,22 @@ class ExportAssistant(gtk.Assistant, ManagedWindow.ManagedWindow) :
|
||||
if isinstance(arg, gtk.Button) and arg.get_label() == 'gtk-go-forward':
|
||||
self.forward_button = arg
|
||||
|
||||
def get_cancel_button(self, arg):
|
||||
if isinstance(arg, gtk.HBox):
|
||||
arg.forall(self._cancel_btn)
|
||||
|
||||
def _cancel_btn(self, arg):
|
||||
if isinstance(arg, gtk.Button) and arg.get_label() == 'gtk-cancel':
|
||||
self.cancel_button = arg
|
||||
|
||||
def get_close_button(self, arg):
|
||||
if isinstance(arg, gtk.HBox):
|
||||
arg.forall(self._close_btn)
|
||||
|
||||
def _close_btn(self, arg):
|
||||
if isinstance(arg, gtk.Button) and arg.get_label() == 'gtk-close':
|
||||
self.close_button = arg
|
||||
|
||||
def build_menu_names(self, obj):
|
||||
"""Override ManagedWindow method."""
|
||||
return (self.top_title, None)
|
||||
@@ -382,22 +400,18 @@ class ExportAssistant(gtk.Assistant, ManagedWindow.ManagedWindow) :
|
||||
self.set_page_complete(page, False)
|
||||
self.set_page_type(page, gtk.ASSISTANT_PAGE_SUMMARY)
|
||||
|
||||
|
||||
def do_apply(self):
|
||||
pass
|
||||
|
||||
def do_cancel(self):
|
||||
if self.writestarted :
|
||||
return True
|
||||
else :
|
||||
self.close()
|
||||
|
||||
def do_close(self):
|
||||
if self.writestarted :
|
||||
return True
|
||||
else :
|
||||
pass
|
||||
else :
|
||||
self.close()
|
||||
|
||||
def do_cancel(self):
|
||||
self.do_close()
|
||||
|
||||
def do_prepare(self, page):
|
||||
"""
|
||||
The "prepare" signal is emitted when a new page is set as the
|
||||
@@ -462,7 +476,7 @@ class ExportAssistant(gtk.Assistant, ManagedWindow.ManagedWindow) :
|
||||
#Allow for exotic error: file is still not correct
|
||||
self.check_fileselect(self.chooser, show=False)
|
||||
if self.get_page_complete(self.chooser) :
|
||||
filename = Utils.get_unicode_path(self.chooser.get_filename())
|
||||
filename = Utils.get_unicode_path_from_file_chooser(self.chooser.get_filename())
|
||||
name = os.path.split(filename)[1]
|
||||
folder = os.path.split(filename)[0]
|
||||
confirm_text = _(
|
||||
@@ -536,7 +550,7 @@ class ExportAssistant(gtk.Assistant, ManagedWindow.ManagedWindow) :
|
||||
|
||||
def close(self, *obj) :
|
||||
#clean up ManagedWindow menu, then destroy window, bring forward parent
|
||||
|
||||
gtk.Assistant.destroy(self)
|
||||
ManagedWindow.ManagedWindow.close(self,*obj)
|
||||
|
||||
def get_intro_text(self):
|
||||
@@ -596,7 +610,7 @@ class ExportAssistant(gtk.Assistant, ManagedWindow.ManagedWindow) :
|
||||
hasattr(self.option_box_instance, "no_fileselect")):
|
||||
filename = ""
|
||||
else:
|
||||
filename = Utils.get_unicode_path(self.chooser.get_filename())
|
||||
filename = Utils.get_unicode_path_from_file_chooser(self.chooser.get_filename())
|
||||
config.set('paths.recent-export-dir', os.path.split(filename)[0])
|
||||
ix = self.get_selected_format_index()
|
||||
config.set('behavior.recent-export-type', ix)
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
SUBDIRS = Rules SideBar
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@/Filters
|
||||
pkgpythondir = $(datadir)/@PACKAGE@/Filters
|
||||
|
||||
pkgdata_PYTHON = \
|
||||
pkgpython_PYTHON = \
|
||||
_FilterComboBox.py \
|
||||
_FilterList.py \
|
||||
_FilterMenu.py \
|
||||
@@ -17,7 +17,6 @@ pkgdata_PYTHON = \
|
||||
_SearchFilter.py
|
||||
|
||||
pkgpyexecdir = @pkgpyexecdir@/Filters
|
||||
pkgpythondir = @pkgpythondir@/Filters
|
||||
|
||||
# Clean up all the byte-compiled files
|
||||
MOSTLYCLEANFILES = *pyc *pyo
|
||||
@@ -26,4 +25,4 @@ GRAMPS_PY_MODPATH = "../"
|
||||
|
||||
pycheck:
|
||||
(export PYTHONPATH=$(GRAMPS_PY_MODPATH); \
|
||||
pychecker $(pkgdata_PYTHON));
|
||||
pychecker $(pkgpython_PYTHON));
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# This is the src/Filters/Rules/Event level Makefile for Gramps
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@/Filters/Rules/Event
|
||||
pkgpythondir = $(datadir)/@PACKAGE@/Filters/Rules/Event
|
||||
|
||||
pkgdata_PYTHON = \
|
||||
pkgpython_PYTHON = \
|
||||
_ChangedSince.py\
|
||||
_MatchesFilter.py\
|
||||
_EventPrivate.py\
|
||||
@@ -24,7 +24,7 @@ pkgdata_PYTHON = \
|
||||
__init__.py
|
||||
|
||||
pkgpyexecdir = @pkgpyexecdir@/Filters/Rules/Event
|
||||
pkgpythondir = @pkgpythondir@/Filters/Rules/Event
|
||||
|
||||
|
||||
# Clean up all the byte-compiled files
|
||||
MOSTLYCLEANFILES = *pyc *pyo
|
||||
@@ -33,4 +33,4 @@ GRAMPS_PY_MODPATH = "../../../"
|
||||
|
||||
pycheck:
|
||||
(export PYTHONPATH=$(GRAMPS_PY_MODPATH); \
|
||||
pychecker $(pkgdata_PYTHON));
|
||||
pychecker $(pkgpython_PYTHON));
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# This is the src/Filters/Rules/Family level Makefile for Gramps
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@/Filters/Rules/Family
|
||||
pkgpythondir = $(datadir)/@PACKAGE@/Filters/Rules/Family
|
||||
|
||||
pkgdata_PYTHON = \
|
||||
pkgpython_PYTHON = \
|
||||
_AllFamilies.py\
|
||||
_ChangedSince.py\
|
||||
_FamilyPrivate.py\
|
||||
@@ -38,7 +38,6 @@ pkgdata_PYTHON = \
|
||||
|
||||
|
||||
pkgpyexecdir = @pkgpyexecdir@/Filters/Rules/Family
|
||||
pkgpythondir = @pkgpythondir@/Filters/Rules/Family
|
||||
|
||||
# Clean up all the byte-compiled files
|
||||
MOSTLYCLEANFILES = *pyc *pyo
|
||||
@@ -47,4 +46,4 @@ GRAMPS_PY_MODPATH = "../../../"
|
||||
|
||||
pycheck:
|
||||
(export PYTHONPATH=$(GRAMPS_PY_MODPATH); \
|
||||
pychecker $(pkgdata_PYTHON));
|
||||
pychecker $(pkgpython_PYTHON));
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
SUBDIRS = Person Family Event Place Source MediaObject Repository Note
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@/Filters/Rules
|
||||
pkgpythondir = $(datadir)/@PACKAGE@/Filters/Rules
|
||||
|
||||
pkgdata_PYTHON = \
|
||||
pkgpython_PYTHON = \
|
||||
_ChangedSinceBase.py\
|
||||
_Everything.py\
|
||||
_HasEventBase.py\
|
||||
@@ -29,7 +29,6 @@ pkgdata_PYTHON = \
|
||||
_HasMarkerBase.py
|
||||
|
||||
pkgpyexecdir = @pkgpyexecdir@/Filters/Rules
|
||||
pkgpythondir = @pkgpythondir@/Filters/Rules
|
||||
|
||||
# Clean up all the byte-compiled files
|
||||
MOSTLYCLEANFILES = *pyc *pyo
|
||||
@@ -38,4 +37,4 @@ GRAMPS_PY_MODPATH = "../../"
|
||||
|
||||
pycheck:
|
||||
(export PYTHONPATH=$(GRAMPS_PY_MODPATH); \
|
||||
pychecker $(pkgdata_PYTHON));
|
||||
pychecker $(pkgpython_PYTHON));
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# This is the src/Filters/Rules/MediaObject level Makefile for Gramps
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@/Filters/Rules/MediaObject
|
||||
pkgpythondir = $(datadir)/@PACKAGE@/Filters/Rules/MediaObject
|
||||
|
||||
pkgdata_PYTHON = \
|
||||
pkgpython_PYTHON = \
|
||||
_AllMedia.py\
|
||||
_ChangedSince.py\
|
||||
_HasIdOf.py\
|
||||
@@ -17,7 +17,7 @@ pkgdata_PYTHON = \
|
||||
__init__.py
|
||||
|
||||
pkgpyexecdir = @pkgpyexecdir@/Filters/Rules/MediaObject
|
||||
pkgpythondir = @pkgpythondir@/Filters/Rules/MediaObject
|
||||
|
||||
|
||||
# Clean up all the byte-compiled files
|
||||
MOSTLYCLEANFILES = *pyc *pyo
|
||||
@@ -26,4 +26,4 @@ GRAMPS_PY_MODPATH = "../../../"
|
||||
|
||||
pycheck:
|
||||
(export PYTHONPATH=$(GRAMPS_PY_MODPATH); \
|
||||
pychecker $(pkgdata_PYTHON));
|
||||
pychecker $(pkgpython_PYTHON));
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# This is the src/Filters/Rules/Note level Makefile for Gramps
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@/Filters/Rules/Note
|
||||
pkgpythondir = $(datadir)/@PACKAGE@/Filters/Rules/Note
|
||||
|
||||
pkgdata_PYTHON = \
|
||||
pkgpython_PYTHON = \
|
||||
_AllNotes.py\
|
||||
_ChangedSince.py\
|
||||
_HasIdOf.py\
|
||||
@@ -17,7 +17,6 @@ pkgdata_PYTHON = \
|
||||
__init__.py
|
||||
|
||||
pkgpyexecdir = @pkgpyexecdir@/Filters/Rules/Note
|
||||
pkgpythondir = @pkgpythondir@/Filters/Rules/Note
|
||||
|
||||
# Clean up all the byte-compiled files
|
||||
MOSTLYCLEANFILES = *pyc *pyo
|
||||
@@ -26,4 +25,4 @@ GRAMPS_PY_MODPATH = "../../../"
|
||||
|
||||
pycheck:
|
||||
(export PYTHONPATH=$(GRAMPS_PY_MODPATH); \
|
||||
pychecker $(pkgdata_PYTHON));
|
||||
pychecker $(pkgpython_PYTHON));
|
||||
|
||||
@@ -57,7 +57,7 @@ class MatchesRegexpOf(Rule):
|
||||
|
||||
def apply(self, db, note):
|
||||
""" Apply the filter """
|
||||
text = unicode(note.get())
|
||||
text = note.get()
|
||||
if self.match.match(text) is not None:
|
||||
return True
|
||||
return False
|
||||
|
||||
@@ -49,7 +49,7 @@ class MatchesSubstringOf(Rule):
|
||||
|
||||
def apply(self, db, note):
|
||||
""" Apply the filter """
|
||||
text = unicode(note.get())
|
||||
text = note.get()
|
||||
if text.upper().find(self.list[0].upper()) != -1:
|
||||
return True
|
||||
return False
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# This is the src/Filters/Rules/Person level Makefile for Gramps
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@/Filters/Rules/Person
|
||||
pkgpythondir = $(datadir)/@PACKAGE@/Filters/Rules/Person
|
||||
|
||||
pkgdata_PYTHON = \
|
||||
pkgpython_PYTHON = \
|
||||
_ChangedSince.py\
|
||||
_Disconnected.py \
|
||||
_DeepRelationshipPathBetween.py \
|
||||
@@ -74,7 +74,6 @@ pkgdata_PYTHON = \
|
||||
__init__.py
|
||||
|
||||
pkgpyexecdir = @pkgpyexecdir@/Filters/Rules/Person
|
||||
pkgpythondir = @pkgpythondir@/Filters/Rules/Person
|
||||
|
||||
# Clean up all the byte-compiled files
|
||||
MOSTLYCLEANFILES = *pyc *pyo
|
||||
@@ -83,4 +82,4 @@ GRAMPS_PY_MODPATH = "../../../"
|
||||
|
||||
pycheck:
|
||||
(export PYTHONPATH=$(GRAMPS_PY_MODPATH); \
|
||||
pychecker $(pkgdata_PYTHON));
|
||||
pychecker $(pkgpython_PYTHON));
|
||||
|
||||
@@ -46,10 +46,10 @@ def filter_database(db, progress, filter_name):
|
||||
"""Returns a list of person handles"""
|
||||
|
||||
filt = MatchesFilter([filter_name])
|
||||
progress.set_header('Preparing sub-filter')
|
||||
filt.prepare(db)
|
||||
progress.set_header(_('Preparing sub-filter'))
|
||||
filt.requestprepare(db)
|
||||
|
||||
progress.set_header('Retrieving all sub-filter matches')
|
||||
progress.set_header(_('Retrieving all sub-filter matches'))
|
||||
matches = []
|
||||
for handle in db.iter_person_handles():
|
||||
person = db.get_person_from_handle(handle)
|
||||
@@ -57,7 +57,7 @@ def filter_database(db, progress, filter_name):
|
||||
matches.append(handle)
|
||||
progress.step()
|
||||
|
||||
filt.reset()
|
||||
filt.requestreset()
|
||||
|
||||
return matches
|
||||
|
||||
@@ -75,7 +75,8 @@ def get_family_handle_people(db, exclude_handle, family_handle):
|
||||
possibly_add_handle(family.get_mother_handle())
|
||||
|
||||
for child_ref in family.get_child_ref_list():
|
||||
possibly_add_handle(child_ref.get_reference_handle())
|
||||
if child_ref:
|
||||
possibly_add_handle(child_ref.get_reference_handle())
|
||||
|
||||
return people
|
||||
|
||||
@@ -132,7 +133,7 @@ class DeepRelationshipPathBetween(Rule):
|
||||
root_person = db.get_person_from_gramps_id(root_person_id)
|
||||
|
||||
progress = ProgressMeter(_('Finding relationship paths'))
|
||||
progress.set_pass(header=_('Evaluating people'), mode=ProgressMeter.MODE_ACTIVITY)
|
||||
progress.set_pass(header=_('Evaluating people'), mode=ProgressMeter.MODE_ACTIVITY)
|
||||
|
||||
filter_name = self.list[1]
|
||||
target_people = filter_database(db, progress, filter_name)
|
||||
|
||||
@@ -48,11 +48,12 @@ class FamilyWithIncompleteEvent(Rule):
|
||||
def apply(self,db,person):
|
||||
for family_handle in person.get_family_handle_list():
|
||||
family = db.get_family_from_handle(family_handle)
|
||||
for event_ref in family.get_event_ref_list():
|
||||
if event_ref:
|
||||
event = db.get_event_from_handle(event_ref.ref)
|
||||
if not event.get_place_handle():
|
||||
return True
|
||||
if not event.get_date_object():
|
||||
return True
|
||||
if family:
|
||||
for event_ref in family.get_event_ref_list():
|
||||
if event_ref:
|
||||
event = db.get_event_from_handle(event_ref.ref)
|
||||
if not event.get_place_handle():
|
||||
return True
|
||||
if not event.get_date_object():
|
||||
return True
|
||||
return False
|
||||
|
||||
@@ -58,7 +58,9 @@ class HasBirth(Rule):
|
||||
|
||||
def apply(self,db,person):
|
||||
for event_ref in person.get_event_ref_list():
|
||||
if event_ref.role != EventRoleType.PRIMARY:
|
||||
if not event_ref:
|
||||
continue
|
||||
elif event_ref.role != EventRoleType.PRIMARY:
|
||||
# Only match primaries, no witnesses
|
||||
continue
|
||||
event = db.get_event_from_handle(event_ref.ref)
|
||||
|
||||
@@ -63,19 +63,28 @@ class HasCommonAncestorWith(Rule):
|
||||
def add_ancs(self, db, person):
|
||||
if person.handle not in self.ancestor_cache:
|
||||
self.ancestor_cache[person.handle] = set()
|
||||
# We are going to compare ancestors of one person with that of
|
||||
# another person; if that other person is an ancestor and itself
|
||||
# has no ancestors is must be included, this is achieved by the
|
||||
# little trick of making a person his own ancestor.
|
||||
self.ancestor_cache[person.handle].add(person.handle)
|
||||
else:
|
||||
return
|
||||
|
||||
for fam_handle in person.get_parent_family_handle_list():
|
||||
parentless_fam = True
|
||||
fam = db.get_family_from_handle(fam_handle)
|
||||
for par_handle in (fam.get_father_handle(), fam.get_mother_handle()):
|
||||
if par_handle:
|
||||
par = db.get_person_from_handle(par_handle)
|
||||
if par and par.handle not in self.ancestor_cache:
|
||||
self.add_ancs(db, par)
|
||||
if par:
|
||||
self.ancestor_cache[person.handle].add(par)
|
||||
self.ancestor_cache[person.handle] |= self.ancestor_cache[par.handle]
|
||||
if fam:
|
||||
for par_handle in (fam.get_father_handle(), fam.get_mother_handle()):
|
||||
if par_handle:
|
||||
parentless_fam = False
|
||||
par = db.get_person_from_handle(par_handle)
|
||||
if par and par.handle not in self.ancestor_cache:
|
||||
self.add_ancs(db, par)
|
||||
if par:
|
||||
self.ancestor_cache[person.handle] |= self.ancestor_cache[par.handle]
|
||||
if parentless_fam:
|
||||
self.ancestor_cache[person.handle].add(fam_handle)
|
||||
|
||||
def reset(self):
|
||||
self.ancestor_cache = {}
|
||||
|
||||
@@ -41,7 +41,7 @@ from _MatchesFilter import MatchesFilter
|
||||
# HasCommonAncestorWithFilterMatch
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class HasCommonAncestorWithFilterMatch(HasCommonAncestorWith,MatchesFilter):
|
||||
class HasCommonAncestorWithFilterMatch(HasCommonAncestorWith):
|
||||
"""Rule that checks for a person that has a common ancestor with
|
||||
someone matching a filter"""
|
||||
|
||||
@@ -64,7 +64,7 @@ class HasCommonAncestorWithFilterMatch(HasCommonAncestorWith,MatchesFilter):
|
||||
self.ancestor_cache = {}
|
||||
self.with_people = []
|
||||
filt = MatchesFilter(self.list)
|
||||
filt.prepare(db)
|
||||
filt.requestprepare(db)
|
||||
for handle in db.iter_person_handles():
|
||||
person = db.get_person_from_handle(handle)
|
||||
if filt.apply (db, person):
|
||||
@@ -73,4 +73,4 @@ class HasCommonAncestorWithFilterMatch(HasCommonAncestorWith,MatchesFilter):
|
||||
#fill list of ancestor of person if not present yet
|
||||
if handle not in self.ancestor_cache:
|
||||
self.add_ancs(db, person)
|
||||
filt.reset()
|
||||
filt.requestreset()
|
||||
|
||||
@@ -58,7 +58,9 @@ class HasDeath(Rule):
|
||||
|
||||
def apply(self,db,person):
|
||||
for event_ref in person.get_event_ref_list():
|
||||
if event_ref.role != EventRoleType.PRIMARY:
|
||||
if not event_ref:
|
||||
continue
|
||||
elif event_ref.role != EventRoleType.PRIMARY:
|
||||
# Only match primaries, no witnesses
|
||||
continue
|
||||
event = db.get_event_from_handle(event_ref.ref)
|
||||
|
||||
@@ -53,10 +53,13 @@ class HasFamilyAttribute(Rule):
|
||||
return False
|
||||
for f_id in person.get_family_handle_list():
|
||||
f = db.get_family_from_handle(f_id)
|
||||
if not f:
|
||||
continue
|
||||
for attr in f.get_attribute_list():
|
||||
name_match = self.list[0] == attr.get_type()
|
||||
value_match = \
|
||||
attr.get_value().upper().find(self.list[1].upper()) != -1
|
||||
if name_match and value_match:
|
||||
return True
|
||||
if attr:
|
||||
name_match = self.list[0] == attr.get_type()
|
||||
value_match = \
|
||||
attr.get_value().upper().find(self.list[1].upper()) != -1
|
||||
if name_match and value_match:
|
||||
return True
|
||||
return False
|
||||
|
||||
@@ -64,6 +64,8 @@ class HasFamilyEvent(Rule):
|
||||
def apply(self,db,person):
|
||||
for f_id in person.get_family_handle_list():
|
||||
f = db.get_family_from_handle(f_id)
|
||||
if not f:
|
||||
continue
|
||||
for event_ref in f.get_event_ref_list():
|
||||
if not event_ref:
|
||||
continue
|
||||
|
||||
@@ -61,9 +61,10 @@ class HasRelationship(Rule):
|
||||
# count children and look for a relationship type match
|
||||
for f_id in person.get_family_handle_list():
|
||||
f = db.get_family_from_handle(f_id)
|
||||
cnt = cnt + len(f.get_child_ref_list())
|
||||
if self.list[1] and specified_type == f.get_relationship():
|
||||
rel_type = 1
|
||||
if f:
|
||||
cnt = cnt + len(f.get_child_ref_list())
|
||||
if self.list[1] and specified_type == f.get_relationship():
|
||||
rel_type = 1
|
||||
|
||||
# if number of relations specified
|
||||
if self.list[0]:
|
||||
|
||||
@@ -171,7 +171,7 @@ class HasTextMatchingSubstringOf(Rule):
|
||||
self.repo_map.update(
|
||||
|
||||
repo.handle for repo in self.db.iter_repositories()
|
||||
if self.match_object(repo)
|
||||
if repo and self.match_object(repo)
|
||||
|
||||
)
|
||||
|
||||
|
||||
@@ -48,9 +48,10 @@ class HaveAltFamilies(Rule):
|
||||
def apply(self,db,person):
|
||||
for fhandle in person.get_parent_family_handle_list():
|
||||
family = db.get_family_from_handle(fhandle)
|
||||
ref = [ ref for ref in family.get_child_ref_list() \
|
||||
if ref.ref == person.handle]
|
||||
if ref[0].get_father_relation() == ChildRefType.ADOPTED \
|
||||
or ref[0].get_mother_relation() == ChildRefType.ADOPTED:
|
||||
return True
|
||||
if family:
|
||||
ref = [ ref for ref in family.get_child_ref_list() \
|
||||
if ref.ref == person.handle]
|
||||
if ref[0].get_father_relation() == ChildRefType.ADOPTED \
|
||||
or ref[0].get_mother_relation() == ChildRefType.ADOPTED:
|
||||
return True
|
||||
return False
|
||||
|
||||
@@ -47,4 +47,4 @@ class HaveChildren(Rule):
|
||||
def apply(self,db,person):
|
||||
for family_handle in person.get_family_handle_list():
|
||||
family = db.get_family_from_handle(family_handle)
|
||||
return len(family.get_child_ref_list()) > 0
|
||||
return (family is not None) and len(family.get_child_ref_list()) > 0
|
||||
|
||||
@@ -40,7 +40,7 @@ from _MatchesFilter import MatchesFilter
|
||||
# IsAncestorOfFilterMatch
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class IsAncestorOfFilterMatch(IsAncestorOf,MatchesFilter):
|
||||
class IsAncestorOfFilterMatch(IsAncestorOf):
|
||||
"""Rule that checks for a person that is an ancestor of
|
||||
someone matched by a filter"""
|
||||
|
||||
@@ -66,11 +66,11 @@ class IsAncestorOfFilterMatch(IsAncestorOf,MatchesFilter):
|
||||
first = 1
|
||||
|
||||
filt = MatchesFilter(self.list[0:1])
|
||||
filt.prepare(db)
|
||||
filt.requestprepare(db)
|
||||
for person in db.iter_people():
|
||||
if filt.apply(db, person):
|
||||
self.init_ancestor_list(db, person, first)
|
||||
filt.reset()
|
||||
filt.requestreset()
|
||||
|
||||
def reset(self):
|
||||
self.map.clear()
|
||||
|
||||
@@ -32,6 +32,7 @@ from gen.ggettext import gettext as _
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from Filters.Rules import Rule
|
||||
from _MatchesFilter import MatchesFilter
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@@ -39,7 +40,7 @@ from _MatchesFilter import MatchesFilter
|
||||
# IsChildOfFilterMatch
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class IsChildOfFilterMatch(MatchesFilter):
|
||||
class IsChildOfFilterMatch(Rule):
|
||||
"""Rule that checks for a person that is a child
|
||||
of someone matched by a filter"""
|
||||
|
||||
@@ -52,11 +53,11 @@ class IsChildOfFilterMatch(MatchesFilter):
|
||||
self.db = db
|
||||
self.map = set()
|
||||
filt = MatchesFilter(self.list)
|
||||
filt.prepare(db)
|
||||
filt.requestprepare(db)
|
||||
for person in db.iter_people():
|
||||
if filt.apply(db, person):
|
||||
self.init_list(person)
|
||||
filt.reset()
|
||||
filt.requestreset()
|
||||
|
||||
def reset(self):
|
||||
self.map.clear()
|
||||
@@ -69,5 +70,6 @@ class IsChildOfFilterMatch(MatchesFilter):
|
||||
return
|
||||
for fam_id in person.get_family_handle_list():
|
||||
fam = self.db.get_family_from_handle(fam_id)
|
||||
self.map.update(child_ref.ref
|
||||
for child_ref in fam.get_child_ref_list())
|
||||
if fam:
|
||||
self.map.update(child_ref.ref
|
||||
for child_ref in fam.get_child_ref_list())
|
||||
|
||||
@@ -83,17 +83,18 @@ class IsDescendantFamilyOf(Rule):
|
||||
|
||||
for family_handle in person.get_family_handle_list():
|
||||
family = self.db.get_family_from_handle(family_handle)
|
||||
if family:
|
||||
# Add every child recursively
|
||||
for child_ref in family.get_child_ref_list():
|
||||
if child_ref:
|
||||
self.add_matches(self.db.get_person_from_handle(child_ref.ref))
|
||||
|
||||
# Add every child recursively
|
||||
for child_ref in family.get_child_ref_list():
|
||||
self.add_matches(self.db.get_person_from_handle(child_ref.ref))
|
||||
|
||||
# Add spouse
|
||||
if person.handle == family.get_father_handle():
|
||||
spouse_handle = family.get_mother_handle()
|
||||
else:
|
||||
spouse_handle = family.get_father_handle()
|
||||
self.matches.add(spouse_handle)
|
||||
# Add spouse
|
||||
if person.handle == family.get_father_handle():
|
||||
spouse_handle = family.get_mother_handle()
|
||||
else:
|
||||
spouse_handle = family.get_father_handle()
|
||||
self.matches.add(spouse_handle)
|
||||
|
||||
def exclude(self):
|
||||
# This removes root person and his/her spouses from the matches set
|
||||
@@ -101,8 +102,9 @@ class IsDescendantFamilyOf(Rule):
|
||||
self.matches.remove(self.root_person.handle)
|
||||
for family_handle in self.root_person.get_family_handle_list():
|
||||
family = self.db.get_family_from_handle(family_handle)
|
||||
if self.root_person.handle == family.get_father_handle():
|
||||
spouse_handle = family.get_mother_handle()
|
||||
else:
|
||||
spouse_handle = family.get_father_handle()
|
||||
self.matches.remove(spouse_handle)
|
||||
if family:
|
||||
if self.root_person.handle == family.get_father_handle():
|
||||
spouse_handle = family.get_mother_handle()
|
||||
else:
|
||||
spouse_handle = family.get_father_handle()
|
||||
self.matches.remove(spouse_handle)
|
||||
|
||||
@@ -40,7 +40,7 @@ from _MatchesFilter import MatchesFilter
|
||||
# IsDescendantOfFilterMatch
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class IsDescendantOfFilterMatch(IsDescendantOf,MatchesFilter):
|
||||
class IsDescendantOfFilterMatch(IsDescendantOf):
|
||||
"""Rule that checks for a person that is a descendant
|
||||
of someone matched by a filter"""
|
||||
|
||||
@@ -66,11 +66,11 @@ class IsDescendantOfFilterMatch(IsDescendantOf,MatchesFilter):
|
||||
first = 1
|
||||
|
||||
filt = MatchesFilter(self.list[0:1])
|
||||
filt.prepare(db)
|
||||
filt.requestprepare(db)
|
||||
for person in db.iter_people():
|
||||
if filt.apply(db, person):
|
||||
self.init_list(person, first)
|
||||
filt.reset()
|
||||
filt.requestreset()
|
||||
|
||||
def reset(self):
|
||||
self.map.clear()
|
||||
|
||||
@@ -75,6 +75,7 @@ class IsLessThanNthGenerationDescendantOf(Rule):
|
||||
|
||||
for fam_id in person.get_family_handle_list():
|
||||
fam = self.db.get_family_from_handle(fam_id)
|
||||
for child_ref in fam.get_child_ref_list():
|
||||
self.init_list(
|
||||
self.db.get_person_from_handle(child_ref.ref), gen+1)
|
||||
if fam:
|
||||
for child_ref in fam.get_child_ref_list():
|
||||
self.init_list(
|
||||
self.db.get_person_from_handle(child_ref.ref), gen+1)
|
||||
|
||||
@@ -73,6 +73,7 @@ class IsMoreThanNthGenerationDescendantOf(Rule):
|
||||
|
||||
for fam_id in person.get_family_handle_list():
|
||||
fam = self.db.get_family_from_handle(fam_id)
|
||||
for child_ref in fam.get_child_ref_list():
|
||||
self.init_list(
|
||||
self.db.get_person_from_handle(child_ref.ref), gen+1)
|
||||
if fam:
|
||||
for child_ref in fam.get_child_ref_list():
|
||||
self.init_list(
|
||||
self.db.get_person_from_handle(child_ref.ref), gen+1)
|
||||
|
||||
@@ -32,6 +32,7 @@ from gen.ggettext import gettext as _
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from Filters.Rules import Rule
|
||||
from _MatchesFilter import MatchesFilter
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@@ -39,7 +40,7 @@ from _MatchesFilter import MatchesFilter
|
||||
# IsParentOfFilterMatch
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class IsParentOfFilterMatch(MatchesFilter):
|
||||
class IsParentOfFilterMatch(Rule):
|
||||
"""Rule that checks for a person that is a parent
|
||||
of someone matched by a filter"""
|
||||
|
||||
@@ -52,11 +53,11 @@ class IsParentOfFilterMatch(MatchesFilter):
|
||||
self.db = db
|
||||
self.map = set()
|
||||
filt = MatchesFilter(self.list)
|
||||
filt.prepare(db)
|
||||
filt.requestprepare(db)
|
||||
for person in db.iter_people():
|
||||
if filt.apply(db, person):
|
||||
self.init_list(person)
|
||||
filt.reset()
|
||||
filt.requestreset()
|
||||
|
||||
def reset(self):
|
||||
self.map.clear()
|
||||
@@ -67,6 +68,9 @@ class IsParentOfFilterMatch(MatchesFilter):
|
||||
def init_list(self,person):
|
||||
for fam_id in person.get_parent_family_handle_list():
|
||||
fam = self.db.get_family_from_handle(fam_id)
|
||||
self.map.update(parent_id
|
||||
for parent_id in [fam.get_father_handle(), fam.get_mother_handle()]
|
||||
if parent_id)
|
||||
if fam:
|
||||
self.map.update(parent_id
|
||||
for parent_id in [fam.get_father_handle(),
|
||||
fam.get_mother_handle()]
|
||||
if parent_id)
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ from gen.ggettext import gettext as _
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from Filters.Rules import Rule
|
||||
from _MatchesFilter import MatchesFilter
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@@ -39,7 +40,7 @@ from _MatchesFilter import MatchesFilter
|
||||
# IsSiblingOfFilterMatch
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class IsSiblingOfFilterMatch(MatchesFilter):
|
||||
class IsSiblingOfFilterMatch(Rule):
|
||||
"""Rule that checks for siblings of someone matched by a filter"""
|
||||
|
||||
labels = [ _('Filter name:') ]
|
||||
@@ -51,11 +52,11 @@ class IsSiblingOfFilterMatch(MatchesFilter):
|
||||
self.db = db
|
||||
self.map = set()
|
||||
filt = MatchesFilter(self.list)
|
||||
filt.prepare(db)
|
||||
filt.requestprepare(db)
|
||||
for person in db.iter_people():
|
||||
if filt.apply (db, person):
|
||||
self.init_list (person)
|
||||
filt.reset()
|
||||
filt.requestreset()
|
||||
|
||||
def reset(self):
|
||||
self.map.clear()
|
||||
@@ -71,4 +72,4 @@ class IsSiblingOfFilterMatch(MatchesFilter):
|
||||
if fam:
|
||||
self.map.update(child_ref.ref
|
||||
for child_ref in fam.get_child_ref_list()
|
||||
if child_ref.ref != person.handle)
|
||||
if child_ref and child_ref.ref != person.handle)
|
||||
|
||||
@@ -32,6 +32,7 @@ from gen.ggettext import gettext as _
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from Filters.Rules import Rule
|
||||
from _MatchesFilter import MatchesFilter
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@@ -39,7 +40,7 @@ from _MatchesFilter import MatchesFilter
|
||||
# IsSpouseOfFilterMatch
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class IsSpouseOfFilterMatch(MatchesFilter):
|
||||
class IsSpouseOfFilterMatch(Rule):
|
||||
"""Rule that checks for a person married to someone matching
|
||||
a filter"""
|
||||
|
||||
@@ -50,16 +51,21 @@ class IsSpouseOfFilterMatch(MatchesFilter):
|
||||
|
||||
def prepare(self,db):
|
||||
self.filt = MatchesFilter (self.list)
|
||||
self.filt.prepare(db)
|
||||
self.filt.requestprepare(db)
|
||||
|
||||
def apply(self,db,person):
|
||||
for family_handle in person.get_family_handle_list ():
|
||||
family = db.get_family_from_handle(family_handle)
|
||||
for spouse_id in [family.get_father_handle (), family.get_mother_handle ()]:
|
||||
if not spouse_id:
|
||||
continue
|
||||
if spouse_id == person.handle:
|
||||
continue
|
||||
if self.filt.apply (db, db.get_person_from_handle( spouse_id)):
|
||||
return True
|
||||
if family:
|
||||
for spouse_id in [family.get_father_handle(),
|
||||
family.get_mother_handle()]:
|
||||
if not spouse_id:
|
||||
continue
|
||||
if spouse_id == person.handle:
|
||||
continue
|
||||
if self.filt.apply (db, db.get_person_from_handle( spouse_id)):
|
||||
return True
|
||||
return False
|
||||
|
||||
def reset(self):
|
||||
self.filt.requestreset()
|
||||
|
||||
@@ -48,7 +48,7 @@ class IsWitness(Rule):
|
||||
|
||||
def apply(self,db,person):
|
||||
for event_ref in person.event_ref_list:
|
||||
if event_ref.role == EventRoleType.WITNESS:
|
||||
if event_ref and event_ref.role == EventRoleType.WITNESS:
|
||||
# This is the witness.
|
||||
# If event type was given, then check it.
|
||||
if self.list[0]:
|
||||
|
||||
@@ -53,10 +53,11 @@ class MissingParent(Rule):
|
||||
return True
|
||||
for family_handle in person.get_parent_family_handle_list():
|
||||
family = db.get_family_from_handle(family_handle)
|
||||
father_handle = family.get_father_handle()
|
||||
mother_handle = family.get_mother_handle()
|
||||
if not father_handle:
|
||||
return True
|
||||
if not mother_handle:
|
||||
return True
|
||||
if family:
|
||||
father_handle = family.get_father_handle()
|
||||
mother_handle = family.get_mother_handle()
|
||||
if not father_handle:
|
||||
return True
|
||||
if not mother_handle:
|
||||
return True
|
||||
return False
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# This is the src/Filters/Rules/Place level Makefile for Gramps
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@/Filters/Rules/Place
|
||||
pkgpythondir = $(datadir)/@PACKAGE@/Filters/Rules/Place
|
||||
|
||||
pkgdata_PYTHON = \
|
||||
pkgpython_PYTHON = \
|
||||
_AllPlaces.py\
|
||||
_ChangedSince.py\
|
||||
_HasIdOf.py\
|
||||
@@ -21,7 +21,6 @@ pkgdata_PYTHON = \
|
||||
__init__.py
|
||||
|
||||
pkgpyexecdir = @pkgpyexecdir@/Filters/Rules/Place
|
||||
pkgpythondir = @pkgpythondir@/Filters/Rules/Place
|
||||
|
||||
# Clean up all the byte-compiled files
|
||||
MOSTLYCLEANFILES = *pyc *pyo
|
||||
@@ -30,4 +29,4 @@ GRAMPS_PY_MODPATH = "../../../"
|
||||
|
||||
pycheck:
|
||||
(export PYTHONPATH=$(GRAMPS_PY_MODPATH); \
|
||||
pychecker $(pkgdata_PYTHON));
|
||||
pychecker $(pkgpython_PYTHON));
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# This is the src/Filters/Rules/Media level Makefile for Gramps
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@/Filters/Rules/Repository
|
||||
pkgpythondir = $(datadir)/@PACKAGE@/Filters/Rules/Repository
|
||||
|
||||
pkgdata_PYTHON = \
|
||||
pkgpython_PYTHON = \
|
||||
_AllRepos.py\
|
||||
_ChangedSince.py\
|
||||
_HasIdOf.py\
|
||||
@@ -16,7 +16,6 @@ pkgdata_PYTHON = \
|
||||
__init__.py
|
||||
|
||||
pkgpyexecdir = @pkgpyexecdir@/Filters/Rules/Repository
|
||||
pkgpythondir = @pkgpythondir@/Filters/Rules/Repository
|
||||
|
||||
# Clean up all the byte-compiled files
|
||||
MOSTLYCLEANFILES = *pyc *pyo
|
||||
@@ -25,4 +24,4 @@ GRAMPS_PY_MODPATH = "../../../"
|
||||
|
||||
pycheck:
|
||||
(export PYTHONPATH=$(GRAMPS_PY_MODPATH); \
|
||||
pychecker $(pkgdata_PYTHON));
|
||||
pychecker $(pkgpython_PYTHON));
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# This is the src/Filters/Rules/Source level Makefile for Gramps
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@/Filters/Rules/Source
|
||||
pkgpythondir = $(datadir)/@PACKAGE@/Filters/Rules/Source
|
||||
|
||||
pkgdata_PYTHON = \
|
||||
pkgpython_PYTHON = \
|
||||
_ChangedSince.py\
|
||||
_MatchesFilter.py\
|
||||
_SourcePrivate.py\
|
||||
@@ -19,7 +19,6 @@ pkgdata_PYTHON = \
|
||||
__init__.py
|
||||
|
||||
pkgpyexecdir = @pkgpyexecdir@/Filters/Rules/Source
|
||||
pkgpythondir = @pkgpythondir@/Filters/Rules/Source
|
||||
|
||||
# Clean up all the byte-compiled files
|
||||
MOSTLYCLEANFILES = *pyc *pyo
|
||||
@@ -28,4 +27,4 @@ GRAMPS_PY_MODPATH = "../../../"
|
||||
|
||||
pycheck:
|
||||
(export PYTHONPATH=$(GRAMPS_PY_MODPATH); \
|
||||
pychecker $(pkgdata_PYTHON));
|
||||
pychecker $(pkgpython_PYTHON));
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2002-2006 Donald N. Allingham
|
||||
# Copyright (C) 2010 Raphael Ackermann
|
||||
#
|
||||
# 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
|
||||
@@ -40,7 +41,7 @@ from Filters.Rules import Rule
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class HasGrampsId(Rule):
|
||||
"""Rule that checks for a person with a specific GRAMPS ID."""
|
||||
"""Rule that checks for an object with a specific GRAMPS ID."""
|
||||
|
||||
labels = [ _('ID:') ]
|
||||
name = _('Object with <Id>')
|
||||
@@ -48,4 +49,8 @@ class HasGrampsId(Rule):
|
||||
category = _('General filters')
|
||||
|
||||
def apply(self, db, obj):
|
||||
return obj.gramps_id.find(self.list[0]) !=-1
|
||||
"""
|
||||
apply the rule on the obj.
|
||||
return true if the rule passes, false otherwise.
|
||||
"""
|
||||
return obj.gramps_id == self.list[0]
|
||||
|
||||
@@ -59,7 +59,7 @@ class HasNoteRegexBase(Rule):
|
||||
notelist = person.get_note_list()
|
||||
for notehandle in notelist:
|
||||
note = db.get_note_from_handle(notehandle)
|
||||
n = unicode(note.get())
|
||||
n = note.get()
|
||||
if self.match.match(n) is not None:
|
||||
return True
|
||||
return False
|
||||
|
||||
@@ -50,7 +50,7 @@ class HasNoteSubstrBase(Rule):
|
||||
notelist = person.get_note_list()
|
||||
for notehandle in notelist:
|
||||
note = db.get_note_from_handle(notehandle)
|
||||
n = unicode(note.get())
|
||||
n = note.get()
|
||||
if n.upper().find(self.list[0].upper()) != -1:
|
||||
return True
|
||||
return False
|
||||
|
||||
@@ -55,34 +55,22 @@ class MatchesFilterBase(Rule):
|
||||
category = _('General filters')
|
||||
|
||||
def prepare(self, db):
|
||||
#if Filters.SystemFilters:
|
||||
#for filt in Filters.SystemFilters.get_filters(self.namespace):
|
||||
#if filt.get_name() == self.list[0]:
|
||||
#for rule in filt.flist:
|
||||
#rule.prepare(db)
|
||||
if Filters.CustomFilters:
|
||||
for filt in Filters.CustomFilters.get_filters(self.namespace):
|
||||
if filt.get_name() == self.list[0]:
|
||||
for rule in filt.flist:
|
||||
rule.prepare(db)
|
||||
rule.requestprepare(db)
|
||||
break
|
||||
|
||||
def reset(self):
|
||||
#if Filters.SystemFilters:
|
||||
#for filt in Filters.SystemFilters.get_filters(self.namespace):
|
||||
#if filt.get_name() == self.list[0]:
|
||||
#for rule in filt.flist:
|
||||
#rule.reset()
|
||||
if Filters.CustomFilters:
|
||||
for filt in Filters.CustomFilters.get_filters(self.namespace):
|
||||
if filt.get_name() == self.list[0]:
|
||||
for rule in filt.flist:
|
||||
rule.reset()
|
||||
rule.requestreset()
|
||||
break
|
||||
|
||||
def apply(self, db, obj):
|
||||
#if Filters.SystemFilters:
|
||||
#for filt in Filters.SystemFilters.get_filters(self.namespace):
|
||||
#if filt.get_name() == self.list[0]:
|
||||
#return filt.check(db, obj.handle)
|
||||
if Filters.CustomFilters:
|
||||
for filt in Filters.CustomFilters.get_filters(self.namespace):
|
||||
if filt.get_name() == self.list[0]:
|
||||
@@ -93,10 +81,6 @@ class MatchesFilterBase(Rule):
|
||||
"""
|
||||
Return the selected filter or None.
|
||||
"""
|
||||
#if Filters.SystemFilters:
|
||||
#for filt in Filters.SystemFilters.get_filters(self.namespace):
|
||||
#if filt.get_name() == self.list[0]:
|
||||
#return filt
|
||||
if Filters.CustomFilters:
|
||||
for filt in Filters.CustomFilters.get_filters(self.namespace):
|
||||
if filt.get_name() == self.list[0]:
|
||||
|
||||
@@ -43,14 +43,47 @@ class Rule(object):
|
||||
|
||||
def __init__(self, arg):
|
||||
self.set_list(arg)
|
||||
self.nrprepare = 0
|
||||
|
||||
def is_empty(self):
|
||||
return False
|
||||
|
||||
def requestprepare(self, db):
|
||||
"""
|
||||
Request that the prepare method of the rule is executed if needed
|
||||
|
||||
Special: Custom Filters have fixed values, so only one instance needs to
|
||||
exists during a search. It is stored in a FilterStore, and initialized
|
||||
once.
|
||||
As filters are can be grouped in a group
|
||||
filter, we request a prepare. Only the first time prepare will be
|
||||
called
|
||||
"""
|
||||
if self.nrprepare == 0:
|
||||
self.prepare(db)
|
||||
self.nrprepare += 1
|
||||
|
||||
def prepare(self, db):
|
||||
"""prepare so the rule can be executed efficiently"""
|
||||
pass
|
||||
|
||||
def requestreset(self):
|
||||
"""
|
||||
Request that the reset method of the rule is executed if possible
|
||||
|
||||
Special: Custom Filters have fixed values, so only one instance needs to
|
||||
exists during a search. It is stored in a FilterStore, and initialized
|
||||
once.
|
||||
As filters are can be grouped in a group
|
||||
filter, we request a reset. Only the last time reset will be
|
||||
called
|
||||
"""
|
||||
self.nrprepare -= 1
|
||||
if self.nrprepare == 0:
|
||||
self.reset()
|
||||
|
||||
def reset(self):
|
||||
"""remove no longer needed memory"""
|
||||
pass
|
||||
|
||||
def set_list(self, arg):
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# This is the src/Filters/SideBar level Makefile for Gramps
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@/Filters/SideBar
|
||||
pkgpythondir = $(datadir)/@PACKAGE@/Filters/SideBar
|
||||
|
||||
pkgdata_PYTHON = \
|
||||
pkgpython_PYTHON = \
|
||||
_EventSidebarFilter.py \
|
||||
_FamilySidebarFilter.py \
|
||||
__init__.py \
|
||||
@@ -15,7 +15,6 @@ pkgdata_PYTHON = \
|
||||
_NoteSidebarFilter.py
|
||||
|
||||
pkgpyexecdir = @pkgpyexecdir@/Filters/SideBar
|
||||
pkgpythondir = @pkgpythondir@/Filters/SideBar
|
||||
|
||||
# Clean up all the byte-compiled files
|
||||
MOSTLYCLEANFILES = *pyc *pyo
|
||||
@@ -24,4 +23,4 @@ GRAMPS_PY_MODPATH = "../"
|
||||
|
||||
pycheck:
|
||||
(export PYTHONPATH=$(GRAMPS_PY_MODPATH); \
|
||||
pychecker $(pkgdata_PYTHON));
|
||||
pychecker $(pkgpython_PYTHON));
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#-------------------------------------------------------------------------
|
||||
from xml.sax import make_parser, SAXParseException
|
||||
import os
|
||||
import sys
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@@ -84,8 +85,7 @@ class FilterList(object):
|
||||
return l.replace('"', '"')
|
||||
|
||||
def save(self):
|
||||
f = open(self.file.encode('utf-8'), 'w')
|
||||
|
||||
f = open(self.file.encode(sys.getfilesystemencoding()), 'w')
|
||||
f.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
|
||||
f.write('<filters>\n')
|
||||
for namespace in self.filter_namespaces:
|
||||
|
||||
@@ -61,8 +61,10 @@ class GenericFilter(object):
|
||||
return False
|
||||
|
||||
def is_empty(self):
|
||||
return len(self.flist) == 0 or \
|
||||
(len(self.flist) == 1 and self.flist[0].is_empty())
|
||||
return (len(self.flist) == 0 or
|
||||
(len(self.flist) == 1 and
|
||||
((self.flist[0].is_empty() and not self.invert) or
|
||||
(not self.flist[0].is_empty() and self.invert))))
|
||||
|
||||
def set_logical_op(self, val):
|
||||
if val in GenericFilter.logical_functions:
|
||||
@@ -227,10 +229,10 @@ class GenericFilter(object):
|
||||
"""
|
||||
m = self.get_check_func()
|
||||
for rule in self.flist:
|
||||
rule.prepare(db)
|
||||
rule.requestprepare(db)
|
||||
res = m(db, id_list, progress, tupleind)
|
||||
for rule in self.flist:
|
||||
rule.reset()
|
||||
rule.requestreset()
|
||||
return res
|
||||
|
||||
class GenericFamilyFilter(GenericFilter):
|
||||
|
||||
@@ -30,6 +30,7 @@ Package providing filtering framework for GRAMPS.
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from Filters._GenericFilter import GenericFilter
|
||||
from Errors import FilterError
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@@ -58,8 +59,11 @@ class ParamFilter(GenericFilter):
|
||||
new_list[ix] = self.param_list[ix]
|
||||
rule.set_list(new_list)
|
||||
for rule in self.flist:
|
||||
rule.prepare(db)
|
||||
if rule.nrprepare > 0:
|
||||
raise FilterError, 'Custom filters can not twice be used' \
|
||||
' in a parameter filter'
|
||||
rule.requestprepare(db)
|
||||
result = GenericFilter.apply(self, db, id_list)
|
||||
for rule in self.flist:
|
||||
rule.reset()
|
||||
rule.requestreset()
|
||||
return result
|
||||
|
||||
@@ -57,7 +57,15 @@ class SearchBar(object):
|
||||
self.filter_model = gtk.ListStore(gobject.TYPE_STRING,
|
||||
gobject.TYPE_INT,
|
||||
gobject.TYPE_BOOLEAN)
|
||||
|
||||
|
||||
def destroy(self):
|
||||
"""Unset all things that can block garbage collection.
|
||||
"""
|
||||
self.on_apply_callback = None
|
||||
self.apply_done_callback = None
|
||||
self.dbstate = None
|
||||
self.uistate = None
|
||||
|
||||
def build( self):
|
||||
self.filterbar.set_spacing(4)
|
||||
self.filter_list.connect('changed', self.filter_changed)
|
||||
|
||||
@@ -124,7 +124,7 @@ class GrampsAboutDialog(gtk.AboutDialog):
|
||||
"Distribution: %s")
|
||||
% (elipses(str(const.VERSION)),
|
||||
elipses(str(sys.version).replace('\n','')),
|
||||
elipses(str(bsddb.__version__)),
|
||||
elipses(str(bsddb.__version__) + " " + str(bsddb.db.version())),
|
||||
elipses(os.environ.get('LANG','')),
|
||||
elipses(operatingsystem),
|
||||
elipses(distribution)))
|
||||
|
||||
@@ -3,16 +3,14 @@
|
||||
# but that is not necessarily portable.
|
||||
# If not using GNU make, then list all .py files individually
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@/GrampsLocale
|
||||
pkgpythondir = $(datadir)/@PACKAGE@/GrampsLocale
|
||||
|
||||
pkgdata_PYTHON = \
|
||||
pkgpython_PYTHON = \
|
||||
_GrampsLocale.py\
|
||||
__init__.py
|
||||
|
||||
|
||||
pkgpyexecdir = @pkgpyexecdir@/GrampsLocale
|
||||
pkgpythondir = @pkgpythondir@/GrampsLocale
|
||||
|
||||
|
||||
dist_pkgdata_DATA =
|
||||
|
||||
@@ -23,4 +21,4 @@ GRAMPS_PY_MODPATH = "../"
|
||||
|
||||
pycheck:
|
||||
(export PYTHONPATH=$(GRAMPS_PY_MODPATH); \
|
||||
pychecker $(pkgdata_PYTHON));
|
||||
pychecker $(pkgpython_PYTHON));
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
# but that is not necessarily portable.
|
||||
# If not using GNU make, then list all .py files individually
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@/GrampsLogger
|
||||
|
||||
pkgdata_PYTHON = \
|
||||
pkgpython_PYTHON = \
|
||||
_ErrorReportAssistant.py\
|
||||
_ErrorView.py\
|
||||
_GtkHandler.py\
|
||||
@@ -13,7 +11,7 @@ pkgdata_PYTHON = \
|
||||
_RotateHandler.py
|
||||
|
||||
pkgpyexecdir = @pkgpyexecdir@/GrampsLogger
|
||||
pkgpythondir = @pkgpythondir@/GrampsLogger
|
||||
pkgpythondir = $(datadir)/@PACKAGE@/GrampsLogger
|
||||
|
||||
# Clean up all the byte-compiled files
|
||||
MOSTLYCLEANFILES = *pyc *pyo
|
||||
@@ -22,4 +20,4 @@ GRAMPS_PY_MODPATH = "../"
|
||||
|
||||
pycheck:
|
||||
(export PYTHONPATH=$(GRAMPS_PY_MODPATH); \
|
||||
pychecker $(pkgdata_PYTHON));
|
||||
pychecker $(pkgpython_PYTHON));
|
||||
|
||||
@@ -119,7 +119,7 @@ class ErrorReportAssistant(object):
|
||||
"gobject version: %s\n"\
|
||||
"cairo version : %s"\
|
||||
% (str(sys.version).replace('\n',''),
|
||||
str(bsddb.__version__),
|
||||
str(bsddb.__version__) + " " + str(bsddb.db.version()),
|
||||
str(const.VERSION),
|
||||
os.environ.get('LANG',''),
|
||||
operatingsystem,
|
||||
|
||||
@@ -38,6 +38,13 @@ import tempfile
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import Utils
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# resize_to_jpeg
|
||||
@@ -111,6 +118,7 @@ def resize_to_jpeg_buffer(source, width, height):
|
||||
img = gtk.gdk.pixbuf_new_from_file(source)
|
||||
scaled = img.scale_simple(int(width), int(height), gtk.gdk.INTERP_BILINEAR)
|
||||
os.close(filed)
|
||||
dest = Utils.get_unicode_path_from_env_var(dest)
|
||||
scaled.save(dest, 'jpeg')
|
||||
ofile = open(dest, mode='rb')
|
||||
data = ofile.read()
|
||||
|
||||
@@ -151,4 +151,7 @@ class LRU(object):
|
||||
"""
|
||||
Empties LRU
|
||||
"""
|
||||
for obj, node in self.data.iteritems():
|
||||
node.prev = None
|
||||
node.next = None
|
||||
self.data.clear()
|
||||
|
||||
@@ -437,8 +437,8 @@ class ManagedWindow(object):
|
||||
if object is not None:
|
||||
return object
|
||||
raise ValueError, (
|
||||
'ManagedWindow.get_widget: "%s" widget not found in "%s"' %
|
||||
(name, self._gladeobj.get_name())
|
||||
'ManagedWindow.get_widget: "%s" widget not found in "%s/%s"' %
|
||||
(name, self._gladeobj.dirname, self._gladeobj.filename)
|
||||
)
|
||||
return object
|
||||
|
||||
|
||||
@@ -3,16 +3,15 @@
|
||||
# but that is not necessarily portable.
|
||||
# If not using GNU make, then list all .py files individually
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@/Merge
|
||||
pkgpythondir = $(datadir)/@PACKAGE@/Merge
|
||||
|
||||
pkgdata_PYTHON = \
|
||||
pkgpython_PYTHON = \
|
||||
__init__.py \
|
||||
_MergePerson.py \
|
||||
_MergePlace.py \
|
||||
_MergeSource.py
|
||||
|
||||
pkgpyexecdir = @pkgpyexecdir@/Merge
|
||||
pkgpythondir = @pkgpythondir@/Merge
|
||||
|
||||
# Clean up all the byte-compiled files
|
||||
MOSTLYCLEANFILES = *pyc *pyo
|
||||
@@ -21,4 +20,4 @@ GRAMPS_PY_MODPATH = "../"
|
||||
|
||||
pycheck:
|
||||
(export PYTHONPATH=$(GRAMPS_PY_MODPATH); \
|
||||
pychecker $(pkgdata_PYTHON));
|
||||
pychecker $(pkgpython_PYTHON));
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
# but that is not necessarily portable.
|
||||
# If not using GNU make, then list all .py files individually
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@/PluginUtils
|
||||
pkgpythondir = $(datadir)/@PACKAGE@/PluginUtils
|
||||
|
||||
pkgdata_PYTHON = \
|
||||
pkgpython_PYTHON = \
|
||||
__init__.py\
|
||||
_GuiOptions.py\
|
||||
_Options.py\
|
||||
@@ -23,4 +23,4 @@ GRAMPS_PY_MODPATH = "../"
|
||||
|
||||
pycheck:
|
||||
(export PYTHONPATH=$(GRAMPS_PY_MODPATH); \
|
||||
pychecker $(pkgdata_PYTHON));
|
||||
pychecker $(pkgpython_PYTHON));
|
||||
|
||||
@@ -700,9 +700,7 @@ class GuiNoteOption(gtk.HBox):
|
||||
"""
|
||||
if note:
|
||||
note_id = note.get_gramps_id()
|
||||
txt = " ".join(note.get().split())
|
||||
#String must be unicode for truncation to work for non ascii characters
|
||||
txt = unicode(txt)
|
||||
txt = u" ".join(note.get().split())
|
||||
if len(txt) > 35:
|
||||
txt = txt[:35] + "..."
|
||||
txt = "%s [%s]" % (txt, note_id)
|
||||
@@ -1277,7 +1275,7 @@ class GuiDestinationOption(gtk.HBox):
|
||||
|
||||
status = fcd.run()
|
||||
if status == gtk.RESPONSE_OK:
|
||||
path = Utils.get_unicode_path(fcd.get_filename())
|
||||
path = Utils.get_unicode_path_from_file_chooser(fcd.get_filename())
|
||||
if path:
|
||||
if not self.__option.get_directory_entry() and \
|
||||
not path.endswith(self.__option.get_extension()):
|
||||
|
||||
@@ -537,7 +537,11 @@ class PluginStatus(ManagedWindow.ManagedWindow):
|
||||
except:
|
||||
callback(_("Unable to open '%s'") % path)
|
||||
return
|
||||
buffer = cStringIO.StringIO(fp.read())
|
||||
try:
|
||||
buffer = cStringIO.StringIO(fp.read())
|
||||
except:
|
||||
callback(_("Error in reading '%s'") % path)
|
||||
return
|
||||
fp.close()
|
||||
# file_obj is either Zipfile or TarFile
|
||||
if path.endswith(".zip") or path.endswith(".ZIP"):
|
||||
@@ -601,7 +605,7 @@ class PluginStatus(ManagedWindow.ManagedWindow):
|
||||
# But don't use converted filenames
|
||||
# in the call to self.__pmgr.reg_plugins
|
||||
# as that will break in reg_plugins.
|
||||
u_gpr_file = unicode(gpr_file, sys.getfilesystemencoding())
|
||||
u_gpr_file = Utils.get_unicode_path_from_file_chooser(gpr_file)
|
||||
callback(" " + (_("Registered '%s'") % u_gpr_file) + "\n")
|
||||
self.__pmgr.reg_plugins(gpr_file)
|
||||
|
||||
@@ -629,7 +633,7 @@ class PluginStatus(ManagedWindow.ManagedWindow):
|
||||
|
||||
status = fcd.run()
|
||||
if status == gtk.RESPONSE_OK:
|
||||
path = Utils.get_unicode_path(fcd.get_filename())
|
||||
path = Utils.get_unicode_path_from_file_chooser(fcd.get_filename())
|
||||
if path:
|
||||
self.install_addon_path.set_text(path)
|
||||
fcd.destroy()
|
||||
|
||||
@@ -259,7 +259,7 @@ def cli_tool(dbstate, name,category,tool_class, options_class, options_str_dict)
|
||||
|
||||
# run tool
|
||||
try:
|
||||
tool_class(dbstate,None, options_class, name,None)
|
||||
tool_class(dbstate, None, clt.option_class, name, None)
|
||||
except:
|
||||
log.error("Failed to start tool.", exc_info=True)
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ class ErrorDialog(gtk.MessageDialog):
|
||||
|
||||
class RunDatabaseRepair(ErrorDialog):
|
||||
def __init__(self, msg, parent=None):
|
||||
msg = unicode(msg.decode(sys.getfilesystemencoding()))
|
||||
msg = unicode(str(msg).decode(sys.getfilesystemencoding()))
|
||||
ErrorDialog.__init__(
|
||||
self,
|
||||
_('Error detected in database'),
|
||||
@@ -199,7 +199,7 @@ class RunDatabaseRepair(ErrorDialog):
|
||||
|
||||
class DBErrorDialog(ErrorDialog):
|
||||
def __init__(self, msg, parent=None):
|
||||
msg = unicode(msg.decode(sys.getfilesystemencoding()))
|
||||
msg = unicode(str(msg).decode(sys.getfilesystemencoding()))
|
||||
ErrorDialog.__init__(
|
||||
self,
|
||||
_("Low level database corruption detected"),
|
||||
|
||||
+3
-2
@@ -1330,6 +1330,7 @@ class RelationshipCalculator(object):
|
||||
all_dist=True,
|
||||
all_families=True, only_birth=False)
|
||||
if not data[0][0] == -1:
|
||||
data = self.collapse_relations(data)
|
||||
for rel in data :
|
||||
rel2 = rel[2]
|
||||
rel4 = rel[4]
|
||||
@@ -1360,13 +1361,13 @@ class RelationshipCalculator(object):
|
||||
if not rel_str in relstrings:
|
||||
relstrings.append(rel_str)
|
||||
if rel1:
|
||||
commons[rel_str] = [rel1]
|
||||
commons[rel_str] = rel1
|
||||
else:
|
||||
#unknown parent eg
|
||||
commons[rel_str] = []
|
||||
else:
|
||||
if rel1:
|
||||
commons[rel_str].append(rel1)
|
||||
commons[rel_str].extend(rel1)
|
||||
#construct the return tupply, relstrings is ordered on rank automatic
|
||||
common_list = []
|
||||
for rel_str in relstrings:
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# This is the src/Report level Makefile for Gramps
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@/ReportBase
|
||||
pkgpythondir = $(datadir)/@PACKAGE@/ReportBase
|
||||
|
||||
pkgdata_PYTHON = \
|
||||
pkgpython_PYTHON = \
|
||||
__init__.py\
|
||||
_Bibliography.py\
|
||||
_CommandLineReport.py\
|
||||
@@ -32,4 +32,4 @@ GRAMPS_PY_MODPATH = "../"
|
||||
|
||||
pycheck:
|
||||
(export PYTHONPATH=$(GRAMPS_PY_MODPATH); \
|
||||
pychecker $(pkgdata_PYTHON));
|
||||
pychecker $(pkgpython_PYTHON));
|
||||
|
||||
@@ -223,7 +223,7 @@ class Bibliography(object):
|
||||
if ( self.mode & self.MODE_DATE ) == self.MODE_DATE:
|
||||
date1 = source_ref1.get_date_object()
|
||||
date2 = source_ref2.get_date_object()
|
||||
if date1.is_equal(date2):
|
||||
if not date1.is_equal(date2):
|
||||
return False
|
||||
if ( self.mode & self.MODE_CONF ) == self.MODE_CONF:
|
||||
conf1 = source_ref1.get_confidence_level()
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user