Compare commits
315 Commits
v4.0.0-alp
...
v4.0.0-alp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
80db60b332 | ||
|
|
c06e8d3b64 | ||
|
|
c19c5e2569 | ||
|
|
992b161798 | ||
|
|
2dee2c4d77 | ||
|
|
96440156bd | ||
|
|
588089954a | ||
|
|
7e749a9e25 | ||
|
|
3e0fd433b5 | ||
|
|
8a4732a5d2 | ||
|
|
8371684a98 | ||
|
|
2828211c6a | ||
|
|
bf67b3e114 | ||
|
|
d01f7bf7df | ||
|
|
1d2b143be9 | ||
|
|
debf8b601a | ||
|
|
bcef9fc868 | ||
|
|
fae194d1a0 | ||
|
|
7aa1c2bbde | ||
|
|
2528da2f2d | ||
|
|
8ea29ede81 | ||
|
|
4ca0c9f8c9 | ||
|
|
5a8a7479dd | ||
|
|
c3f39e7d40 | ||
|
|
5235a6a6ac | ||
|
|
62475bbc87 | ||
|
|
a33eb1d799 | ||
|
|
6e73fc8924 | ||
|
|
06b8b291f8 | ||
|
|
98fa69b717 | ||
|
|
7c9ec32d22 | ||
|
|
e1fb1c5b14 | ||
|
|
7541dd5b2e | ||
|
|
e8bad4d4c8 | ||
|
|
d704d9ac4b | ||
|
|
d334e0043f | ||
|
|
dede164e69 | ||
|
|
f309f210d1 | ||
|
|
ebe1d0139c | ||
|
|
ebcd0bb119 | ||
|
|
fc8eb4f445 | ||
|
|
3ae8e5cc1e | ||
|
|
a03877e8c9 | ||
|
|
357eb8af19 | ||
|
|
c91eec3d5f | ||
|
|
870f80fc83 | ||
|
|
3ee5b1dec4 | ||
|
|
c37bfc9dbe | ||
|
|
bb494a56ca | ||
|
|
4a512c7347 | ||
|
|
e6034cde4b | ||
|
|
5e9837d484 | ||
|
|
57fcc67498 | ||
|
|
3872899ebc | ||
|
|
ad20c91b4f | ||
|
|
5df0c7d3ee | ||
|
|
daae9242bf | ||
|
|
114a71c13c | ||
|
|
7d7cc6f789 | ||
|
|
b99e2e29df | ||
|
|
44f065eabf | ||
|
|
b126aa1fc3 | ||
|
|
e2860c99f6 | ||
|
|
6cd609941f | ||
|
|
4a23da9500 | ||
|
|
73cdf3d86f | ||
|
|
d24586eb34 | ||
|
|
158a5f93fb | ||
|
|
7ff24aa9d1 | ||
|
|
bb2bcc4185 | ||
|
|
c8254b1c68 | ||
|
|
8d06298921 | ||
|
|
4621970783 | ||
|
|
123a6e0ecf | ||
|
|
3d0fa7a00a | ||
|
|
400523c7f3 | ||
|
|
0bbbc76852 | ||
|
|
252d2932df | ||
|
|
bffb6767aa | ||
|
|
0c07855f37 | ||
|
|
088c97106f | ||
|
|
bfa28faf55 | ||
|
|
8222d4c04c | ||
|
|
879c48f57d | ||
|
|
7127f8f2da | ||
|
|
db9daced3c | ||
|
|
c42cb6beee | ||
|
|
efa53a0537 | ||
|
|
bbf16cb40c | ||
|
|
d62ff6059e | ||
|
|
f3361500c0 | ||
|
|
df1157e9d4 | ||
|
|
11ad512f2d | ||
|
|
fd559d0d80 | ||
|
|
7a894d9a41 | ||
|
|
b6b3fb8680 | ||
|
|
755b653925 | ||
|
|
592f68ab6e | ||
|
|
0986d69429 | ||
|
|
98898ddb71 | ||
|
|
8cbba85cf1 | ||
|
|
c01846fb84 | ||
|
|
fccfdecd03 | ||
|
|
3f408af0fa | ||
|
|
8cea2e239a | ||
|
|
221c30976f | ||
|
|
e28e114c95 | ||
|
|
3788d52107 | ||
|
|
740c7036d7 | ||
|
|
eeaf8697f0 | ||
|
|
3fabbe1ecb | ||
|
|
d10d572002 | ||
|
|
3d0fa69bd0 | ||
|
|
a84d51d6b7 | ||
|
|
88831f8398 | ||
|
|
945bec0d6c | ||
|
|
dfb6be488d | ||
|
|
22bcc94ec0 | ||
|
|
d02f6a3fb1 | ||
|
|
76eae75da2 | ||
|
|
657d8e233f | ||
|
|
5bb9581b15 | ||
|
|
d6c4298ff4 | ||
|
|
260170ce36 | ||
|
|
801f1b77aa | ||
|
|
d5dfa05ff9 | ||
|
|
808002d419 | ||
|
|
4dc0f01137 | ||
|
|
aa7e0b49e4 | ||
|
|
3c103143a6 | ||
|
|
ef65c893ea | ||
|
|
566c3fb32b | ||
|
|
db1bd1e114 | ||
|
|
866796f5dc | ||
|
|
fdf740b35c | ||
|
|
1500556d99 | ||
|
|
5e4b2d3bdc | ||
|
|
880e6c44e7 | ||
|
|
4068bebb3e | ||
|
|
0465b9cf37 | ||
|
|
fed5cc6a71 | ||
|
|
69800680a3 | ||
|
|
a3a758fd13 | ||
|
|
eadae6dbc9 | ||
|
|
3ee843917e | ||
|
|
43c49238f5 | ||
|
|
641155478f | ||
|
|
6ca692e33a | ||
|
|
41fdca39dd | ||
|
|
bb3ac61359 | ||
|
|
a00a5ba32d | ||
|
|
efdb6e9fd5 | ||
|
|
ff12fdc4a3 | ||
|
|
3ef8a88a11 | ||
|
|
117b5b6594 | ||
|
|
6a5a78eee0 | ||
|
|
ba28adea94 | ||
|
|
17f938c978 | ||
|
|
54034d4811 | ||
|
|
45fc795964 | ||
|
|
0d9884186a | ||
|
|
e593d753ee | ||
|
|
2cd6aa43e4 | ||
|
|
7c82a5df48 | ||
|
|
23baca2f09 | ||
|
|
02fd2409c5 | ||
|
|
3b4496a808 | ||
|
|
235a1e72fd | ||
|
|
1af985dbc7 | ||
|
|
378f24272c | ||
|
|
6bc5bcf644 | ||
|
|
efbd0e95dd | ||
|
|
45a6524247 | ||
|
|
13c58292e3 | ||
|
|
5d8e37807c | ||
|
|
5feda5f56c | ||
|
|
5d46ae352d | ||
|
|
4c622a7b0f | ||
|
|
7e7ae7c42b | ||
|
|
0e172acd4c | ||
|
|
c221c1076a | ||
|
|
b2ae97c544 | ||
|
|
38f29ece86 | ||
|
|
383bd9548a | ||
|
|
97a37439d2 | ||
|
|
3ba99eb0b0 | ||
|
|
1e02a60f14 | ||
|
|
a5ffbb5e08 | ||
|
|
c36181d024 | ||
|
|
d91be2fd0b | ||
|
|
b23699d9ce | ||
|
|
313dcb77c2 | ||
|
|
348fa98341 | ||
|
|
7ac6856b60 | ||
|
|
e60ffbf83b | ||
|
|
5735799057 | ||
|
|
0446b7405d | ||
|
|
7be387e8fd | ||
|
|
f0cc7f35d6 | ||
|
|
b7d5bed60a | ||
|
|
c56fb05d1c | ||
|
|
64a8895df9 | ||
|
|
afefbeedf8 | ||
|
|
64ca5d105f | ||
|
|
1d3a687c0c | ||
|
|
fb56547589 | ||
|
|
e91a06dc1b | ||
|
|
096e57e36a | ||
|
|
44ea1b0fa8 | ||
|
|
3c75de2327 | ||
|
|
ca287ac12e | ||
|
|
bb392985f0 | ||
|
|
0625ed8109 | ||
|
|
5824a674d6 | ||
|
|
ee7ef78f6d | ||
|
|
6a287a6018 | ||
|
|
92ba36c349 | ||
|
|
54fd78c12a | ||
|
|
adb8a084a4 | ||
|
|
c133edec8e | ||
|
|
d3f8f73180 | ||
|
|
c081c5f6f5 | ||
|
|
41b4634d52 | ||
|
|
26ac4a6856 | ||
|
|
d4cd826b6f | ||
|
|
bd65cfcbea | ||
|
|
8bf43ccabb | ||
|
|
faac8fef8a | ||
|
|
1f825771b5 | ||
|
|
e677f40cab | ||
|
|
f9305d9e7f | ||
|
|
80625063a0 | ||
|
|
5923610e80 | ||
|
|
904dd024c6 | ||
|
|
a4abc9f26a | ||
|
|
f4e6ffb4be | ||
|
|
385641f092 | ||
|
|
e292eb0400 | ||
|
|
af953dec7c | ||
|
|
9a6f472ffd | ||
|
|
c572259d25 | ||
|
|
e613f02469 | ||
|
|
722f0f7589 | ||
|
|
2255acaa62 | ||
|
|
cac68a4110 | ||
|
|
599fe33470 | ||
|
|
222525e035 | ||
|
|
94d452d63c | ||
|
|
b30220b72b | ||
|
|
1604af190d | ||
|
|
711aba5272 | ||
|
|
2aa9aa1f48 | ||
|
|
d62e751285 | ||
|
|
2553cdc642 | ||
|
|
15e44633cf | ||
|
|
e5194e1462 | ||
|
|
af9f421d3f | ||
|
|
a3a8444fbe | ||
|
|
3401e86c60 | ||
|
|
4b6a95f211 | ||
|
|
d1765efa49 | ||
|
|
0bd44eeb84 | ||
|
|
32b6b27dca | ||
|
|
7dd022bddf | ||
|
|
642f837658 | ||
|
|
5f24c8834c | ||
|
|
d60bbe812b | ||
|
|
eee79d223b | ||
|
|
ddd1aae5c3 | ||
|
|
17824534cb | ||
|
|
a8c1530436 | ||
|
|
47fd0cf00f | ||
|
|
5105b4fd44 | ||
|
|
5b8d5b739a | ||
|
|
bb9601a2a0 | ||
|
|
81e1237b3c | ||
|
|
236da6da81 | ||
|
|
ca9f5de077 | ||
|
|
36008d3abe | ||
|
|
80d73f058c | ||
|
|
8d19b0198f | ||
|
|
9c69c3523e | ||
|
|
cae2814c97 | ||
|
|
421882c0e8 | ||
|
|
49585e1e96 | ||
|
|
904397ff11 | ||
|
|
5aa70b08a6 | ||
|
|
d080d15352 | ||
|
|
f3c4314a89 | ||
|
|
2284694530 | ||
|
|
15edee3a26 | ||
|
|
d0e698ffac | ||
|
|
addfaa933f | ||
|
|
e2fc32c4c0 | ||
|
|
46e8d865b1 | ||
|
|
c208b91184 | ||
|
|
ab6342af70 | ||
|
|
715ddbbab3 | ||
|
|
cc936c589b | ||
|
|
f554ffd57d | ||
|
|
46e9edaf59 | ||
|
|
29620a31ef | ||
|
|
ca2fd738d0 | ||
|
|
821caa8a5f | ||
|
|
3a45e70f54 | ||
|
|
89f6c7d83e | ||
|
|
ca73e01512 | ||
|
|
bfcecc646d | ||
|
|
77f9760504 | ||
|
|
3a93d03a4a | ||
|
|
03851db458 | ||
|
|
9f87dfd54b | ||
|
|
711e25e5bb | ||
|
|
f1eecb349d | ||
|
|
04baa6b50f |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -2,11 +2,12 @@
|
||||
*.py[cod]
|
||||
|
||||
# Distutils
|
||||
MANIFEST
|
||||
build/
|
||||
sdist/
|
||||
dist/
|
||||
|
||||
# Gramps
|
||||
gramps/data/tips.xml
|
||||
data/tips.xml
|
||||
gramps/gen/const.py
|
||||
gramps/plugins/lib/holidays.xml
|
||||
po/.intltool-merge-cache
|
||||
|
||||
22
MANIFEST.in
22
MANIFEST.in
@@ -11,34 +11,22 @@ include TestPlan.txt
|
||||
recursive-include data *
|
||||
recursive-include debian *
|
||||
recursive-include docs *
|
||||
recursive-include gramps *
|
||||
recursive-include help *
|
||||
recursive-include images *
|
||||
recursive-include mac *
|
||||
recursive-include po *
|
||||
recursive-include gramps *
|
||||
recursive-include test *
|
||||
recursive-include windows *
|
||||
|
||||
# Remove files created in the build
|
||||
exclude data/gramps.desktop
|
||||
exclude data/gramps.keys
|
||||
exclude data/gramps.xml
|
||||
recursive-exclude data/man *.1
|
||||
recursive-exclude data/man *.1.gz
|
||||
exclude gramps/const.py
|
||||
exclude gramps/data/tips.xml
|
||||
exclude data/tips.xml
|
||||
exclude gramps/gen/const.py
|
||||
exclude gramps/plugins/lib/holidays.xml
|
||||
exclude po/*.gmo
|
||||
exclude po/.intltool-merge-cache
|
||||
exclude po/stamp-it
|
||||
exclude po/POTFILES
|
||||
global-exclude *.pyc
|
||||
global-exclude *.py~
|
||||
global-exclude *.pyo
|
||||
global-exclude *.bak
|
||||
|
||||
# Remove directories which should not be included in the distribution
|
||||
prune gramps/guiQML
|
||||
prune gramps/webapp
|
||||
|
||||
# Remove Makefiles used by autotools
|
||||
global-exclude Makefile*
|
||||
#prune gramps/webapp
|
||||
|
||||
14
README
14
README
@@ -8,6 +8,7 @@ The following packages *MUST* be installed in order for Gramps to work:
|
||||
Python 2.7 or greater, Python 3.2 or greater (python version cannot be mixed)
|
||||
GTK 3.0 or greater
|
||||
pygobject 3.3.2 or greater
|
||||
cairo, pango, pangocairo with instrospection bindings (the gi packages)
|
||||
librsvg2 (svg icon view)
|
||||
xdg-utils
|
||||
|
||||
@@ -23,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.
|
||||
@@ -38,6 +39,14 @@ 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
|
||||
|
||||
ttf-freefont More font support in the reports
|
||||
|
||||
gir-webkit GObject introspection data of WebKit is required for the
|
||||
@@ -62,9 +71,6 @@ No longer needed in 3.2:
|
||||
No longer needed in 3.1:
|
||||
yelp Gnome help browser. At the moment no help is shipped
|
||||
|
||||
Remark: There is a conflict when using python-gnome2 in Ubuntu. This is evident
|
||||
with the error: TypeError: Error when calling the metaclass bases
|
||||
metaclass conflict
|
||||
|
||||
Documentation
|
||||
---------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"UNSTABLE Gramps 4.0.0 Alpha2 release.
|
||||
"UNSTABLE Gramps 4.0.0 Alpha5 release.
|
||||
|
||||
This is a technology preview to allow plugin writers and packagers-installer
|
||||
writers to update their plugins and scripts. This release is not production
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
# This is the data/man level Makefile for Gramps
|
||||
# $Id$
|
||||
|
||||
SUBDIRS = fr sv nl pl cs pt_BR
|
||||
|
||||
man_IN_FILES = gramps.1.in
|
||||
man_MANS = $(man_IN_FILES:.1.in=.1)
|
||||
|
||||
EXTRA_DIST = $(man_MANS) $(man_IN_FILES)
|
||||
|
||||
gramps.1: $(top_builddir)/config.status gramps.1.in
|
||||
cd $(top_builddir) && CONFIG_FILES=data/man/$@ $(SHELL) ./config.status
|
||||
|
||||
CLEANFILES=$(man_MANS)
|
||||
@@ -1,14 +0,0 @@
|
||||
# This is the data/man/sv level Makefile for Gramps
|
||||
# $Id: Makefile.am 6189 2006-03-21 19:05:46Z rshura $
|
||||
|
||||
man_IN_FILES = gramps.1.in
|
||||
man_MANS = $(man_IN_FILES:.1.in=.1)
|
||||
|
||||
mandir = @mandir@/cs
|
||||
|
||||
EXTRA_DIST = $(man_MANS) $(man_IN_FILES)
|
||||
|
||||
gramps.1: $(top_builddir)/config.status gramps.1.in
|
||||
cd $(top_builddir) && CONFIG_FILES=data/man/cs/$@ $(SHELL) ./config.status
|
||||
|
||||
CLEANFILES=$(man_MANS)
|
||||
@@ -1,14 +0,0 @@
|
||||
# This is the data/man/fr level Makefile for Gramps
|
||||
# $Id$
|
||||
|
||||
man_IN_FILES = gramps.1.in
|
||||
man_MANS = $(man_IN_FILES:.1.in=.1)
|
||||
|
||||
mandir = @mandir@/fr
|
||||
|
||||
EXTRA_DIST = $(man_MANS) $(man_IN_FILES)
|
||||
|
||||
gramps.1: $(top_builddir)/config.status gramps.1.in
|
||||
cd $(top_builddir) && CONFIG_FILES=data/man/fr/$@ $(SHELL) ./config.status
|
||||
|
||||
CLEANFILES=$(man_MANS)
|
||||
@@ -152,7 +152,7 @@ gramps(1) @VERSION@ gramps(1)
|
||||
|
||||
|
||||
**Opération**
|
||||
Si le premie argument de la ligne de commande ne commence pas par un
|
||||
Si le premier argument de la ligne de commande ne commence pas par un
|
||||
tiret (i.e. pas d'instruction), gramps va essayer d'ouvrir la base de
|
||||
données avec le nom donné par le premier argument et démarrer une ses‐
|
||||
sion interactive, en ignorant le reste de la ligne de commande.
|
||||
|
||||
@@ -172,7 +172,7 @@ Imprime le numéro de version pour gramps puis quitte.
|
||||
.UNINDENT
|
||||
.TP
|
||||
.B \fBOpération\fP
|
||||
Si le premie argument de la ligne de commande ne commence pas par un
|
||||
Si le premier argument de la ligne de commande ne commence pas par un
|
||||
tiret (i.e. pas d\(aqinstruction), gramps va essayer d\(aqouvrir la base de
|
||||
données avec le nom donné par le premier argument et démarrer une ses‐
|
||||
sion interactive, en ignorant le reste de la ligne de commande.
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
# This is the data/man/nl level Makefile for Gramps
|
||||
# $Id: Makefile.am 9819 2008-01-15 15:42:10Z bmcage $
|
||||
|
||||
mandir = @mandir@/nl
|
||||
|
||||
man_IN_FILES = gramps.1.in
|
||||
man_MANS = $(man_IN_FILES:.1.in=.1)
|
||||
|
||||
EXTRA_DIST = $(man_MANS) $(man_IN_FILES)
|
||||
|
||||
gramps.1: $(top_builddir)/config.status gramps.1.in
|
||||
cd $(top_builddir) && CONFIG_FILES=data/man/nl/$@ $(SHELL) ./config.status
|
||||
|
||||
CLEANFILES=$(man_MANS)
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
# This is the data/man/sv level Makefile for Gramps
|
||||
# $Id: Makefile.am 6189 2006-03-21 19:05:46Z rshura $
|
||||
|
||||
man_IN_FILES = gramps.1.in
|
||||
man_MANS = $(man_IN_FILES:.1.in=.1)
|
||||
|
||||
mandir = @mandir@/pl
|
||||
|
||||
EXTRA_DIST = $(man_MANS) $(man_IN_FILES)
|
||||
|
||||
gramps.1: $(top_builddir)/config.status gramps.1.in
|
||||
cd $(top_builddir) && CONFIG_FILES=data/man/pl/$@ $(SHELL) ./config.status
|
||||
|
||||
CLEANFILES=$(man_MANS)
|
||||
@@ -1,14 +0,0 @@
|
||||
# This is the data/pt_BR level Makefile for Gramps
|
||||
# $Id: Makefile.am 16377 2011-01-13 18:32:42Z matlas $
|
||||
|
||||
man_IN_FILES = gramps.1.in
|
||||
man_MANS = $(man_IN_FILES:.1.in=.1)
|
||||
|
||||
mandir = @mandir@/pt_BR
|
||||
|
||||
EXTRA_DIST = $(man_MANS) $(man_IN_FILES)
|
||||
|
||||
gramps.1: $(top_builddir)/config.status gramps.1.in
|
||||
cd $(top_builddir) && CONFIG_FILES=data/man/pt_BR/$@ $(SHELL) ./config.status
|
||||
|
||||
CLEANFILES=$(man_MANS)
|
||||
@@ -1,14 +0,0 @@
|
||||
# This is the data/man/sv level Makefile for Gramps
|
||||
# $Id: Makefile.am 6189 2006-03-21 19:05:46Z rshura $
|
||||
|
||||
man_IN_FILES = gramps.1.in
|
||||
man_MANS = $(man_IN_FILES:.1.in=.1)
|
||||
|
||||
mandir = @mandir@/sv
|
||||
|
||||
EXTRA_DIST = $(man_MANS) $(man_IN_FILES)
|
||||
|
||||
gramps.1: $(top_builddir)/config.status gramps.1.in
|
||||
cd $(top_builddir) && CONFIG_FILES=data/man/sv/$@ $(SHELL) ./config.status
|
||||
|
||||
CLEANFILES=$(man_MANS)
|
||||
@@ -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():
|
||||
|
||||
@@ -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():
|
||||
|
||||
@@ -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"])
|
||||
print(_("Family Tree \"%s\":") % summary["Family tree"].\
|
||||
encode(sys.stdout.encoding, 'backslashreplace'))
|
||||
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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
@@ -147,8 +148,8 @@ class CLIDbManager(object):
|
||||
from gramps.gen.db import META, PERSON_TBL
|
||||
env = db.DBEnv()
|
||||
flags = db.DB_CREATE | db.DB_PRIVATE |\
|
||||
db.DB_INIT_MPOOL | db.DB_INIT_LOCK |\
|
||||
db.DB_INIT_LOG | db.DB_INIT_TXN | db.DB_THREAD
|
||||
db.DB_INIT_MPOOL |\
|
||||
db.DB_INIT_LOG | db.DB_INIT_TXN
|
||||
try:
|
||||
env.open(file_name, flags)
|
||||
except:
|
||||
@@ -158,8 +159,9 @@ 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)
|
||||
version = dbmap1.get(b'version', default=None)
|
||||
dbmap1.close()
|
||||
dbmap2 = dbshelve.DBShelf(env)
|
||||
fname = os.path.join(file_name, PERSON_TBL + ".db")
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
@@ -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
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
# This is the src/data level Makefile for gramps
|
||||
# $Id$
|
||||
#
|
||||
SUBDIRS =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@/data
|
||||
|
||||
dist_pkgdata_DATA = \
|
||||
authors.xml \
|
||||
papersize.xml \
|
||||
tips.xml\
|
||||
lds.xml
|
||||
|
||||
# Rules for files with translatable strings
|
||||
# These are taken care of by the intltool
|
||||
xml_in_files = tips.xml.in
|
||||
xml_files = $(xml_in_files:.xml.in=.xml)
|
||||
@INTLTOOL_XML_NOMERGE_RULE@
|
||||
|
||||
EXTRA_DIST = $(xml_in_files)
|
||||
CLEANFILES = $(xml_files)
|
||||
@@ -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
|
||||
|
||||
@@ -151,7 +152,7 @@ register('behavior.surname-guessing', 0)
|
||||
register('behavior.use-tips', False)
|
||||
register('behavior.welcome', 100)
|
||||
register('behavior.web-search-url', 'http://google.com/#&q=%(text)s')
|
||||
register('behavior.addons-url', "http://gramps-addons.svn.sourceforge.net/viewvc/gramps-addons/branches/gramps40/")
|
||||
register('behavior.addons-url', "http://svn.code.sf.net/p/gramps-addons/code/branches/gramps40/")
|
||||
|
||||
register('export.proxy-order', [
|
||||
["privacy", 0],
|
||||
@@ -188,7 +189,7 @@ register('interface.clipboard-height', 300)
|
||||
register('interface.clipboard-width', 300)
|
||||
register('interface.dont-ask', False)
|
||||
register('interface.view-categories',
|
||||
["Gramplets", "People", "Relationships", "Families",
|
||||
["Dashboard", "People", "Relationships", "Families",
|
||||
"Ancestry", "Events", "Places", "Geography", "Sources",
|
||||
"Citations", "Repositories", "Media", "Notes"])
|
||||
register('interface.edit-filter-width', 500)
|
||||
@@ -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)
|
||||
@@ -279,6 +281,8 @@ register('preferences.date-format', 0)
|
||||
register('preferences.calendar-format-report', 0)
|
||||
register('preferences.cprefix', 'C%04d')
|
||||
register('preferences.default-source', False)
|
||||
register('preferences.tag-on-import', False)
|
||||
register('preferences.tag-on-import-format', _("Imported %Y/%m/%d %H:%M:%S"))
|
||||
register('preferences.eprefix', 'E%04d')
|
||||
register('preferences.family-warn', True)
|
||||
register('preferences.fprefix', 'F%04d')
|
||||
|
||||
@@ -42,7 +42,7 @@ import uuid
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from .ggettext import sgettext as _
|
||||
from .svn_revision import get_svn_revision
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@@ -50,11 +50,20 @@ from .ggettext import sgettext as _
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
PROGRAM_NAME = "Gramps"
|
||||
if "@VERSIONSTRING@" == "@" + "VERSIONSTRING" + "@":
|
||||
VERSION = "4.0.0"
|
||||
else:
|
||||
VERSION = "@VERSIONSTRING@"
|
||||
VERSION_TUPLE = (4, 0, 0)
|
||||
VERSION = "@VERSIONSTRING@"
|
||||
if VERSION == "@" + "VERSIONSTRING" + "@":
|
||||
raise Exception("Please run 'python setup.py build'")
|
||||
def get_version_tuple(v):
|
||||
""" Get the numeric-dotted part of version number"""
|
||||
retval = ""
|
||||
for c in v:
|
||||
if c.isdigit() or (c == "." and retval.count(".") <= 1):
|
||||
retval += c
|
||||
else:
|
||||
break
|
||||
return tuple(map(int, retval.split(".")))
|
||||
VERSION_TUPLE = get_version_tuple(VERSION)
|
||||
major_version = "%s.%s" % (VERSION_TUPLE[0], VERSION_TUPLE[1])
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@@ -65,11 +74,11 @@ URL_HOMEPAGE = "http://gramps-project.org/"
|
||||
URL_MAILINGLIST = "http://sourceforge.net/mail/?group_id=25770"
|
||||
URL_BUGTRACKER = "http://bugs.gramps-project.org/bug_report_advanced_page.php"
|
||||
URL_WIKISTRING = "http://gramps-project.org/wiki/index.php?title="
|
||||
URL_MANUAL_PAGE = "Gramps_4.0_Wiki_Manual"
|
||||
URL_MANUAL_PAGE = "Gramps_%s_Wiki_Manual" % major_version
|
||||
WIKI_FAQ = "FAQ"
|
||||
WIKI_KEYBINDINGS = "Gramps_4.0_Wiki_Manual_-_Keybindings"
|
||||
WIKI_EXTRAPLUGINS= "4.0_Addons"
|
||||
WIKI_EXTRAPLUGINS_RAWDATA = "Plugins4.0&action=raw"
|
||||
WIKI_KEYBINDINGS = "Gramps_%s_Wiki_Manual_-_Keybindings" % major_version
|
||||
WIKI_EXTRAPLUGINS= "%s_Addons" % major_version
|
||||
WIKI_EXTRAPLUGINS_RAWDATA = "Plugins%s&action=raw" % major_version
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@@ -90,7 +99,6 @@ APP_VCARD = ["text/x-vcard", "text/x-vcalendar"]
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
LOCALE_DIR = "@LOCALE_DIR@"
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Platforms
|
||||
@@ -133,24 +141,6 @@ if sys.version_info[0] < 3:
|
||||
else:
|
||||
pass
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Paths to files - assumes that files reside in the same directory as
|
||||
# this one, and that the plugins directory is in a directory below this.
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(
|
||||
__file__), os.pardir))
|
||||
if sys.version_info[0] < 3:
|
||||
# test for sys.frozen to detect a py2exe executable on Windows
|
||||
if hasattr(sys, "frozen"):
|
||||
ROOT_DIR = os.path.abspath(os.path.dirname(
|
||||
unicode(sys.executable, sys.getfilesystemencoding())))
|
||||
else:
|
||||
ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(
|
||||
unicode(__file__, sys.getfilesystemencoding())), os.pardir))
|
||||
|
||||
IMAGE_DIR = os.path.join(ROOT_DIR, "images")
|
||||
VERSION_DIR = os.path.join(
|
||||
HOME_DIR, "gramps%s%s" % (VERSION_TUPLE[0], VERSION_TUPLE[1]))
|
||||
|
||||
@@ -168,15 +158,28 @@ USER_PLUGINS = os.path.join(VERSION_DIR, "plugins")
|
||||
USER_DIRLIST = (HOME_DIR, VERSION_DIR, ENV_DIR, TEMP_DIR, THUMB_DIR,
|
||||
THUMB_NORMAL, THUMB_LARGE, USER_PLUGINS)
|
||||
|
||||
ICON = os.path.join(ROOT_DIR, "images", "gramps.png")
|
||||
LOGO = os.path.join(ROOT_DIR, "images", "logo.png")
|
||||
SPLASH = os.path.join(ROOT_DIR, "images", "splash.jpg")
|
||||
LICENSE_FILE = os.path.join(ROOT_DIR, "COPYING")
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Paths to python modules - assumes that the root directory is one level
|
||||
# above this one, and that the plugins directory is below the root directory.
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(
|
||||
__file__), os.pardir))
|
||||
if sys.version_info[0] < 3:
|
||||
# test for sys.frozen to detect a py2exe executable on Windows
|
||||
if hasattr(sys, "frozen"):
|
||||
ROOT_DIR = os.path.abspath(os.path.dirname(
|
||||
unicode(sys.executable, sys.getfilesystemencoding())))
|
||||
else:
|
||||
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
|
||||
#
|
||||
|
||||
GLADE_DIR = os.path.join(ROOT_DIR, "gui", "glade")
|
||||
GLADE_FILE = os.path.join(GLADE_DIR, "gramps.glade")
|
||||
PERSON_GLADE = os.path.join(GLADE_DIR, "edit_person.glade")
|
||||
@@ -186,29 +189,51 @@ RULE_GLADE = os.path.join(GLADE_DIR, "rule.glade")
|
||||
|
||||
|
||||
PLUGINS_DIR = os.path.join(ROOT_DIR, "plugins")
|
||||
DATA_DIR = os.path.join(ROOT_DIR, "data")
|
||||
WEB_DIR = os.path.join(ROOT_DIR, 'webapp')
|
||||
#SYSTEM_FILTERS = os.path.join(DATA_DIR, "system_filters.xml")
|
||||
TIP_DATA = os.path.join(DATA_DIR, "tips.xml")
|
||||
WEBSTUFF_DIR = os.path.join(PLUGINS_DIR, "webstuff")
|
||||
WEBSTUFF_IMAGE_DIR = os.path.join(WEBSTUFF_DIR, "images")
|
||||
|
||||
PAPERSIZE = os.path.join(DATA_DIR, "papersize.xml")
|
||||
|
||||
USE_TIPS = False
|
||||
USE_TIPS = False
|
||||
|
||||
if os.sys.platform in WINDOWS:
|
||||
USE_THUMBNAILER = False
|
||||
else:
|
||||
USE_THUMBNAILER = True
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Paths to data files.
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
LOCALE_DIR = "@LOCALE_DIR@"
|
||||
DATA_DIR = "@DATA_DIR@"
|
||||
IMAGE_DIR = "@IMAGE_DIR@"
|
||||
DOC_DIR = "@DOC_DIR@"
|
||||
|
||||
TIP_DATA = os.path.join(DATA_DIR, "tips.xml")
|
||||
PAPERSIZE = os.path.join(DATA_DIR, "papersize.xml")
|
||||
|
||||
ICON = os.path.join(IMAGE_DIR, "gramps.png")
|
||||
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 gramps.gen.utils.grampslocale import GrampsLocale
|
||||
GRAMPS_LOCALE = GrampsLocale()
|
||||
_ = GRAMPS_LOCALE.get_translation().sgettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# About box information
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
COPYRIGHT_MSG = "© 2001-2006 Donald N. Allingham\n" \
|
||||
"© 2007-2012 The Gramps Developers"
|
||||
"© 2007-2013 The Gramps Developers"
|
||||
COMMENTS = _("Gramps (Genealogical Research and Analysis "
|
||||
"Management Programming System) is a personal "
|
||||
"genealogy program.")
|
||||
@@ -313,3 +338,29 @@ LONGOPTS = [
|
||||
SHORTOPTS = "O:C:i:e:f:a:p:d:c:lLhuv?s"
|
||||
|
||||
GRAMPS_UUID = uuid.UUID('516cd010-5a41-470f-99f8-eb22f1098ad6')
|
||||
|
||||
def need_to_update_const():
|
||||
""" Check to see if this file is older than
|
||||
setup.py or const.py.in """
|
||||
this_file = os.path.join(ROOT_DIR, "gen", "const.py")
|
||||
in_file = os.path.join(ROOT_DIR, "gen", "const.py.in")
|
||||
setup_file = os.path.join(ROOT_DIR, "..", "setup.py")
|
||||
|
||||
if (os.path.exists(this_file) and
|
||||
os.path.exists(in_file) and
|
||||
os.path.exists(setup_file)):
|
||||
|
||||
this_file_time = os.path.getmtime(this_file)
|
||||
in_file_time = os.path.getmtime(in_file)
|
||||
setup_file_time = os.path.getmtime(setup_file)
|
||||
|
||||
# Is this file older than others? If so,
|
||||
# need to run setup
|
||||
return (this_file_time < in_file_time or
|
||||
this_file_time < setup_file_time)
|
||||
else:
|
||||
# Can't tell because can't find the files
|
||||
return False
|
||||
|
||||
if need_to_update_const():
|
||||
print("Outdated gramps.gen.const; please run 'python setup.py build'")
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -24,8 +24,15 @@
|
||||
Class handling language-specific selection for date parser and displayer.
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# set up logging
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import logging
|
||||
|
||||
from ..const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.get_translation().sgettext
|
||||
# import prerequisites for localized handlers
|
||||
from ._datehandler import (LANG, LANG_SHORT, LANG_TO_PARSER, LANG_TO_DISPLAY,
|
||||
register_datehandler)
|
||||
@@ -59,7 +66,7 @@ try:
|
||||
else:
|
||||
parser = LANG_TO_PARSER[LANG_SHORT]()
|
||||
except:
|
||||
print("Date parser for", LANG, "not available, using default")
|
||||
logging.warning(_("Date parser for '%s' not available, using default") % LANG)
|
||||
parser = LANG_TO_PARSER["C"]()
|
||||
|
||||
# Initialize global displayer
|
||||
@@ -75,7 +82,7 @@ try:
|
||||
else:
|
||||
displayer = LANG_TO_DISPLAY[LANG_SHORT](val)
|
||||
except:
|
||||
print("Date displayer for", LANG, "not available, using default")
|
||||
logging.warning(_("Date displayer for '%s' not available, using default") % LANG)
|
||||
displayer = LANG_TO_DISPLAY["C"](val)
|
||||
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -40,8 +42,9 @@ if sys.version_info[0] < 3:
|
||||
else:
|
||||
#locale returns unicode in python 3
|
||||
to_uni = lambda x, y: x
|
||||
codeset = glocale.encoding
|
||||
|
||||
try:
|
||||
codeset = locale.nl_langinfo(locale.CODESET)
|
||||
|
||||
month_to_int = {
|
||||
to_uni(locale.nl_langinfo(locale.MON_1), codeset).lower() : 1,
|
||||
@@ -137,69 +140,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 +211,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
|
||||
|
||||
@@ -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
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -198,8 +198,8 @@ if __name__ == "__main__":
|
||||
x = db.DBEnv()
|
||||
print("3")
|
||||
x.open('/tmp', db.DB_CREATE | db.DB_PRIVATE |\
|
||||
db.DB_INIT_MPOOL | db.DB_INIT_LOCK |\
|
||||
db.DB_INIT_LOG | db.DB_INIT_TXN | db.DB_THREAD)
|
||||
db.DB_INIT_MPOOL |\
|
||||
db.DB_INIT_LOG | db.DB_INIT_TXN)
|
||||
print("4")
|
||||
d = dbshelve.DBShelf(x)
|
||||
print("5")
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
@@ -80,6 +80,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")
|
||||
@@ -102,6 +103,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
|
||||
@@ -127,7 +139,10 @@ def __index_surname(surn_list):
|
||||
NameOriginType.PATRONYMIC, NameOriginType.MATRONYMIC]) ])
|
||||
else:
|
||||
surn = ""
|
||||
return surn.encode('utf-8')
|
||||
if sys.version_info[0] < 3:
|
||||
return surn.encode('utf-8')
|
||||
else:
|
||||
return surn
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@@ -1627,7 +1642,7 @@ class DbBsddbRead(DbReadBase, Callback):
|
||||
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):
|
||||
@@ -1635,13 +1650,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):
|
||||
@@ -1650,13 +1665,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):
|
||||
@@ -1665,13 +1680,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):
|
||||
@@ -1680,13 +1695,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):
|
||||
@@ -1695,13 +1710,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."""
|
||||
|
||||
@@ -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
|
||||
@@ -67,6 +69,7 @@ DBERRS = (db.DBRunRecoveryError, db.DBAccessError,
|
||||
|
||||
_SIGBASE = ('person', 'family', 'source', 'event', 'media',
|
||||
'place', 'repository', 'reference', 'note', 'tag', 'citation')
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# DbUndo class
|
||||
@@ -315,7 +318,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 +327,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()
|
||||
|
||||
@@ -30,7 +30,8 @@ import time
|
||||
import logging
|
||||
LOG = logging.getLogger(".citation")
|
||||
|
||||
from ..ggettext import gettext as _
|
||||
from ..const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.get_translation().gettext
|
||||
from ..constfunc import cuni
|
||||
|
||||
"""
|
||||
@@ -144,7 +145,9 @@ def gramps_upgrade_16(self):
|
||||
new_citation_list, note_list, change, tag_list,
|
||||
private, person_ref_list)
|
||||
with BSDDBTxn(self.env, self.person_map) as txn:
|
||||
txn.put(str(handle), new_person)
|
||||
if isinstance(handle, UNITYPE):
|
||||
handle = handle.encode('utf-8')
|
||||
txn.put(handle, new_person)
|
||||
self.update()
|
||||
|
||||
LOG.debug("%d persons upgraded with %d citations in %d seconds. " %
|
||||
@@ -176,7 +179,9 @@ def gramps_upgrade_16(self):
|
||||
change, date, tag_list, private)
|
||||
LOG.debug(" upgrade new_media %s" % [new_media])
|
||||
with BSDDBTxn(self.env, self.media_map) as txn:
|
||||
txn.put(str(handle), new_media)
|
||||
if isinstance(handle, UNITYPE):
|
||||
handle = handle.encode('utf-8')
|
||||
txn.put(handle, new_media)
|
||||
LOG.debug(" update ref map media %s" % [handle,
|
||||
self.get_object_from_handle(handle) ])
|
||||
self.update()
|
||||
@@ -195,7 +200,7 @@ def gramps_upgrade_16(self):
|
||||
start_time = time.time()
|
||||
for place_handle in self.place_map.keys():
|
||||
place = self.place_map[place_handle]
|
||||
(handle, gramps_id, title, int, lat,
|
||||
(handle, gramps_id, title, longi, lat,
|
||||
main_loc, alt_loc, urls, media_list, source_list, note_list,
|
||||
change, private) = place
|
||||
if source_list:
|
||||
@@ -208,11 +213,13 @@ def gramps_upgrade_16(self):
|
||||
self, media_list)
|
||||
if source_list or media_list:
|
||||
new_place = (handle, gramps_id, title,
|
||||
int, lat, main_loc, alt_loc, urls,
|
||||
longi, lat, main_loc, alt_loc, urls,
|
||||
media_list, new_citation_list, note_list,
|
||||
change, private)
|
||||
with BSDDBTxn(self.env, self.place_map) as txn:
|
||||
txn.put(str(handle), new_place)
|
||||
if isinstance(handle, UNITYPE):
|
||||
handle = handle.encode('utf-8')
|
||||
txn.put(handle, new_place)
|
||||
self.update()
|
||||
|
||||
LOG.debug("%d places upgraded with %d citations in %d seconds. " %
|
||||
@@ -260,7 +267,9 @@ def gramps_upgrade_16(self):
|
||||
attribute_list, lds_seal_list, new_citation_list,
|
||||
note_list, change, tag_list, private)
|
||||
with BSDDBTxn(self.env, self.family_map) as txn:
|
||||
txn.put(str(handle), new_family)
|
||||
if isinstance(handle, UNITYPE):
|
||||
handle = handle.encode('utf-8')
|
||||
txn.put(handle, new_family)
|
||||
self.update()
|
||||
|
||||
LOG.debug("%d familys upgraded with %d citations in %d seconds. " %
|
||||
@@ -300,7 +309,9 @@ def gramps_upgrade_16(self):
|
||||
attribute_list,
|
||||
change, private)
|
||||
with BSDDBTxn(self.env, self.event_map) as txn:
|
||||
txn.put(str(handle), new_event)
|
||||
if isinstance(handle, UNITYPE):
|
||||
handle = handle.encode('utf-8')
|
||||
txn.put(handle, new_event)
|
||||
t2 = time.time()
|
||||
upgrade_time += t2 - t1
|
||||
t3 = time.time()
|
||||
@@ -332,7 +343,9 @@ def gramps_upgrade_16(self):
|
||||
new_repository = (handle, gramps_id, the_type, name, note_list,
|
||||
address_list, urls, change, private)
|
||||
with BSDDBTxn(self.env, self.repository_map) as txn:
|
||||
txn.put(str(handle), new_repository)
|
||||
if isinstance(handle, UNITYPE):
|
||||
handle = handle.encode('utf-8')
|
||||
txn.put(handle, new_repository)
|
||||
self.update()
|
||||
|
||||
LOG.debug("%d repositorys upgraded with %d citations in %d seconds. " %
|
||||
@@ -535,7 +548,9 @@ def convert_source_list_to_citation_list_16(self, source_list):
|
||||
date, page, confidence, ref, note_list, new_media_list,
|
||||
new_data_map, new_change, private)
|
||||
with BSDDBTxn(self.env, self.citation_map) as txn:
|
||||
txn.put(str(new_handle), new_citation)
|
||||
if isinstance(new_handle, UNITYPE):
|
||||
new_handle = new_handle.encode('utf-8')
|
||||
txn.put(new_handle, new_citation)
|
||||
self.cmap_index += 1
|
||||
# # add backlinks for references from Citation to Source
|
||||
# with BSDDBTxn(self.env) as txn:
|
||||
@@ -621,7 +636,9 @@ def gramps_upgrade_15(self):
|
||||
)
|
||||
|
||||
with BSDDBTxn(self.env, self.person_map) as txn:
|
||||
txn.put(str(handle), new_person)
|
||||
if isinstance(handle, UNITYPE):
|
||||
handle = handle.encode('utf-8')
|
||||
txn.put(handle, new_person)
|
||||
self.update()
|
||||
#surname is now different, remove secondary index with names
|
||||
_db = db.DB(self.env)
|
||||
@@ -644,7 +661,9 @@ def gramps_upgrade_15(self):
|
||||
new_family[13] = []
|
||||
new_family = tuple(new_family)
|
||||
with BSDDBTxn(self.env, self.family_map) as txn:
|
||||
txn.put(str(handle), new_family)
|
||||
if isinstance(handle, UNITYPE):
|
||||
handle = handle.encode('utf-8')
|
||||
txn.put(handle, new_family)
|
||||
self.update()
|
||||
|
||||
# ---------------------------------
|
||||
@@ -661,7 +680,9 @@ def gramps_upgrade_15(self):
|
||||
new_note[6] = []
|
||||
new_note = tuple(new_note)
|
||||
with BSDDBTxn(self.env, self.note_map) as txn:
|
||||
txn.put(str(handle), new_note)
|
||||
if isinstance(handle, UNITYPE):
|
||||
handle = handle.encode('utf-8')
|
||||
txn.put(handle, new_note)
|
||||
self.update()
|
||||
|
||||
# ---------------------------------
|
||||
@@ -674,7 +695,9 @@ def gramps_upgrade_15(self):
|
||||
new_media[10] = []
|
||||
new_media = tuple(new_media)
|
||||
with BSDDBTxn(self.env, self.media_map) as txn:
|
||||
txn.put(str(handle), new_media)
|
||||
if isinstance(handle, UNITYPE):
|
||||
handle = handle.encode('utf-8')
|
||||
txn.put(handle, new_media)
|
||||
self.update()
|
||||
|
||||
# ---------------------------------
|
||||
@@ -688,7 +711,9 @@ def gramps_upgrade_15(self):
|
||||
#new_event[11] = []
|
||||
new_event = tuple(new_event)
|
||||
with BSDDBTxn(self.env, self.event_map) as txn:
|
||||
txn.put(str(handle), new_event)
|
||||
if isinstance(handle, UNITYPE):
|
||||
handle = handle.encode('utf-8')
|
||||
txn.put(handle, new_event)
|
||||
self.update()
|
||||
|
||||
# ---------------------------------
|
||||
@@ -704,7 +729,9 @@ def gramps_upgrade_15(self):
|
||||
new_place = new_place[:12] + new_place[13:]
|
||||
new_place = tuple(new_place)
|
||||
with BSDDBTxn(self.env, self.place_map) as txn:
|
||||
txn.put(str(handle), new_place)
|
||||
if isinstance(handle, UNITYPE):
|
||||
handle = handle.encode('utf-8')
|
||||
txn.put(handle, new_place)
|
||||
self.update()
|
||||
|
||||
# ---------------------------------
|
||||
@@ -717,7 +744,9 @@ def gramps_upgrade_15(self):
|
||||
new_source = new_source[:11] + new_source[12:]
|
||||
new_source = tuple(new_source)
|
||||
with BSDDBTxn(self.env, self.source_map) as txn:
|
||||
txn.put(str(handle), new_source)
|
||||
if isinstance(handle, UNITYPE):
|
||||
handle = handle.encode('utf-8')
|
||||
txn.put(handle, new_source)
|
||||
self.update()
|
||||
|
||||
# ---------------------------------
|
||||
@@ -731,7 +760,9 @@ def gramps_upgrade_15(self):
|
||||
new_repository[5] = list(map(convert_address, new_repository[5]))
|
||||
new_repository = tuple(new_repository)
|
||||
with BSDDBTxn(self.env, self.repository_map) as txn:
|
||||
txn.put(str(handle), new_repository)
|
||||
if isinstance(handle, UNITYPE):
|
||||
handle = handle.encode('utf-8')
|
||||
txn.put(handle, new_repository)
|
||||
self.update()
|
||||
|
||||
# Bump up database version. Separate transaction to save metadata.
|
||||
@@ -753,6 +784,8 @@ def convert_marker(self, marker_field):
|
||||
tag.set_name(tag_name)
|
||||
tag.set_priority(len(self.tags))
|
||||
with BSDDBTxn(self.env, self.tag_map) as txn:
|
||||
if isinstance(handle, UNITYPE):
|
||||
handle = handle.encode('utf-8')
|
||||
txn.put(handle, tag.serialize())
|
||||
self.tags[tag_name] = handle
|
||||
return self.tags[tag_name]
|
||||
@@ -819,7 +852,9 @@ def gramps_upgrade_14(self):
|
||||
new_note = (handle, gramps_id, styled_text, format, note_type,
|
||||
change, marker, private)
|
||||
with BSDDBTxn(self.env, self.note_map) as txn:
|
||||
txn.put(str(handle), new_note)
|
||||
if isinstance(handle, UNITYPE):
|
||||
handle = handle.encode('utf-8')
|
||||
txn.put(handle, new_note)
|
||||
self.update()
|
||||
|
||||
# ---------------------------------
|
||||
@@ -839,7 +874,9 @@ def gramps_upgrade_14(self):
|
||||
description, place, new_source_list, note_list,
|
||||
new_media_list, new_attribute_list, change,marker,private)
|
||||
with BSDDBTxn(self.env, self.event_map) as txn:
|
||||
txn.put(str(handle), new_event)
|
||||
if isinstance(handle, UNITYPE):
|
||||
handle = handle.encode('utf-8')
|
||||
txn.put(handle, new_event)
|
||||
self.update()
|
||||
|
||||
# ---------------------------------
|
||||
@@ -921,7 +958,9 @@ def gramps_upgrade_14(self):
|
||||
)
|
||||
|
||||
with BSDDBTxn(self.env, self.person_map) as txn:
|
||||
txn.put(str(handle), new_person)
|
||||
if isinstance(handle, UNITYPE):
|
||||
handle = handle.encode('utf-8')
|
||||
txn.put(handle, new_person)
|
||||
self.update()
|
||||
|
||||
# ---------------------------------
|
||||
@@ -953,7 +992,9 @@ def gramps_upgrade_14(self):
|
||||
change, marker, private)
|
||||
|
||||
with BSDDBTxn(self.env, self.family_map) as txn:
|
||||
txn.put(str(handle), new_family)
|
||||
if isinstance(handle, UNITYPE):
|
||||
handle = handle.encode('utf-8')
|
||||
txn.put(handle, new_family)
|
||||
self.update()
|
||||
|
||||
# ---------------------------------
|
||||
@@ -978,7 +1019,9 @@ def gramps_upgrade_14(self):
|
||||
new_address_list, urls, change, marker, private)
|
||||
|
||||
with BSDDBTxn(self.env, self.repository_map) as txn:
|
||||
txn.put(str(handle), new_repository)
|
||||
if isinstance(handle, UNITYPE):
|
||||
handle = handle.encode('utf-8')
|
||||
txn.put(handle, new_repository)
|
||||
self.update()
|
||||
|
||||
# ---------------------------------
|
||||
@@ -996,7 +1039,9 @@ def gramps_upgrade_14(self):
|
||||
new_date, marker, private)
|
||||
|
||||
with BSDDBTxn(self.env, self.media_map) as txn:
|
||||
txn.put(str(handle), new_media)
|
||||
if isinstance(handle, UNITYPE):
|
||||
handle = handle.encode('utf-8')
|
||||
txn.put(handle, new_media)
|
||||
self.update()
|
||||
|
||||
# ---------------------------------
|
||||
@@ -1004,17 +1049,19 @@ def gramps_upgrade_14(self):
|
||||
# ---------------------------------
|
||||
for place_handle in self.place_map.keys():
|
||||
place = self.place_map[place_handle]
|
||||
(handle, gramps_id, title, int, lat,
|
||||
(handle, gramps_id, title, longi, lat,
|
||||
main_loc, alt_loc, urls, media_list, source_list, note_list,
|
||||
change, marker, private) = place
|
||||
new_media_list = new_media_list_14(media_list)
|
||||
new_source_list = new_source_list_14(source_list)
|
||||
new_place = (handle, gramps_id, title, int, lat,
|
||||
new_place = (handle, gramps_id, title, longi, lat,
|
||||
main_loc, alt_loc, urls, new_media_list,
|
||||
new_source_list, note_list, change, marker, private)
|
||||
|
||||
with BSDDBTxn(self.env, self.place_map) as txn:
|
||||
txn.put(str(handle), new_place)
|
||||
if isinstance(handle, UNITYPE):
|
||||
handle = handle.encode('utf-8')
|
||||
txn.put(handle, new_place)
|
||||
self.update()
|
||||
|
||||
# ---------------------------------
|
||||
@@ -1033,7 +1080,9 @@ def gramps_upgrade_14(self):
|
||||
marker, private)
|
||||
|
||||
with BSDDBTxn(self.env, self.source_map) as txn:
|
||||
txn.put(str(handle), new_source)
|
||||
if isinstance(handle, UNITYPE):
|
||||
handle = handle.encode('utf-8')
|
||||
txn.put(handle, new_source)
|
||||
self.update()
|
||||
|
||||
# Bump up database version. Separate transaction to save metadata.
|
||||
|
||||
@@ -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
|
||||
@@ -74,13 +72,15 @@ 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")
|
||||
@@ -163,7 +163,7 @@ KEY_TO_NAME_MAP = {PERSON_KEY: 'person',
|
||||
# Helper functions
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
|
||||
def find_idmap(key, data):
|
||||
""" return id for association of secondary index.
|
||||
returns a byte string
|
||||
@@ -495,8 +495,8 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
||||
|
||||
# The DB_PRIVATE flag must go if we ever move to multi-user setup
|
||||
env_flags = db.DB_CREATE | db.DB_PRIVATE |\
|
||||
db.DB_INIT_MPOOL | db.DB_INIT_LOCK |\
|
||||
db.DB_INIT_LOG | db.DB_INIT_TXN | db.DB_THREAD
|
||||
db.DB_INIT_MPOOL |\
|
||||
db.DB_INIT_LOG | db.DB_INIT_TXN
|
||||
|
||||
# As opposed to before, we always try recovery on databases
|
||||
env_flags |= db.DB_RECOVER
|
||||
@@ -718,7 +718,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),
|
||||
@@ -857,6 +857,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 +876,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 +955,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')
|
||||
@@ -1125,11 +1135,6 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
||||
self.transaction_abort(self.transaction)
|
||||
self.env.txn_checkpoint()
|
||||
|
||||
lockstats = self.env.lock_stat()
|
||||
_LOG.debug("lock occupancy: %d%%, locked object occupancy: %d%%" % (
|
||||
round(lockstats['maxnlocks']*100/lockstats['maxlocks']),
|
||||
round(lockstats['maxnobjects']*100/lockstats['maxobjects'])))
|
||||
|
||||
self.__close_metadata()
|
||||
self.name_group.close()
|
||||
self.surnames.close()
|
||||
@@ -1488,7 +1493,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 +1505,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):
|
||||
"""
|
||||
@@ -1895,10 +1900,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)]]
|
||||
@@ -2045,8 +2050,8 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
||||
|
||||
# The DB_PRIVATE flag must go if we ever move to multi-user setup
|
||||
env_flags = db.DB_CREATE | db.DB_PRIVATE |\
|
||||
db.DB_INIT_MPOOL | db.DB_INIT_LOCK |\
|
||||
db.DB_INIT_LOG | db.DB_INIT_TXN | db.DB_THREAD
|
||||
db.DB_INIT_MPOOL |\
|
||||
db.DB_INIT_LOG | db.DB_INIT_TXN
|
||||
|
||||
# As opposed to before, we always try recovery on databases
|
||||
env_flags |= db.DB_RECOVER
|
||||
|
||||
@@ -53,8 +53,11 @@ Specific symbols for parts of a name are defined:
|
||||
# Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from ..ggettext import sgettext as _
|
||||
from ..const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.get_translation().sgettext
|
||||
import re
|
||||
import logging
|
||||
LOG = logging.getLogger(".gramps.gen")
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@@ -1047,8 +1050,17 @@ def fn(%s):
|
||||
else:
|
||||
return p + str + s
|
||||
return cleanup_name("%s" %% (%s))""" % (args, new_fmt, ",".join(param))
|
||||
exec(s)
|
||||
|
||||
return locals()['fn']
|
||||
try:
|
||||
exec(s) in globals(), locals()
|
||||
return locals()['fn']
|
||||
except:
|
||||
LOG.error("\n" + 'Wrong name format string %s' % new_fmt
|
||||
+"\n" + ("ERROR, Edit Name format in Preferences->Display to correct")
|
||||
+"\n" + _('Wrong name format string %s') % new_fmt
|
||||
+"\n" + ("ERROR, Edit Name format in Preferences->Display to correct")
|
||||
)
|
||||
def errfn(*arg):
|
||||
return _("ERROR, Edit Name format in Preferences")
|
||||
return errfn
|
||||
|
||||
displayer = NameDisplay()
|
||||
|
||||
@@ -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('"', '"')
|
||||
|
||||
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:
|
||||
|
||||
@@ -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
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
# Standard Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from ...ggettext import gettext as _
|
||||
from ...const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.get_translation().gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
# Standard Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from ...ggettext import gettext as _
|
||||
from ...const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.get_translation().gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
# Standard Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from ...ggettext import gettext as _
|
||||
from ...const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.get_translation().gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
# Standard Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from ...ggettext import gettext as _
|
||||
from ...const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.get_translation().gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
# Standard Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from ...ggettext import gettext as _
|
||||
from ...const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.get_translation().gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
# Standard Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from ...ggettext import gettext as _
|
||||
from ...const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.get_translation().gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
# Standard Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from ...ggettext import gettext as _
|
||||
from ...const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.get_translation().gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -29,7 +29,8 @@
|
||||
# Standard Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from ...ggettext import gettext as _
|
||||
from ...const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.get_translation().gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import re
|
||||
from ...ggettext import gettext as _
|
||||
from ...const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.get_translation().gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
# Standard Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from ...ggettext import gettext as _
|
||||
from ...const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.get_translation().gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
# Standard Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from ...ggettext import gettext as _
|
||||
from ...const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.get_translation().gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
# Standard Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from ...ggettext import gettext as _
|
||||
from ...const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.get_translation().gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
# Standard Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from ...ggettext import gettext as _
|
||||
from ...const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.get_translation().gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
# Standard Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from ...ggettext import gettext as _
|
||||
from ...const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.get_translation().gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -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
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
# Standard Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from ...ggettext import gettext as _
|
||||
from ...const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.get_translation().gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -23,7 +23,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
Reference in New Issue
Block a user