Compare commits

...

152 Commits

Author SHA1 Message Date
Jérôme Rapinat
04638a9dcb update "gettext" environment
svn: r23313
2013-10-12 10:10:25 +00:00
Nick Hall
0ffc0cdd12 Merge with latest changes in trunk
svn: r21356
2013-02-14 22:06:12 +00:00
Paul Franklin
e424e5cdbb 6247: Crash when attempting to use Book Report
svn: r21350
2013-02-13 18:43:25 +00:00
Serge Noiraud
9c2e0ca760 Geography : bug #6442 use the good glib with introspection.
svn: r21349
2013-02-13 15:07:41 +00:00
Peter Landgren
abeda15fa7 Fixed a typo.
svn: r21344
2013-02-12 15:42:45 +00:00
Serge Noiraud
18e1150010 Geography : replace GObject.timeout_add by glib.timeout_add as it is deprecated
svn: r21341
2013-02-12 08:33:49 +00:00
Paul Franklin
8108adbef8 6379: Can not get ancestry or relationship tabs to work
svn: r21337
2013-02-10 21:11:57 +00:00
Josip Pisoj
8453ac9119 win32-py3 fix: ValueError: strftime() requires year in [1; 9999]
svn: r21332
2013-02-10 18:03:55 +00:00
Josip Pisoj
da9106834a win32 changes
svn: r21331
2013-02-10 17:53:43 +00:00
Helge Herz
9c7a058ef4 Revert svn21255 (svn21254 in branches/maintenance/gramps40) as discussed in issue 6424
svn: r21329
2013-02-10 15:23:06 +00:00
Tim G L Lyons
8066052641 Reinstate inadvertent removal of rev 19988 change for bug 5900
svn: r21327
2013-02-09 21:12:19 +00:00
John Ralls
8bbcc2c341 GrampsLocale: Correct setting GrampsLocale.languages
Test only first 5 or first 2 characters of the language id against the
list of available translations.

Thanks to Tim Lyons for exposing the error.

svn: r21326
2013-02-09 18:59:20 +00:00
Erik De Richter
b287b13b9a updated nl translation
svn: r21325
2013-02-09 13:03:11 +00:00
Tim G L Lyons
d48148ed65 Revert change 21304 for moving report_options file
svn: r21324
2013-02-08 17:11:14 +00:00
Serge Noiraud
9e48884a5b Geography : synchronize gramps and osm-gps-map for the free maps.
svn: r21321
2013-02-08 07:59:31 +00:00
Serge Noiraud
79e2ab25af Geography : sometimes crash with unknown people or family.
svn: r21320
2013-02-08 07:57:47 +00:00
Tim G L Lyons
3659944f4d 0006411: Navweb crashes alpha4 when creating Media pages
svn: r21315
2013-02-07 16:48:45 +00:00
Benny Malengier
40fce3c091 use latest gtkspell if available
svn: r21309
2013-02-06 09:24:15 +00:00
Tim G L Lyons
ffa4ac4eeb 0003968: [NarWeb] Save/Restore settings for Narrated Website Generation. Change report_options file to be in the database directory, and implement different default report file and directory names based on the Family Tree Name. N.B. On upgrading, if you want to preserve your report_options, copy the report_option.xml file from the .gramps directory to the applicable .gramps.grampsdb.<number> directory. Also don't forget that the default options are to EXCLUDE private and living data.
svn: r21306
2013-02-05 18:07:37 +00:00
Peter Landgren
f5f7445692 Fix of gramps -v for Graphviz and ghostscript.
svn: r21301
2013-02-05 15:11:45 +00:00
Gary Burton
463549b179 Bug #6358. gc.DEBUG_OBJECTS removed from python3. Also handle exceptions due to collected weak references.
svn: r21298
2013-02-04 22:01:03 +00:00
Tim G L Lyons
2587bfe73e Change format of console logging messages to have a meaningful timestamp
svn: r21295
2013-02-04 19:14:29 +00:00
Tim G L Lyons
94a16c85c2 Fix processing of contractions, and changes to ensure code (after initial lines) for narrativeweb is the same for trunk and gramps34
svn: r21293
2013-02-04 18:23:57 +00:00
Tim G L Lyons
859293f74b date.get_start_date has no attribute 'is_valid'
svn: r21292
2013-02-04 18:12:09 +00:00
Peter Landgren
7ae88f69aa Added strings for sidebar category.
svn: r21291
2013-02-04 17:53:34 +00:00
Jérôme Rapinat
f1dc4c891f missing glocale
svn: r21290
2013-02-04 14:06:33 +00:00
Jérôme Rapinat
1e864415f1 6403: Limit and try to avoid markups in translatable messages
svn: r21289
2013-02-04 09:25:41 +00:00
John Ralls
ae8bd2d4e0 GrampsLocale: Allow for importing older PyICU packages
svn: r21287
2013-02-04 01:42:51 +00:00
Gary Burton
ec40418f5d Fix memory leaks.
svn: r21285
2013-02-03 16:40:43 +00:00
Peter Landgren
ccffe86db1 Fixed a typo LC_MONETARY -> 'LC_MONETARY'.
svn: r21283
2013-02-03 15:30:40 +00:00
John Ralls
81a702e9af GrampsLocale: Fix some oversights in creation of second GrampsLocale
svn: r21282
2013-02-03 02:05:14 +00:00
John Ralls
5596d0c47e grampslocale: Pretty up the log messages.
svn: r21281
2013-02-03 02:05:06 +00:00
John Ralls
ffdb23230d grampslocale.py: Protect against C.UTF-8 not being an installed locale on Linux.
svn: r21280
2013-02-03 01:23:05 +00:00
John Ralls
4d24c4cf66 relationship.py: Fix not registering "en_GB" as english.
Also replace diagnostic print with proper logging.

svn: r21279
2013-02-03 01:22:59 +00:00
Jérôme Rapinat
1a7ad93476 update path
svn: r21278
2013-02-02 09:54:32 +00:00
John Ralls
5a54d1ecd5 Handle junk at the end of revision strings
svn: r21276
2013-02-01 22:49:22 +00:00
John Ralls
cc564061f9 GrampsLocale: Replace locale.strcoll, locale.strxfrm, and conv*_tosrtkey
With GrampsLocale.sort_key (for strxfrm and conv*_tosrtkey) and
GrampsLocale.strcoll.

If ICU is available will use the correct ICU::Collator for the locale,
otherwise falls back to locale.strxfrm -- for which it temporarily
changes the LC_COLLATE locale.

svn: r21275
2013-02-01 22:49:14 +00:00
John Ralls
e62596bf2c GrampsLocale: Introduce GrampsLocale attributes currency, calendar, and collate
svn: r21274
2013-02-01 22:48:57 +00:00
John Ralls
29873cc9d4 GrampsLocale: Make maclocale.mac_setup_localization() set glocale attributes directly
svn: r21273
2013-02-01 22:48:51 +00:00
John Ralls
f644717309 GrampsLocale: Extract function __init_from_environment
svn: r21272
2013-02-01 22:48:41 +00:00
John Ralls
ee7e69a616 Add modules for ICU
svn: r21271
2013-02-01 20:25:35 +00:00
Tim G L Lyons
2ceeb7143b export file select dialogue does not correctly reject empty filenames - two (probably long standing) coding errors: use of method name 'strip' instead of calling it, and does not isolate the filename from the full pathname
svn: r21268
2013-02-01 17:40:24 +00:00
Tim G L Lyons
a50e83fa5f find_file and find_folder do not return null string if the file or folder resp. do not exist (coding typo)
svn: r21267
2013-02-01 17:35:37 +00:00
Nick Hall
b34eea702b Update post-install scripts
svn: r21265
2013-01-31 23:23:32 +00:00
Nick Hall
e6a43370bd Fix bug with --install-scripts option
svn: r21263
2013-01-31 22:30:02 +00:00
Nick Hall
11df6b2b29 Remove duplicate LOCALE_DIR
svn: r21262
2013-01-31 18:33:20 +00:00
Erik De Richter
578c7345fa updated nl translation
svn: r21261
2013-01-31 15:33:22 +00:00
Jérôme Rapinat
681ae03901 6367: Update the Side/Bottombar text (patch by Patsyblefebre)
svn: r21260
2013-01-31 08:29:39 +00:00
Tim G L Lyons
adb94b1974 Narrative web: fix tar file output and HTML encoding output support.
svn: r21258
2013-01-30 18:58:44 +00:00
John Ralls
ef9464006e Revert "Allow hard-coded paths to be overridden with $XDG_DATA_DIRS"
This reverts r21246

svn: r21257
2013-01-30 14:54:08 +00:00
Benny Malengier
9b48321f9f gdkpixbuf support on windows
svn: r21255
2013-01-30 10:05:29 +00:00
Jérôme Rapinat
773443aec0 6384: Update Danish translation by Lars Kristian Lundin
svn: r21251
2013-01-30 09:32:57 +00:00
John Ralls
5afe501e94 Allow hard-coded paths to be overridden with $XDG_DATA_DIRS
Necessary for post-installation relocatability.
Also ensure that data installed to share/gramps is in mac bundle.

svn: r21246
2013-01-29 20:35:41 +00:00
Jérôme Rapinat
deaba77b3b typo
svn: r21243
2013-01-29 15:06:09 +00:00
Jérôme Rapinat
e7281fcde2 6377: Danish translation is incomplete (patch by Lars Kristian Lundin)
svn: r21242
2013-01-29 08:49:29 +00:00
Jérôme Rapinat
24b337ec5d 6377: Danish translation is incomplete
svn: r21239
2013-01-28 16:13:56 +00:00
John Ralls
c8bfe1db3b GrampsLocale: Replace use of get_language_string with GrampsLocale.get_language_dict
Permits sorting by localized language name.
Also hides the language code, which the user doesn't really care about.
Removes get_language_string from libtranslate.py, no longer needed.

svn: r21236
2013-01-27 21:10:17 +00:00
John Ralls
a65dbaddcb GrampsLocale: Use module-specific logger for grampslocale.py
Fixes double-logging problem reported by Tim Lyons.

svn: r21235
2013-01-27 21:10:09 +00:00
Jérôme Rapinat
b67df8930d behavior has changed on gramplet bars, message needs an update too
svn: r21231
2013-01-27 16:52:09 +00:00
Gary Burton
9285b289b4 Bug #6371. Fix memory leak caused by hanging reference to progress meter callback method.
svn: r21225
2013-01-26 09:28:52 +00:00
Doug Blank
8c820e1ce2 6364: dead people are shown as alive in narrated web page export
svn: r21219
2013-01-25 12:53:50 +00:00
Nick Hall
1e7b512c7c 6307: Use untranslated string in filter
svn: r21214
2013-01-24 16:47:14 +00:00
Nick Hall
5557ae2643 6360: Fix to work with new model
svn: r21212
2013-01-24 16:28:13 +00:00
Jérôme Rapinat
33fa3c2fea listing missing references
svn: r21210
2013-01-24 15:37:45 +00:00
Benny Malengier
8a6da23737 6288: crash: no attribute 'require_version' - better fix
svn: r21207
2013-01-24 08:45:00 +00:00
Gary Burton
3795974c6f Bug #6255.
svn: r21201
2013-01-22 20:56:11 +00:00
John Ralls
8c73137ffd [Bug #6361] try to run soundex tool
Updated for python3

svn: r21199
2013-01-22 19:21:29 +00:00
John Ralls
77c0645acf Fix unhandled exception in expandersidebar
svn: r21198
2013-01-22 19:21:17 +00:00
John Ralls
88f3176f91 GrampsLocale: Fix missing "operating_system" value
Inadvertently deleted the creation in r21143

svn: r21197
2013-01-22 19:21:04 +00:00
Tim G L Lyons
672fd4e8f0 Error in person.get_citation_child_list. Causes error in merging citation in person event reference attribute. (Discovered during investigation of 0006336: Delayed update of bottom bar in Person View after merge)
svn: r21196
2013-01-22 19:14:57 +00:00
Nick Hall
46ded3e7db Add tagging to all primary objects
svn: r21194
2013-01-22 16:12:15 +00:00
Paul Franklin
bc202fb9ac add "Id" property
svn: r21189
2013-01-21 15:56:16 +00:00
Jérôme Rapinat
1cc9e43cfe "grampletview" is now "dashboardview"
svn: r21188
2013-01-21 15:51:59 +00:00
Jérôme Rapinat
af7c0e5e5f some broken references have blocked python modules check
svn: r21187
2013-01-21 15:40:23 +00:00
John Ralls
8f71da6ec4 GrampsLocale: Fix call to member function.
svn: r21186
2013-01-21 15:14:17 +00:00
Jérôme Rapinat
1dcdc52b1d update for testing translations handling
svn: r21184
2013-01-21 10:08:11 +00:00
John Ralls
60729859f2 GrampsLocale: Restructure so that multiple GrampsLocale objects can safely be created for different locales
Only the first dependent upon the environment
All may be created with parameters which override environment variables or OS settings.
See the GrampsLocale docstring for details.

svn: r21182
2013-01-21 01:27:29 +00:00
John Ralls
20289c20a3 relationship.py: Remove unused import
svn: r21181
2013-01-21 01:27:21 +00:00
John Ralls
fecf9e4e19 Fix platform detection on OSX
'darwin' is returned by sys.platform, not os.name.

svn: r21180
2013-01-20 19:35:35 +00:00
John Ralls
fe775c19bd Fix undefined variable reference, make separate not-loaded warning
Thanks to Pat Lefebre for reporting the error.

svn: r21179
2013-01-20 19:35:28 +00:00
Gary Burton
f479a876e3 Bug #6255. Wrap gzip files with TextIOWrapper to allow them to be read as text.
svn: r21177
2013-01-20 17:16:01 +00:00
Tim G L Lyons
99c54b5e2e 0005088: Narrated Web Site Report sort order different Windows vs Linux. Initial commit to resolve the issues on Linux and Mac (provided in both cases PyICU is installed). Windows still needs to be tested, and there may still be some other uses of strxfrm (or strcoll) that need to be fixed.
svn: r21175
2013-01-20 15:11:06 +00:00
John Ralls
32b30ccc09 Add goocanvas-2.0 to gramps dependencies
Also remove gramps-40 target, it doesn't belong in trunk now that it has 
its own branch.



svn: r21173
2013-01-19 21:47:44 +00:00
John Ralls
5f4665b3a8 GrampsLocale: Fix another typo
svn: r21171
2013-01-19 00:56:18 +00:00
John Ralls
64671663dd GrampsLocale: Convert some late-added translations to GRAMPS_LOCALE
svn: r21170
2013-01-18 22:23:11 +00:00
John Ralls
6c90a89612 GrampsLocale: Fix the typo in my typo fix.
svn: r21169
2013-01-18 22:04:46 +00:00
John Ralls
f8f250ad71 GrampsLocale: get_relationship_calculator: Fix missed variable name change.
svn: r21168
2013-01-18 21:27:48 +00:00
Nick Hall
774ceff34b Use public interface of Gtk.TreeModel in listview code
svn: r21165
2013-01-18 18:46:09 +00:00
Nick Hall
0cf2bc0032 6353: Fix error when setting colours
svn: r21163
2013-01-18 18:24:13 +00:00
Nick Hall
fe09b8342b Remove handle and tooltip columns from models
svn: r21158
2013-01-17 21:58:53 +00:00
John Ralls
f16db81075 Fix GeoGraphyView.__init__ arg list for simplified bookmarks
svn: r21157
2013-01-17 19:49:04 +00:00
John Ralls
3b9890d9c4 Descendant Report: Fix changed Sort function name
svn: r21156
2013-01-17 19:48:58 +00:00
John Ralls
296e2f4f86 Use IMAGE_DIR in geography.py so that map images can be found when running from source directory.
svn: r21155
2013-01-17 19:48:51 +00:00
John Ralls
c7f9b52003 Import get_svn_revision into const.py (via const.py.in, of course)
svn: r21154
2013-01-17 19:48:44 +00:00
John Ralls
90e07c8cfc PdfDocGen: Report cause of failure on all exceptions
not just file open ones. Expat can raise exceptions too!

svn: r21153
2013-01-17 19:48:37 +00:00
John Ralls
87c5b6632a GrampsLocale: Fix file encoding error in recentfiles
Expat wants a binary file, not a string file.

svn: r21152
2013-01-17 19:48:32 +00:00
John Ralls
fba8cdddd1 GrampsLocale: Get the language code from the global translation
Instead of probing locale.getlocale() and environment variables

svn: r21151
2013-01-17 19:48:24 +00:00
John Ralls
9e8b2af5c1 GrampsLocale: Use the codeset from the singleton translation
Instead of locale.getlocale() or locale.nl_langinfo

svn: r21150
2013-01-17 19:48:14 +00:00
John Ralls
fc609ef3d5 Fix some file resource leaks
I.e., files left open when the opening function exits. This is
a PyDebug warning.

svn: r21149
2013-01-17 19:48:07 +00:00
John Ralls
9a515bfde6 GrampsLocale: Simplify the file-finding functions
Making use of the fact that GrampsLocale now knows what
encoding to use, and noting that filesystems don't use
more than one encoding to write filenames in directories.

Also specify the encoding on some more files

svn: r21148
2013-01-17 19:47:59 +00:00
John Ralls
08d8d4c775 [Bug 6364] Fix file-opening failures due to unicode content.
svn: r21147
2013-01-17 19:47:44 +00:00
John Ralls
5781e8ac72 GrampsLocale: Replace calls to sys.getfilesystemencoding
On MSWin and OSX, this call always returns the correct
value (utf-8 on OSX, 'mbcs' on MSWin), but on Linux the
return value is bizarrely dependent upon the environment.

Replace it with a GrampsLocale function which returns 'utf-8'
(the correct value for most Linux file systems) regardless of
the environment.

Also replace its use in print and write functions: It's the
encoding of paths in the filesystem, not of the files's content,
nor of the terminal's capabilities. The former is almost
always utf-8 as long as we write the file, the latter is
given by sys.stdout.encoding. Use the 'backslashreplace' error
handler to avoid exceptions when we need to output unicode
text to an ASCII terminal.

svn: r21146
2013-01-17 19:47:36 +00:00
John Ralls
4b6afc33fe [Bug 6222]: Get the addons language list from the primary
GrampsLocale instance.

svn: r21145
2013-01-17 19:47:21 +00:00
John Ralls
c6e51d841d GrampsLocale: Remove ggettext
svn: r21144
2013-01-17 19:46:55 +00:00
John Ralls
69d2b09ed6 Localization: Re-implement localization as a class, GrampsLocale
GrampsLocale is effectively a singleton: An instance is created in
const.py and retrieved everywhere.

Translations are provided via Translations classes, which are derived
from GNUTranslations and NullTranslations to provide extra functions
like sgettext.

svn: r21143
2013-01-17 19:42:11 +00:00
John Ralls
4dd31fc7aa Rename trans.py and mactrans.py to grampslocale.py and maclocale.py
Reflecting discussion on gramps-devel about their affecting more than
just translations.

Provide for a master GrampsLocale instance to be retrieved from
const.py, set by grampsapp.

svn: r21142
2013-01-17 19:41:58 +00:00
Nick Hall
42610bdb97 6333: Display optional close button in gramplet bar tabs
svn: r21140
2013-01-16 23:59:48 +00:00
Nick Hall
b2ba4c3a6d Tidy up bookmark code
svn: r21139
2013-01-15 22:30:18 +00:00
Nick Hall
bd6b4ce012 6331: Fix spelling mistakes
svn: r21137
2013-01-15 21:04:57 +00:00
Benny Malengier
38b9ae0e6a 6338: NotImplementedError on Export a View to a spreadsheet from the People Category
svn: r21136
2013-01-15 19:49:07 +00:00
Nick Hall
cb268dac1f Allow icons as column headings in listviews
svn: r21134
2013-01-15 18:46:18 +00:00
Nick Hall
b6136261aa Add family filter to match twins
svn: r21132
2013-01-15 18:27:43 +00:00
Benny Malengier
a2acb593ec 6330: Can't download ans install addons
svn: r21131
2013-01-15 10:59:13 +00:00
Benny Malengier
7860fa5221 Filter was not working, we need to query global variable when we need it, not once at start
svn: r21129
2013-01-15 10:19:38 +00:00
Benny Malengier
6fa7b75550 factor out double handle2internal
svn: r21127
2013-01-15 08:49:22 +00:00
Erik De Richter
f17f4cc0ac updated nl translation
svn: r21125
2013-01-15 08:46:14 +00:00
Benny Malengier
011f40ad75 6329: Crazy citations after XML import of bacuo from Gramps 3.4.3
svn: r21123
2013-01-15 08:42:50 +00:00
Erik De Richter
b46640039d updated nl translation
svn: r21122
2013-01-15 08:40:26 +00:00
Doug Blank
ffc935599d Don't convert handle if None
svn: r21121
2013-01-14 22:05:29 +00:00
Benny Malengier
d23aca2481 6326: Running Export View crashes with 'tuple' object has no attribute 'get_indices'
svn: r21120
2013-01-14 18:57:47 +00:00
Doug Blank
ccc0b540da Changes for 1.6 svn
svn: r21117
2013-01-14 18:38:44 +00:00
Paul Franklin
cf1456319f more absolute addressing, not relative
svn: r21115
2013-01-14 18:25:54 +00:00
Nick Hall
c3edd2c359 1765: Add private column to views
svn: r21114
2013-01-14 16:49:52 +00:00
Doug Blank
a030be6100 Rename Gramplet View to Dashboard View
svn: r21112
2013-01-14 11:49:51 +00:00
John Ralls
d84df82c55 Fix typo in GI_TYPELIB_PATH
svn: r21110
2013-01-13 21:06:41 +00:00
John Ralls
7b6abfeb03 Build graphviz with pango, freetype support
Otherwise it can't output PDFs.
Also fix Gramps svn repo to new SF scheme.


svn: r21107
2013-01-13 20:35:51 +00:00
John Ralls
1e7d0f847e Include gi typelibs in bundle
Also point to pango modules file.


svn: r21106
2013-01-13 20:32:11 +00:00
Doug Blank
6a559ad827 indent typo
svn: r21103
2013-01-13 17:19:29 +00:00
Nick Hall
d4e85e7336 Improvement to dropdown navigation plugin
svn: r21102
2013-01-13 17:09:53 +00:00
Doug Blank
7a5e277b38 http://www.gramps-project.org/bugs/view.php?id=2623#c26969 make handle safe
svn: r21101
2013-01-13 17:07:44 +00:00
Benny Malengier
f85a78a50d 6288: crash: no attribute 'require_version'
svn: r21100
2013-01-13 16:51:04 +00:00
Doug Blank
49766e00a7 Set of changes to allow merge/patch functionality: feature on db to not add sources or tags on import; all gen.lib objects' to_struct marks Handles rather than strings; Differences report (gramps-add) now shows all relevant changes
svn: r21098
2013-01-13 16:38:54 +00:00
Doug Blank
7704bd435a Bring data.gramps up to date with version 1.5.0 of XML; fix missing citations
svn: r21097
2013-01-13 16:27:08 +00:00
Doug Blank
ba25ce0b97 Moving to xml rather than gz for comparison purposes
svn: r21096
2013-01-13 16:25:09 +00:00
Paul Franklin
6cfffee22d 6229: bug when creating a book reports
svn: r21090
2013-01-13 01:07:19 +00:00
Nick Hall
ce373e3036 Add two experimental navigation plugins
svn: r21088
2013-01-12 23:35:45 +00:00
Benny Malengier
6400f61b29 6315: Inserting action group 'Bookmarks' into UI manager which already has a group with this name
svn: r21087
2013-01-12 22:20:41 +00:00
Benny Malengier
864f9c667a 6318: Mention in the README that RCS is an optional package
svn: r21085
2013-01-12 15:00:52 +00:00
Benny Malengier
065d11647d 6321: installed rcs and tried to make an archive
svn: r21083
2013-01-12 14:48:49 +00:00
Nick Hall
d8d345772c 6306: Remove focus from the help button in detached gramplet windows
svn: r21080
2013-01-12 00:03:16 +00:00
Benny Malengier
9c9cb508ed 6310: Warning dialog "No Home Person" should be helpful and more descriptive
svn: r21079
2013-01-11 22:52:27 +00:00
Benny Malengier
d6f66f3856 6291: No Text report, with output format ODF, is created
svn: r21077
2013-01-11 22:32:41 +00:00
Nick Hall
f0da385b33 6312: Fix Dashboard category icon
svn: r21074
2013-01-11 22:10:27 +00:00
Erik De Richter
fb930c4560 updated nl translation
svn: r21073
2013-01-11 20:00:05 +00:00
Nick Hall
3dbd69ad31 6307: Bug fixes for To Do gramplets
svn: r21071
2013-01-11 19:23:38 +00:00
Benny Malengier
d9c1a330f3 fix error from fix encoding issue for python 3
svn: r21070
2013-01-11 17:20:16 +00:00
Nick Hall
976dd620a2 6307: Improved To Do gramplets
svn: r21067
2013-01-11 16:09:23 +00:00
Nick Hall
64f67aa204 Bug fixes
svn: r20767
2012-12-05 12:32:34 +00:00
Nick Hall
c2092a71bd Update with latest trunk changes
svn: r20754
2012-12-02 23:53:41 +00:00
Nick Hall
3eb9594a98 Merge trunk changes
svn: r20750
2012-12-02 17:59:28 +00:00
Nick Hall
0758e411fd Initial version
svn: r20746
2012-12-02 14:23:29 +00:00
Nick Hall
e2c48ddb54 Prototype for hierarchical locations
svn: r20744
2012-12-02 14:06:40 +00:00
771 changed files with 69787 additions and 62727 deletions

7
README
View File

@ -24,7 +24,7 @@ to your language:
The following packages are *STRONGLY RECOMMENDED* to be installed:
osmgpsmap Used to show maps in the geography view.
Without this the GeoView will not be active, see
http://gramps-project.org/wiki/index.php?title=Gramps_3.3_Wiki_Manual_-_Main_Window#Geography_Category
http://gramps-project.org/wiki/index.php?title=Gramps_4.0_Wiki_Manual_-_Main_Window#Geography_Category
The package is named osmgpsmap, osm-gps-map
or python-osmgpsmap. Or obtain it from: http://nzjrs.github.com/osm-gps-map/
GraphViz Enable creation of graphs using GraphViz engine.
@ -39,6 +39,11 @@ The following packages are optional
enchant. A version of gtkspell with gobject introspection
is needed, so minimally version 3.0.0
rcs The GNU Revision Control System (RCS) can be used to manage
multiple revisions of your family trees. See info at
http://www.gramps-project.org/wiki/index.php?title=Gramps_4.0_Wiki_Manual_-_Manage_Family_Trees#Archiving_a_Family_Tree
Only rcs is needed, NO python bindings are required
PIL Python Image Library is needed to convert non jpg images to
jpg so as to include them in LaTeX output

View File

@ -25,15 +25,15 @@
-->
<!--
This is the Document Type Definition file for v1.5.0
This is the Document Type Definition file for v1.6.0
of the GRAMPS XML genealogy data format.
Please use the following formal public identifier to identify it:
"-//GRAMPS//DTD GRAMPS XML V1.5.0//EN"
"-//GRAMPS//DTD GRAMPS XML V1.6.0//EN"
For example:
<!DOCTYPE database PUBLIC "-//GRAMPS//DTD GRAMPS XML V1.5.0//EN"
"http://gramps-project.org/xml/1.5.0/grampsxml.dtd"
<!DOCTYPE database PUBLIC "-//GRAMPS//DTD GRAMPS XML V1.6.0//EN"
"http://gramps-project.org/xml/1.6.0/grampsxml.dtd"
[...]>
-->
@ -215,7 +215,8 @@ EVENT
<!ELEMENT events (event)*>
<!ELEMENT event (type?, (daterange|datespan|dateval|datestr)?, place?, cause?,
description?, attribute*, noteref*, citationref*, objref*)>
description?, attribute*, noteref*, citationref*, objref*,
tagref*)>
<!ATTLIST event
id CDATA #IMPLIED
handle ID #REQUIRED
@ -229,7 +230,7 @@ SOURCES
<!ELEMENT sources (source)*>
<!ELEMENT source (stitle?, sauthor?, spubinfo?, sabbrev?,
noteref*, objref*, data_item*, reporef*)>
noteref*, objref*, data_item*, reporef*, tagref*)>
<!ATTLIST source
id CDATA #IMPLIED
handle ID #REQUIRED
@ -248,7 +249,7 @@ PLACES
<!ELEMENT places (placeobj)*>
<!ELEMENT placeobj (ptitle?, coord?, location*, objref*, url*, noteref*,
citationref*)>
citationref*, tagref*)>
<!ATTLIST placeobj
id CDATA #IMPLIED
handle ID #REQUIRED
@ -305,7 +306,7 @@ REPOSITORIES
<!ELEMENT repositories (repository)*>
<!ELEMENT repository (rname, type, address*, url*, noteref*)>
<!ELEMENT repository (rname, type, address*, url*, noteref*, tagref*)>
<!ATTLIST repository
id CDATA #IMPLIED
handle ID #REQUIRED
@ -368,7 +369,7 @@ CITATIONS
<!ELEMENT citations (citation)*>
<!ELEMENT citation ((daterange|datespan|dateval|datestr)?, page?, confidence?,
noteref*, objref*, data_item*, sourceref)>
noteref*, objref*, data_item*, sourceref, tagref*)>
<!ATTLIST citation
id CDATA #IMPLIED
handle ID #REQUIRED

View File

@ -32,7 +32,7 @@
<grammar
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
ns="http://gramps-project.org/xml/1.5.0/"
ns="http://gramps-project.org/xml/1.6.0/"
xmlns="http://relaxng.org/ns/structure/1.0">
<start><element name="database">
@ -160,6 +160,9 @@
<value>0</value>
<value>1</value>
</choice></attribute></optional>
<zeroOrMore><element name="tagref">
<ref name="tagref-content"/>
</element></zeroOrMore>
</define>
<define name="person-content">
@ -205,9 +208,6 @@
<zeroOrMore><element name="citationref">
<ref name="citationref-content"/>
</element></zeroOrMore>
<zeroOrMore><element name="tagref">
<ref name="tagref-content"/>
</element></zeroOrMore>
</define>
<define name="child-rel">
@ -403,9 +403,6 @@
<zeroOrMore><element name="citationref">
<ref name="citationref-content"/>
</element></zeroOrMore>
<zeroOrMore><element name="tagref">
<ref name="tagref-content"/>
</element></zeroOrMore>
</define>
<define name="event-content">
@ -520,9 +517,6 @@
<zeroOrMore><element name="citationref">
<ref name="citationref-content"/>
</element></zeroOrMore>
<zeroOrMore><element name="tagref">
<ref name="tagref-content"/>
</element></zeroOrMore>
</define>
<define name="repository-content">
@ -581,9 +575,6 @@
</choice></attribute></optional>
<attribute name="type"><text/></attribute>
<ref name="styledtext"/>
<zeroOrMore><element name="tagref">
<ref name="tagref-content"/>
</element></zeroOrMore>
</define>
<define name="styledtext">

View File

@ -52,11 +52,11 @@ SPHINXBUILD = 'sphinx-build'
if sys.platform == 'win32':
pythonCmd = os.path.join(sys.prefix, 'bin', 'python.exe')
sphinxCmd = os.path.join(sys.prefix, 'bin', 'sphinx-build.exe')
elif sys.platform == 'linux2' or os.name == 'darwin':
elif sys.platform in ['linux2', 'darwin', 'cygwin']:
pythonCmd = os.path.join(sys.prefix, 'bin', 'python')
sphinxCmd = SPHINXBUILD
else:
print ("ERROR: unknown system, don't know sphinx, ... commands")
print ("Update Man ERROR: unknown system, don't know sphinx, ... commands")
sys.exit(0)
def tests():

View File

@ -42,11 +42,11 @@ SPHINXBUILD = 'sphinx-build'
if sys.platform == 'win32':
pythonCmd = os.path.join(sys.prefix, 'bin', 'python.exe')
sphinxCmd = os.path.join(sys.prefix, 'bin', 'sphinx-build.exe')
elif sys.platform == 'linux2' or os.name == 'darwin':
elif sys.platform in ['linux2', 'darwin', 'cygwin']:
pythonCmd = os.path.join(sys.prefix, 'bin', 'python')
sphinxCmd = SPHINXBUILD
else:
print ("ERROR: unknown system, don't know sphinx, ... commands")
print ("Update Docs ERROR: unknown system, don't know sphinx, ... commands")
sys.exit(0)
def tests():

Binary file not shown.

View File

@ -39,7 +39,8 @@ Module responsible for handling the command line arguments for GRAMPS.
from __future__ import print_function
import os
import sys
from gramps.gen.ggettext import gettext as _
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#
@ -185,9 +186,9 @@ class ArgHandler(object):
else:
# Need to convert to system file encoding before printing
# For non latin characters in path/file/user names
print(msg1.encode(sys.getfilesystemencoding()), file=sys.stderr)
print(msg1.encode(sys.stdout.encoding, 'backslashreplace'), file=sys.stderr)
if msg2 is not None:
print(msg2.encode(sys.getfilesystemencoding()), file=sys.stderr)
print(msg2.encode(sys.stdout.encoding, 'backslashreplace'), file=sys.stderr)
#-------------------------------------------------------------------------
# Argument parser: sorts out given arguments
@ -294,7 +295,7 @@ class ArgHandler(object):
else:
ask = input
ans = ask(_('OK to overwrite? (yes/no) ') \
.encode(sys.getfilesystemencoding()))
.encode(sys.stdout.encoding, 'backslashreplace'))
except EOFError:
print()
sys.exit(0)
@ -408,26 +409,26 @@ class ArgHandler(object):
if self.list:
print(_('List of known family trees in your database path\n').\
encode(sys.getfilesystemencoding()))
encode(sys.stdout.encoding, 'backslashreplace'))
for name, dirname in sorted(self.dbman.family_tree_list(),
key=lambda pair: pair[0].lower()):
print((_("%(full_DB_path)s with name \"%(f_t_name)s\"") % \
{'full_DB_path' : dirname,
'f_t_name' : name}).encode(sys.getfilesystemencoding()))
'f_t_name' : name}).encode(sys.stdout.encoding, 'backslashreplace'))
sys.exit(0)
if self.list_more:
print(_('Gramps Family Trees:').encode(sys.getfilesystemencoding()))
print(_('Gramps Family Trees:').encode(sys.stdout.encoding, 'backslashreplace'))
summary_list = self.dbman.family_tree_summary()
for summary in sorted(summary_list,
key=lambda sum: sum["Family tree"].lower()):
print(_("Family Tree \"%s\":").\
encode(sys.getfilesystemencoding()) % summary["Family tree"])
encode(sys.stdout.encoding, 'backslashreplace') % summary["Family tree"])
for item in sorted(summary):
if item != "Family tree":
print((" %s: %s" % (item, summary[item])).\
encode(sys.getfilesystemencoding()))
encode(sys.stdout.encoding, 'backslashreplace'))
sys.exit(0)
self.__open_action()
@ -442,7 +443,7 @@ class ArgHandler(object):
for expt in self.exports:
# Need to convert path/filename to str before printing
# For non latin characters in Windows path/file/user names
fn = expt[0].encode(sys.getfilesystemencoding())
fn = expt[0].encode(sys.stdout.encoding, 'backslashreplace')
fmt = str(expt[1])
print(_("Exporting: file %(filename)s, "
"format %(format)s.") % \
@ -480,7 +481,7 @@ class ArgHandler(object):
self.imp_db_path, title = self.dbman.create_new_db_cli()
else:
self.imp_db_path = get_empty_tempdir("import_dbdir") \
.encode(sys.getfilesystemencoding())
.encode(sys.stdout.encoding, 'backslashreplace')
newdb = DbBsddb()
newdb.write_version(self.imp_db_path)
@ -494,7 +495,7 @@ class ArgHandler(object):
sys.exit(0)
for imp in self.imports:
fn = imp[0].encode(sys.getfilesystemencoding())
fn = imp[0].encode(sys.stdout.encoding, 'backslashreplace')
fmt = str(imp[1])
msg = _("Importing: file %(filename)s, format %(format)s.") % \
{'filename' : fn, 'format' : fmt}
@ -623,10 +624,10 @@ class ArgHandler(object):
# Print cli report name ([item[0]), GUI report name (item[4])
if len(pdata.id) <= 25:
print(" %s%s- %s" % ( pdata.id, " " * (26 - len(pdata.id)),
pdata.name.encode(sys.getfilesystemencoding())), file=sys.stderr)
pdata.name.encode(sys.stdout.encoding, 'backslashreplace')), file=sys.stderr)
else:
print(" %s\t- %s" % (pdata.id,
pdata.name.encode(sys.getfilesystemencoding())), file=sys.stderr)
pdata.name.encode(sys.stdout.encoding, 'backslashreplace')), file=sys.stderr)
elif action == "tool":
from gramps.gui.plug import tool
@ -664,10 +665,10 @@ class ArgHandler(object):
# Print cli report name ([item[0]), GUI report name (item[4])
if len(pdata.id) <= 25:
print(" %s%s- %s" % ( pdata.id, " " * (26 - len(pdata.id)),
pdata.name.encode(sys.getfilesystemencoding())), file=sys.stderr)
pdata.name.encode(sys.stdout.encoding, 'backslashreplace')), file=sys.stderr)
else:
print(" %s\t- %s" % (pdata.id,
pdata.name.encode(sys.getfilesystemencoding())), file=sys.stderr)
pdata.name.encode(sys.stdout.encoding, 'backslashreplace')), file=sys.stderr)
elif action == "book":
try:

View File

@ -39,7 +39,8 @@ Module responsible for handling the command line arguments for GRAMPS.
from __future__ import print_function
import sys
import getopt
from gramps.gen.ggettext import gettext as _
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
import logging
#-------------------------------------------------------------------------
@ -292,7 +293,7 @@ class ArgParser(object):
self.list_more = True
elif option in ('-s','--show'):
print ("Gramps config settings from %s:" % \
config.filename.encode(sys.getfilesystemencoding()))
config.filename.encode(sys.stdout.encoding, 'backslashreplace'))
for section in config.data:
for setting in config.data[section]:
print ("%s.%s=%s" % (
@ -402,7 +403,7 @@ class ArgParser(object):
"""
if self.help:
# Convert Help messages to file system encoding before printing
print (_HELP.encode(sys.getfilesystemencoding()))
print (_HELP.encode(sys.stdout.encoding, 'backslashreplace'))
sys.exit(0)
def print_usage(self):
@ -411,5 +412,5 @@ class ArgParser(object):
"""
if self.usage:
# Convert Help messages to file system encoding before printing
print (_USAGE.encode(sys.getfilesystemencoding()))
print (_USAGE.encode(sys.stdout.encoding, 'backslashreplace'))
sys.exit(0)

View File

@ -44,7 +44,6 @@ else:
from urllib.parse import urlparse
from urllib.request import urlopen, url2pathname
import tempfile
from gramps.gen.ggettext import gettext as _
#-------------------------------------------------------------------------
#
# set up logging
@ -58,6 +57,8 @@ LOG = logging.getLogger(".clidbman")
# gramps modules
#
#-------------------------------------------------------------------------
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
from gramps.gen.db import DbBsddb
from gramps.gen.plug import BasePluginManager
from gramps.gen.config import config
@ -158,6 +159,7 @@ class CLIDbManager(object):
try:
dbmap1.open(fname, META, db.DB_HASH, db.DB_RDONLY)
except:
env.close()
return "Unknown", "Unknown"
version = dbmap1.get('version', default=None)
dbmap1.close()
@ -191,7 +193,7 @@ class CLIDbManager(object):
retval["Locked?"] = "no"
retval["DB version"] = version
if sys.version_info[0] < 3:
retval["Family tree"] = name.encode(sys.getfilesystemencoding())
retval["Family tree"] = name.encode(glocale.getfilesystemencoding())
else:
retval["Family tree"] = name
retval["Path"] = dirpath
@ -206,7 +208,7 @@ class CLIDbManager(object):
# make the default directory if it does not exist
dbdir = os.path.expanduser(config.get('behavior.database-path'))
if sys.version_info[0] < 3:
dbdir = dbdir.encode(sys.getfilesystemencoding())
dbdir = dbdir.encode(glocale.getfilesystemencoding())
db_ok = make_dbdir(dbdir)
self.current_names = []
@ -217,6 +219,7 @@ class CLIDbManager(object):
if os.path.isfile(path_name):
file = open(path_name)
name = file.readline().strip()
file.close()
(tval, last) = time_val(dirpath)
(enable, stock_id) = self.icon_values(dirpath, self.active,
@ -413,7 +416,7 @@ def make_dbdir(dbdir):
if not os.path.isdir(dbdir):
os.makedirs(dbdir)
except (IOError, OSError) as msg:
msg = conv_to_unicode(str(msg), sys.getfilesystemencoding())
msg = conv_to_unicode(str(msg), glocale.getfilesystemencoding())
LOG.error(_("\nERROR: Wrong database path in Edit Menu->Preferences.\n"
"Open preferences and set correct database path.\n\n"
"Details: Could not make database directory:\n %s\n\n") % msg)
@ -442,7 +445,7 @@ def find_next_db_dir():
base = "%x" % int(time.time())
dbdir = os.path.expanduser(config.get('behavior.database-path'))
if sys.version_info[0] < 3:
dbdir = dbdir.encode(sys.getfilesystemencoding())
dbdir = dbdir.encode(glocale.getfilesystemencoding())
new_path = os.path.join(dbdir, base)
if not os.path.isdir(new_path):
break
@ -485,7 +488,7 @@ def find_locker_name(dirpath):
# Convert username to unicode according to system encoding
# Otherwise problems with non ASCII characters in
# username in Windows
username = conv_to_unicode(username, sys.getfilesystemencoding())
username = conv_to_unicode(username, glocale.getfilesystemencoding())
# feature request 2356: avoid genitive form
last = _("Locked by %s") % username
ifile.close()

View File

@ -35,7 +35,8 @@ Provides also two small base classes: CLIDbLoader, CLIManager
#-------------------------------------------------------------------------
from __future__ import print_function
from gramps.gen.ggettext import gettext as _
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
import os
import sys
@ -296,10 +297,10 @@ def startcli(errors, argparser):
#already errors encountered. Show first one on terminal and exit
# Convert error message to file system encoding before print
errmsg = _('Error encountered: %s') % errors[0][0]
errmsg = errmsg.encode(sys.getfilesystemencoding())
errmsg = errmsg.encode(sys.stdout.encoding, 'backslashreplace')
print(errmsg)
errmsg = _(' Details: %s') % errors[0][1]
errmsg = errmsg.encode(sys.getfilesystemencoding())
errmsg = errmsg.encode(sys.stdout.encoding, 'backslashreplace')
print(errmsg)
sys.exit(1)
@ -307,10 +308,10 @@ def startcli(errors, argparser):
# Convert error message to file system encoding before print
errmsg = _('Error encountered in argument parsing: %s') \
% argparser.errors[0][0]
errmsg = errmsg.encode(sys.getfilesystemencoding())
errmsg = errmsg.encode(sys.stdout.encoding, 'backslashreplace')
print(errmsg)
errmsg = _(' Details: %s') % argparser.errors[0][1]
errmsg = errmsg.encode(sys.getfilesystemencoding())
errmsg = errmsg.encode(sys.stdout.encoding, 'backslashreplace')
print(errmsg)
sys.exit(1)

View File

@ -35,7 +35,8 @@
#-------------------------------------------------------------------------
from __future__ import print_function
from gramps.gen.ggettext import gettext as _
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
import traceback
import os
import sys
@ -570,11 +571,11 @@ class CommandLineReport(object):
# Make the output nicer to read, assume a tab has 8 spaces
tabs = '\t\t' if len(key) < 10 else '\t'
optmsg = " %s%s%s (%s)" % (key, tabs, opt[1], opt[0])
print(optmsg.encode(sys.getfilesystemencoding()))
print(optmsg.encode(sys.stdout.encoding, 'backslashreplace'))
else:
optmsg = " %s%s%s" % (key, tabs,
_('(no help available)'))
print(optmsg.encode(sys.getfilesystemencoding()))
print(optmsg.encode(sys.stdout.encoding, 'backslashreplace'))
print((_(" Use '%(donottranslate)s' to see description "
"and acceptable values") %
{'donottranslate' : "show=option"}))
@ -587,10 +588,10 @@ class CommandLineReport(object):
if isinstance(vals, (list, tuple)):
for val in vals:
optmsg = " %s" % val
print(optmsg.encode(sys.getfilesystemencoding()))
print(optmsg.encode(sys.stdout.encoding, 'backslashreplace'))
else:
optmsg = " %s" % opt[2]
print(optmsg.encode(sys.getfilesystemencoding()))
print(optmsg.encode(sys.stdout.encoding, 'backslashreplace'))
else:
#there was a show option given, but the option is invalid
@ -726,6 +727,7 @@ def cl_book(database, name, book, options_str_dict):
clr.marginr, clr.margint, clr.marginb))
user = User()
rptlist = []
global_style = None
for item in book.get_item_list():
# The option values were loaded magically by the book parser.
@ -743,6 +745,12 @@ def cl_book(database, name, book, options_str_dict):
report_class, item.option_class, user)
style_sheet = create_style_sheet(item)
rptlist.append((obj, style_sheet))
if ( item.name == 'table_of_contents' or
item.name == 'alphabetical_index' ): # ugly hack: FIXME
if global_style is None:
global_style = style_sheet
else:
global_style = create_style_sheet(item, global_style)
doc.open(clr.option_class.get_output())
doc.init()
@ -754,6 +762,8 @@ def cl_book(database, name, book, options_str_dict):
newpage = 1
rpt.begin_report()
rpt.write_report()
if global_style:
doc.set_style_sheet(global_style)
doc.close()
#------------------------------------------------------------------------

View File

@ -38,7 +38,8 @@ import sys
# Gramps Modules
#
#------------------------------------------------------------------------
from gramps.gen.ggettext import gettext as _
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
from gramps.gen.user import User
#------------------------------------------------------------------------

View File

@ -41,7 +41,8 @@ import logging
# Gramps imports
#
#---------------------------------------------------------------
from .ggettext import gettext as _
from .const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
from .const import HOME_DIR, USER_HOME, VERSION_DIR
from .utils.configmanager import ConfigManager
@ -209,6 +210,7 @@ register('interface.filter', False)
register('interface.filter-editor-width', 400)
register('interface.filter-editor-height', 350)
register('interface.fullscreen', False)
register('interface.grampletbar-close', False)
register('interface.height', 500)
register('interface.lds-height', 450)
register('interface.lds-width', 600)

View File

@ -42,7 +42,6 @@ import uuid
# Gramps modules
#
#-------------------------------------------------------------------------
from .ggettext import sgettext as _
from .svn_revision import get_svn_revision
#-------------------------------------------------------------------------
@ -65,7 +64,6 @@ def get_version_tuple(v):
return tuple(map(int, retval.split(".")))
VERSION_TUPLE = get_version_tuple(VERSION)
major_version = "%s.%s" % (VERSION_TUPLE[0], VERSION_TUPLE[1])
VERSION += get_svn_revision()
#-------------------------------------------------------------------------
#
@ -171,6 +169,8 @@ if sys.version_info[0] < 3:
ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(
unicode(__file__, sys.getfilesystemencoding())), os.pardir))
VERSION += get_svn_revision(ROOT_DIR)
#
# Glade files
#
@ -212,6 +212,14 @@ LOGO = os.path.join(IMAGE_DIR, "logo.png")
SPLASH = os.path.join(IMAGE_DIR, "splash.jpg")
LICENSE_FILE = os.path.join(DOC_DIR, 'COPYING')
#-------------------------------------------------------------------------
#
# Init Localization
#
#-------------------------------------------------------------------------
from .utils.grampslocale import GrampsLocale
GRAMPS_LOCALE = GrampsLocale()
_ = GRAMPS_LOCALE.get_translation().sgettext
#-------------------------------------------------------------------------
#

View File

@ -64,6 +64,13 @@ else:
STRTYPE = str
UNITYPE = str
cuni = conv_to_unicode_direct
# handle in database is bytes, while internally Gramps wants unicode for py3
if sys.version_info[0] < 3:
handle2internal = lambda x: x
else:
handle2internal = lambda x: conv_to_unicode(x, 'utf-8')
#-------------------------------------------------------------------------
#
# Platform determination functions

View File

@ -25,6 +25,8 @@ import locale
import sys
from ..constfunc import mac, win, conv_to_unicode
from gramps.gen.const import GRAMPS_LOCALE as glocale
"""
Some OS environments do not support the locale.nl_langinfo() method
of determing month names and other date related information.
@ -41,7 +43,11 @@ else:
#locale returns unicode in python 3
to_uni = lambda x, y: x
try:
codeset = locale.nl_langinfo(locale.CODESET)
codeset = glocale.get_translation().info()["charset"]
except KeyError:
codeset = "UTF-8"
try:
month_to_int = {
to_uni(locale.nl_langinfo(locale.MON_1), codeset).lower() : 1,
@ -137,69 +143,64 @@ try:
except:
import time
codeset = None
if win() or mac():
codeset = locale.getlocale()[1]
if codeset is None:
codeset = locale.getpreferredencoding()
month_to_int = {
to_uni(time.strftime('%B',(0,1,1,1,1,1,1,1,1)), codeset).lower() : 1,
to_uni(time.strftime('%b',(0,1,1,1,1,1,1,1,1)), codeset).lower() : 1,
to_uni(time.strftime('%B',(0,2,1,1,1,1,1,1,1)), codeset).lower() : 2,
to_uni(time.strftime('%b',(0,2,1,1,1,1,1,1,1)), codeset).lower() : 2,
to_uni(time.strftime('%B',(0,3,1,1,1,1,1,1,1)), codeset).lower() : 3,
to_uni(time.strftime('%b',(0,3,1,1,1,1,1,1,1)), codeset).lower() : 3,
to_uni(time.strftime('%B',(0,4,1,1,1,1,1,1,1)), codeset).lower() : 4,
to_uni(time.strftime('%b',(0,4,1,1,1,1,1,1,1)), codeset).lower() : 4,
to_uni(time.strftime('%B',(0,5,1,1,1,1,1,1,1)), codeset).lower() : 5,
to_uni(time.strftime('%b',(0,5,1,1,1,1,1,1,1)), codeset).lower() : 5,
to_uni(time.strftime('%B',(0,6,1,1,1,1,1,1,1)), codeset).lower() : 6,
to_uni(time.strftime('%b',(0,6,1,1,1,1,1,1,1)), codeset).lower() : 6,
to_uni(time.strftime('%B',(0,7,1,1,1,1,1,1,1)), codeset).lower() : 7,
to_uni(time.strftime('%b',(0,7,1,1,1,1,1,1,1)), codeset).lower() : 7,
to_uni(time.strftime('%B',(0,8,1,1,1,1,1,1,1)), codeset).lower() : 8,
to_uni(time.strftime('%b',(0,8,1,1,1,1,1,1,1)), codeset).lower() : 8,
to_uni(time.strftime('%B',(0,9,1,1,1,1,1,1,1)), codeset).lower() : 9,
to_uni(time.strftime('%b',(0,9,1,1,1,1,1,1,1)), codeset).lower() : 9,
to_uni(time.strftime('%B',(0,10,1,1,1,1,1,1,1)), codeset).lower() : 10,
to_uni(time.strftime('%b',(0,10,1,1,1,1,1,1,1)), codeset).lower() : 10,
to_uni(time.strftime('%B',(0,11,1,1,1,1,1,1,1)), codeset).lower() : 11,
to_uni(time.strftime('%b',(0,11,1,1,1,1,1,1,1)), codeset).lower() : 11,
to_uni(time.strftime('%B',(0,12,1,1,1,1,1,1,1)), codeset).lower() : 12,
to_uni(time.strftime('%b',(0,12,1,1,1,1,1,1,1)), codeset).lower() : 12,
to_uni(time.strftime('%B',(1,1,1,1,1,1,1,1,1)), codeset).lower() : 1,
to_uni(time.strftime('%b',(1,1,1,1,1,1,1,1,1)), codeset).lower() : 1,
to_uni(time.strftime('%B',(1,2,1,1,1,1,1,1,1)), codeset).lower() : 2,
to_uni(time.strftime('%b',(1,2,1,1,1,1,1,1,1)), codeset).lower() : 2,
to_uni(time.strftime('%B',(1,3,1,1,1,1,1,1,1)), codeset).lower() : 3,
to_uni(time.strftime('%b',(1,3,1,1,1,1,1,1,1)), codeset).lower() : 3,
to_uni(time.strftime('%B',(1,4,1,1,1,1,1,1,1)), codeset).lower() : 4,
to_uni(time.strftime('%b',(1,4,1,1,1,1,1,1,1)), codeset).lower() : 4,
to_uni(time.strftime('%B',(1,5,1,1,1,1,1,1,1)), codeset).lower() : 5,
to_uni(time.strftime('%b',(1,5,1,1,1,1,1,1,1)), codeset).lower() : 5,
to_uni(time.strftime('%B',(1,6,1,1,1,1,1,1,1)), codeset).lower() : 6,
to_uni(time.strftime('%b',(1,6,1,1,1,1,1,1,1)), codeset).lower() : 6,
to_uni(time.strftime('%B',(1,7,1,1,1,1,1,1,1)), codeset).lower() : 7,
to_uni(time.strftime('%b',(1,7,1,1,1,1,1,1,1)), codeset).lower() : 7,
to_uni(time.strftime('%B',(1,8,1,1,1,1,1,1,1)), codeset).lower() : 8,
to_uni(time.strftime('%b',(1,8,1,1,1,1,1,1,1)), codeset).lower() : 8,
to_uni(time.strftime('%B',(1,9,1,1,1,1,1,1,1)), codeset).lower() : 9,
to_uni(time.strftime('%b',(1,9,1,1,1,1,1,1,1)), codeset).lower() : 9,
to_uni(time.strftime('%B',(1,10,1,1,1,1,1,1,1)), codeset).lower() : 10,
to_uni(time.strftime('%b',(1,10,1,1,1,1,1,1,1)), codeset).lower() : 10,
to_uni(time.strftime('%B',(1,11,1,1,1,1,1,1,1)), codeset).lower() : 11,
to_uni(time.strftime('%b',(1,11,1,1,1,1,1,1,1)), codeset).lower() : 11,
to_uni(time.strftime('%B',(1,12,1,1,1,1,1,1,1)), codeset).lower() : 12,
to_uni(time.strftime('%b',(1,12,1,1,1,1,1,1,1)), codeset).lower() : 12,
}
long_months = (
"",
to_uni(time.strftime('%B',(0,1,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%B',(0,2,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%B',(0,3,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%B',(0,4,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%B',(0,5,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%B',(0,6,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%B',(0,7,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%B',(0,8,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%B',(0,9,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%B',(0,10,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%B',(0,11,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%B',(0,12,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%B',(1,1,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%B',(1,2,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%B',(1,3,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%B',(1,4,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%B',(1,5,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%B',(1,6,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%B',(1,7,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%B',(1,8,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%B',(1,9,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%B',(1,10,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%B',(1,11,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%B',(1,12,1,1,1,1,1,1,1)), codeset),
)
short_months = (
"",
to_uni(time.strftime('%b',(0,1,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%b',(0,2,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%b',(0,3,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%b',(0,4,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%b',(0,5,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%b',(0,6,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%b',(0,7,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%b',(0,8,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%b',(0,9,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%b',(0,10,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%b',(0,11,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%b',(0,12,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%b',(1,1,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%b',(1,2,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%b',(1,3,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%b',(1,4,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%b',(1,5,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%b',(1,6,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%b',(1,7,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%b',(1,8,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%b',(1,9,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%b',(1,10,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%b',(1,11,1,1,1,1,1,1,1)), codeset),
to_uni(time.strftime('%b',(1,12,1,1,1,1,1,1,1)), codeset),
)
# Gramps day number: Sunday => 1, Monday => 2, etc
@ -213,24 +214,24 @@ except:
# just a dummy.
long_days = (
"",
to_uni(time.strftime('%A',(0,1,1,1,1,1,6,1,1)), codeset), # Sunday
to_uni(time.strftime('%A',(0,1,1,1,1,1,0,1,1)), codeset), # Monday
to_uni(time.strftime('%A',(0,1,1,1,1,1,1,1,1)), codeset), # Tuesday
to_uni(time.strftime('%A',(0,1,1,1,1,1,2,1,1)), codeset), # Wednesday
to_uni(time.strftime('%A',(0,1,1,1,1,1,3,1,1)), codeset), # Thursday
to_uni(time.strftime('%A',(0,1,1,1,1,1,4,1,1)), codeset), # Friday
to_uni(time.strftime('%A',(0,1,1,1,1,1,5,1,1)), codeset), # Saturday
to_uni(time.strftime('%A',(1,1,1,1,1,1,6,1,1)), codeset), # Sunday
to_uni(time.strftime('%A',(1,1,1,1,1,1,0,1,1)), codeset), # Monday
to_uni(time.strftime('%A',(1,1,1,1,1,1,1,1,1)), codeset), # Tuesday
to_uni(time.strftime('%A',(1,1,1,1,1,1,2,1,1)), codeset), # Wednesday
to_uni(time.strftime('%A',(1,1,1,1,1,1,3,1,1)), codeset), # Thursday
to_uni(time.strftime('%A',(1,1,1,1,1,1,4,1,1)), codeset), # Friday
to_uni(time.strftime('%A',(1,1,1,1,1,1,5,1,1)), codeset), # Saturday
)
short_days = (
"",
to_uni(time.strftime('%a',(0,1,1,1,1,1,6,1,1)), codeset), # Sunday
to_uni(time.strftime('%a',(0,1,1,1,1,1,0,1,1)), codeset), # Monday
to_uni(time.strftime('%a',(0,1,1,1,1,1,1,1,1)), codeset), # Tuesday
to_uni(time.strftime('%a',(0,1,1,1,1,1,2,1,1)), codeset), # Wednesday
to_uni(time.strftime('%a',(0,1,1,1,1,1,3,1,1)), codeset), # Thursday
to_uni(time.strftime('%a',(0,1,1,1,1,1,4,1,1)), codeset), # Friday
to_uni(time.strftime('%a',(0,1,1,1,1,1,5,1,1)), codeset), # Saturday
to_uni(time.strftime('%a',(1,1,1,1,1,1,6,1,1)), codeset), # Sunday
to_uni(time.strftime('%a',(1,1,1,1,1,1,0,1,1)), codeset), # Monday
to_uni(time.strftime('%a',(1,1,1,1,1,1,1,1,1)), codeset), # Tuesday
to_uni(time.strftime('%a',(1,1,1,1,1,1,2,1,1)), codeset), # Wednesday
to_uni(time.strftime('%a',(1,1,1,1,1,1,3,1,1)), codeset), # Thursday
to_uni(time.strftime('%a',(1,1,1,1,1,1,4,1,1)), codeset), # Friday
to_uni(time.strftime('%a',(1,1,1,1,1,1,5,1,1)), codeset), # Saturday
)
# depending on the locale, the value returned for 20th Feb 2009 could be

View File

@ -67,8 +67,9 @@ else:
#
#------------------------------------------------------------------------
from .exceptions import DbException
from .write import FAMILY_TBL, PLACES_TBL, SOURCES_TBL, MEDIA_TBL, \
EVENTS_TBL, PERSON_TBL, REPO_TBL, NOTE_TBL, TAG_TBL, META, CITATIONS_TBL
from .write import (FAMILY_TBL, PLACES_TBL, LOCATION_TBL, SOURCES_TBL,
MEDIA_TBL, EVENTS_TBL, PERSON_TBL, REPO_TBL, NOTE_TBL,
TAG_TBL, META, CITATIONS_TBL)
#------------------------------------------------------------------------
#
@ -215,5 +216,6 @@ def __build_tbl_map(database):
( MEDIA_TBL, database.media_map.db),
( EVENTS_TBL, database.event_map.db),
( TAG_TBL, database.tag_map.db),
( LOCATION_TBL, database.location_map.db),
( META, database.metadata.db),
]

View File

@ -32,7 +32,8 @@ from this class.
# Python libraries
#
#-------------------------------------------------------------------------
from ..ggettext import gettext as _
from ..const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#
@ -321,6 +322,27 @@ class DbReadBase(object):
"""
raise NotImplementedError
def get_location_cursor(self):
"""
Return a reference to a cursor over Location objects
"""
raise NotImplementedError
def get_location_from_handle(self, handle):
"""
Find a Location in the database from the passed handle.
If no such Location exists, None is returned.
"""
raise NotImplementedError
def get_location_handles(self):
"""
Return a list of database handles, one handle for each Location in
the database.
"""
raise NotImplementedError
def get_media_attribute_types(self):
"""
Return a list of all Attribute types associated with Media and MediaRef
@ -436,6 +458,12 @@ class DbReadBase(object):
"""
raise NotImplementedError
def get_number_of_locations(self):
"""
Return the number of locations currently in the database.
"""
raise NotImplementedError
def get_number_of_media_objects(self):
"""
Return the number of media objects currently in the database.
@ -591,6 +619,12 @@ class DbReadBase(object):
"""
raise NotImplementedError
def get_raw_location_data(self, handle):
"""
Return raw (serialized and pickled) Location object from handle
"""
raise NotImplementedError
def get_raw_note_data(self, handle):
"""
Return raw (serialized and pickled) Note object from handle
@ -867,6 +901,12 @@ class DbReadBase(object):
"""
raise NotImplementedError
def has_location_handle(self, handle):
"""
Return True if the handle exists in the current Location database.
"""
raise NotImplementedError
def has_name_group_key(self, name):
"""
Return if a key exists in the name_group table.
@ -945,6 +985,18 @@ class DbReadBase(object):
"""
raise NotImplementedError
def iter_location_handles(self):
"""
Return an iterator over handles for Locations in the database
"""
raise NotImplementedError
def iter_locations(self):
"""
Return an iterator over objects for Locations in the database
"""
raise NotImplementedError
def iter_media_object_handles(self):
"""
Return an iterator over handles for Media in the database
@ -1235,6 +1287,13 @@ class DbWriteBase(DbReadBase):
"""
raise NotImplementedError
def add_location(self, location, transaction):
"""
Add a Location to the database, assigning a handle if it has not already
been defined.
"""
raise NotImplementedError
def add_note(self, obj, transaction, set_gid=True):
"""
Add a Note to the database, assigning internal IDs if they have
@ -1343,6 +1402,13 @@ class DbWriteBase(DbReadBase):
"""
raise NotImplementedError
def commit_location(self, location, transaction, change_time=None):
"""
Commit the specified Location to the database, storing the changes as
part of the transaction.
"""
raise NotImplementedError
def commit_media_object(self, obj, transaction, change_time=None):
"""
Commit the specified MediaObject to the database, storing the changes
@ -1460,6 +1526,15 @@ class DbWriteBase(DbReadBase):
"""
raise NotImplementedError
def remove_location(self, handle, transaction):
"""
Remove the Location specified by the database handle from the
database, preserving the change in the passed transaction.
This method must be overridden in the derived class.
"""
raise NotImplementedError
def remove_note(self, handle, transaction):
"""
Remove the Note specified by the database handle from the

View File

@ -45,8 +45,8 @@ __all__ = (
) +
('PERSON_KEY', 'FAMILY_KEY', 'SOURCE_KEY', 'CITATION_KEY',
'EVENT_KEY', 'MEDIA_KEY', 'PLACE_KEY', 'REPOSITORY_KEY',
'NOTE_KEY', 'REFERENCE_KEY', 'TAG_KEY'
'EVENT_KEY', 'MEDIA_KEY', 'PLACE_KEY', 'LOCATION_KEY',
'REPOSITORY_KEY', 'NOTE_KEY', 'REFERENCE_KEY', 'TAG_KEY'
) +
('TXNADD', 'TXNUPD', 'TXNDEL')
@ -87,5 +87,6 @@ REFERENCE_KEY = 7
NOTE_KEY = 8
TAG_KEY = 9
CITATION_KEY = 10
LOCATION_KEY = 11
TXNADD, TXNUPD, TXNDEL = 0, 1, 2

View File

@ -195,6 +195,7 @@ class DictionaryDb(DbWriteBase, DbReadBase):
}
# skip GEDCOM cross-ref check for now:
self.set_feature("skip-check-xref", True)
self.set_feature("skip-import-additions", True)
self.readonly = False
self.db_is_open = True
self.name_formats = []
@ -255,6 +256,20 @@ class DictionaryDb(DbWriteBase, DbReadBase):
self.txn = DictionaryTxn("DbDictionary Transaction", self)
self.transaction = None
def version_supported(self):
"""Return True when the file has a supported version."""
return True
def get_table_names(self):
"""Return a list of valid table names."""
return list(self._tables.keys())
def get_table_metadata(self, table_name):
"""Return the metadata for a valid table name."""
if table_name in self._tables:
return self._tables[table_name]
return None
def transaction_commit(self, txn):
pass

View File

@ -27,7 +27,8 @@
# Standard python modules
#
#-------------------------------------------------------------------------
from ..ggettext import gettext as _
from ..const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
class DbException(Exception):

View File

@ -40,7 +40,6 @@ else:
import pickle
import time
import random
import locale
import os
from sys import maxsize
@ -49,7 +48,8 @@ if config.get('preferences.use-bsddb3') or sys.version_info[0] >= 3:
from bsddb3 import db
else:
from bsddb import db
from ..ggettext import gettext as _
from ..const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
import re
import logging
@ -66,6 +66,7 @@ from ..lib.src import Source
from ..lib.citation import Citation
from ..lib.event import Event
from ..lib.place import Place
from ..lib.location import Location
from ..lib.repo import Repository
from ..lib.note import Note
from ..lib.tag import Tag
@ -80,6 +81,7 @@ from . import (BsddbBaseCursor, DbReadBase)
from ..utils.id import create_id
from ..errors import DbError
from ..constfunc import UNITYPE, STRTYPE, cuni
from ..const import GRAMPS_LOCALE as glocale
LOG = logging.getLogger(DBLOGNAME)
LOG = logging.getLogger(".citation")
@ -91,7 +93,7 @@ LOG = logging.getLogger(".citation")
from .dbconst import *
_SIGBASE = ('person', 'family', 'source', 'citation',
'event', 'media', 'place', 'repository',
'event', 'media', 'place', 'location', 'repository',
'reference', 'note', 'tag')
DBERRS = (db.DBRunRecoveryError, db.DBAccessError,
@ -102,6 +104,17 @@ DBERRS = (db.DBRunRecoveryError, db.DBAccessError,
# Helper functions
#
#-------------------------------------------------------------------------
def find_byte_surname(key, data):
"""
Creating a surname from raw data of a person, to use for sort and index
returns a byte string
"""
surn = __index_surname(data[3][5])
# in python 3 we work with unicode internally, but need byte function sometimes
if isinstance(surn, UNITYPE):
return surn.encode('utf-8')
return surn
def find_surname(key, data):
"""
Creating a surname from raw data of a person, to use for sort and index
@ -178,6 +191,32 @@ class DbReadCursor(BsddbBaseCursor):
self.cursor = source.db.cursor(txn)
self.source = source
#-------------------------------------------------------------------------
#
# DbBsddbTreeCursor
#
#-------------------------------------------------------------------------
class DbBsddbTreeCursor(BsddbBaseCursor):
def __init__(self, source, txn=None, **kwargs):
BsddbBaseCursor.__init__(self, txn=txn, **kwargs)
self.cursor = source.cursor(txn)
self.source = source
def __iter__(self):
"""
Iterator
"""
to_do = [None]
while to_do:
data = self.set(str(to_do.pop()))
_n = self.next_dup
while data:
payload = pickle.loads(data[1])
yield (payload[0], payload)
to_do.append(payload[0])
data = _n()
class DbBsddbRead(DbReadBase, Callback):
"""
Read class for the GRAMPS databases. Implements methods necessary to read
@ -327,6 +366,13 @@ class DbBsddbRead(DbReadBase, Callback):
"cursor_func": self.get_tag_cursor,
"handles_func": self.get_tag_handles,
},
'Location':
{
"handle_func": self.get_location_from_handle,
"gramps_id_func": None,
"class_func": Location,
"cursor_func": self.get_location_cursor,
},
}
self.set_person_id_prefix('I%04d')
@ -381,6 +427,7 @@ class DbBsddbRead(DbReadBase, Callback):
self.nid_trans = {}
self.eid_trans = {}
self.tag_trans = {}
self.loc_trans = {}
self.env = None
self.person_map = {}
self.family_map = {}
@ -484,6 +531,9 @@ class DbBsddbRead(DbReadBase, Callback):
def get_tag_cursor(self, *args, **kwargs):
return self.get_cursor(self.tag_map, *args, **kwargs)
def get_location_cursor(self, *args, **kwargs):
return DbBsddbTreeCursor(self.parents, self.txn)
def close(self):
"""
Close the specified database.
@ -532,6 +582,7 @@ class DbBsddbRead(DbReadBase, Callback):
self.emit('repository-rebuild')
self.emit('note-rebuild')
self.emit('tag-rebuild')
self.emit('location-rebuild')
def __find_next_gramps_id(self, prefix, map_index, trans):
"""
@ -747,6 +798,14 @@ class DbBsddbRead(DbReadBase, Callback):
"""
return self.get_from_handle(handle, Tag, self.tag_map)
def get_location_from_handle(self, handle):
"""
Find a Location in the database from the passed handle.
If no such Location exists, None is returned.
"""
return self.get_from_handle(handle, Location, self.location_map)
def __get_obj_from_gramps_id(self, val, tbl, class_, prim_tbl):
if isinstance(tbl, dict):
return None ## trying to get object too early
@ -955,6 +1014,12 @@ class DbBsddbRead(DbReadBase, Callback):
"""
return self.get_number_of_records(self.tag_map)
def get_number_of_locations(self):
"""
Return the number of locations currently in the database.
"""
return self.get_number_of_records(self.location_map)
def all_handles(self, table):
return table.keys(txn=self.txn)
@ -1079,6 +1144,15 @@ class DbBsddbRead(DbReadBase, Callback):
return handle_list
return []
def get_location_handles(self):
"""
Return a list of database handles, one handle for each Location in the
database.
"""
if self.db_is_open:
return self.all_handles(self.location_map)
return []
def _f(curs_):
"""
Closure that returns an iterator over handles in the database.
@ -1101,6 +1175,7 @@ class DbBsddbRead(DbReadBase, Callback):
iter_repository_handles = _f(get_repository_cursor)
iter_note_handles = _f(get_note_cursor)
iter_tag_handles = _f(get_tag_cursor)
iter_location_handles = _f(get_location_cursor)
del _f
def _f(curs_, obj_):
@ -1127,6 +1202,7 @@ class DbBsddbRead(DbReadBase, Callback):
iter_repositories = _f(get_repository_cursor, Repository)
iter_notes = _f(get_note_cursor, Note)
iter_tags = _f(get_tag_cursor, Tag)
iter_locations = _f(get_location_cursor, Location)
del _f
def get_gramps_ids(self, obj_key):
@ -1558,6 +1634,9 @@ class DbBsddbRead(DbReadBase, Callback):
def get_raw_tag_data(self, handle):
return self.__get_raw_data(self.tag_map, handle)
def get_raw_location_data(self, handle):
return self.__get_raw_data(self.location_map, handle)
def __has_handle(self, table, handle):
"""
Helper function for has_<object>_handle methods
@ -1630,10 +1709,16 @@ class DbBsddbRead(DbReadBase, Callback):
"""
return self.__has_handle(self.tag_map, handle)
def has_location_handle(self, handle):
"""
Return True if the handle exists in the current Location database.
"""
return self.__has_handle(self.location_map, handle)
def __sortbyperson_key(self, handle):
if isinstance(handle, UNITYPE):
handle = handle.encode('utf-8')
return locale.strxfrm(find_surname(handle,
return glocale.sort_key(find_surname(handle,
self.person_map.get(handle)))
def __sortbyplace(self, first, second):
@ -1641,13 +1726,13 @@ class DbBsddbRead(DbReadBase, Callback):
first = first.encode('utf-8')
if isinstance(second, UNITYPE):
second = second.encode('utf-8')
return locale.strcoll(self.place_map.get(first)[2],
return glocale.strcoll(self.place_map.get(first)[2],
self.place_map.get(second)[2])
def __sortbyplace_key(self, place):
if isinstance(place, UNITYPE):
place = place.encode('utf-8')
return locale.strxfrm(self.place_map.get(place)[2])
return glocale.sort_key(self.place_map.get(place)[2])
def __sortbysource(self, first, second):
if isinstance(first, UNITYPE):
@ -1656,13 +1741,13 @@ class DbBsddbRead(DbReadBase, Callback):
second = second.encode('utf-8')
source1 = cuni(self.source_map[first][2])
source2 = cuni(self.source_map[second][2])
return locale.strcoll(source1, source2)
return glocale.strcoll(source1, source2)
def __sortbysource_key(self, key):
if isinstance(key, UNITYPE):
key = key.encode('utf-8')
source = cuni(self.source_map[key][2])
return locale.strxfrm(source)
return glocale.sort_key(source)
def __sortbycitation(self, first, second):
if isinstance(first, UNITYPE):
@ -1671,13 +1756,13 @@ class DbBsddbRead(DbReadBase, Callback):
second = second.encode('utf-8')
citation1 = cuni(self.citation_map[first][3])
citation2 = cuni(self.citation_map[second][3])
return locale.strcoll(citation1, citation2)
return glocale.strcoll(citation1, citation2)
def __sortbycitation_key(self, key):
if isinstance(key, UNITYPE):
key = key.encode('utf-8')
citation = cuni(self.citation_map[key][3])
return locale.strxfrm(citation)
return glocale.sort_key(citation)
def __sortbymedia(self, first, second):
if isinstance(first, UNITYPE):
@ -1686,13 +1771,13 @@ class DbBsddbRead(DbReadBase, Callback):
second = second.encode('utf-8')
media1 = self.media_map[first][4]
media2 = self.media_map[second][4]
return locale.strcoll(media1, media2)
return glocale.strcoll(media1, media2)
def __sortbymedia_key(self, key):
if isinstance(key, UNITYPE):
key = key.encode('utf-8')
media = self.media_map[key][4]
return locale.strxfrm(media)
return glocale.sort_key(media)
def __sortbytag(self, first, second):
if isinstance(first, UNITYPE):
@ -1701,13 +1786,13 @@ class DbBsddbRead(DbReadBase, Callback):
second = second.encode('utf-8')
tag1 = self.tag_map[first][1]
tag2 = self.tag_map[second][1]
return locale.strcoll(tag1, tag2)
return glocale.strcoll(tag1, tag2)
def __sortbytag_key(self, key):
if isinstance(key, UNITYPE):
key = key.encode('utf-8')
tag = self.tag_map[key][1]
return locale.strxfrm(tag)
return glocale.sort_key(tag)
def set_mediapath(self, path):
"""Set the default media path for database, path should be utf-8."""
@ -1786,6 +1871,10 @@ class DbBsddbRead(DbReadBase, Callback):
'cursor_func': self.get_tag_cursor,
'class_func': Tag,
},
'Location': {
'cursor_func': self.get_location_cursor,
'class_func': Location,
},
}
# Find which tables to iterate over

View File

@ -46,13 +46,15 @@ if config.get('preferences.use-bsddb3') or sys.version_info[0] >= 3:
from bsddb3 import db
else:
from bsddb import db
from ..ggettext import gettext as _
from ..const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#
# Gramps modules
#
#-------------------------------------------------------------------------
from ..constfunc import conv_to_unicode, handle2internal
from .dbconst import *
from . import BSDDBTxn
from ..errors import DbError
@ -65,8 +67,9 @@ from ..errors import DbError
DBERRS = (db.DBRunRecoveryError, db.DBAccessError,
db.DBPageNotFoundError, db.DBInvalidArgError)
_SIGBASE = ('person', 'family', 'source', 'event', 'media',
'place', 'repository', 'reference', 'note', 'tag', 'citation')
_SIGBASE = ('person', 'family', 'source', 'event', 'media', 'place',
'location', 'repository', 'reference', 'note', 'tag', 'citation')
#-------------------------------------------------------------------------
#
# DbUndo class
@ -104,6 +107,7 @@ class DbUndo(object):
self.db.note_map,
self.db.tag_map,
self.db.citation_map,
self.db.location_map,
)
def clear(self):
@ -315,7 +319,7 @@ class DbUndo(object):
"""
try:
if data is None:
emit(signal_root + '-delete', ([handle],))
emit(signal_root + '-delete', ([handle2internal(handle)],))
db_map.delete(handle, txn=self.txn)
else:
ex_data = db_map.get(handle, txn=self.txn)
@ -324,7 +328,7 @@ class DbUndo(object):
else:
signal = signal_root + '-add'
db_map.put(handle, data, txn=self.txn)
emit(signal, ([handle],))
emit(signal, ([handle2internal(handle)],))
except DBERRS as msg:
self.db._log_error()
@ -479,6 +483,7 @@ def testundo():
self.place_map = {}
self.note_map = {}
self.tag_map = {}
self.location_map = {}
self.repository_map = {}
self.reference_map = {}

View File

@ -30,8 +30,9 @@ import time
import logging
LOG = logging.getLogger(".citation")
from ..ggettext import gettext as _
from ..constfunc import cuni, UNITYPE
from ..const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
from ..constfunc import cuni
"""
methods to upgrade a database from version 13 to current version
@ -42,12 +43,166 @@ if config.get('preferences.use-bsddb3') or sys.version_info[0] >= 3:
else:
from bsddb import db
from . import BSDDBTxn
from ..constfunc import UNITYPE
from ..lib.nameorigintype import NameOriginType
from .write import _mkname, SURNAMES
from .dbconst import (PERSON_KEY, FAMILY_KEY, EVENT_KEY,
MEDIA_KEY, PLACE_KEY, REPOSITORY_KEY)
from .dbconst import (PERSON_KEY, FAMILY_KEY, EVENT_KEY, MEDIA_KEY, PLACE_KEY,
LOCATION_KEY, REPOSITORY_KEY)
from gramps.gui.dialog import (InfoDialog)
def gramps_upgrade_18(self):
self.set_total(len(self.place_map))
self.children = {None: []}
for handle in self.place_map.keys():
place = self.place_map[handle]
new_place = list(place)
lat_long = (new_place[4], new_place[3])
if new_place[5] is not None:
new_place[5] = process_location(self, new_place[5], lat_long)
else:
new_place[5] = process_location(self, None, lat_long)
add_reference(self, handle, new_place[5])
alt_locs = []
for alt_loc in new_place[6]:
ref_handle = process_location(self, alt_loc, lat_long)
add_reference(self, handle, ref_handle)
alt_locs.append(ref_handle)
new_place[6] = alt_locs
new_place = tuple(new_place[:3] + new_place[5:])
with BSDDBTxn(self.env, self.place_map) as txn:
txn.put(str(handle), new_place)
self.update()
with BSDDBTxn(self.env, self.metadata) as txn:
txn.put(b'version', 18)
def add_reference(self, pri_handle, ref_handle):
key = (PLACE_KEY, pri_handle)
data = ((PLACE_KEY, pri_handle), (LOCATION_KEY, ref_handle))
with BSDDBTxn(self.env, self.reference_map) as txn:
txn.put(str(key), data)
def process_location(self, loc, lat_long):
if loc is None:
location = ['Unknown']
else:
# (street, locality, parish, city, county, state, country)
# We need to think about where to put ZIP code and Phone number
location = loc[0][:2] + (loc[1],) + loc[0][2:6]
location = list(location)
location.reverse()
items = [x for x in enumerate(location) if x[1]]
parent = None
for item in items:
parent = match_location(self, parent, item, lat_long)
return parent
def match_location(self, parent, item, lat_long):
for handle in self.children[parent]:
if self.location_map[handle][2] == item[1]:
return handle
handle = self.create_id()
self.children[handle] = []
self.children[parent].append(handle)
new_location = (handle,
str(parent),
item[1], # Name
item[0]+1, # Type
lat_long[0],
lat_long[1],
int(time.time()))
with BSDDBTxn(self.env, self.location_map) as txn:
txn.put(str(handle), new_location)
return handle
def gramps_upgrade_17(self):
"""Upgrade database from version 16 to 17. This upgrade adds tags to
event, place, repository, source and citation objects.
"""
length = (len(self.event_map) + len(self.place_map) +
len(self.repository_map) + len(self.source_map) +
len(self.citation_map))
self.set_total(length)
# ---------------------------------
# Modify Event
# ---------------------------------
# Add new tag_list field.
for handle in self.event_map.keys():
event = self.event_map[handle]
new_event = list(event)
new_event = new_event[:11] + [[]] + new_event[11:]
new_event = tuple(new_event)
with BSDDBTxn(self.env, self.event_map) as txn:
if isinstance(handle, UNITYPE):
handle = handle.encode('utf-8')
txn.put(handle, new_event)
self.update()
# ---------------------------------
# Modify Place
# ---------------------------------
# Add new tag_list field.
for handle in self.place_map.keys():
place = self.place_map[handle]
new_place = list(place)
new_place = new_place[:12] + [[]] + new_place[12:]
new_place = tuple(new_place)
with BSDDBTxn(self.env, self.place_map) as txn:
if isinstance(handle, UNITYPE):
handle = handle.encode('utf-8')
txn.put(handle, new_place)
self.update()
# ---------------------------------
# Modify Repository
# ---------------------------------
# Add new tag_list field.
for handle in self.repository_map.keys():
repository = self.repository_map[handle]
new_repository = list(repository)
new_repository = new_repository[:8] + [[]] + new_repository[8:]
new_repository = tuple(new_repository)
with BSDDBTxn(self.env, self.repository_map) as txn:
if isinstance(handle, UNITYPE):
handle = handle.encode('utf-8')
txn.put(handle, new_repository)
self.update()
# ---------------------------------
# Modify Source
# ---------------------------------
# Add new tag_list field.
for handle in self.source_map.keys():
source = self.source_map[handle]
new_source = list(source)
new_source = new_source[:11] + [[]] + new_source[11:]
new_source = tuple(new_source)
with BSDDBTxn(self.env, self.source_map) as txn:
if isinstance(handle, UNITYPE):
handle = handle.encode('utf-8')
txn.put(handle, new_source)
self.update()
# ---------------------------------
# Modify Citation
# ---------------------------------
# Add new tag_list field.
for handle in self.citation_map.keys():
citation = self.citation_map[handle]
new_citation = list(citation)
new_citation = new_citation[:10] + [[]] + new_citation[10:]
new_citation = tuple(new_citation)
with BSDDBTxn(self.env, self.citation_map) as txn:
if isinstance(handle, UNITYPE):
handle = handle.encode('utf-8')
txn.put(handle, new_citation)
self.update()
# Bump up database version. Separate transaction to save metadata.
with BSDDBTxn(self.env, self.metadata) as txn:
txn.put(b'version', 17)
def gramps_upgrade_16(self):
"""Upgrade database from version 15 to 16. This upgrade converts all
SourceRef child objects to Citation Primary objects.

View File

@ -40,13 +40,11 @@ else:
import pickle
import os
import time
import locale
import bisect
from functools import wraps
import logging
from sys import maxsize
from ..ggettext import gettext as _
from ..config import config
if config.get('preferences.use-bsddb3') or sys.version_info[0] >= 3:
from bsddb3 import dbshelve, db
@ -64,6 +62,7 @@ from ..lib.src import Source
from ..lib.citation import Citation
from ..lib.event import Event
from ..lib.place import Place
from ..lib.location import Location
from ..lib.repo import Repository
from ..lib.mediaobj import MediaObject
from ..lib.note import Note
@ -74,18 +73,20 @@ from ..lib.researcher import Researcher
from . import (DbBsddbRead, DbWriteBase, BSDDBTxn,
DbTxn, BsddbBaseCursor, BsddbDowngradeError, DbVersionError,
DbEnvironmentError, DbUpgradeRequiredError, find_surname,
find_surname_name, DbUndoBSDDB as DbUndo)
find_byte_surname, find_surname_name, DbUndoBSDDB as DbUndo)
from .dbconst import *
from ..utils.callback import Callback
from ..utils.cast import (conv_unicode_tosrtkey, conv_dbstr_to_unicode)
from ..utils.cast import conv_dbstr_to_unicode
from ..updatecallback import UpdateCallback
from ..errors import DbError
from ..constfunc import win, conv_to_unicode, cuni, UNITYPE
from ..constfunc import win, conv_to_unicode, cuni, UNITYPE, handle2internal
from ..const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
_LOG = logging.getLogger(DBLOGNAME)
LOG = logging.getLogger(".citation")
_MINVERSION = 9
_DBVERSION = 16
_DBVERSION = 18
IDTRANS = "person_id"
FIDTRANS = "family_id"
@ -97,6 +98,8 @@ NIDTRANS = "note_id"
SIDTRANS = "source_id"
CIDTRANS = "citation_id"
TAGTRANS = "tag_name"
LPARENTS = "location_parent"
LNAMES = "location_name"
SURNAMES = "surnames"
NAME_GROUP = "name_group"
META = "meta_data"
@ -111,6 +114,7 @@ PERSON_TBL = "person"
REPO_TBL = "repo"
NOTE_TBL = "note"
TAG_TBL = "tag"
LOCATION_TBL = "location"
REF_MAP = "reference_map"
REF_PRI = "primary_map"
@ -134,7 +138,8 @@ CLASS_TO_KEY_MAP = {Person.__name__: PERSON_KEY,
Place.__name__: PLACE_KEY,
Repository.__name__:REPOSITORY_KEY,
Note.__name__: NOTE_KEY,
Tag.__name__: TAG_KEY}
Tag.__name__: TAG_KEY,
Location.__name__: LOCATION_KEY}
KEY_TO_CLASS_MAP = {PERSON_KEY: Person.__name__,
FAMILY_KEY: Family.__name__,
@ -145,7 +150,8 @@ KEY_TO_CLASS_MAP = {PERSON_KEY: Person.__name__,
PLACE_KEY: Place.__name__,
REPOSITORY_KEY: Repository.__name__,
NOTE_KEY: Note.__name__,
TAG_KEY: Tag.__name__}
TAG_KEY: Tag.__name__,
LOCATION_KEY: Location.__name__}
KEY_TO_NAME_MAP = {PERSON_KEY: 'person',
FAMILY_KEY: 'family',
@ -157,13 +163,14 @@ KEY_TO_NAME_MAP = {PERSON_KEY: 'person',
REPOSITORY_KEY: 'repository',
#REFERENCE_KEY: 'reference',
NOTE_KEY: 'note',
TAG_KEY: 'tag'}
TAG_KEY: 'tag',
LOCATION_KEY: 'location'}
#-------------------------------------------------------------------------
#
# Helper functions
#
#-------------------------------------------------------------------------
def find_idmap(key, data):
""" return id for association of secondary index.
returns a byte string
@ -173,6 +180,20 @@ def find_idmap(key, data):
val = val.encode('utf-8')
return val
def find_parent(key, data):
return str(data[1])
val = data[1]
if isinstance(val, UNITYPE):
val = val.encode('utf-8')
return val
def find_name(key, data):
return str(data[2]).upper()
val = data[2].upper()
if isinstance(val, UNITYPE):
val = val.encode('utf-8')
return val
# Secondary database key lookups for reference_map table
# reference_map data values are of the form:
# ((primary_object_class_name, primary_object_handle),
@ -235,7 +256,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
# 1. Signals for primary objects
__signals__ = dict((obj+'-'+op, signal)
for obj in
['person', 'family', 'event', 'place',
['person', 'family', 'event', 'place', 'location',
'source', 'citation', 'media', 'note', 'repository', 'tag']
for op, signal in zip(
['add', 'update', 'delete', 'rebuild'],
@ -363,6 +384,20 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
return DbBsddbAssocCursor(self.reference_map_referenced_map,
self.txn)
@catch_db_error
def get_location_parent_cursor(self):
"""
Returns a reference to a cursor over the location parents
"""
return DbBsddbAssocCursor(self.parents, self.txn)
@catch_db_error
def get_location_name_cursor(self):
"""
Returns a reference to a cursor over the location names
"""
return DbBsddbAssocCursor(self.names, self.txn)
# These are overriding the DbBsddbRead's methods of saving metadata
# because we now have txn-capable metadata table
@ -444,7 +479,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
# See if we lack write access to any files in the directory
for base in [FAMILY_TBL, PLACES_TBL, SOURCES_TBL, CITATIONS_TBL,
MEDIA_TBL, EVENTS_TBL, PERSON_TBL, REPO_TBL,
NOTE_TBL, REF_MAP, META]:
NOTE_TBL, TAG_TBL, LOCATION_TBL, REF_MAP, META]:
path = os.path.join(name, base + DBEXT)
if os.path.isfile(path) and not os.access(path, os.W_OK):
return True
@ -558,6 +593,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
("repository_map", REPO_TBL, db.DB_HASH),
("note_map", NOTE_TBL, db.DB_HASH),
("tag_map", TAG_TBL, db.DB_HASH),
("location_map", LOCATION_TBL, db.DB_HASH),
("reference_map", REF_MAP, db.DB_BTREE),
]
@ -706,6 +742,8 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
("rid_trans", RIDTRANS, db.DB_HASH, 0),
("nid_trans", NIDTRANS, db.DB_HASH, 0),
("tag_trans", TAGTRANS, db.DB_HASH, 0),
("parents", LPARENTS, db.DB_HASH, 0),
("names", LNAMES, db.DB_BTREE, db.DB_DUPSORT),
("reference_map_primary_map", REF_PRI, db.DB_BTREE, 0),
("reference_map_referenced_map", REF_REF, db.DB_BTREE, db.DB_DUPSORT),
]
@ -718,7 +756,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
if not self.readonly:
assoc = [
(self.person_map, self.surnames, find_surname),
(self.person_map, self.surnames, find_byte_surname),
(self.person_map, self.id_trans, find_idmap),
(self.family_map, self.fid_trans, find_idmap),
(self.event_map, self.eid_trans, find_idmap),
@ -729,6 +767,8 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
(self.repository_map, self.rid_trans, find_idmap),
(self.note_map, self.nid_trans, find_idmap),
(self.tag_map, self.tag_trans, find_idmap),
(self.location_map, self.parents, find_parent),
(self.location_map, self.names, find_name),
(self.reference_map, self.reference_map_primary_map,
find_primary_handle),
(self.reference_map, self.reference_map_referenced_map,
@ -770,6 +810,8 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
( self.nid_trans, NIDTRANS ),
( self.cid_trans, CIDTRANS ),
( self.tag_trans, TAGTRANS ),
( self.parents, LPARENTS ),
( self.names, LNAMES ),
( self.reference_map_primary_map, REF_PRI),
( self.reference_map_referenced_map, REF_REF),
]
@ -796,6 +838,60 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
if callback:
callback(12)
@catch_db_error
def find_location_child_handles(self, handle):
"""
"""
handle = str(handle)
parent_cur = self.get_location_parent_cursor()
try:
ret = parent_cur.set(handle)
except:
ret = None
while (ret is not None):
(key, data) = ret
### FIXME: this is a dirty hack that works without no
### sensible explanation. For some reason, for a readonly
### database, secondary index returns a primary table key
### corresponding to the data, not the data.
if self.readonly:
data = self.location_map.get(data)
else:
data = pickle.loads(data)
yield data[0]
ret = parent_cur.next_dup()
parent_cur.close()
@catch_db_error
def find_location_from_name(self, name):
"""
"""
name = str(name).upper()
size = len(name)
name_cur = self.get_location_name_cursor()
try:
ret = name_cur.set_range(name)
ret = name_cur.current()
except:
ret = None
while (ret is not None):
(key, data) = ret
if key[:size] != name:
break
yield data[0]
ret = name_cur.next()
name_cur.close()
@catch_db_error
def find_backlink_handles(self, handle, include_classes=None):
"""
@ -857,6 +953,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
def delete_primary_from_reference_map(self, handle, transaction, txn=None):
"""
Remove all references to the primary object from the reference_map.
handle should be utf-8
"""
primary_cur = self.get_reference_map_primary_cursor()
@ -875,8 +972,12 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
# so we need the second tuple give us a reference that we can
# combine with the primary_handle to get the main key.
main_key = (handle, pickle.loads(data)[1][1])
if sys.version_info[0] < 3:
#handle should be in python 2 str
main_key = (handle, pickle.loads(data)[1][1])
else:
#python 3 work internally with unicode
main_key = (handle.decode('utf-8'), pickle.loads(data)[1][1])
# The trick is not to remove while inside the cursor,
# but collect them all and remove after the cursor is closed
@ -950,7 +1051,12 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
the passed transaction.
"""
if isinstance(key, tuple):
#create a string key
#create a byte string key, first validity check in python 3!
for val in key:
if sys.version_info[0] >= 3 and isinstance(val, bytes):
raise DbError(_('An attempt is made to safe a reference key '
'which is partly bytecode, this is not allowed.\n'
'Key is %s') % str(key))
key = str(key)
if isinstance(key, UNITYPE):
key = key.encode('utf-8')
@ -1143,6 +1249,8 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
self.cid_trans.close()
self.pid_trans.close()
self.tag_trans.close()
self.parents.close()
self.names.close()
self.reference_map_primary_map.close()
self.reference_map_referenced_map.close()
self.reference_map.close()
@ -1160,6 +1268,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
self.media_map.close()
self.event_map.close()
self.tag_map.close()
self.location_map.close()
self.env.close()
self.__close_undodb()
@ -1173,6 +1282,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
self.media_map = None
self.event_map = None
self.tag_map = None
self.location_map = None
self.surnames = None
self.env = None
self.metadata = None
@ -1191,6 +1301,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
self.media_map = None
self.event_map = None
self.tag_map = None
self.location_map = None
self.reference_map_primary_map = None
self.reference_map_referenced_map = None
self.reference_map = None
@ -1356,6 +1467,13 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
"""
return self.__add_object(obj, transaction, None, self.commit_tag)
def add_location(self, obj, transaction):
"""
Add a Location to the database, assigning a handle if it has not already
been defined.
"""
return self.__add_object(obj, transaction, None, self.commit_location)
def __do_remove(self, handle, transaction, data_map, key):
if self.readonly or not handle:
return
@ -1470,6 +1588,14 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
self.__do_remove(handle, transaction, self.tag_map,
TAG_KEY)
def remove_location(self, handle, transaction):
"""
Remove the Location specified by the database handle from the
database, preserving the change in the passed transaction.
"""
self.__do_remove(handle, transaction, self.location_map,
LOCATION_KEY)
@catch_db_error
def set_name_group_mapping(self, name, group):
if not self.readonly:
@ -1488,7 +1614,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
self.emit('person-groupname-rebuild', (name, grouppar))
def sort_surname_list(self):
self.surname_list.sort(key=conv_unicode_tosrtkey)
self.surname_list.sort(key=glocale.sort_key)
@catch_db_error
def build_surname_list(self):
@ -1500,7 +1626,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
#TODO GTK3: Why double conversion? Convert to a list of str objects!
self.surname_list = sorted(
map(conv_dbstr_to_unicode, set(self.surnames.keys())),
key=conv_unicode_tosrtkey)
key=glocale.sort_key)
def add_to_surname_list(self, person, batch_transaction):
"""
@ -1790,6 +1916,14 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
self.commit_base(tag, self.tag_map, TAG_KEY,
transaction, change_time)
def commit_location(self, location, transaction, change_time=None):
"""
Commit the specified Location to the database, storing the changes as
part of the transaction.
"""
self.commit_base(location, self.location_map, LOCATION_KEY,
transaction, change_time)
def get_from_handle(self, handle, class_type, data_map):
if isinstance(handle, UNITYPE):
handle = handle.encode('utf-8')
@ -1895,10 +2029,10 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
"""
if (obj_type, trans_type) in transaction:
if trans_type == TXNDEL:
handles = [handle for handle, data in
handles = [handle2internal(handle) for handle, data in
transaction[(obj_type, trans_type)]]
else:
handles = [handle for handle, data in
handles = [handle2internal(handle) for handle, data in
transaction[(obj_type, trans_type)]
if (handle, None) not in transaction[(obj_type,
TXNDEL)]]
@ -1994,6 +2128,10 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
upgrade.gramps_upgrade_15(self)
if version < 16:
upgrade.gramps_upgrade_16(self)
if version < 17:
upgrade.gramps_upgrade_17(self)
if version < 18:
upgrade.gramps_upgrade_18(self)
self.reset()
self.set_total(6)

View File

@ -53,8 +53,8 @@ Specific symbols for parts of a name are defined:
# Python modules
#
#-------------------------------------------------------------------------
from ..ggettext import sgettext as _
import sys
from ..const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().sgettext
import re
import logging
LOG = logging.getLogger(".gramps.gen")

View File

@ -40,6 +40,7 @@ import collections
from ._filterparser import FilterParser
from ..plug import BasePluginManager
from ..constfunc import STRTYPE
from ..const import GRAMPS_LOCALE as glocale
PLUGMAN = BasePluginManager.get_instance()
#-------------------------------------------------------------------------
@ -111,6 +112,7 @@ class FilterList(object):
parser.parse(the_file)
the_file.close()
except (IOError, OSError):
print("IO/OSError in _filterlist.py")
pass
except SAXParseException:
print("Parser error")
@ -123,7 +125,7 @@ class FilterList(object):
return l.replace('"', '&quot;')
def save(self):
f = open(self.file.encode(sys.getfilesystemencoding()), 'w')
f = open(self.file.encode(glocale.getfilesystemencoding()), 'w')
f.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
f.write('<filters>\n')
for namespace in self.filter_namespaces:

View File

@ -28,7 +28,8 @@
from __future__ import print_function, unicode_literals
from xml.sax import handler
from ..ggettext import gettext as _
from ..const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -26,7 +26,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ...ggettext import gettext as _
from ...const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
import re
import time

View File

@ -25,7 +25,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ...ggettext import gettext as _
from ...const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -25,7 +25,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ...ggettext import gettext as _
from ...const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -26,7 +26,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ...ggettext import gettext as _
from ...const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -25,7 +25,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ...ggettext import gettext as _
from ...const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -28,7 +28,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ...ggettext import gettext as _
from ...const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -26,7 +26,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ...ggettext import gettext as _
from ...const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -28,7 +28,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ...ggettext import gettext as _
from ...const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -29,7 +29,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ...ggettext import gettext as _
from ...const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -26,7 +26,8 @@
#
#-------------------------------------------------------------------------
import re
from ...ggettext import gettext as _
from ...const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -25,7 +25,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ...ggettext import gettext as _
from ...const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -25,7 +25,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ...ggettext import gettext as _
from ...const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -26,7 +26,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ...ggettext import gettext as _
from ...const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -28,7 +28,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ...ggettext import gettext as _
from ...const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -26,7 +26,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ...ggettext import gettext as _
from ...const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -27,7 +27,8 @@ Rule that checks for an object with a particular tag.
# Standard Python modules
#
#-------------------------------------------------------------------------
from ...ggettext import gettext as _
from ...const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -25,7 +25,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ...ggettext import gettext as _
from ...const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -23,7 +23,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ...ggettext import gettext as _
from ...const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -26,7 +26,8 @@
# GRAMPS modules
#
#-------------------------------------------------------------------------
from gramps.gen.ggettext import gettext as _
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
from . import Rule
#-------------------------------------------------------------------------

View File

@ -25,7 +25,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ...ggettext import gettext as _
from ...const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -25,14 +25,19 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ...ggettext import gettext as _
import logging
LOG = logging.getLogger(".filter")
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
from .. import CustomFilters
# we need global variableCustomFilters, so we need to query gramps.gen.filters
# when we need this variable, not import it at the start!
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
import gramps.gen.filters
from . import Rule
#-------------------------------------------------------------------------
@ -48,31 +53,36 @@ class MatchesFilterBase(Rule):
Subclasses need to define the namespace class attribute.
"""
labels = [_('Filter name:')]
name = 'Objects matching the <filter>'
description = "Matches objects matched by the specified filter name"
category = _('General filters')
def prepare(self, db):
if CustomFilters:
filters = CustomFilters.get_filters_dict(self.namespace)
if gramps.gen.filters.CustomFilters:
filters = gramps.gen.filters.CustomFilters.get_filters_dict(self.namespace)
if self.list[0] in filters:
filt = filters[self.list[0]]
for rule in filt.flist:
rule.requestprepare(db)
else:
LOG.warning(_("Can't find filter %s in the defined custom filters")
% self.list[0])
else:
LOG.warning(_("Can't find filter %s in the defined custom filters")
% self.list[0])
def reset(self):
if CustomFilters:
filters = CustomFilters.get_filters_dict(self.namespace)
if gramps.gen.filters.CustomFilters:
filters = gramps.gen.filters.CustomFilters.get_filters_dict(self.namespace)
if self.list[0] in filters:
filt = filters[self.list[0]]
for rule in filt.flist:
rule.requestreset()
def apply(self, db, obj):
if CustomFilters:
filters = CustomFilters.get_filters_dict(self.namespace)
if gramps.gen.filters.CustomFilters:
filters = gramps.gen.filters.CustomFilters.get_filters_dict(self.namespace)
if self.list[0] in filters:
filt = filters[self.list[0]]
return filt.check(db, obj.handle)
@ -82,8 +92,8 @@ class MatchesFilterBase(Rule):
"""
Return the selected filter or None.
"""
if CustomFilters:
filters = CustomFilters.get_filters_dict(self.namespace)
if gramps.gen.filters.CustomFilters:
filters = gramps.gen.filters.CustomFilters.get_filters_dict(self.namespace)
if self.list[0] in filters:
return filters[self.list[0]]
return None

View File

@ -29,7 +29,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ...ggettext import gettext as _
from ...const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -26,7 +26,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ...ggettext import gettext as _
from ...const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -26,7 +26,8 @@
#
#-------------------------------------------------------------------------
import re
from ...ggettext import gettext as _
from ...const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -30,7 +30,8 @@ Base class for filter rules.
# Standard Python modules
#
#-------------------------------------------------------------------------
from ...ggettext import gettext as _
from ...const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
import re
#-------------------------------------------------------------------------

View File

@ -42,6 +42,7 @@ from ._matchespagesubstringof import MatchesPageSubstringOf
from ._matchesrepositoryfilter import MatchesRepositoryFilter
from ._matchessourcefilter import MatchesSourceFilter
from ._regexpidof import RegExpIdOf
from ._hastag import HasTag
editor_rule_list = [
HasCitation,
@ -59,5 +60,6 @@ editor_rule_list = [
MatchesPageSubstringOf,
MatchesRepositoryFilter,
MatchesSourceFilter,
RegExpIdOf
RegExpIdOf,
HasTag
]

View File

@ -26,7 +26,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -26,7 +26,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -26,7 +26,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -28,7 +28,8 @@ Filter rule to match citation data.
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -28,7 +28,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -26,7 +26,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -29,7 +29,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -26,7 +26,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -26,7 +26,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -26,7 +26,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -29,7 +29,8 @@ Filter rule to match citation with a particular source.
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -0,0 +1,51 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2010 Nick Hall
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
"""
Rule that checks for a citation with a particular tag.
"""
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
from .._hastagbase import HasTagBase
#-------------------------------------------------------------------------
#
# HasTag
#
#-------------------------------------------------------------------------
class HasTag(HasTagBase):
"""
Rule that checks for a citation with a particular tag.
"""
labels = [ _('Tag:') ]
name = _('Citations with the <tag>')
description = _("Matches citations with the particular tag")

View File

@ -26,7 +26,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -25,7 +25,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -28,7 +28,8 @@
#-------------------------------------------------------------------------
import logging
LOG = logging.getLogger(".citation")
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -27,7 +27,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -26,7 +26,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -47,6 +47,7 @@ from ._matchessourcefilter import MatchesSourceFilter
from ._hasattribute import HasAttribute
from ._hasdata import HasData
from ._changedsince import ChangedSince
from ._hastag import HasTag
editor_rule_list = [
AllEvents,
@ -67,5 +68,6 @@ editor_rule_list = [
MatchesSourceFilter,
HasAttribute,
HasData,
ChangedSince
ChangedSince,
HasTag
]

View File

@ -25,7 +25,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -26,7 +26,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -25,7 +25,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -25,7 +25,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -29,7 +29,8 @@ Filter rule to match event with a particular citation.
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -25,7 +25,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -28,7 +28,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -25,7 +25,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -28,7 +28,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -25,7 +25,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -25,7 +25,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -25,7 +25,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -27,7 +27,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -0,0 +1,51 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2010 Nick Hall
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
"""
Rule that checks for an event with a particular tag.
"""
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
from .._hastagbase import HasTagBase
#-------------------------------------------------------------------------
#
# HasTag
#
#-------------------------------------------------------------------------
class HasTag(HasTagBase):
"""
Rule that checks for an event with a particular tag.
"""
labels = [ _('Tag:') ]
name = _('Events with the <tag>')
description = _("Matches events with the particular tag")

View File

@ -25,7 +25,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -25,7 +25,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -25,7 +25,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -26,7 +26,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import sgettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().sgettext
#-------------------------------------------------------------------------
#

View File

@ -27,7 +27,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -25,7 +25,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -60,6 +60,7 @@ from ._childhasnameof import ChildHasNameOf
from ._childhasidof import ChildHasIdOf
from ._changedsince import ChangedSince
from ._hastag import HasTag
from ._hastwins import HasTwins
editor_rule_list = [
AllFamilies,
@ -89,4 +90,5 @@ editor_rule_list = [
ChildHasIdOf,
ChangedSince,
HasTag,
HasTwins,
]

View File

@ -25,7 +25,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -26,7 +26,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -25,7 +25,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -25,7 +25,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -25,7 +25,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -25,7 +25,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

View File

@ -25,7 +25,8 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....ggettext import gettext as _
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#

Some files were not shown because too many files have changed in this diff Show More