Compare commits
403 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 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 | |||
| 612b1889d8 | |||
| 07e2fc2dd4 | |||
| 76ced42747 | |||
| e06ba873f3 | |||
| db67f8de2a | |||
| 32d363fb7f | |||
| 2465b88422 | |||
| 8cea9a51eb | |||
| 4550baab10 | |||
| 55f392869a | |||
| 00b0412fee | |||
| 13b5c5a524 | |||
| e044b265d1 | |||
| 2e784b10dc | |||
| 1a0eb9ce07 | |||
| f7bdf34e52 | |||
| d4c8769f77 | |||
| d771987d25 | |||
| 5576d5a29a | |||
| 8383d19e2c | |||
| fe986d59e2 | |||
| d473bc8704 | |||
| 4c1b073dac | |||
| def3e1f1c1 | |||
| 33f27e5a9d | |||
| dd585eeb14 | |||
| 3638758a6a | |||
| a48189188f | |||
| beec9a1e5b | |||
| 41c810d9ae | |||
| cf6a378e0a | |||
| 5aa5782130 | |||
| b7ca1ab432 | |||
| 62e4b4bc29 | |||
| 6ed480d1d9 | |||
| 6806b68d9d | |||
| 537c2cf71f | |||
| 54b87d8fc6 | |||
| cc2a9b39fb | |||
| 67866b3be6 | |||
| 62bd563c9e | |||
| 4954b97248 | |||
| 75c9a2ef3b | |||
| 2a66d6b648 | |||
| 92dd34a742 | |||
| d66ba3430a | |||
| b38c9e5144 | |||
| 4f648c3c7e | |||
| 0754a00faf | |||
| d60766d252 | |||
| be1deaa875 | |||
| 00b02b19ed | |||
| 8f38b63312 | |||
| ab138911f5 | |||
| b88b68e3cf | |||
| 59f12247f5 | |||
| 690daa1783 | |||
| 8564556ddd | |||
| 99e8b2bb31 | |||
| 387e9537a5 | |||
| 290c7413ea | |||
| 84b35dcbd0 | |||
| 361a781b44 | |||
| 1b205c9d8d | |||
| 3ca9122aa9 | |||
| 62e612da4f | |||
| 8f3d0564d7 | |||
| 3f9096cac1 | |||
| 3eafa61ba7 | |||
| d2a7319945 | |||
| 9de60a586a | |||
| d54e4dadbe | |||
| 9445741cd1 | |||
| dfdda43ed7 | |||
| 6e04d0c427 | |||
| 98b68e0d2c | |||
| 6ccb9e2fb7 | |||
| 8c429cdb4e | |||
| abcc901da6 | |||
| 561f7fc040 | |||
| 163382d835 | |||
| a3c6fa4e6f | |||
| 02ba3841f3 | |||
| 5a07dd88c6 | |||
| 3fbecd2480 | |||
| a32f2d8d51 | |||
| 9c181346f0 | |||
| 3c7cbc9a49 | |||
| bee3835ab6 | |||
| e231990b74 | |||
| 8667244185 | |||
| 5297e676b0 | |||
| a81f6956a5 | |||
| aac19c3b31 | |||
| ea49e88bb5 | |||
| 18dd8cac93 | |||
| 28306a0bf4 | |||
| 3430645c48 | |||
| 869cd9f118 | |||
| e5dcf43212 | |||
| 7d1812fe7e | |||
| 9773eb5a15 | |||
| 8777a0ee1e | |||
| f829b1bf91 | |||
| b0d01d4c2c | |||
| f1acb5e0d5 | |||
| 9655233957 | |||
| 1ea98777ca | |||
| b21d78ef8b | |||
| 4053357d17 | |||
| c57394f6aa | |||
| c47b012160 | |||
| a1d66d4e42 | |||
| b9c55e9f41 | |||
| d3b6d8c9f3 | |||
| f52dc92ad0 | |||
| 6846dc43dd | |||
| 78dca2345a | |||
| aaa5f81719 | |||
| d8268a5c5e | |||
| 699b1415d3 | |||
| 8fdebc3f79 | |||
| 2b968797b5 | |||
| c4f62cf446 | |||
| 3c4c8bae1c | |||
| d3494a9429 | |||
| 318ffc4060 | |||
| 1fcfbe0cb3 | |||
| b6be5cfbb5 | |||
| 13e14ab179 | |||
| 193de7d191 | |||
| 49f4af524c | |||
| 9c514656a2 | |||
| fa97100070 | |||
| 429494fb13 | |||
| d3012d9753 | |||
| 6d397343bd | |||
| 4083a4e95e | |||
| 0ab9fb1041 | |||
| 531a1670bd | |||
| e114a33e8c | |||
| 39a211e6b6 | |||
| 07cf64904e | |||
| 1ea37388af | |||
| a7e06a91aa | |||
| 9302411eb4 | |||
| 4aca694f11 | |||
| eb052c160e | |||
| 8b0851a5d9 | |||
| 1518db862b | |||
| 1832a4335c | |||
| 17945cd5d2 | |||
| 994d8479ef | |||
| a442eea8bb | |||
| 94a9262faf | |||
| 05af777974 | |||
| 0decb74ba2 | |||
| 02295c4b37 | |||
| e0503bf667 | |||
| 3f1d184f9b | |||
| 096aeb789c | |||
| b014c9d39d | |||
| 097200d512 | |||
| fb93619c6e | |||
| d286d6355a | |||
| a897c63f31 | |||
| 766ea73c52 | |||
| ed19bd7c71 | |||
| 06a2f38faa | |||
| 38be51fdc7 | |||
| 636ef25a7a | |||
| 4219566d11 | |||
| 08920e3f8c | |||
| f5c1e9efcf | |||
| 2d78513cfe | |||
| e43b659d50 | |||
| 97662e04e3 | |||
| 0d2eab4f07 | |||
| 66da4a7f96 | |||
| 2f9a6cef54 | |||
| 0563f93c97 | |||
| d83b8d5675 | |||
| 1f0214abda | |||
| b68b0be609 | |||
| 46abb12de5 | |||
| 6fde03c4a0 | |||
| e73736b83c | |||
| 3db68542cd | |||
| 9d3352fd9f | |||
| 573f342462 | |||
| df7afdf59f | |||
| fcf37f7e42 | |||
| 8ec4760b8f | |||
| 7595be65f2 | |||
| f0e4a17c99 | |||
| 643e6321c3 | |||
| 90f27a4b06 | |||
| 6a020331e4 | |||
| 339b7c7d24 | |||
| 0957aac8b0 | |||
| 999c8fb653 | |||
| 1bb7b75060 | |||
| d4adeacaa4 | |||
| 07527ad229 | |||
| 2974f5034b | |||
| 56d940ca03 | |||
| a521a5721a | |||
| 5f4700674e | |||
| 10a8de8f1f | |||
| 85cda5069b | |||
| e009296c4e | |||
| 029d505706 | |||
| b3e903f455 | |||
| 1a11905b03 | |||
| 60d4102d2b | |||
| 648f0c17e1 | |||
| 3311cb01a7 | |||
| c3cf78513e | |||
| 321461ffac | |||
| ae92094ccf | |||
| 21e99eb292 | |||
| 5ccfcd25d0 | |||
| c6ace32787 | |||
| cc022dc858 | |||
| a0e510a210 | |||
| d47852bfbe | |||
| ee1185428a | |||
| 59457b5974 | |||
| c49071215a | |||
| 1cf2b67ddd | |||
| d84f35e449 | |||
| a0082082f7 | |||
| f07071178d | |||
| bf83a938f6 | |||
| 3d56add348 | |||
| 8ade441c5c | |||
| 4e2c568c75 |
@@ -1,4 +1,41 @@
|
||||
Version 3.2.0 (beta1) -- the "I am your father" release.
|
||||
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.
|
||||
* See the release notes from the 3.2.1 release for the full list of changes and translation updates.
|
||||
|
||||
Version 3.2.1 -- the "One of those men is my father" release.
|
||||
* Many bug fixes:
|
||||
-> fixed missing icons
|
||||
-> load/reload plugins must unload old plugins
|
||||
-> import/export fixes (date ranges, underscore, latitude/longitude)
|
||||
-> narrative web crash fixes and many updates, html notes, css updates
|
||||
-> geoview fixes and updates
|
||||
-> unicode error in soundex
|
||||
-> fixed crash on data entry
|
||||
* Translation updates: bg, ca, de, es, fr, he, hr, it, nb, nl, sk, sv
|
||||
|
||||
Version 3.2.0 -- the "I am your father" release.
|
||||
* New Plugin System:
|
||||
-> In the Help Menu -> Menu Status, all available plugins are visible. All
|
||||
plugins can be hidden, saving resources and hiding options you do not need.
|
||||
|
||||
+3
-3
@@ -5,13 +5,13 @@ 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.0, [gramps-bugs@lists.sourceforge.net])
|
||||
AC_INIT(gramps, 3.2.4, [gramps-bugs@lists.sourceforge.net])
|
||||
AC_CONFIG_SRCDIR(configure.in)
|
||||
AM_INIT_AUTOMAKE([1.6.3 foreign])
|
||||
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
RELEASE=0beta.SVN$(svnversion -n .)
|
||||
RELEASE=0.SVN$(svnversion -n .)
|
||||
dnl RELEASE=0beta3
|
||||
dnl RELEASE=0rc1
|
||||
dnl RELEASE=1
|
||||
@@ -33,7 +33,7 @@ AC_SUBST(RELEASE)
|
||||
AC_SUBST(VERSIONSTRING)
|
||||
|
||||
dnl Add the languages which your application supports here.
|
||||
ALL_LINGUAS="hu zh_CN cs da de es fr it nb nl nn pl pt_BR ru sv eo fi lt sk bg hr sl ca sq"
|
||||
ALL_LINGUAS="hu zh_CN cs da de es fr it nb nl nn pl pt_BR ru sv fi lt sk bg hr sl ca sq he"
|
||||
GETTEXT_PACKAGE=gramps
|
||||
AC_SUBST(GETTEXT_PACKAGE)
|
||||
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Define to the Gettext package name.])
|
||||
|
||||
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:
|
||||
+1868
-1743
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
|
||||
|
||||
+1
-1
@@ -17648,7 +17648,7 @@ msgstr "由 <a href = \"%(homepage)s\">Gramps</a> 生成, %(date)s"
|
||||
#: ../src/plugins/webreport/NarrativeWeb.py:880
|
||||
#, python-format
|
||||
msgid " Created for <a href = \"%s\">%s</a>"
|
||||
msgstr "为 <a href = \"%s\">%s</a> 创建 "
|
||||
msgstr " 为 <a href = \"%s\">%s</a> 创建 "
|
||||
|
||||
#: ../src/plugins/webreport/NarrativeWeb.py:1001
|
||||
msgid "Html|Home"
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -139,7 +139,12 @@ class DateDisplay(object):
|
||||
Formats the extra items (calendar, newyear) for a date.
|
||||
"""
|
||||
scal = self.calendar[cal]
|
||||
snewyear = self.newyear[newyear]
|
||||
if isinstance(newyear, int) and newyear <= len(self.newyear):
|
||||
snewyear = self.newyear[newyear]
|
||||
elif isinstance(newyear, (list, tuple)):
|
||||
snewyear = "%s-%s" % (newyear[0], newyear[1])
|
||||
else:
|
||||
snewyear = "Err"
|
||||
retval = ""
|
||||
for item in [scal, snewyear]:
|
||||
if item:
|
||||
|
||||
@@ -154,11 +154,17 @@ class DateParser(object):
|
||||
modifier_after_to_int = {}
|
||||
|
||||
hebrew_to_int = {
|
||||
"tishri" : 1, "heshvan" : 2, "kislev" : 3,
|
||||
"tevet" : 4, "shevat" : 5, "adari" : 6,
|
||||
"adarii" : 7, "nisan" : 8, "iyyar" : 9,
|
||||
"sivan" : 10, "tammuz" : 11, "av" : 12,
|
||||
"elul" : 13,
|
||||
u"tishri" : 1, u"heshvan" : 2, u"kislev" : 3,
|
||||
u"tevet" : 4, u"shevat" : 5, u"adari" : 6,
|
||||
u"adarii" : 7, u"nisan" : 8, u"iyyar" : 9,
|
||||
u"sivan" : 10, u"tammuz" : 11, u"av" : 12,
|
||||
u"elul" : 13,
|
||||
#alternative spelling
|
||||
u"cheshvan": 2, u"adar sheni": 7, u"iyar" : 9,
|
||||
#GEDCOM months
|
||||
u"tsh" : 1, u"csh": 5, u"ksl": 3, u"tvt": 4, u"shv": 5, u"adr": 6,
|
||||
u"ads" : 7, u"nsn": 8, u"iyr": 9, u"svn":10, u"tmz":11, u"aav":12,
|
||||
u"ell":13,
|
||||
}
|
||||
|
||||
french_to_int = {
|
||||
@@ -168,7 +174,15 @@ class DateParser(object):
|
||||
u'germinal' : 7, u'floréal' : 8,
|
||||
u'prairial' : 9, u'messidor' : 10,
|
||||
u'thermidor' : 11, u'fructidor' : 12,
|
||||
u'extra' : 13
|
||||
u'extra' : 13,
|
||||
#GEDCOM months
|
||||
u'vend' : 1, u'brum' : 2,
|
||||
u'frim' : 3, u'nivo' : 4,
|
||||
u'pluv' : 5, u'vent' : 6,
|
||||
u'germ' : 7, u'flor' : 8,
|
||||
u'prai' : 9, u'mess' : 10,
|
||||
u'ther' : 11, u'fruc' : 12,
|
||||
u'comp' : 13,
|
||||
}
|
||||
|
||||
islamic_to_int = {
|
||||
@@ -430,7 +444,6 @@ class DateParser(object):
|
||||
m = 0
|
||||
else:
|
||||
m = mmap[groups[1].lower()]
|
||||
|
||||
d = self._get_int(groups[0])
|
||||
|
||||
if groups[2] is None:
|
||||
@@ -586,11 +599,15 @@ class DateParser(object):
|
||||
text_parser = self.parser[cal]
|
||||
(text1, bc1) = self.match_bce(match.group('start'))
|
||||
start = self._parse_subdate(text1, text_parser)
|
||||
if start == Date.EMPTY and text1 != "":
|
||||
return 0
|
||||
if bc1:
|
||||
start = self.invert_year(start)
|
||||
|
||||
(text2, bc2) = self.match_bce(match.group('stop'))
|
||||
stop = self._parse_subdate(text2, text_parser)
|
||||
if stop == Date.EMPTY and text2 != "":
|
||||
return 0
|
||||
if bc2:
|
||||
stop = self.invert_year(stop)
|
||||
|
||||
@@ -609,11 +626,15 @@ class DateParser(object):
|
||||
text_parser = self.parser[cal]
|
||||
(text1, bc1) = self.match_bce(match.group('start'))
|
||||
start = self._parse_subdate(text1, text_parser)
|
||||
if start == Date.EMPTY and text1 != "":
|
||||
return 0
|
||||
if bc1:
|
||||
start = self.invert_year(start)
|
||||
|
||||
(text2, bc2) = self.match_bce(match.group('stop'))
|
||||
stop = self._parse_subdate(text2, text_parser)
|
||||
if stop == Date.EMPTY and text2 != "":
|
||||
return 0
|
||||
if bc2:
|
||||
stop = self.invert_year(stop)
|
||||
|
||||
@@ -666,7 +687,10 @@ class DateParser(object):
|
||||
start = self._parse_subdate(grps[0], self.parser[cal])
|
||||
mod = self.modifier_after_to_int.get(grps[1].lower(),
|
||||
Date.MOD_NONE)
|
||||
if bc:
|
||||
if start == Date.EMPTY:
|
||||
date.set_modifier(Date.MOD_TEXTONLY)
|
||||
date.set_text_value(text)
|
||||
elif bc:
|
||||
date.set(qual, mod, cal, self.invert_year(start), newyear=ny)
|
||||
else:
|
||||
date.set(qual, mod, cal, start, newyear=ny)
|
||||
@@ -676,7 +700,10 @@ class DateParser(object):
|
||||
grps = match.groups()
|
||||
start = self._parse_subdate(grps[0])
|
||||
mod = Date.MOD_ABOUT
|
||||
if bc:
|
||||
if start == Date.EMPTY:
|
||||
date.set_modifier(Date.MOD_TEXTONLY)
|
||||
date.set_text_value(text)
|
||||
elif bc:
|
||||
date.set(qual, mod, cal, self.invert_year(start), newyear=ny)
|
||||
else:
|
||||
date.set(qual, mod, cal, start, newyear=ny)
|
||||
@@ -712,6 +739,8 @@ class DateParser(object):
|
||||
if subdate == Date.EMPTY and text != "":
|
||||
date.set_as_text(text)
|
||||
return
|
||||
#else:
|
||||
# print 'valid subdate', text, subdate
|
||||
except:
|
||||
date.set_as_text(text)
|
||||
return
|
||||
|
||||
@@ -194,12 +194,12 @@ class DateDisplayBG(DateDisplay):
|
||||
|
||||
calendar = (
|
||||
u"",
|
||||
u" (юлиански)",
|
||||
u" (еврейски)",
|
||||
u" (републикански)",
|
||||
u" (персийски)",
|
||||
u" (ислямски)",
|
||||
u" (шведски)"
|
||||
u"юлиански",
|
||||
u"еврейски",
|
||||
u"републикански",
|
||||
u"персийски",
|
||||
u"ислямски",
|
||||
u"шведски"
|
||||
)
|
||||
|
||||
_mod_str = ("", "преди ", "след ", "около ", "", "", "")
|
||||
@@ -282,6 +282,7 @@ class DateDisplayBG(DateDisplay):
|
||||
cal = date.get_calendar()
|
||||
qual = date.get_quality()
|
||||
start = date.get_start_date()
|
||||
newyear = date.get_new_year()
|
||||
|
||||
qual_str = self._qual_str[qual]
|
||||
|
||||
@@ -292,14 +293,17 @@ class DateDisplayBG(DateDisplay):
|
||||
elif mod == Date.MOD_SPAN:
|
||||
d1 = self.display_cal[cal](start)
|
||||
d2 = self.display_cal[cal](date.get_stop_date())
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'от', d1, u'до', d2, self.calendar[cal])
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'от', d1, u'до', d2, scal)
|
||||
elif mod == Date.MOD_RANGE:
|
||||
d1 = self.display_cal[cal](start)
|
||||
d2 = self.display_cal[cal](date.get_stop_date())
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'между', d1, u'и', d2, self.calendar[cal])
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'между', d1, u'и', d2, scal)
|
||||
else:
|
||||
text = self.display_cal[date.get_calendar()](start)
|
||||
return "%s%s%s%s" % (qual_str, self._mod_str[mod], text, self.calendar[cal])
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s%s%s" % (qual_str, self._mod_str[mod], text, scal)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
+15
-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"Julià", u"Hebreu",
|
||||
u"Revolucionari", u"Persa", u"Islàmic",
|
||||
u"Suec"
|
||||
)
|
||||
|
||||
_mod_str = ("", u"abans de ", u"després de ", u"cap a ", "", "", "")
|
||||
@@ -164,6 +163,7 @@ class DateDisplayCA(DateDisplay):
|
||||
cal = date.get_calendar()
|
||||
qual = date.get_quality()
|
||||
start = date.get_start_date()
|
||||
newyear = date.get_new_year()
|
||||
|
||||
qual_str = self._qual_str[qual]
|
||||
|
||||
@@ -174,14 +174,17 @@ class DateDisplayCA(DateDisplay):
|
||||
elif mod == Date.MOD_SPAN:
|
||||
d1 = self.display_cal[cal](start)
|
||||
d2 = self.display_cal[cal](date.get_stop_date())
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'des de', d1, u'fins a', d2, self.calendar[cal])
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'des de', d1, u'fins a', d2, scal)
|
||||
elif mod == Date.MOD_RANGE:
|
||||
d1 = self.display_cal[cal](start)
|
||||
d2 = self.display_cal[cal](date.get_stop_date())
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'entre', d1, u'i', d2, self.calendar[cal])
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'entre', d1, u'i', d2, scal)
|
||||
else:
|
||||
text = self.display_cal[date.get_calendar()](start)
|
||||
return "%s%s%s%s" % (qual_str, self._mod_str[mod], text, self.calendar[cal])
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s%s%s" % (qual_str, self._mod_str[mod], text, scal)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
+15
-12
@@ -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"juliánský", u"hebrejský",
|
||||
u"republikánský", u"perský", u"islámský",
|
||||
u"švédský"
|
||||
)
|
||||
|
||||
_mod_str = ("", u"před ", u"po ", u"kolem ", "", "", "")
|
||||
@@ -133,6 +132,7 @@ class DateDisplayCZ(DateDisplay):
|
||||
cal = date.get_calendar()
|
||||
qual = date.get_quality()
|
||||
start = date.get_start_date()
|
||||
newyear = date.get_new_year()
|
||||
|
||||
qual_str = self._qual_str[qual]
|
||||
|
||||
@@ -143,17 +143,20 @@ class DateDisplayCZ(DateDisplay):
|
||||
elif mod == Date.MOD_SPAN:
|
||||
d1 = self.display_cal[cal](start)
|
||||
d2 = self.display_cal[cal](date.get_stop_date())
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'od', d1,
|
||||
u'do', d2, self.calendar[cal])
|
||||
u'do', d2, scal)
|
||||
elif mod == Date.MOD_RANGE:
|
||||
d1 = self.display_cal[cal](start)
|
||||
d2 = self.display_cal[cal](date.get_stop_date())
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'mezi',
|
||||
d1, u'a', d2, self.calendar[cal])
|
||||
d1, u'a', d2, scal)
|
||||
else:
|
||||
text = self.display_cal[date.get_calendar()](start)
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s%s%s" % (qual_str, self._mod_str[mod],
|
||||
text, self.calendar[cal])
|
||||
text, scal)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -206,9 +206,9 @@ class DateDisplayDE(DateDisplay):
|
||||
u"Jul", u"Aug", u"Sep", u"Okt", u"Nov", u"Dez" )
|
||||
|
||||
calendar = (
|
||||
"", u" (julianisch)", u" (hebräisch)",
|
||||
u" (französisch republikanisch)", u" (persisch)", u" (islamisch)",
|
||||
u" (schwedisch)"
|
||||
"", u"julianisch", u"hebräisch",
|
||||
u"französisch republikanisch", u"persisch", u"islamisch",
|
||||
u"schwedisch"
|
||||
)
|
||||
|
||||
_mod_str = ("", u"vor ", u"nach ", u"etwa ", "", "", "")
|
||||
@@ -289,6 +289,7 @@ class DateDisplayDE(DateDisplay):
|
||||
cal = date.get_calendar()
|
||||
qual = date.get_quality()
|
||||
start = date.get_start_date()
|
||||
newyear = date.get_new_year()
|
||||
|
||||
qual_str = self._qual_str[qual]
|
||||
|
||||
@@ -299,14 +300,17 @@ class DateDisplayDE(DateDisplay):
|
||||
elif mod == Date.MOD_SPAN:
|
||||
d1 = self.display_cal[cal](start)
|
||||
d2 = self.display_cal[cal](date.get_stop_date())
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'von', d1, u'bis', d2, self.calendar[cal])
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'von', d1, u'bis', d2, scal)
|
||||
elif mod == Date.MOD_RANGE:
|
||||
d1 = self.display_cal[cal](start)
|
||||
d2 = self.display_cal[cal](date.get_stop_date())
|
||||
return "%szwischen %s und %s%s" % (qual_str, d1, d2, self.calendar[cal])
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%szwischen %s und %s%s" % (qual_str, d1, d2, scal)
|
||||
else:
|
||||
text = self.display_cal[date.get_calendar()](start)
|
||||
return "%s%s%s%s" % (qual_str, self._mod_str[mod], text, self.calendar[cal])
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s%s%s" % (qual_str, self._mod_str[mod], text, scal)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -127,9 +127,9 @@ class DateDisplayES(DateDisplay):
|
||||
u"dic" )
|
||||
|
||||
calendar = (
|
||||
"", u" (Juliano)", u" (Hebreo)",
|
||||
u" (Revolucionario)", u" (Persa)", u" (Islámico)",
|
||||
u" (Swedish)"
|
||||
"", u"Juliano", u"Hebreo",
|
||||
u"Revolucionario", u"Persa", u"Islámico",
|
||||
u"Swedish"
|
||||
)
|
||||
|
||||
_mod_str = ("", u"antes de ", u"después de ", u"hacia ", "", "", "")
|
||||
@@ -149,6 +149,7 @@ class DateDisplayES(DateDisplay):
|
||||
cal = date.get_calendar()
|
||||
qual = date.get_quality()
|
||||
start = date.get_start_date()
|
||||
newyear = date.get_new_year()
|
||||
|
||||
qual_str = self._qual_str[qual]
|
||||
|
||||
@@ -159,14 +160,17 @@ class DateDisplayES(DateDisplay):
|
||||
elif mod == Date.MOD_SPAN:
|
||||
d1 = self.display_cal[cal](start)
|
||||
d2 = self.display_cal[cal](date.get_stop_date())
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'de', d1, u'a', d2, self.calendar[cal])
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'de', d1, u'a', d2, scal)
|
||||
elif mod == Date.MOD_RANGE:
|
||||
d1 = self.display_cal[cal](start)
|
||||
d2 = self.display_cal[cal](date.get_stop_date())
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'entre', d1, u'y', d2, self.calendar[cal])
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'entre', d1, u'y', d2, scal)
|
||||
else:
|
||||
text = self.display_cal[date.get_calendar()](start)
|
||||
return "%s%s%s%s" % (qual_str, self._mod_str[mod], text, self.calendar[cal])
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s%s%s" % (qual_str, self._mod_str[mod], text, scal)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
+19
-16
@@ -116,22 +116,22 @@ 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)",
|
||||
u"(heprealainen)",
|
||||
u"(ranskan v.)",
|
||||
u"(persialainen)",
|
||||
u"(islamilainen)",
|
||||
u" (svensk)"
|
||||
)
|
||||
u"juliaaninen",
|
||||
u"heprealainen",
|
||||
u"ranskan v.",
|
||||
u"persialainen",
|
||||
u"islamilainen",
|
||||
u"svensk"
|
||||
)
|
||||
|
||||
_qual_str = (u"", u"arviolta", u"laskettuna")
|
||||
|
||||
@@ -139,7 +139,7 @@ class DateDisplayFI(DateDisplay):
|
||||
|
||||
formats = (
|
||||
"VVVV-KK-PP (ISO)",
|
||||
"PP.KK.VVVV"
|
||||
"PP.KK.VVVV"
|
||||
)
|
||||
|
||||
def display(self, date):
|
||||
@@ -150,6 +150,7 @@ class DateDisplayFI(DateDisplay):
|
||||
qual = date.get_quality()
|
||||
cal = date.get_calendar()
|
||||
start = date.get_start_date()
|
||||
newyear = date.get_new_year()
|
||||
|
||||
if mod == Date.MOD_TEXTONLY:
|
||||
return date.get_text()
|
||||
@@ -185,9 +186,11 @@ class DateDisplayFI(DateDisplay):
|
||||
if qual:
|
||||
# prepend quality
|
||||
text = u"%s %s" % (self._qual_str[qual], text)
|
||||
if cal:
|
||||
|
||||
if cal or newyear:
|
||||
# append calendar type
|
||||
text = u"%s %s" % (text, self.calendar[cal])
|
||||
scal = self.format_extras(cal, newyear)
|
||||
text = u"%s %s" % (text, scal)
|
||||
|
||||
return text
|
||||
|
||||
|
||||
+23
-12
@@ -58,6 +58,15 @@ class DateParserFR(DateParser):
|
||||
|
||||
month_to_int = DateParser.month_to_int
|
||||
|
||||
# Custom short months not the same as long months
|
||||
|
||||
month_to_int[u"janv"] = 1
|
||||
month_to_int[u"févr"] = 2
|
||||
month_to_int[u"juil"] = 7
|
||||
month_to_int[u"sept"] = 9
|
||||
month_to_int[u"oct"] = 10
|
||||
month_to_int[u"déc"] = 12
|
||||
|
||||
# Add common value
|
||||
|
||||
month_to_int[u"bluviose"] = 5
|
||||
@@ -230,7 +239,6 @@ class DateParserFR(DateParser):
|
||||
self._stext2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' %
|
||||
self._smon_str, re.IGNORECASE)
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# French display
|
||||
@@ -247,8 +255,8 @@ class DateDisplayFR(DateDisplay):
|
||||
short_months = ( u"", u"janv", u"févr", u"mars", u"avril", u"mai", u"juin",
|
||||
u"juil", u"août", u"sept", u"oct", u"nov", u"déc" )
|
||||
|
||||
calendar = ("", u" (Julien)", u" (Hébreu)", u" (Révolutionnaire)",
|
||||
u" (Perse)", u" (Islamique)", u" (Suédois)")
|
||||
calendar = ("", u"Julien", u"Hébreu", u"Révolutionnaire",
|
||||
u"Perse", u"Islamique", u"Suédois")
|
||||
|
||||
_mod_str = ("", u"avant ", u"après ", u"vers ", "", "", "")
|
||||
|
||||
@@ -383,6 +391,7 @@ class DateDisplayFR(DateDisplay):
|
||||
cal = date.get_calendar()
|
||||
qual = date.get_quality()
|
||||
start = date.get_start_date()
|
||||
newyear = date.get_new_year()
|
||||
|
||||
qual_str = (self._qual_str)[qual]
|
||||
|
||||
@@ -391,20 +400,22 @@ class DateDisplayFR(DateDisplay):
|
||||
elif start == Date.EMPTY:
|
||||
return ""
|
||||
elif mod == Date.MOD_SPAN:
|
||||
date1 = (self.display_cal)[cal](start)
|
||||
date2 = (self.display_cal)[cal](date.get_stop_date())
|
||||
date1 = self.display_cal[cal](start)
|
||||
date2 = self.display_cal[cal](date.get_stop_date())
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'de', date1, u'à',
|
||||
date2, (self.calendar)[cal])
|
||||
date2, scal)
|
||||
elif mod == Date.MOD_RANGE:
|
||||
date1 = (self.display_cal)[cal](start)
|
||||
date2 = (self.display_cal)[cal](date.get_stop_date())
|
||||
date1 = self.display_cal[cal](start)
|
||||
date2 = self.display_cal[cal](date.get_stop_date())
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'entre', date1, u'et',
|
||||
date2, (self.calendar)[cal])
|
||||
date2, scal)
|
||||
else:
|
||||
text = (self.display_cal)[date.get_calendar()](start)
|
||||
text = self.display_cal[date.get_calendar()](start)
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s%s%s" % (qual_str, (self._mod_str)[mod], text,
|
||||
(self.calendar)[cal])
|
||||
|
||||
scal)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -227,9 +227,9 @@ class DateDisplayHR(DateDisplay):
|
||||
)
|
||||
|
||||
calendar = (
|
||||
"", u" (julijanski)", u" (hebrejski)",
|
||||
u" (francuski republikanski)", u" (perzijski)", u" (islamski)",
|
||||
u" (swedish)"
|
||||
"", u"julijanski", u"hebrejski",
|
||||
u"francuski republikanski", u"perzijski", u"islamski",
|
||||
u"swedish"
|
||||
)
|
||||
|
||||
_mod_str = ("", "prije ", "poslije ", "okolo ", "", "", "")
|
||||
@@ -322,6 +322,7 @@ class DateDisplayHR(DateDisplay):
|
||||
cal = date.get_calendar()
|
||||
qual = date.get_quality()
|
||||
start = date.get_start_date()
|
||||
newyear = date.get_new_year()
|
||||
|
||||
qual_str = self._qual_str[qual]
|
||||
|
||||
@@ -332,17 +333,20 @@ class DateDisplayHR(DateDisplay):
|
||||
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 "%s%s %s %s %s%s" % (qual_str, u'od', d_1, u'do', d_2,
|
||||
self.calendar[cal])
|
||||
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)
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'između', d_1, u'i', d_2,
|
||||
self.calendar[cal])
|
||||
scal)
|
||||
else:
|
||||
text = self.display_cal[date.get_calendar()](start)
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s%s%s" % (qual_str, self._mod_str[mod], text,
|
||||
self.calendar[cal])
|
||||
scal)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -120,9 +120,9 @@ class DateDisplayIT(DateDisplay):
|
||||
u"lug", u"ago", u"set", u"ott", u"nov", u"dic" )
|
||||
|
||||
calendar = (
|
||||
"", u" (Giuliano)", u" (Ebraico)",
|
||||
u" (Rivoluzionario)", u" (Persiano)", u" (Islamico)",
|
||||
u" (Svedese)"
|
||||
"", u"Giuliano", u"Ebraico",
|
||||
u"Rivoluzionario", u"Persiano", u"Islamico",
|
||||
u"Svedese"
|
||||
)
|
||||
|
||||
_mod_str = ("", u"prima del ", u"dopo del ", u"circa il ", "", "", "")
|
||||
@@ -159,6 +159,7 @@ class DateDisplayIT(DateDisplay):
|
||||
cal = date.get_calendar()
|
||||
qual = date.get_quality()
|
||||
start = date.get_start_date()
|
||||
newyear = date.get_new_year()
|
||||
|
||||
qual_str = self._qual_str[qual]
|
||||
|
||||
@@ -169,14 +170,17 @@ class DateDisplayIT(DateDisplay):
|
||||
elif mod == Date.MOD_SPAN:
|
||||
d1 = self.display_cal[cal](start)
|
||||
d2 = self.display_cal[cal](date.get_stop_date())
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'dal', d1, u'al', d2, self.calendar[cal])
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'dal', d1, u'al', d2, scal)
|
||||
elif mod == Date.MOD_RANGE:
|
||||
d1 = self.display_cal[cal](start)
|
||||
d2 = self.display_cal[cal](date.get_stop_date())
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'tra', d1, u'e', d2, self.calendar[cal])
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'tra', d1, u'e', d2, scal)
|
||||
else:
|
||||
text = self.display_cal[date.get_calendar()](start)
|
||||
return "%s%s%s%s" % (qual_str, self._mod_str[mod], text, self.calendar[cal])
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s%s%s" % (qual_str, self._mod_str[mod], text, scal)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
+19
-15
@@ -101,21 +101,21 @@ 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"Sausis", u"Vasaris", u"Kovas", u"Balandis", u"Gegužė",
|
||||
u"Birželis", u"Liepa", u"Rugpjūtis", u"Rugsejis", u"Spalis",
|
||||
u"Lapkritis", u"Gruodis" )
|
||||
|
||||
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"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" (persų)",
|
||||
u" (islamo)",
|
||||
u" (swedish)"
|
||||
u"", u"julijaus",
|
||||
u"hebrajų",
|
||||
u"prancuzų respublikos",
|
||||
u"persų",
|
||||
u"islamo",
|
||||
u"swedish"
|
||||
)
|
||||
|
||||
_mod_str = (u"",
|
||||
@@ -139,6 +139,7 @@ class DateDisplayLT(DateDisplay):
|
||||
cal = date.get_calendar()
|
||||
qual = date.get_quality()
|
||||
start = date.get_start_date()
|
||||
newyear = date.get_new_year()
|
||||
|
||||
qual_str = self._qual_str[qual]
|
||||
|
||||
@@ -149,17 +150,20 @@ class DateDisplayLT(DateDisplay):
|
||||
elif mod == Date.MOD_SPAN:
|
||||
d1 = self.display_cal[cal](start)
|
||||
d2 = self.display_cal[cal](date.get_stop_date())
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'nuo', d1, u'iki',
|
||||
d2, self.calendar[cal])
|
||||
d2, scal)
|
||||
elif mod == Date.MOD_RANGE:
|
||||
d1 = self.display_cal[cal](start)
|
||||
d2 = self.display_cal[cal](date.get_stop_date())
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'tarp', d1, u'ir',
|
||||
d2, self.calendar[cal])
|
||||
d2, scal)
|
||||
else:
|
||||
text = self.display_cal[date.get_calendar()](start)
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s%s%s" % (qual_str, self._mod_str[mod], text,
|
||||
self.calendar[cal])
|
||||
scal)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -124,12 +124,12 @@ class DateDisplayNb(DateDisplay):
|
||||
|
||||
calendar = (
|
||||
"",
|
||||
" (juliansk)",
|
||||
" (hebraisk)",
|
||||
" (fransk republikansk)",
|
||||
" (persisk)",
|
||||
" (islamisk)",
|
||||
" (svensk)"
|
||||
"juliansk",
|
||||
"hebraisk",
|
||||
"fransk republikansk",
|
||||
"persisk",
|
||||
"islamisk",
|
||||
"svensk"
|
||||
)
|
||||
|
||||
_mod_str = ("", u"før ", u"etter ", u"ca ", "", "", "")
|
||||
@@ -146,6 +146,7 @@ class DateDisplayNb(DateDisplay):
|
||||
cal = date.get_calendar()
|
||||
qual = date.get_quality()
|
||||
start = date.get_start_date()
|
||||
newyear = date.get_new_year()
|
||||
|
||||
qual_str = self._qual_str[qual]
|
||||
|
||||
@@ -156,16 +157,19 @@ class DateDisplayNb(DateDisplay):
|
||||
elif mod == Date.MOD_SPAN:
|
||||
d1 = self.display_cal[cal](start)
|
||||
d2 = self.display_cal[cal](date.get_stop_date())
|
||||
return u"%sfra %s til %s%s" % (qual_str, d1, d2, self.calendar[cal])
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return u"%sfra %s til %s%s" % (qual_str, d1, d2, scal)
|
||||
elif mod == Date.MOD_RANGE:
|
||||
d1 = self.display_cal[cal](start)
|
||||
d2 = self.display_cal[cal](date.get_stop_date())
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return u"%smellom %s og %s%s" % (qual_str, d1, d2,
|
||||
self.calendar[cal])
|
||||
scal)
|
||||
else:
|
||||
text = self.display_cal[date.get_calendar()](start)
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return u"%s%s%s%s" % (qual_str, self._mod_str[mod],
|
||||
text, self.calendar[cal])
|
||||
text, scal)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -65,6 +65,9 @@ class DateParserNL(DateParser):
|
||||
month_to_int[u"feber"] = 2
|
||||
month_to_int[u"februaris"] = 2
|
||||
month_to_int[u"merz"] = 3
|
||||
#make sure on all distro mrt and maa are accepted
|
||||
month_to_int[u"maa"] = 3
|
||||
month_to_int[u"mrt"] = 3
|
||||
month_to_int[u"aprilis"] = 4
|
||||
month_to_int[u"maius"] = 5
|
||||
month_to_int[u"junius"] = 6
|
||||
@@ -143,13 +146,13 @@ class DateDisplayNL(DateDisplay):
|
||||
u"juni", u"juli", u"augustus", u"september", u"oktober",
|
||||
u"november", u"december" )
|
||||
|
||||
short_months = ( u"", u"jan", u"feb", u"maa", u"apr", u"mei", u"jun",
|
||||
short_months = ( u"", u"jan", u"feb", u"mrt", u"apr", u"mei", u"jun",
|
||||
u"jul", u"aug", u"sep", u"okt", u"nov", u"dec" )
|
||||
|
||||
calendar = (
|
||||
"", u" (juliaans)", u" (hebreeuws)",
|
||||
u" (franse republiek)", u" (persisch)", u" (islamitisch)",
|
||||
u" (zweeds)" )
|
||||
"", u"juliaans", u"hebreeuws",
|
||||
u"franse republiek", u"persisch", u"islamitisch",
|
||||
u"zweeds" )
|
||||
|
||||
_mod_str = ("", u"voor ", u"na ", u"rond ", "", "", "")
|
||||
|
||||
@@ -231,6 +234,7 @@ class DateDisplayNL(DateDisplay):
|
||||
cal = date.get_calendar()
|
||||
qual = date.get_quality()
|
||||
start = date.get_start_date()
|
||||
newyear = date.get_new_year()
|
||||
|
||||
qual_str = self._qual_str[qual]
|
||||
|
||||
@@ -241,17 +245,20 @@ class DateDisplayNL(DateDisplay):
|
||||
elif mod == Date.MOD_SPAN:
|
||||
d1 = self.display_cal[cal](start)
|
||||
d2 = self.display_cal[cal](date.get_stop_date())
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'van', d1,
|
||||
u'tot', d2, self.calendar[cal])
|
||||
u'tot', d2, scal)
|
||||
elif mod == Date.MOD_RANGE:
|
||||
d1 = self.display_cal[cal](start)
|
||||
d2 = self.display_cal[cal](date.get_stop_date())
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%stussen %s en %s%s" % (qual_str, d1, d2,
|
||||
self.calendar[cal])
|
||||
scal)
|
||||
else:
|
||||
text = self.display_cal[date.get_calendar()](start)
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s%s%s" % (qual_str, self._mod_str[mod], text,
|
||||
self.calendar[cal])
|
||||
scal)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
+61
-23
@@ -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,18 +173,18 @@ 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)",
|
||||
u" (francuski republikański)", u" (perski)", u" (islamski)",
|
||||
u" (swedish)"
|
||||
"", u"juliański", u"hebrajski",
|
||||
u"francuski republikański", u"perski", u"islamski",
|
||||
u"swedish"
|
||||
)
|
||||
|
||||
_mod_str = ("", u"przed ", u"po ", u"ok. ", "", "", "")
|
||||
@@ -246,6 +280,7 @@ class DateDisplayPL(DateDisplay):
|
||||
cal = date.get_calendar()
|
||||
qual = date.get_quality()
|
||||
start = date.get_start_date()
|
||||
newyear = date.get_new_year()
|
||||
|
||||
qual_str = self._qual_str[qual]
|
||||
|
||||
@@ -256,17 +291,20 @@ class DateDisplayPL(DateDisplay):
|
||||
elif mod == Date.MOD_SPAN:
|
||||
d1 = self.display_cal[cal](start)
|
||||
d2 = self.display_cal[cal](date.get_stop_date())
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'od', d1, u'do', d2,
|
||||
self.calendar[cal])
|
||||
scal)
|
||||
elif mod == Date.MOD_RANGE:
|
||||
d1 = self.display_cal[cal](start)
|
||||
d2 = self.display_cal[cal](date.get_stop_date())
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'między', d1, u'a', d2,
|
||||
self.calendar[cal])
|
||||
scal)
|
||||
else:
|
||||
text = self.display_cal[date.get_calendar()](start)
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s%s%s" % (qual_str, self._mod_str[mod], text,
|
||||
self.calendar[cal])
|
||||
scal)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
+36
-27
@@ -52,20 +52,26 @@ from _DateHandler import register_datehandler
|
||||
class DateParserPT(DateParser):
|
||||
|
||||
modifier_to_int = {
|
||||
u'antes de' : Date.MOD_BEFORE,
|
||||
u'antes' : Date.MOD_BEFORE,
|
||||
u'ant.' : Date.MOD_BEFORE,
|
||||
u'ant' : Date.MOD_BEFORE,
|
||||
u'após' : Date.MOD_AFTER,
|
||||
u'aprox.' : Date.MOD_ABOUT,
|
||||
u'aprox' : Date.MOD_ABOUT,
|
||||
u'apr.' : Date.MOD_ABOUT,
|
||||
u'apr' : Date.MOD_ABOUT,
|
||||
u'cerca de' : Date.MOD_ABOUT,
|
||||
u'ca.' : Date.MOD_ABOUT,
|
||||
u'ca' : Date.MOD_ABOUT,
|
||||
u'c.' : Date.MOD_ABOUT,
|
||||
u'até' : Date.MOD_ABOUT,
|
||||
u'antes de' : Date.MOD_BEFORE,
|
||||
u'antes' : Date.MOD_BEFORE,
|
||||
u'ant.' : Date.MOD_BEFORE,
|
||||
u'ant' : Date.MOD_BEFORE,
|
||||
u'até' : Date.MOD_BEFORE,
|
||||
u'depois de' : Date.MOD_AFTER,
|
||||
u'depois' : Date.MOD_AFTER,
|
||||
u'dep.' : Date.MOD_AFTER,
|
||||
u'dep' : Date.MOD_AFTER,
|
||||
u'aprox.' : Date.MOD_ABOUT,
|
||||
u'aprox' : Date.MOD_ABOUT,
|
||||
u'apr.' : Date.MOD_ABOUT,
|
||||
u'apr' : Date.MOD_ABOUT,
|
||||
u'cerca de' : Date.MOD_ABOUT,
|
||||
u'ca.' : Date.MOD_ABOUT,
|
||||
u'ca' : Date.MOD_ABOUT,
|
||||
u'c.' : Date.MOD_ABOUT,
|
||||
u'por volta de' : Date.MOD_ABOUT,
|
||||
u'por volta' : Date.MOD_ABOUT,
|
||||
u'pvd.' : Date.MOD_ABOUT,
|
||||
}
|
||||
|
||||
calendar_to_int = {
|
||||
@@ -116,21 +122,20 @@ class DateDisplayPT(DateDisplay):
|
||||
"""
|
||||
Portuguese 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"Janeiro", u"Fevereiro", u"Março", u"Abril", u"Maio",
|
||||
u"Junho", u"Julho", u"Agosto", u"Setembro", u"Outubro",
|
||||
u"Novembro", u"Dezembro" )
|
||||
|
||||
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"Jan", u"Fev", u"Mar", u"Abr", u"Mai", u"Jun",
|
||||
u"Jul", u"Ago", u"Set", u"Out", u"Nov", u"Dez" )
|
||||
|
||||
calendar = (
|
||||
"", u" (Juliano)", u" (Hebreu)",
|
||||
u" (Revolucionário)", u" (Persa)", u" (Islâmico)",
|
||||
u" (Swedish)"
|
||||
"", u"Juliano", u"Hebreu",
|
||||
u"Revolucionário", u"Persa", u"Islâmico",
|
||||
u"Sueco"
|
||||
)
|
||||
|
||||
_mod_str = ("",u"antes de ",u"depois de ",u"até ","","","")
|
||||
_mod_str = ("",u"antes de ",u"depois de ",u"por volta de ","","","")
|
||||
|
||||
_qual_str = ("","estimado ","calculado ")
|
||||
|
||||
@@ -147,6 +152,7 @@ class DateDisplayPT(DateDisplay):
|
||||
cal = date.get_calendar()
|
||||
qual = date.get_quality()
|
||||
start = date.get_start_date()
|
||||
newyear = date.get_new_year()
|
||||
|
||||
qual_str = self._qual_str[qual]
|
||||
|
||||
@@ -157,14 +163,17 @@ class DateDisplayPT(DateDisplay):
|
||||
elif mod == Date.MOD_SPAN:
|
||||
d1 = self.display_cal[cal](start)
|
||||
d2 = self.display_cal[cal](date.get_stop_date())
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'de', d1, u'a', d2,self.calendar[cal])
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'de', d1, u'a', d2, scal)
|
||||
elif mod == Date.MOD_RANGE:
|
||||
d1 = self.display_cal[cal](start)
|
||||
d2 = self.display_cal[cal](date.get_stop_date())
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'entre', d1, u'e', d2, self.calendar[cal])
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'entre', d1, u'e', d2, scal)
|
||||
else:
|
||||
text = self.display_cal[date.get_calendar()](start)
|
||||
return "%s%s%s%s" % (qual_str, self._mod_str[mod], text, self.calendar[cal])
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s%s%s" % (qual_str, self._mod_str[mod], text, scal)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -197,12 +197,12 @@ class DateDisplayRU(DateDisplay):
|
||||
|
||||
calendar = (
|
||||
u"",
|
||||
u" (юлианский)",
|
||||
u" (еврейский)",
|
||||
u" (республиканский)",
|
||||
u" (персидский)",
|
||||
u" (исламский)",
|
||||
u" (Swedish)"
|
||||
u"юлианский",
|
||||
u"еврейский",
|
||||
u"республиканский",
|
||||
u"персидский",
|
||||
u"исламский",
|
||||
u"Swedish"
|
||||
)
|
||||
|
||||
_mod_str = (
|
||||
@@ -291,6 +291,7 @@ class DateDisplayRU(DateDisplay):
|
||||
cal = date.get_calendar()
|
||||
qual = date.get_quality()
|
||||
start = date.get_start_date()
|
||||
newyear = date.get_new_year()
|
||||
|
||||
qual_str = self._qual_str[qual]
|
||||
|
||||
@@ -301,17 +302,20 @@ class DateDisplayRU(DateDisplay):
|
||||
elif mod == Date.MOD_SPAN:
|
||||
d1 = self.display_cal[cal](start)
|
||||
d2 = self.display_cal[cal](date.get_stop_date())
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%sс %s %s %s%s" % (qual_str, d1, u'по', d2,
|
||||
self.calendar[cal])
|
||||
scal)
|
||||
elif mod == Date.MOD_RANGE:
|
||||
d1 = self.display_cal[cal](start)
|
||||
d2 = self.display_cal[cal](date.get_stop_date())
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'между', d1, u'и',
|
||||
d2, self.calendar[cal])
|
||||
d2, scal)
|
||||
else:
|
||||
text = self.display_cal[date.get_calendar()](start)
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s%s%s" % (qual_str, self._mod_str[mod],
|
||||
text, self.calendar[cal])
|
||||
text, scal)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
+15
-12
@@ -104,18 +104,17 @@ class DateDisplaySK(DateDisplay):
|
||||
"""
|
||||
Slovak 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"január", u"február", u"marec", u"apríl", u"máj",
|
||||
u"jún", u"júl", u"august", u"september", u"október",
|
||||
u"november", u"december" )
|
||||
|
||||
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"jan", u"feb", u"mar", u"apr", u"máj", u"jún",
|
||||
u"júl", u"aug", u"sep", u"okt", u"nov", u"dec" )
|
||||
|
||||
calendar = (
|
||||
"", u" (juliánský)", u" (hebrejský)",
|
||||
u" (republikánsky)", u" (perzský)", u" (islamský)",
|
||||
u" (swedish)"
|
||||
"", u"juliánský", u"hebrejský",
|
||||
u"republikánsky", u"perzský", u"islamský",
|
||||
u"swedish"
|
||||
)
|
||||
|
||||
_mod_str = ("", u"pred ", u"po ", u"okolo ", "", "", "")
|
||||
@@ -135,6 +134,7 @@ class DateDisplaySK(DateDisplay):
|
||||
cal = date.get_calendar()
|
||||
qual = date.get_quality()
|
||||
start = date.get_start_date()
|
||||
newyear = date.get_new_year()
|
||||
|
||||
qual_str = self._qual_str[qual]
|
||||
|
||||
@@ -145,17 +145,20 @@ class DateDisplaySK(DateDisplay):
|
||||
elif mod == Date.MOD_SPAN:
|
||||
d1 = self.display_cal[cal](start)
|
||||
d2 = self.display_cal[cal](date.get_stop_date())
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'od', d1,
|
||||
u'do', d2, self.calendar[cal])
|
||||
u'do', d2, scal)
|
||||
elif mod == Date.MOD_RANGE:
|
||||
d1 = self.display_cal[cal](start)
|
||||
d2 = self.display_cal[cal](date.get_stop_date())
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'medzi',
|
||||
d1, u'a', d2, self.calendar[cal])
|
||||
d1, u'a', d2, scal)
|
||||
else:
|
||||
text = self.display_cal[date.get_calendar()](start)
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s%s%s" % (qual_str, self._mod_str[mod],
|
||||
text, self.calendar[cal])
|
||||
text, scal)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -251,9 +251,9 @@ class DateDisplaySR_latin(DateDisplay):
|
||||
)
|
||||
|
||||
calendar = (
|
||||
"", u" (julijanski)", u" (hebrejski)",
|
||||
u" (francuski republikanski)", u" (persijski)", u" (islamski)",
|
||||
u" (švedski)"
|
||||
"", u"julijanski", u"hebrejski",
|
||||
u"francuski republikanski", u"persijski", u"islamski",
|
||||
u"švedski"
|
||||
)
|
||||
|
||||
_mod_str = ("", "pre ", "posle ", "oko ", "", "", "")
|
||||
@@ -334,6 +334,7 @@ class DateDisplaySR_latin(DateDisplay):
|
||||
cal = date.get_calendar()
|
||||
qual = date.get_quality()
|
||||
start = date.get_start_date()
|
||||
newyear = date.get_new_year()
|
||||
|
||||
qual_str = self._qual_str[qual]
|
||||
|
||||
@@ -344,17 +345,20 @@ class DateDisplaySR_latin(DateDisplay):
|
||||
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 "%s%s %s %s %s%s" % (qual_str, u'od', d_1, u'do', d_2,
|
||||
self.calendar[cal])
|
||||
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)
|
||||
return "%s%s %s %s %s%s" % (qual_str, u'između', d_1, u'i', d_2,
|
||||
self.calendar[cal])
|
||||
scal)
|
||||
else:
|
||||
text = self.display_cal[date.get_calendar()](start)
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return "%s%s%s%s" % (qual_str, self._mod_str[mod], text,
|
||||
self.calendar[cal])
|
||||
scal)
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
+18
-14
@@ -64,7 +64,7 @@ class DateParserSv(DateParser):
|
||||
u'c:a' : Date.MOD_ABOUT
|
||||
}
|
||||
|
||||
bce = ["f Kr"]
|
||||
bce = [u"f Kr"]
|
||||
|
||||
calendar_to_int = {
|
||||
u'gregoriansk ' : Date.CAL_GREGORIAN,
|
||||
@@ -128,20 +128,20 @@ class DateDisplaySv(DateDisplay):
|
||||
)
|
||||
|
||||
calendar = (
|
||||
"",
|
||||
" (juliansk)",
|
||||
" (hebreisk)",
|
||||
" (fransk republikansk)",
|
||||
" (persisk)",
|
||||
" (islamisk)",
|
||||
" (svensk)"
|
||||
u"",
|
||||
u"juliansk",
|
||||
u"hebreisk",
|
||||
u"fransk republikansk",
|
||||
u"persisk",
|
||||
u"islamisk",
|
||||
u"svensk"
|
||||
)
|
||||
|
||||
_mod_str = ("", u"före ", u"efter ", u"c:a ", "", "", "")
|
||||
_mod_str = (u"", u"före ", u"efter ", u"c:a ", u"", u"", u"")
|
||||
|
||||
_qual_str = ("", u"uppskattat ", u"beräknat ")
|
||||
_qual_str = (u"", u"uppskattat ", u"beräknat ")
|
||||
|
||||
_bce_str = "%s f Kr"
|
||||
_bce_str = u"%s f Kr"
|
||||
|
||||
def display(self, date):
|
||||
"""
|
||||
@@ -151,6 +151,7 @@ class DateDisplaySv(DateDisplay):
|
||||
cal = date.get_calendar()
|
||||
qual = date.get_quality()
|
||||
start = date.get_start_date()
|
||||
newyear = date.get_new_year()
|
||||
|
||||
qual_str = self._qual_str[qual]
|
||||
|
||||
@@ -161,16 +162,19 @@ class DateDisplaySv(DateDisplay):
|
||||
elif mod == Date.MOD_SPAN:
|
||||
d1 = self.display_cal[cal](start)
|
||||
d2 = self.display_cal[cal](date.get_stop_date())
|
||||
return u"%sfrån %s till %s%s" % (qual_str, d1, d2, self.calendar[cal])
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return u"%sfrån %s till %s%s" % (qual_str, d1, d2, scal)
|
||||
elif mod == Date.MOD_RANGE:
|
||||
d1 = self.display_cal[cal](start)
|
||||
d2 = self.display_cal[cal](date.get_stop_date())
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return u"%smellan %s och %s%s" % (qual_str, d1, d2,
|
||||
self.calendar[cal])
|
||||
scal)
|
||||
else:
|
||||
text = self.display_cal[date.get_calendar()](start)
|
||||
scal = self.format_extras(cal, newyear)
|
||||
return u"%s%s%s%s" % (qual_str, self._mod_str[mod],
|
||||
text, self.calendar[cal])
|
||||
text, scal)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
+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)
|
||||
|
||||
@@ -40,5 +40,5 @@ from Filters.Rules._HasSourceBase import HasSourceBase
|
||||
class HasSource(HasSourceBase):
|
||||
"""Events with sources"""
|
||||
|
||||
name = _('Events with <count> source')
|
||||
description = _("Matches events with a certain number of items in the source")
|
||||
name = _('Events with <count> sources')
|
||||
description = _("Matches events with a certain number of sources connected to it")
|
||||
|
||||
@@ -43,5 +43,5 @@ from Filters.Rules._HasSourceBase import HasSourceBase
|
||||
class HasSource(HasSourceBase):
|
||||
"""Families with sources"""
|
||||
|
||||
name = _('Families with <count> source')
|
||||
description = _("Matches families with a certain number of items in the source")
|
||||
name = _('Families with <count> sources')
|
||||
description = _("Matches families with a certain number of sources connected to it")
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -68,14 +68,15 @@ class HasCommonAncestorWith(Rule):
|
||||
|
||||
for fam_handle in person.get_parent_family_handle_list():
|
||||
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:
|
||||
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]
|
||||
|
||||
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]:
|
||||
|
||||
@@ -43,5 +43,5 @@ from Filters.Rules._HasSourceBase import HasSourceBase
|
||||
class HasSource(HasSourceBase):
|
||||
"""People with sources"""
|
||||
|
||||
name = _('People with <count> source')
|
||||
description = _("Matches people with a certain number of items in the source")
|
||||
name = _('People with <count> sources')
|
||||
description = _("Matches people with a certain number of sources connected to it")
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -43,7 +43,7 @@ class HasRepository(Rule):
|
||||
|
||||
labels = [ _('Number of instances:'), _('Number must be:')]
|
||||
name = _('Sources with <count> Repository references')
|
||||
description = _("Matches sources with certain number repository references")
|
||||
description = _("Matches sources with a certain number of repository references")
|
||||
category = _('General filters')
|
||||
|
||||
def prepare(self, db):
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -43,7 +43,7 @@ class HasSourceBase(Rule):
|
||||
|
||||
labels = [ _('Number of instances:'), _('Number must be:')]
|
||||
name = _('Objects with <count> sources')
|
||||
description = _("Matches objects that have a certain number of sources")
|
||||
description = _("Matches objects that have a certain number of sources connected to it")
|
||||
category = _('General filters')
|
||||
|
||||
def prepare(self, db):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -227,10 +227,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
|
||||
|
||||
@@ -79,6 +79,10 @@ class SearchBar(object):
|
||||
return self.filterbar
|
||||
|
||||
def setup_filter( self, column_data ):
|
||||
"""
|
||||
column_data is a list of tuples:
|
||||
[(trans_col_name, index, use_exact), ...]
|
||||
"""
|
||||
self.filter_model.clear()
|
||||
old_value = self.filter_list.get_active()
|
||||
|
||||
@@ -88,11 +92,17 @@ class SearchBar(object):
|
||||
self.filter_list.add_attribute(cell, 'text', 0)
|
||||
|
||||
maxval = 0
|
||||
for col, index in column_data:
|
||||
rule = _("%s contains") % col
|
||||
for col, index, exact in column_data:
|
||||
if exact:
|
||||
rule = _("%s is") % col
|
||||
else:
|
||||
rule = _("%s contains") % col
|
||||
self.filter_model.append(row=[rule, index, False])
|
||||
maxval += 1
|
||||
rule = _("%s does not contain") % col
|
||||
if exact:
|
||||
rule = _("%s is not") % col
|
||||
else:
|
||||
rule = _("%s does not contain") % col
|
||||
self.filter_model.append(row=[rule, index, True])
|
||||
maxval += 1
|
||||
|
||||
|
||||
@@ -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)))
|
||||
|
||||
@@ -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
|
||||
@@ -110,6 +117,8 @@ def resize_to_jpeg_buffer(source, width, height):
|
||||
filed, dest = tempfile.mkstemp()
|
||||
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()
|
||||
|
||||
+3
-1
@@ -91,7 +91,9 @@ class LdsTemples(object):
|
||||
"""
|
||||
returns a list of temple codes, temple name tuples
|
||||
"""
|
||||
return [(code, name) for name, code in self.__temple_codes.iteritems()]
|
||||
return sorted([(code, name) for name, code
|
||||
in self.__temple_codes.iteritems()],
|
||||
key=lambda v: v[1])
|
||||
|
||||
def __start_element(self, tag, attrs):
|
||||
"""
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
+104
-19
@@ -2,6 +2,7 @@
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000-2007 Donald N. Allingham
|
||||
# Copyright (C) 2010 Michiel D. Nauta
|
||||
#
|
||||
# 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
|
||||
@@ -433,8 +434,9 @@ class MergePeople(object):
|
||||
|
||||
self.db.set_birth_death_index(new)
|
||||
|
||||
# copy attributes
|
||||
new.set_attribute_list(self.p1.get_attribute_list() +
|
||||
# add other attributes to new, which may already have
|
||||
# some attributes from the merger
|
||||
map(new.add_attribute, self.p1.get_attribute_list() +
|
||||
self.p2.get_attribute_list())
|
||||
|
||||
# copy addresses
|
||||
@@ -594,32 +596,69 @@ class MergePeople(object):
|
||||
self.old_handle, trans)
|
||||
new.add_parent_family_handle(family_handle)
|
||||
|
||||
def merge_childref(self, ref_one, ref_two):
|
||||
"""
|
||||
Add the content of two child-references together where ref_one is the
|
||||
preferred.
|
||||
|
||||
Data typically lost is: mrel/frel of ref_two.
|
||||
"""
|
||||
self.copy_note(ref_one, ref_two)
|
||||
self.copy_sources(ref_one, ref_two)
|
||||
ref_one.set_privacy(ref_one.get_privacy() or ref_two.get_privacy())
|
||||
one_frel = ref_one.get_father_relation()
|
||||
one_mrel = ref_one.get_mother_relation()
|
||||
two_frel = ref_two.get_father_relation()
|
||||
two_mrel = ref_two.get_mother_relation()
|
||||
if (one_mrel != two_mrel) or (one_frel != two_frel):
|
||||
if one_mrel == gen.lib.ChildRefType.UNKNOWN:
|
||||
ref_one.set_mother_relation(two_mrel)
|
||||
if one_frel == gen.lib.ChildRefType.UNKNOWN:
|
||||
ref_one.set_father_relation(two_frel)
|
||||
|
||||
def convert_child_ids(self, fhandle, new_handle, old_handle, trans):
|
||||
"""
|
||||
Search the family associated with fhandle, and replace
|
||||
old handle with the new handle in all child references.
|
||||
|
||||
There are three situations: The child references list contains
|
||||
a reference to new_handle, but not old_handle, vice versa and
|
||||
references to both new AND old_handle. In the first case nothing needs
|
||||
to be done, in the second case the old_handle needs replacement by
|
||||
new_handle and in the latter case the references must be merged.
|
||||
|
||||
:param fhandle: Handle of the family to process.
|
||||
:type fhandle: database handle
|
||||
:param new_handle: Handle that should replace any old_handle.
|
||||
:type new_handle: database handle
|
||||
:param old_handle: Handle of obsolete person.
|
||||
:type old_handle: database handle
|
||||
:param trans: database transaction
|
||||
:type trans: I don't know, probably string
|
||||
"""
|
||||
family = self.db.get_family_from_handle(fhandle)
|
||||
orig_ref_list = family.get_child_ref_list()
|
||||
new_ref_list = []
|
||||
|
||||
# loop through original child list. If a handle matches the
|
||||
# old handle, replace it with the new handle if the new handle
|
||||
# is not already in the list
|
||||
old_ref = [x for x in orig_ref_list if x.ref == old_handle]
|
||||
if old_ref:
|
||||
old_ref = old_ref[0]
|
||||
new_ref = [x for x in orig_ref_list if x.ref == new_handle]
|
||||
if new_ref:
|
||||
new_ref = new_ref[0]
|
||||
|
||||
for child_ref in orig_ref_list:
|
||||
if child_ref.ref == old_handle:
|
||||
if new_handle not in [ref.ref for ref in new_ref_list]:
|
||||
new_ref = gen.lib.ChildRef()
|
||||
new_ref.ref = new_handle
|
||||
new_ref_list.append(new_ref)
|
||||
elif child_ref.ref not in [ref.ref for ref in new_ref_list]:
|
||||
if old_ref:
|
||||
for child_ref in orig_ref_list:
|
||||
if child_ref.ref == old_handle:
|
||||
if new_ref:
|
||||
continue # go on to child_ref.ref == new_handle
|
||||
else:
|
||||
child_ref.ref = new_handle
|
||||
elif child_ref.ref == new_handle:
|
||||
self.merge_childref(child_ref, old_ref)
|
||||
new_ref_list.append(child_ref)
|
||||
|
||||
# compare the new list with the original list. If this list
|
||||
# is different, we need to save the changes to the database.
|
||||
if [ref.ref for ref in new_ref_list] \
|
||||
!= [ref.ref for ref in orig_ref_list]:
|
||||
# save changes to database
|
||||
family.set_child_ref_list(new_ref_list)
|
||||
self.db.commit_family(family, trans)
|
||||
|
||||
@@ -769,6 +808,27 @@ class MergePeople(object):
|
||||
return myfamily
|
||||
|
||||
def merge_existing_family(self, new, src_family, tgt_family, trans):
|
||||
"""
|
||||
Removes the family object that becomes superfluous because of the
|
||||
merger of a person.
|
||||
|
||||
If a person is merged with another, there can be a situation that two
|
||||
families that are in the database also need to merge; that is one
|
||||
family stays on and receives extra data, the other family is removed.
|
||||
Removal of a family involves removal of parentin attributes in a person,
|
||||
removal of childof attributes from children and actual removal of the
|
||||
family from the db. The merging of data from both families is performed
|
||||
in its own method.
|
||||
|
||||
:param new: The person that is merging.
|
||||
:type new: :class:`~gen.lib.person.Person`
|
||||
:param src_family: Family `new` is a parent in and that will be removed.
|
||||
:type src_family: :class:`~gen.lib.family.Family`
|
||||
:param tgt_family: Family `new` is and will stay a parent in.
|
||||
:type src_family: :class:`~gen.lib.family.Family`
|
||||
:param trans: db-transaction
|
||||
:type trans: I do not know, string probably
|
||||
"""
|
||||
|
||||
src_family_handle = src_family.get_handle()
|
||||
|
||||
@@ -813,13 +873,38 @@ class MergePeople(object):
|
||||
new.add_family_handle(tgt_family.get_handle())
|
||||
|
||||
def merge_family_pair(self, tgt_family, src_family, trans):
|
||||
"""
|
||||
Add data from src_family to tgt_family.
|
||||
|
||||
This is typically called when src_family is about to be removed because
|
||||
it became superfluous by a person merger. The data transfered from
|
||||
source to target family is everything except id, father and mother.
|
||||
Data typically lost is: marker and rel of the src-family.
|
||||
|
||||
Missing: lds_ord, Merged Gramps ID attribute and privacy; make own patch
|
||||
|
||||
:param tgt_family: Family receiving data from src_family.
|
||||
:type src_family: :class:`~gen.lib.family.Family`
|
||||
:param src_family: Family adding data to tgt_family.
|
||||
:type src_family: :class:`~gen.lib.family.Family`
|
||||
:param trans: db-transaction
|
||||
:type trans: I do not know, string probably
|
||||
"""
|
||||
childrefs_in_both = {}
|
||||
tgtlist = tgt_family.get_child_ref_list()
|
||||
for child_ref in src_family.get_child_ref_list():
|
||||
for tgt_child_ref in tgtlist:
|
||||
if tgt_child_ref.ref == child_ref.ref:
|
||||
childrefs_in_both[child_ref.ref] = tgt_child_ref
|
||||
break
|
||||
|
||||
tgt_family_child_handles = \
|
||||
[ref.ref for ref in tgt_family.get_child_ref_list()]
|
||||
# copy children from source to target
|
||||
for child_ref in src_family.get_child_ref_list():
|
||||
child_handle = child_ref.ref
|
||||
if child_handle not in tgt_family_child_handles:
|
||||
if child_handle in childrefs_in_both:
|
||||
tgt_child_ref = childrefs_in_both[child_handle]
|
||||
self.merge_childref(tgt_child_ref, child_ref)
|
||||
else:
|
||||
child = self.db.get_person_from_handle(child_handle)
|
||||
parents = child.get_parent_family_handle_list()
|
||||
tgt_family.add_child_ref(child_ref)
|
||||
|
||||
@@ -241,6 +241,38 @@ def __convert_using_classic_repr(stringValue, typedeg):
|
||||
|
||||
return __convert_structure_to_float(sign, degs, mins, secs)
|
||||
|
||||
def __convert_using_modgedcom_repr(val, typedeg):
|
||||
""" helper function that tries to convert the string using the
|
||||
modified GEDCOM representation where direction [NSEW] is appended
|
||||
instead of prepended. This particular representation is the result
|
||||
of value normalization done on values passed to this function
|
||||
"""
|
||||
if typedeg == 'lat':
|
||||
pos = val.find('N')
|
||||
if pos >= 0:
|
||||
stringValue = val[:pos]
|
||||
else:
|
||||
pos = val.find('S')
|
||||
if pos >= 0:
|
||||
stringValue = '-' + val[:pos]
|
||||
else:
|
||||
return None
|
||||
else:
|
||||
pos = val.find('E')
|
||||
if pos >= 0:
|
||||
stringValue = val[:pos]
|
||||
else:
|
||||
pos = val.find('W')
|
||||
if pos >= 0:
|
||||
stringValue = '-' + val[:pos]
|
||||
else:
|
||||
return None
|
||||
try :
|
||||
v = float(stringValue)
|
||||
return v
|
||||
except ValueError :
|
||||
return None;
|
||||
|
||||
def __convert_float_val(val, typedeg = "lat"):
|
||||
# function converting input to float, recognizing decimal input, or
|
||||
# degree notation input. Only english input
|
||||
@@ -270,6 +302,11 @@ def __convert_float_val(val, typedeg = "lat"):
|
||||
v = __convert_using_classic_repr(val, typedeg)
|
||||
if v is not None :
|
||||
return v
|
||||
|
||||
# format XX.YYYY[NSWE]
|
||||
v = __convert_using_modgedcom_repr(val, typedeg)
|
||||
if v is not None :
|
||||
return v
|
||||
|
||||
# no format succeeded
|
||||
return None
|
||||
@@ -364,6 +401,24 @@ def conv_lat_lon(latitude, longitude, format="D.D4"):
|
||||
else:
|
||||
return ("%.8f" % lat_float , str_lon)
|
||||
|
||||
if format == "GEDCOM":
|
||||
# The 5.5.1 spec is inconsistent. Length is supposedly 5 to 8 chars,
|
||||
# but the sample values are longer, using up to 6 fraction digits.
|
||||
# As a compromise, we will produce up to 6 fraction digits, but only
|
||||
# if necessary
|
||||
# correct possible roundoff error
|
||||
if lon_float >= 0:
|
||||
str_lon = "%.6f" % (lon_float)
|
||||
if str_lon == "180.000000":
|
||||
str_lon ="W180.000000"
|
||||
else:
|
||||
str_lon = "E" + str_lon
|
||||
else:
|
||||
str_lon = "W" + "%.6f" % (-lon_float)
|
||||
str_lon = str_lon[:-5] + str_lon[-5:].rstrip("0")
|
||||
str_lat = ("%s%.6f" % (("N", lat_float) if lat_float >= 0 else ("S", -lat_float)))
|
||||
str_lat = str_lat[:-5] + str_lat[-5:].rstrip("0")
|
||||
return (str_lat, str_lon)
|
||||
|
||||
deg_lat = int(lat_float)
|
||||
deg_lon = int(lon_float)
|
||||
@@ -624,6 +679,7 @@ if __name__ == '__main__':
|
||||
format5 = "ISO-DM"
|
||||
format6 = "ISO-DMS"
|
||||
format7 = "RT90"
|
||||
format8 = "GEDCOM"
|
||||
print "Testing conv_lat_lon function, "+text+':'
|
||||
res1, res2 = conv_lat_lon(lat1,lon1,format0)
|
||||
print lat1,lon1,"in format",format0, "is ",res1,res2
|
||||
@@ -641,6 +697,8 @@ if __name__ == '__main__':
|
||||
print lat1,lon1,"in format",format6, "is",res
|
||||
res1, res2 = conv_lat_lon(lat1,lon1,format7)
|
||||
print lat1,lon1,"in format",format7, "is",res1,res2,"\n"
|
||||
res1, res2 = conv_lat_lon(lat1,lon1,format8)
|
||||
print lat1,lon1,"in format",format8, "is",res1,res2,"\n"
|
||||
|
||||
def test_formats_fail(lat1,lon1,text=''):
|
||||
print "This test should make conv_lat_lon function fail, "+text+":"
|
||||
@@ -687,6 +745,8 @@ if __name__ == '__main__':
|
||||
# test precision
|
||||
lat, lon = u' 50°59.99"S', u' 2°59\'59.99"E'
|
||||
test_formats_success(lat,lon)
|
||||
lat, lon = 'N50.849888888888', 'E2.885897222222'
|
||||
test_formats_success(lat,lon)
|
||||
# to large value of lat
|
||||
lat, lon = '90.849888888888', '2.885897222222'
|
||||
test_formats_fail(lat,lon)
|
||||
|
||||
@@ -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()):
|
||||
|
||||
@@ -200,7 +200,7 @@ class PluginStatus(ManagedWindow.ManagedWindow):
|
||||
gtk.DIALOG_DESTROY_WITH_PARENT,
|
||||
(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)),
|
||||
None, self.title)
|
||||
self.window.set_size_request(600, 400)
|
||||
self.window.set_size_request(750, 400)
|
||||
self.window.connect('response', self.close)
|
||||
|
||||
notebook = gtk.Notebook()
|
||||
@@ -218,15 +218,18 @@ class PluginStatus(ManagedWindow.ManagedWindow):
|
||||
self.list_reg.connect('button-press-event', self.button_press_reg)
|
||||
col0_reg = gtk.TreeViewColumn(_('Type'), gtk.CellRendererText(), text=0)
|
||||
col0_reg.set_sort_column_id(0)
|
||||
col0_reg.set_resizable(True)
|
||||
self.list_reg.append_column(col0_reg)
|
||||
col = gtk.TreeViewColumn(_('Status'), gtk.CellRendererText(), markup=1)
|
||||
col.set_sort_column_id(1)
|
||||
self.list_reg.append_column(col)
|
||||
col2_reg = gtk.TreeViewColumn(_('Name'), gtk.CellRendererText(), text=2)
|
||||
col2_reg.set_sort_column_id(2)
|
||||
col2_reg.set_resizable(True)
|
||||
self.list_reg.append_column(col2_reg)
|
||||
col = gtk.TreeViewColumn(_('Description'), gtk.CellRendererText(), text=3)
|
||||
col.set_sort_column_id(3)
|
||||
col.set_resizable(True)
|
||||
self.list_reg.append_column(col)
|
||||
self.list_reg.set_search_column(2)
|
||||
|
||||
@@ -267,10 +270,12 @@ class PluginStatus(ManagedWindow.ManagedWindow):
|
||||
col = gtk.TreeViewColumn(_('Loaded'), gtk.CellRendererText(),
|
||||
markup=0)
|
||||
col.set_sort_column_id(0)
|
||||
col.set_resizable(True)
|
||||
self.list.append_column(col)
|
||||
col1 = gtk.TreeViewColumn(_('File'), gtk.CellRendererText(),
|
||||
text=1)
|
||||
col1.set_sort_column_id(1)
|
||||
col1.set_resizable(True)
|
||||
self.list.append_column(col1)
|
||||
col = gtk.TreeViewColumn(_('Status'), gtk.CellRendererText(),
|
||||
markup=5)
|
||||
@@ -278,6 +283,7 @@ class PluginStatus(ManagedWindow.ManagedWindow):
|
||||
self.list.append_column(col)
|
||||
col2 = gtk.TreeViewColumn(_('Message'), gtk.CellRendererText(), text=2)
|
||||
col2.set_sort_column_id(2)
|
||||
col2.set_resizable(True)
|
||||
self.list.append_column(col2)
|
||||
self.list.set_search_column(1)
|
||||
|
||||
@@ -350,7 +356,10 @@ class PluginStatus(ManagedWindow.ManagedWindow):
|
||||
|
||||
scrolled_window.add(self.addon_list)
|
||||
install_page.pack_start(scrolled_window)
|
||||
install_page.pack_start(install_row, expand=True, fill=False)
|
||||
#add some spce under the scrollbar
|
||||
install_page.pack_start(gtk.Label(''), expand=False, fill=False)
|
||||
#path to addon path line
|
||||
install_page.pack_start(install_row, expand=False, fill=False)
|
||||
|
||||
hbutbox = gtk.HButtonBox()
|
||||
hbutbox.set_layout(gtk.BUTTONBOX_SPREAD)
|
||||
@@ -382,6 +391,7 @@ class PluginStatus(ManagedWindow.ManagedWindow):
|
||||
|
||||
self.window.show_all()
|
||||
self.__populate_lists()
|
||||
self.list_reg.columns_autosize()
|
||||
|
||||
def __refresh_addon_list(self, obj):
|
||||
"""
|
||||
@@ -571,7 +581,7 @@ class PluginStatus(ManagedWindow.ManagedWindow):
|
||||
callback(" " + (_("'%s' is for this version of Gramps.") % gpr_file) + "\n")
|
||||
else:
|
||||
# If the plugin is for another version; inform and do nothing
|
||||
callback(" " + (_("'%s' is for NOT this version of Gramps.") % gpr_file) + "\n")
|
||||
callback(" " + (_("'%s' is NOT for this version of Gramps.") % gpr_file) + "\n")
|
||||
callback(" " + (_("It is for version %d.%d" % vtup) + "\n"))
|
||||
continue
|
||||
else:
|
||||
@@ -591,7 +601,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)
|
||||
|
||||
@@ -606,14 +616,20 @@ class PluginStatus(ManagedWindow.ManagedWindow):
|
||||
gtk.RESPONSE_CANCEL,
|
||||
gtk.STOCK_OPEN,
|
||||
gtk.RESPONSE_OK))
|
||||
name = os.path.abspath(self.install_addon_path.get_text())
|
||||
fcd.set_current_name(name)
|
||||
name = self.install_addon_path.get_text()
|
||||
dir = os.path.dirname(name)
|
||||
if not os.path.isdir(dir):
|
||||
dir = const.USER_HOME
|
||||
name = ''
|
||||
elif not os.path.isfile(name):
|
||||
name = ''
|
||||
fcd.set_current_folder(dir)
|
||||
if name:
|
||||
fcd.set_filename(name)
|
||||
|
||||
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()
|
||||
@@ -790,8 +806,8 @@ Location: %(fpath)s
|
||||
model, node = selection.get_selected()
|
||||
if not node:
|
||||
return
|
||||
id = model.get_value(node, id_col)
|
||||
pdata = self.__preg.get_plugin(id)
|
||||
idv = model.get_value(node, id_col)
|
||||
pdata = self.__preg.get_plugin(idv)
|
||||
self.__pmgr.load_plugin(pdata)
|
||||
self.__rebuild_load_list()
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
# Standard python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.ggettext import gettext as _
|
||||
import sys
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@@ -43,6 +43,7 @@ from gtk.gdk import pixbuf_new_from_file
|
||||
import const
|
||||
import config
|
||||
from glade import Glade
|
||||
from gen.ggettext import gettext as _
|
||||
|
||||
try:
|
||||
ICON = pixbuf_new_from_file(const.ICON)
|
||||
@@ -186,6 +187,7 @@ class ErrorDialog(gtk.MessageDialog):
|
||||
|
||||
class RunDatabaseRepair(ErrorDialog):
|
||||
def __init__(self, msg, parent=None):
|
||||
msg = unicode(msg.decode(sys.getfilesystemencoding()))
|
||||
ErrorDialog.__init__(
|
||||
self,
|
||||
_('Error detected in database'),
|
||||
@@ -193,17 +195,18 @@ class RunDatabaseRepair(ErrorDialog):
|
||||
'usually be resolved by running the "Check and Repair Database" '
|
||||
'tool.\n\nIf this problem continues to exist after running this '
|
||||
'tool, please file a bug report at '
|
||||
'http://bugs.gramps-project.org\n\n') + str(msg), parent)
|
||||
'http://bugs.gramps-project.org\n\n') + msg, parent)
|
||||
|
||||
class DBErrorDialog(ErrorDialog):
|
||||
def __init__(self, msg, parent=None):
|
||||
msg = unicode(msg.decode(sys.getfilesystemencoding()))
|
||||
ErrorDialog.__init__(
|
||||
self,
|
||||
_("Low level database corruption detected"),
|
||||
_("Gramps has detected a problem in the underlying "
|
||||
"Berkeley database. This can be repaired by from "
|
||||
"the Family Tree Manager. Select the database and "
|
||||
'click on the Repair button') + '\n\n' + str(msg), parent)
|
||||
'click on the Repair button') + '\n\n' + msg, parent)
|
||||
|
||||
class WarningDialog(gtk.MessageDialog):
|
||||
def __init__(self, msg1, msg2="", parent=None):
|
||||
|
||||
+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,7 +1,8 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2001-2006 Donald N. Allingham
|
||||
# Copyright (C) 2001-2006 Donald N. Allingham
|
||||
# Copyright (C) 2010 Rob G. Healey <robhealey1@gmail.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -62,6 +63,7 @@ book_categories = {
|
||||
CSS_FILES = [
|
||||
# First is used as default selection.
|
||||
[_("Basic-Ash"), 'Web_Basic-Ash.css'],
|
||||
[_("Basic-Blue"), 'Web_Basic-Blue.css'],
|
||||
[_("Basic-Cypress"), 'Web_Basic-Cypress.css'],
|
||||
[_("Basic-Lilac"), 'Web_Basic-Lilac.css'],
|
||||
[_("Basic-Peach"), 'Web_Basic-Peach.css'],
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
Provide utilities for printing endnotes in text reports.
|
||||
"""
|
||||
from gen.plug.docgen import FontStyle, ParagraphStyle, FONT_SANS_SERIF
|
||||
from gen.lib import NoteType
|
||||
from gen.ggettext import gettext as _
|
||||
|
||||
def add_endnote_styles(style_sheet):
|
||||
@@ -147,7 +148,9 @@ def write_endnotes(bibliography, database, doc, printnotes=False):
|
||||
'type': str(note.get_type())})
|
||||
doc.end_paragraph()
|
||||
doc.write_styled_note(note.get_styledtext(),
|
||||
note.get_format(),'Endnotes-Notes')
|
||||
note.get_format(),'Endnotes-Notes',
|
||||
contains_html= note.get_type() \
|
||||
== NoteType.HTML_CODE)
|
||||
ind += 1
|
||||
|
||||
def _format_source_text(source):
|
||||
|
||||
@@ -73,7 +73,7 @@ class FileEntry(gtk.HBox):
|
||||
dialog.present()
|
||||
status = dialog.run()
|
||||
if status == gtk.RESPONSE_OK:
|
||||
self.set_filename(Utils.get_unicode_path(dialog.get_filename()))
|
||||
self.set_filename(Utils.get_unicode_path_from_file_chooser(dialog.get_filename()))
|
||||
dialog.destroy()
|
||||
|
||||
def set_filename(self, path):
|
||||
|
||||
@@ -34,6 +34,8 @@ import threading
|
||||
import time
|
||||
from types import ClassType, InstanceType
|
||||
from gen.ggettext import gettext as _
|
||||
from subprocess import Popen, PIPE
|
||||
import sys
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
@@ -446,7 +448,16 @@ class GVPsDoc(GVDocBase):
|
||||
# but the output is clipped, some margins have disappeared. I used 1 inch margins always.
|
||||
# See bug tracker issue 2815
|
||||
|
||||
os.system( 'dot -Tps:cairo -o"%s" "%s"' % (self._filename, tmp_dot) )
|
||||
# Covert filename to str using file system encoding.
|
||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||
|
||||
command = 'dot -Tps:cairo -o"%s" "%s"' % (fname, tmp_dot)
|
||||
dotversion = Popen(['dot', '-V'], stderr=PIPE).communicate(input=None)[1]
|
||||
# Problem with dot 2.26.3 and multiple pages, which gives "cairo: out of memory"
|
||||
# If the :cairo is skipped for these cases it gives acceptable result.
|
||||
if dotversion.find('2.26.3') != -1 and (self.vpages * self.hpages) > 1:
|
||||
command=command.replace(':cairo','')
|
||||
os.system(command)
|
||||
# Delete the temporary dot file
|
||||
os.remove(tmp_dot)
|
||||
|
||||
@@ -489,9 +500,11 @@ class GVSvgDoc(GVDocBase):
|
||||
dotfile = os.fdopen(handle,"w")
|
||||
dotfile.write(self._dot.getvalue())
|
||||
dotfile.close()
|
||||
# Covert filename to str using file system encoding.
|
||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||
|
||||
# Generate the SVG file.
|
||||
os.system( 'dot -Tsvg -o"%s" "%s"' % (self._filename, tmp_dot) )
|
||||
os.system( 'dot -Tsvg -o"%s" "%s"' % (fname, tmp_dot) )
|
||||
|
||||
# Delete the temporary dot file
|
||||
os.remove(tmp_dot)
|
||||
@@ -535,9 +548,11 @@ class GVSvgzDoc(GVDocBase):
|
||||
dotfile = os.fdopen(handle,"w")
|
||||
dotfile.write(self._dot.getvalue())
|
||||
dotfile.close()
|
||||
# Covert filename to str using file system encoding.
|
||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||
|
||||
# Generate the SVGZ file.
|
||||
os.system( 'dot -Tsvgz -o"%s" "%s"' % (self._filename, tmp_dot) )
|
||||
os.system( 'dot -Tsvgz -o"%s" "%s"' % (fname, tmp_dot) )
|
||||
|
||||
# Delete the temporary dot file
|
||||
os.remove(tmp_dot)
|
||||
@@ -581,9 +596,11 @@ class GVPngDoc(GVDocBase):
|
||||
dotfile = os.fdopen(handle,"w")
|
||||
dotfile.write(self._dot.getvalue())
|
||||
dotfile.close()
|
||||
# Covert filename to str using file system encoding.
|
||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||
|
||||
# Generate the PNG file.
|
||||
os.system( 'dot -Tpng -o"%s" "%s"' % (self._filename, tmp_dot) )
|
||||
os.system( 'dot -Tpng -o"%s" "%s"' % (fname, tmp_dot) )
|
||||
|
||||
# Delete the temporary dot file
|
||||
os.remove(tmp_dot)
|
||||
@@ -627,9 +644,11 @@ class GVJpegDoc(GVDocBase):
|
||||
dotfile = os.fdopen(handle,"w")
|
||||
dotfile.write(self._dot.getvalue())
|
||||
dotfile.close()
|
||||
# Covert filename to str using file system encoding.
|
||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||
|
||||
# Generate the JPEG file.
|
||||
os.system( 'dot -Tjpg -o"%s" "%s"' % (self._filename, tmp_dot) )
|
||||
os.system( 'dot -Tjpg -o"%s" "%s"' % (fname, tmp_dot) )
|
||||
|
||||
# Delete the temporary dot file
|
||||
os.remove(tmp_dot)
|
||||
@@ -673,9 +692,11 @@ class GVGifDoc(GVDocBase):
|
||||
dotfile = os.fdopen(handle,"w")
|
||||
dotfile.write(self._dot.getvalue())
|
||||
dotfile.close()
|
||||
# Covert filename to str using file system encoding.
|
||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||
|
||||
# Generate the GIF file.
|
||||
os.system( 'dot -Tgif -o"%s" "%s"' % (self._filename, tmp_dot) )
|
||||
os.system( 'dot -Tgif -o"%s" "%s"' % (fname, tmp_dot) )
|
||||
|
||||
# Delete the temporary dot file
|
||||
os.remove(tmp_dot)
|
||||
@@ -722,13 +743,16 @@ class GVPdfGvDoc(GVDocBase):
|
||||
dotfile = os.fdopen(handle,"w")
|
||||
dotfile.write(self._dot.getvalue())
|
||||
dotfile.close()
|
||||
|
||||
# Covert filename to str using file system encoding.
|
||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||
# Generate the PDF file.
|
||||
os.system( 'dot -Tpdf -o"%s" "%s"' % (self._filename, tmp_dot) )
|
||||
|
||||
command = 'dot -Tpdf -o"%s" "%s"' % (fname, tmp_dot)
|
||||
|
||||
os.system( command )
|
||||
|
||||
# Delete the temporary dot file
|
||||
os.remove(tmp_dot)
|
||||
|
||||
|
||||
if self.open_req:
|
||||
open_file_with_default_application(self._filename)
|
||||
|
||||
@@ -775,6 +799,11 @@ class GVPdfGsDoc(GVDocBase):
|
||||
# Reason for using -Tps:cairo. Needed for Non Latin-1 letters
|
||||
# See bug tracker issue 2815
|
||||
command = 'dot -Tps:cairo -o"%s" "%s"' % ( tmp_ps, tmp_dot )
|
||||
dotversion = Popen(['dot', '-V'], stderr=PIPE).communicate(input=None)[1]
|
||||
# Problem with dot 2.26.3 and multiple pages, which gives "cairo: out of memory"
|
||||
# If the :cairo is skipped for these cases it gives acceptable result.
|
||||
if dotversion.find('2.26.3') != -1 and (self.vpages * self.hpages) > 1:
|
||||
command=command.replace(':cairo','')
|
||||
os.system(command)
|
||||
|
||||
# Add .5 to remove rounding errors.
|
||||
@@ -783,9 +812,11 @@ class GVPdfGsDoc(GVDocBase):
|
||||
height_pt = int( (paper_size.get_height_inches() * 72) + 0.5 )
|
||||
|
||||
# Convert to PDF using ghostscript
|
||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||
command = '%s -q -sDEVICE=pdfwrite -dNOPAUSE -dDEVICEWIDTHPOINTS=%d' \
|
||||
' -dDEVICEHEIGHTPOINTS=%d -sOutputFile="%s" "%s" -c quit' \
|
||||
% ( _GS_CMD, width_pt, height_pt, self._filename, tmp_ps )
|
||||
% ( _GS_CMD, width_pt, height_pt, fname, tmp_ps )
|
||||
|
||||
os.system(command)
|
||||
|
||||
os.remove(tmp_ps)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user