Compare commits
114
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 |
No files matched your search
+3
-2
@@ -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
|
||||
+5
-17
@@ -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
|
||||
@@ -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
-1
@@ -1,4 +1,4 @@
|
||||
"UNSTABLE Gramps 4.0.0 Alpha2 release.
|
||||
"UNSTABLE Gramps 4.0.0 Alpha4 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
|
||||
|
||||
File renamed without changes.
File renamed without changes.
@@ -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)
|
||||
@@ -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)
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -726,6 +726,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 +744,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 +761,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()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
@@ -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)
|
||||
@@ -188,7 +188,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 +209,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)
|
||||
|
||||
+84
-46
@@ -43,6 +43,7 @@ import uuid
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from .ggettext import sgettext as _
|
||||
from .svn_revision import get_svn_revision
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@@ -50,11 +51,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 +75,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
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@@ -84,13 +94,6 @@ APP_GRAMPS_PKG = "application/x-gramps-package"
|
||||
APP_GENEWEB = "application/x-geneweb"
|
||||
APP_VCARD = ["text/x-vcard", "text/x-vcalendar"]
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# system paths
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
LOCALE_DIR = "@LOCALE_DIR@"
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Platforms
|
||||
@@ -133,24 +136,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 +153,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 +184,43 @@ 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')
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# 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 +325,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
|
||||
|
||||
+15
-1
@@ -102,6 +102,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 +138,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
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@@ -53,6 +53,7 @@ from ..ggettext import gettext as _
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from ..constfunc import conv_to_unicode, handle2internal
|
||||
from .dbconst import *
|
||||
from . import BSDDBTxn
|
||||
from ..errors import DbError
|
||||
@@ -67,6 +68,7 @@ DBERRS = (db.DBRunRecoveryError, db.DBAccessError,
|
||||
|
||||
_SIGBASE = ('person', 'family', 'source', 'event', 'media',
|
||||
'place', 'repository', 'reference', 'note', 'tag', 'citation')
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# DbUndo class
|
||||
@@ -315,7 +317,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 +326,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()
|
||||
|
||||
+19
-9
@@ -74,13 +74,13 @@ 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 ..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
|
||||
|
||||
_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
|
||||
@@ -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')
|
||||
@@ -1895,10 +1905,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)]]
|
||||
|
||||
@@ -111,6 +111,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")
|
||||
|
||||
@@ -26,13 +26,17 @@
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from ...ggettext import gettext as _
|
||||
import logging
|
||||
LOG = logging.getLogger(".filter")
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from .. import CustomFilters
|
||||
# we need global variableCustomFilters, so we need to query gramps.gen.filters
|
||||
# when we need this variable, not import it at the start!
|
||||
import gramps.gen.filters
|
||||
from . import Rule
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@@ -48,31 +52,36 @@ class MatchesFilterBase(Rule):
|
||||
Subclasses need to define the namespace class attribute.
|
||||
|
||||
"""
|
||||
|
||||
labels = [_('Filter name:')]
|
||||
name = 'Objects matching the <filter>'
|
||||
description = "Matches objects matched by the specified filter name"
|
||||
category = _('General filters')
|
||||
|
||||
def prepare(self, db):
|
||||
if CustomFilters:
|
||||
filters = CustomFilters.get_filters_dict(self.namespace)
|
||||
if gramps.gen.filters.CustomFilters:
|
||||
filters = gramps.gen.filters.CustomFilters.get_filters_dict(self.namespace)
|
||||
if self.list[0] in filters:
|
||||
filt = filters[self.list[0]]
|
||||
for rule in filt.flist:
|
||||
rule.requestprepare(db)
|
||||
else:
|
||||
LOG.warning(_("Can't find filter %s in the defined custom filters")
|
||||
% self.list[0])
|
||||
else:
|
||||
LOG.warning(_("Can't find filter %s in the defined custom filters")
|
||||
% self.list[0])
|
||||
|
||||
def reset(self):
|
||||
if CustomFilters:
|
||||
filters = CustomFilters.get_filters_dict(self.namespace)
|
||||
if gramps.gen.filters.CustomFilters:
|
||||
filters = gramps.gen.filters.CustomFilters.get_filters_dict(self.namespace)
|
||||
if self.list[0] in filters:
|
||||
filt = filters[self.list[0]]
|
||||
for rule in filt.flist:
|
||||
rule.requestreset()
|
||||
|
||||
def apply(self, db, obj):
|
||||
if CustomFilters:
|
||||
filters = CustomFilters.get_filters_dict(self.namespace)
|
||||
if gramps.gen.filters.CustomFilters:
|
||||
filters = gramps.gen.filters.CustomFilters.get_filters_dict(self.namespace)
|
||||
if self.list[0] in filters:
|
||||
filt = filters[self.list[0]]
|
||||
return filt.check(db, obj.handle)
|
||||
@@ -82,8 +91,8 @@ class MatchesFilterBase(Rule):
|
||||
"""
|
||||
Return the selected filter or None.
|
||||
"""
|
||||
if CustomFilters:
|
||||
filters = CustomFilters.get_filters_dict(self.namespace)
|
||||
if gramps.gen.filters.CustomFilters:
|
||||
filters = gramps.gen.filters.CustomFilters.get_filters_dict(self.namespace)
|
||||
if self.list[0] in filters:
|
||||
return filters[self.list[0]]
|
||||
return None
|
||||
@@ -60,6 +60,7 @@ from ._childhasnameof import ChildHasNameOf
|
||||
from ._childhasidof import ChildHasIdOf
|
||||
from ._changedsince import ChangedSince
|
||||
from ._hastag import HasTag
|
||||
from ._hastwins import HasTwins
|
||||
|
||||
editor_rule_list = [
|
||||
AllFamilies,
|
||||
@@ -89,4 +90,5 @@ editor_rule_list = [
|
||||
ChildHasIdOf,
|
||||
ChangedSince,
|
||||
HasTag,
|
||||
HasTwins,
|
||||
]
|
||||
@@ -0,0 +1,64 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2013 Nick Hall
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
# $Id$
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Standard Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from ....ggettext import gettext as _
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from .. import Rule
|
||||
from ....lib.childreftype import ChildRefType
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# HasTwins
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class HasTwins(Rule):
|
||||
"""Rule that checks for a family with twins"""
|
||||
|
||||
name = _('Families with twins')
|
||||
description = _("Matches families with twins")
|
||||
category = _('Child filters')
|
||||
|
||||
def apply(self, db, family):
|
||||
date_list = []
|
||||
for childref in family.get_child_ref_list():
|
||||
if int(childref.get_mother_relation()) == ChildRefType.BIRTH:
|
||||
child = db.get_person_from_handle(childref.ref)
|
||||
birthref = child.get_birth_ref()
|
||||
if birthref:
|
||||
birth = db.get_event_from_handle(birthref.ref)
|
||||
sortval = birth.get_date_object().get_sort_value()
|
||||
if sortval != 0:
|
||||
if sortval in date_list:
|
||||
return True
|
||||
else:
|
||||
date_list.append(sortval)
|
||||
return False
|
||||
@@ -36,6 +36,7 @@ from ._matchesfilter import MatchesFilter
|
||||
from ._hasnote import HasNote
|
||||
from ._changedsince import ChangedSince
|
||||
from ._hastag import HasTag
|
||||
from ._hastype import HasType
|
||||
|
||||
editor_rule_list = [
|
||||
AllNotes,
|
||||
@@ -49,4 +50,5 @@ editor_rule_list = [
|
||||
MatchesFilter,
|
||||
ChangedSince,
|
||||
HasTag,
|
||||
HasType,
|
||||
]
|
||||
@@ -0,0 +1,57 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2002-2006 Donald N. Allingham
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
# $Id$
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Standard Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from ....ggettext import gettext as _
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from ....lib.notetype import NoteType
|
||||
from .. import Rule
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# HasType
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class HasType(Rule):
|
||||
"""Rule that checks for a note of a particular type."""
|
||||
|
||||
labels = [ _('Note type:') ]
|
||||
name = _('Notes with the particular type')
|
||||
description = _("Matches notes with the particular type ")
|
||||
category = _('General filters')
|
||||
|
||||
def apply(self, db, note):
|
||||
if not self.list[0]:
|
||||
return False
|
||||
else:
|
||||
specified_type = NoteType()
|
||||
specified_type.set_from_xml_str(self.list[0])
|
||||
return note.get_type() == specified_type
|
||||
@@ -69,6 +69,7 @@ class NoteType(GrampsType):
|
||||
REPORT_TEXT = 23 # this is used for notes used for reports
|
||||
# indicate a note is html code
|
||||
HTML_CODE = 24
|
||||
TODO = 25
|
||||
|
||||
_CUSTOM = CUSTOM
|
||||
_DEFAULT = GENERAL
|
||||
@@ -84,6 +85,7 @@ class NoteType(GrampsType):
|
||||
(CITATION, _('Citation'), "Citation"),
|
||||
(REPORT_TEXT, _("Report"), "Report"),
|
||||
(HTML_CODE, _("Html code"), "Html code"),
|
||||
(TODO, _("To Do"), "To Do"),
|
||||
]
|
||||
|
||||
_DATAMAPIGNORE = [
|
||||
|
||||
@@ -22,12 +22,9 @@
|
||||
#
|
||||
|
||||
try:
|
||||
from ._gnomemime import get_description, get_type, mime_type_is_defined
|
||||
from ._winmime import get_description, get_type, mime_type_is_defined
|
||||
except:
|
||||
try:
|
||||
from ._winmime import get_description, get_type, mime_type_is_defined
|
||||
except:
|
||||
from ._pythonmime import get_description, get_type, mime_type_is_defined
|
||||
from ._pythonmime import get_description, get_type, mime_type_is_defined
|
||||
|
||||
def base_type(val):
|
||||
return val.split('/')[0]
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000-2006 Donald N. Allingham
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
# $Id$
|
||||
|
||||
from gi.repository import Gtk
|
||||
|
||||
try:
|
||||
from gnomevfs import mime_get_short_list_applications, \
|
||||
mime_get_description, get_mime_type, mime_get_default_application
|
||||
except:
|
||||
from gnome.vfs import mime_get_short_list_applications, \
|
||||
mime_get_description, get_mime_type, mime_get_default_application
|
||||
|
||||
from ..ggettext import gettext as _
|
||||
|
||||
def get_description(type):
|
||||
"""Return the description of the specified mime type."""
|
||||
try:
|
||||
return mime_get_description(type)
|
||||
except:
|
||||
return _("unknown")
|
||||
|
||||
def get_type(file):
|
||||
"""Return the mime type of the specified file."""
|
||||
try:
|
||||
return get_mime_type(file)
|
||||
except:
|
||||
return _('unknown')
|
||||
|
||||
def mime_type_is_defined(type):
|
||||
"""
|
||||
Return True if a description for a mime type exists.
|
||||
"""
|
||||
try:
|
||||
mime_get_description(type)
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# private functions
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def _is_good_command(cmd):
|
||||
"""
|
||||
We don't know what to do with certain substitution values.
|
||||
If we find one, skip the command.
|
||||
"""
|
||||
for sub in [ "%m", "%i", "%c" ]:
|
||||
if cmd.find(sub) != -1:
|
||||
return False
|
||||
return True
|
||||
@@ -37,7 +37,7 @@ import sys
|
||||
if sys.version_info[0] < 3:
|
||||
from StringIO import StringIO
|
||||
else:
|
||||
from io import StringIO
|
||||
from io import BytesIO
|
||||
import tempfile
|
||||
from subprocess import Popen, PIPE
|
||||
import sys
|
||||
@@ -369,7 +369,10 @@ class GVDocBase(BaseDoc, GVDoc):
|
||||
BaseDoc.__init__(self, None, paper_style)
|
||||
|
||||
self._filename = None
|
||||
self._dot = StringIO()
|
||||
if sys.version_info[0] < 3:
|
||||
self._dot = StringIO()
|
||||
else:
|
||||
self._dot = BytesIO()
|
||||
self._paper = paper_style
|
||||
|
||||
get_option_by_name = options.menu.get_option_by_name
|
||||
@@ -595,7 +598,10 @@ class GVDotDoc(GVDocBase):
|
||||
if self._filename[-3:] != ".gv":
|
||||
self._filename += ".gv"
|
||||
|
||||
dotfile = open(self._filename, "w")
|
||||
if sys.version_info[0] < 3:
|
||||
dotfile = open(self._filename, "w")
|
||||
else:
|
||||
dotfile = open(self._filename, "wb")
|
||||
dotfile.write(self._dot.getvalue())
|
||||
dotfile.close()
|
||||
|
||||
@@ -630,7 +636,10 @@ class GVPsDoc(GVDocBase):
|
||||
|
||||
# Create a temporary dot file
|
||||
(handle, tmp_dot) = tempfile.mkstemp(".gv" )
|
||||
dotfile = os.fdopen(handle,"w")
|
||||
if sys.version_info[0] < 3:
|
||||
dotfile = os.fdopen(handle, "w")
|
||||
else:
|
||||
dotfile = os.fdopen(handle, "wb")
|
||||
dotfile.write(self._dot.getvalue())
|
||||
dotfile.close()
|
||||
|
||||
@@ -647,10 +656,13 @@ class GVPsDoc(GVDocBase):
|
||||
# See bug tracker issue 2815
|
||||
# :cairo does not work with Graphviz 2.26.3 and later See issue 4164
|
||||
# Covert filename to str using file system encoding.
|
||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||
if sys.version_info[0] < 3:
|
||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||
else:
|
||||
fname = self._filename
|
||||
|
||||
command = 'dot -Tps:cairo -o"%s" "%s"' % (fname, tmp_dot)
|
||||
dotversion = Popen(['dot', '-V'], stderr=PIPE).communicate(input=None)[1]
|
||||
dotversion = str(Popen(['dot', '-V'], stderr=PIPE).communicate(input=None)[1])
|
||||
# Problem with dot 2.26.3 and later and multiple pages, which gives "cairo: out of
|
||||
# memory" If the :cairo is skipped for these cases it gives acceptable
|
||||
# result.
|
||||
@@ -685,11 +697,17 @@ class GVSvgDoc(GVDocBase):
|
||||
|
||||
# Create a temporary dot file
|
||||
(handle, tmp_dot) = tempfile.mkstemp(".gv" )
|
||||
dotfile = os.fdopen(handle,"w")
|
||||
if sys.version_info[0] < 3:
|
||||
dotfile = os.fdopen(handle, "w")
|
||||
else:
|
||||
dotfile = os.fdopen(handle, "wb")
|
||||
dotfile.write(self._dot.getvalue())
|
||||
dotfile.close()
|
||||
# Covert filename to str using file system encoding.
|
||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||
if sys.version_info[0] < 3:
|
||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||
else:
|
||||
fname = self._filename
|
||||
|
||||
# Generate the SVG file.
|
||||
os.system( 'dot -Tsvg -o"%s" "%s"' % (fname, tmp_dot) )
|
||||
@@ -722,11 +740,17 @@ class GVSvgzDoc(GVDocBase):
|
||||
|
||||
# Create a temporary dot file
|
||||
(handle, tmp_dot) = tempfile.mkstemp(".gv" )
|
||||
dotfile = os.fdopen(handle,"w")
|
||||
if sys.version_info[0] < 3:
|
||||
dotfile = os.fdopen(handle, "w")
|
||||
else:
|
||||
dotfile = os.fdopen(handle, "wb")
|
||||
dotfile.write(self._dot.getvalue())
|
||||
dotfile.close()
|
||||
# Covert filename to str using file system encoding.
|
||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||
if sys.version_info[0] < 3:
|
||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||
else:
|
||||
fname = self._filename
|
||||
|
||||
# Generate the SVGZ file.
|
||||
os.system( 'dot -Tsvgz -o"%s" "%s"' % (fname, tmp_dot) )
|
||||
@@ -759,11 +783,17 @@ class GVPngDoc(GVDocBase):
|
||||
|
||||
# Create a temporary dot file
|
||||
(handle, tmp_dot) = tempfile.mkstemp(".gv" )
|
||||
dotfile = os.fdopen(handle,"w")
|
||||
if sys.version_info[0] < 3:
|
||||
dotfile = os.fdopen(handle, "w")
|
||||
else:
|
||||
dotfile = os.fdopen(handle, "wb")
|
||||
dotfile.write(self._dot.getvalue())
|
||||
dotfile.close()
|
||||
# Covert filename to str using file system encoding.
|
||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||
if sys.version_info[0] < 3:
|
||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||
else:
|
||||
fname = self._filename
|
||||
|
||||
# Generate the PNG file.
|
||||
os.system( 'dot -Tpng -o"%s" "%s"' % (fname, tmp_dot) )
|
||||
@@ -796,11 +826,17 @@ class GVJpegDoc(GVDocBase):
|
||||
|
||||
# Create a temporary dot file
|
||||
(handle, tmp_dot) = tempfile.mkstemp(".gv" )
|
||||
dotfile = os.fdopen(handle,"w")
|
||||
if sys.version_info[0] < 3:
|
||||
dotfile = os.fdopen(handle, "w")
|
||||
else:
|
||||
dotfile = os.fdopen(handle, "wb")
|
||||
dotfile.write(self._dot.getvalue())
|
||||
dotfile.close()
|
||||
# Covert filename to str using file system encoding.
|
||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||
if sys.version_info[0] < 3:
|
||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||
else:
|
||||
fname = self._filename
|
||||
|
||||
# Generate the JPEG file.
|
||||
os.system( 'dot -Tjpg -o"%s" "%s"' % (fname, tmp_dot) )
|
||||
@@ -833,11 +869,17 @@ class GVGifDoc(GVDocBase):
|
||||
|
||||
# Create a temporary dot file
|
||||
(handle, tmp_dot) = tempfile.mkstemp(".gv" )
|
||||
dotfile = os.fdopen(handle,"w")
|
||||
if sys.version_info[0] < 3:
|
||||
dotfile = os.fdopen(handle, "w")
|
||||
else:
|
||||
dotfile = os.fdopen(handle, "wb")
|
||||
dotfile.write(self._dot.getvalue())
|
||||
dotfile.close()
|
||||
# Covert filename to str using file system encoding.
|
||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||
if sys.version_info[0] < 3:
|
||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||
else:
|
||||
fname = self._filename
|
||||
|
||||
# Generate the GIF file.
|
||||
os.system( 'dot -Tgif -o"%s" "%s"' % (fname, tmp_dot) )
|
||||
@@ -873,11 +915,17 @@ class GVPdfGvDoc(GVDocBase):
|
||||
|
||||
# Create a temporary dot file
|
||||
(handle, tmp_dot) = tempfile.mkstemp(".gv" )
|
||||
dotfile = os.fdopen(handle,"w")
|
||||
if sys.version_info[0] < 3:
|
||||
dotfile = os.fdopen(handle, "w")
|
||||
else:
|
||||
dotfile = os.fdopen(handle, "wb")
|
||||
dotfile.write(self._dot.getvalue())
|
||||
dotfile.close()
|
||||
# Covert filename to str using file system encoding.
|
||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||
# Convert filename to str using file system encoding.
|
||||
if sys.version_info[0] < 3:
|
||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||
else:
|
||||
fname = self._filename
|
||||
|
||||
# Generate the PDF file.
|
||||
os.system( 'dot -Tpdf -o"%s" "%s"' % (fname, tmp_dot) )
|
||||
@@ -908,7 +956,10 @@ class GVPdfGsDoc(GVDocBase):
|
||||
|
||||
# Create a temporary dot file
|
||||
(handle, tmp_dot) = tempfile.mkstemp(".gv" )
|
||||
dotfile = os.fdopen(handle,"w")
|
||||
if sys.version_info[0] < 3:
|
||||
dotfile = os.fdopen(handle, "w")
|
||||
else:
|
||||
dotfile = os.fdopen(handle, "wb")
|
||||
dotfile.write(self._dot.getvalue())
|
||||
dotfile.close()
|
||||
|
||||
@@ -922,7 +973,7 @@ class GVPdfGsDoc(GVDocBase):
|
||||
# :cairo does not work with Graphviz 2.26.3 and later See issue 4164
|
||||
|
||||
command = 'dot -Tps:cairo -o"%s" "%s"' % ( tmp_ps, tmp_dot )
|
||||
dotversion = Popen(['dot', '-V'], stderr=PIPE).communicate(input=None)[1]
|
||||
dotversion = str(Popen(['dot', '-V'], stderr=PIPE).communicate(input=None)[1])
|
||||
# Problem with dot 2.26.3 and later and multiple pages, which gives "cairo: out
|
||||
# of memory". If the :cairo is skipped for these cases it gives
|
||||
# acceptable result.
|
||||
@@ -936,7 +987,10 @@ class GVPdfGsDoc(GVDocBase):
|
||||
height_pt = int( (paper_size.get_height_inches() * 72) + 0.5 )
|
||||
|
||||
# Convert to PDF using ghostscript
|
||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||
if sys.version_info[0] < 3:
|
||||
fname = self._filename.encode(sys.getfilesystemencoding())
|
||||
else:
|
||||
fname = self._filename
|
||||
command = '%s -q -sDEVICE=pdfwrite -dNOPAUSE -dDEVICEWIDTHPOINTS=%d' \
|
||||
' -dDEVICEHEIGHTPOINTS=%d -sOutputFile="%s" "%s" -c quit' \
|
||||
% ( _GS_CMD, width_pt, height_pt, fname, tmp_ps )
|
||||
|
||||
@@ -448,11 +448,11 @@ class BookParser(handler.ContentHandler):
|
||||
# Functions
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def create_style_sheet(item):
|
||||
def create_style_sheet(item, previous_style=None):
|
||||
"""
|
||||
Create a style sheet for a book item.
|
||||
Create a style sheet for a book item, appending any previous_style.
|
||||
"""
|
||||
selected_style = StyleSheet()
|
||||
selected_style = StyleSheet(previous_style)
|
||||
|
||||
handler = item.option_class.handler
|
||||
|
||||
|
||||
@@ -908,7 +908,7 @@ class DocOptionHandler(_options.OptionHandler):
|
||||
# First we set options_dict values based on the saved options
|
||||
options = self.saved_option_list.get_options()
|
||||
docgen_names = self.option_list_collection.docgen_names
|
||||
for option_name, option_data in options.iteritems():
|
||||
for option_name, option_data in options.items():
|
||||
if ( option_name in self.options_dict and
|
||||
isinstance(option_data, list) and
|
||||
option_data and
|
||||
|
||||
@@ -35,7 +35,7 @@ import os
|
||||
if sys.version_info[0] < 3:
|
||||
from StringIO import StringIO
|
||||
else:
|
||||
from io import StringIO
|
||||
from io import StringIO, BytesIO
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@@ -219,7 +219,11 @@ def load_addon_file(path, callback=None):
|
||||
callback(_("Unable to open '%s'") % path)
|
||||
return
|
||||
try:
|
||||
buffer = StringIO(fp.read())
|
||||
content = fp.read()
|
||||
if sys.version_info[0] < 3:
|
||||
buffer = StringIO(content)
|
||||
else:
|
||||
buffer = BytesIO(content)
|
||||
except:
|
||||
if callback:
|
||||
callback(_("Error in reading '%s'") % path)
|
||||
|
||||
+18
-7
@@ -29,17 +29,23 @@ Provide soundex calculation
|
||||
# Standard python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import string
|
||||
import sys
|
||||
import unicodedata
|
||||
if sys.version_info[0] < 3:
|
||||
import string
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# constants
|
||||
# constants
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
IGNORE = "HW~!@#$%^&*()_+=-`[]\|;:'/?.,<>\" \t\f\v"
|
||||
TABLE = string.maketrans('ABCDEFGIJKLMNOPQRSTUVXYZ',
|
||||
'012301202245501262301202')
|
||||
if sys.version_info[0] < 3:
|
||||
TABLE = string.maketrans('ABCDEFGIJKLMNOPQRSTUVXYZ',
|
||||
'012301202245501262301202')
|
||||
else:
|
||||
TABLE = bytes.maketrans(b'ABCDEFGIJKLMNOPQRSTUVXYZ',
|
||||
b'012301202245501262301202')
|
||||
|
||||
from .constfunc import conv_to_unicode_direct
|
||||
|
||||
@@ -55,9 +61,14 @@ def soundex(strval):
|
||||
conv_to_unicode_direct(strval.upper().strip())).encode('ASCII', 'ignore')
|
||||
if not strval:
|
||||
return "Z000"
|
||||
strval = strval.encode('iso-8859-1')
|
||||
str2 = strval[0]
|
||||
strval = strval.translate(TABLE, IGNORE)
|
||||
if sys.version_info[0] < 3:
|
||||
strval = strval.encode('iso-8859-1') # Really?
|
||||
str2 = strval[0]
|
||||
strval = strval.translate(TABLE, IGNORE)
|
||||
else:
|
||||
strval = strval.decode('ASCII', 'ignore')
|
||||
str2 = strval[0]
|
||||
strval = strval.translate(TABLE)
|
||||
if not strval:
|
||||
return "Z000"
|
||||
prev = strval[0]
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2012 Doug Blank <doug.blank@gmail.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
# $Id$
|
||||
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
if sys.version_info[0] < 3:
|
||||
cuni = unicode
|
||||
else:
|
||||
def to_utf8(s):
|
||||
return s.decode("utf-8")
|
||||
cuni = to_utf8
|
||||
|
||||
def get_svn_revision(path=""):
|
||||
stdout = ""
|
||||
try:
|
||||
p = subprocess.Popen("svnversion -n \"%s\"" % path, shell=True,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
(stdout, stderr) = p.communicate()
|
||||
except:
|
||||
return "" # subprocess failed
|
||||
# subprocess worked
|
||||
if stdout: # has output
|
||||
stdout = cuni(stdout) # get a proper string
|
||||
if (" " in stdout) or (stdout == "exported"):
|
||||
# one of svnversion's 1.7 non-version responses:
|
||||
# 'Unversioned directory'
|
||||
# 'Unversioned file'
|
||||
# 'Uncommitted local addition, copy or move'
|
||||
# svnversion's 1.6 non-version response:
|
||||
# 'exported'
|
||||
return ""
|
||||
else:
|
||||
return "-r" + stdout
|
||||
else: # no output from svnversion
|
||||
return ""
|
||||
|
||||
@@ -101,13 +101,16 @@ class ProbablyAlive(object):
|
||||
death_date = None
|
||||
birth_date = None
|
||||
explain = ""
|
||||
# If the recorded death year is before current year then
|
||||
# things are simple.
|
||||
|
||||
if death_ref and death_ref.get_role().is_primary():
|
||||
if death_ref:
|
||||
death = self.db.get_event_from_handle(death_ref.ref)
|
||||
if death and death.get_date_object().get_start_date() != Date.EMPTY:
|
||||
if death and death.get_date_object().is_valid():
|
||||
death_date = death.get_date_object()
|
||||
elif death: # has a death event, but it is no valid:
|
||||
death_date = Today() # before today
|
||||
death_date.set_modifier(Date.MOD_BEFORE)
|
||||
explain = _("death event without date")
|
||||
|
||||
# Look for Cause Of Death, Burial or Cremation events.
|
||||
# These are fairly good indications that someone's not alive.
|
||||
@@ -117,7 +120,12 @@ class ProbablyAlive(object):
|
||||
ev = self.db.get_event_from_handle(ev_ref.ref)
|
||||
if ev and ev.type.is_death_fallback():
|
||||
death_date = ev.get_date_object()
|
||||
explain = _("death-related evidence")
|
||||
if death_date.get_start_date().is_valid():
|
||||
explain = _("death-related evidence")
|
||||
else:
|
||||
death_date = Today() # before today
|
||||
death_date.set_modifier(Date.MOD_BEFORE)
|
||||
explain = _("death-related evidence without date")
|
||||
|
||||
# If they were born within X years before current year then
|
||||
# assume they are alive (we already know they are not dead).
|
||||
@@ -495,7 +503,7 @@ def probably_alive(person, db,
|
||||
death += limit # add these years to death
|
||||
# Finally, check to see if current_date is between dates
|
||||
result = (current_date.match(birth, ">=") and
|
||||
current_date.match(death, "<="))
|
||||
current_date.match(death, "<<"))
|
||||
if return_range:
|
||||
return (result, birth, death, explain, relative)
|
||||
else:
|
||||
|
||||
+45
-13
@@ -31,8 +31,11 @@ Utility functions to cast types
|
||||
# Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import os
|
||||
import locale
|
||||
import sys
|
||||
import logging
|
||||
LOG = logging.getLogger(".")
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@@ -42,19 +45,48 @@ import sys
|
||||
from ..datehandler import codeset
|
||||
from ..constfunc import conv_to_unicode, conv_to_unicode_direct, UNITYPE, STRTYPE
|
||||
|
||||
"""
|
||||
strxfrm needs it's unicode argument correctly cast before used.
|
||||
"""
|
||||
if sys.version_info[0] < 3:
|
||||
conv_unicode_tosrtkey = lambda x: locale.strxfrm(x.encode(codeset, 'replace'))
|
||||
else:
|
||||
conv_unicode_tosrtkey = lambda x: locale.strxfrm(x)
|
||||
|
||||
if codeset == 'UTF-8':
|
||||
conv_str_tosrtkey = lambda x: locale.strxfrm(x)
|
||||
else:
|
||||
conv_str_tosrtkey = lambda x: locale.strxfrm(
|
||||
conv_to_unicode(x,'UTF-8').encode(codeset, 'replace'))
|
||||
try:
|
||||
import PyICU
|
||||
if os.environ.has_key("LC_COLLATE"):
|
||||
collation = os.environ['LC_COLLATE']
|
||||
else:
|
||||
collation = os.environ["LANG"]
|
||||
language_and_country = collation.rsplit('.', 1)[0]
|
||||
if language_and_country in PyICU.Collator.getAvailableLocales().keys():
|
||||
loc = language_and_country
|
||||
else:
|
||||
language = collation.rsplit('_', 1)[0]
|
||||
if language in PyICU.Collator.getAvailableLocales().keys():
|
||||
LOG.warn(_("Language and country %s not supported by ICU: "
|
||||
"but language %s is supported and will be used" %
|
||||
(language_and_country, language)))
|
||||
loc = language
|
||||
else:
|
||||
LOG.warn(_("Neither Language and country %s nor language %s "
|
||||
"supported by ICU: using en_GB" %
|
||||
(language_and_country, language)))
|
||||
loc = "en_GB"
|
||||
|
||||
collator = PyICU.Collator.createInstance(PyICU.Locale(loc))
|
||||
# on ICU, the functions need to receive unicode
|
||||
conv_unicode_tosrtkey = lambda x: collator.getCollationKey(
|
||||
x).getByteArray()
|
||||
conv_str_tosrtkey = lambda x: collator.getCollationKey(
|
||||
x.decode("UTF-8")).getByteArray()
|
||||
except:
|
||||
"""
|
||||
strxfrm needs it's unicode argument correctly cast before used.
|
||||
"""
|
||||
if sys.version_info[0] < 3:
|
||||
conv_unicode_tosrtkey = lambda x: locale.strxfrm(x.encode(codeset, 'replace'))
|
||||
else:
|
||||
conv_unicode_tosrtkey = lambda x: locale.strxfrm(x)
|
||||
|
||||
if codeset == 'UTF-8':
|
||||
conv_str_tosrtkey = lambda x: locale.strxfrm(x)
|
||||
else:
|
||||
conv_str_tosrtkey = lambda x: locale.strxfrm(
|
||||
conv_to_unicode(x,'UTF-8').encode(codeset, 'replace'))
|
||||
|
||||
def conv_tosrtkey(value):
|
||||
if isinstance(value, UNITYPE):
|
||||
|
||||
@@ -558,7 +558,6 @@ def get_referents(handle, db, primary_objects):
|
||||
for primary in primary_objects:
|
||||
primary_list = [item[1] for item in object_list if item[0] == primary]
|
||||
the_lists = the_lists + (primary_list, )
|
||||
|
||||
return the_lists
|
||||
|
||||
def get_source_referents(source_handle, db):
|
||||
|
||||
@@ -20,6 +20,6 @@
|
||||
|
||||
# $Id$
|
||||
|
||||
from .TabbedDoc import TabbedDoc
|
||||
from .ODSTab import ODSTab
|
||||
from .CSVTab import CSVTab
|
||||
from .tabbeddoc import TabbedDoc
|
||||
from .odstab import ODSTab
|
||||
from .csvtab import CSVTab
|
||||
@@ -32,7 +32,7 @@ import csv
|
||||
# gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from .TabbedDoc import *
|
||||
from .tabbeddoc import *
|
||||
|
||||
class CSVTab(TabbedDoc):
|
||||
|
||||
@@ -35,7 +35,7 @@ from ...ggettext import gettext as _
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from .TabbedDoc import *
|
||||
from .tabbeddoc import *
|
||||
from ...const import PROGRAM_NAME, VERSION
|
||||
from ...errors import ReportError
|
||||
from ...constfunc import cuni
|
||||
@@ -17,7 +17,6 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# docgen/TabbedDoc.py
|
||||
# $Id$
|
||||
#
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2012 Doug Blank <doug.blank@gmail.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
# $Id$
|
||||
|
||||
"""
|
||||
Based on the version from Django, a Python ORM.
|
||||
"""
|
||||
|
||||
import re
|
||||
import os
|
||||
|
||||
from ..constfunc import cuni
|
||||
|
||||
def get_svn_revision(path=None):
|
||||
"""
|
||||
Returns the SVN revision in the form SVN-XXXX,
|
||||
where XXXX is the revision number.
|
||||
|
||||
Returns "" if anything goes wrong, such as an unexpected
|
||||
format of internal SVN files.
|
||||
|
||||
If path is provided, it should be a directory whose SVN info you
|
||||
want to inspect. If it's not provided, this will use the directory
|
||||
where this file resides.
|
||||
"""
|
||||
rev = None
|
||||
if path is None:
|
||||
path = os.path.dirname(__file__)
|
||||
entries_path = '%s/.svn/entries' % path
|
||||
try:
|
||||
entries = open(entries_path, 'r').read()
|
||||
except IOError:
|
||||
pass
|
||||
else:
|
||||
# Versions >= 7 of the entries file are flat text. The first line is
|
||||
# the version number. The next set of digits after 'dir' is the revision
|
||||
if re.match('(\d+)', entries):
|
||||
rev_match = re.search('\d+\s+dir\s+(\d+)', entries)
|
||||
if rev_match:
|
||||
rev = rev_match.groups()[0]
|
||||
# Older XML versions of the file specify revision as an attribute of
|
||||
# the first entries node.
|
||||
else:
|
||||
from xml.dom import minidom
|
||||
dom = minidom.parse(entries_path)
|
||||
rev = dom.getElementsByTagName('entry')[0].getAttribute('revision')
|
||||
if rev:
|
||||
return cuni('SVN-%s' % rev)
|
||||
return cuni('')
|
||||
@@ -261,7 +261,7 @@ def get_addon_translator(filename=None, domain="addon", languages=None):
|
||||
path = os.path.dirname(os.path.abspath(filename))
|
||||
# Check if path is of type str. Do import and conversion if so.
|
||||
# The import cannot be done at the top as that will conflict with the translation system.
|
||||
if not isinstance(path, UNITYPE) == str:
|
||||
if not isinstance(path, UNITYPE):
|
||||
from .file import get_unicode_path_from_env_var
|
||||
path = get_unicode_path_from_env_var(path)
|
||||
if languages:
|
||||
|
||||
+4
-4
@@ -239,12 +239,12 @@ def show_settings():
|
||||
try:
|
||||
from gi.repository import GObject
|
||||
try:
|
||||
gobjectver_str = '%d.%d.%d' % GObject.pygobject_version
|
||||
pygobjectver_str = '%d.%d.%d' % GObject.pygobject_version
|
||||
except :# any failure to 'get' the version
|
||||
gobjectver_str = 'unknown version'
|
||||
pygobjectver_str = 'unknown version'
|
||||
|
||||
except ImportError:
|
||||
gobjectver_str = 'not found'
|
||||
pygobjectver_str = 'not found'
|
||||
|
||||
try:
|
||||
from gi.repository import Pango
|
||||
@@ -350,7 +350,7 @@ def show_settings():
|
||||
print (' python : %s' % py_str)
|
||||
print (' gramps : %s' % gramps_str)
|
||||
print (' gtk++ : %s' % gtkver_str)
|
||||
print (' gobject : %s' % gobjectver_str)
|
||||
print (' pygobject : %s' % pygobjectver_str)
|
||||
print (' pango : %s' % pangover_str)
|
||||
if usebsddb3:
|
||||
print (' Using bsddb3')
|
||||
|
||||
@@ -42,3 +42,15 @@ class BaseSidebar(object):
|
||||
Called when the active view is changed.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def active(self, cat_num, view_num):
|
||||
"""
|
||||
Called when the sidebar is made visible.
|
||||
"""
|
||||
pass
|
||||
|
||||
def inactive(self):
|
||||
"""
|
||||
Called when the sidebar is hidden.
|
||||
"""
|
||||
pass
|
||||
@@ -893,6 +893,12 @@ class GrampsPreferences(ConfigureDialog):
|
||||
self.dbstate.db.name_formats = _nd.get_name_format(only_custom=True,
|
||||
only_active=False)
|
||||
|
||||
def cb_grampletbar_close(self, obj):
|
||||
"""
|
||||
Gramplet bar close button preference callback
|
||||
"""
|
||||
self.uistate.emit('grampletbar-close-changed')
|
||||
|
||||
def add_formats_panel(self, configdialog):
|
||||
row = 0
|
||||
table = Gtk.Table(4, 4)
|
||||
@@ -1058,6 +1064,13 @@ class GrampsPreferences(ConfigureDialog):
|
||||
_("Show text in sidebar buttons (requires restart)"),
|
||||
row, 'interface.sidebar-text', stop=3)
|
||||
row += 1
|
||||
|
||||
# Gramplet bar close buttons:
|
||||
self.add_checkbox(table,
|
||||
_("Show close button in gramplet bar tabs"),
|
||||
row, 'interface.grampletbar-close', stop=3,
|
||||
extra_callback=self.cb_grampletbar_close)
|
||||
row += 1
|
||||
return _('Display'), table
|
||||
|
||||
def add_text_panel(self, configdialog):
|
||||
|
||||
+4
-1
@@ -50,7 +50,7 @@ else:
|
||||
import logging
|
||||
LOG = logging.getLogger(".DbManager")
|
||||
|
||||
from gramps.gen.constfunc import win
|
||||
from gramps.gen.constfunc import win, UNITYPE
|
||||
if win():
|
||||
_RCS_FOUND = os.system("rcs -V >nul 2>nul") == 0
|
||||
if _RCS_FOUND and "TZ" not in os.environ:
|
||||
@@ -798,6 +798,9 @@ def find_revisions(name):
|
||||
get_next = False
|
||||
if os.path.isfile(name):
|
||||
for line in proc.stdout:
|
||||
if sys.version_info[0] >= 3 and not isinstance(line, UNITYPE):
|
||||
# we assume utf-8 ...
|
||||
line = line.decode('utf-8')
|
||||
match = rev.match(line)
|
||||
if match:
|
||||
rev_str = copy.copy(match.groups()[0])
|
||||
|
||||
@@ -181,10 +181,10 @@ class ErrorDialog(Gtk.MessageDialog):
|
||||
flags=Gtk.DialogFlags.MODAL,
|
||||
type=Gtk.MessageType.ERROR,
|
||||
buttons=Gtk.ButtonsType.CLOSE)
|
||||
self.set_markup('<span weight="bold" size="larger">%s</span>' % msg1)
|
||||
self.set_markup('<span weight="bold" size="larger">%s</span>' % str(msg1))
|
||||
self.format_secondary_text(msg2)
|
||||
self.set_icon(ICON)
|
||||
self.set_title("%s - Gramps" % msg1)
|
||||
self.set_title("%s - Gramps" % str(msg1))
|
||||
self.show()
|
||||
self.run()
|
||||
self.destroy()
|
||||
|
||||
@@ -369,6 +369,7 @@ class DisplayState(Callback):
|
||||
'filters-changed' : (str, ),
|
||||
'filter-name-changed' : (str, UNITYPE, UNITYPE),
|
||||
'nameformat-changed' : None,
|
||||
'grampletbar-close-changed' : None,
|
||||
}
|
||||
|
||||
#nav_type to message
|
||||
|
||||
@@ -178,7 +178,7 @@ class BackRefList(EmbeddedList):
|
||||
"editor and open an editor for the citation "
|
||||
"alone")
|
||||
|
||||
from QuestionDialog import WarningDialog
|
||||
from gramps.gui.dialog import WarningDialog
|
||||
WarningDialog(_("Cannot open new citation editor"),
|
||||
blocked_text)
|
||||
elif reftype == 'Place':
|
||||
|
||||
+40
-22
@@ -39,16 +39,50 @@ LOG = logging.getLogger(".grampsgui")
|
||||
# Miscellaneous initialization
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
MIN_PYGOBJECT_VERSION = (3, 3, 2)
|
||||
PYGOBJ_ERR = False
|
||||
|
||||
try:
|
||||
#import gnome introspection, part of pygobject
|
||||
import gi
|
||||
giversion = gi.require_version
|
||||
except:
|
||||
print(_("Your version of gi (gnome-instrospection) seems to be too old. "
|
||||
"You need a version which has the function 'require_version' "
|
||||
"to start Gramps"))
|
||||
sys.exit(0)
|
||||
|
||||
if not PYGOBJ_ERR:
|
||||
try:
|
||||
from gi.repository import GObject
|
||||
if not GObject.pygobject_version >= MIN_PYGOBJECT_VERSION :
|
||||
PYGOBJ_ERR = True
|
||||
except:
|
||||
PYGOBJ_ERR = True
|
||||
|
||||
if PYGOBJ_ERR:
|
||||
print((_("Your pygobject version does not meet the "
|
||||
"requirements. At least pygobject "
|
||||
"%(major)d.%(feature)d.%(minor)d is needed to"
|
||||
" start Gramps with a GUI.\n\n"
|
||||
"Gramps will terminate now.") %
|
||||
{'major':MIN_PYGOBJECT_VERSION[0],
|
||||
'feature':MIN_PYGOBJECT_VERSION[1],
|
||||
'minor':MIN_PYGOBJECT_VERSION[2]}))
|
||||
sys.exit(0)
|
||||
|
||||
try:
|
||||
gi.require_version('Gtk', '3.0')
|
||||
#It is important to import Pango before Gtk, or some things start to go
|
||||
#wrong in GTK3 !
|
||||
from gi.repository import Pango
|
||||
from gi.repository import Gtk, Gdk
|
||||
except (ImportError, ValueError):
|
||||
print((_("Gtk typelib not installed. Install Gnome Introspection, and "
|
||||
"pygobject version 3.3.2 or later.\n\n"
|
||||
print((_("Gdk, Gtk or Pango typelib not installed.\n"
|
||||
"Install Gnome Introspection, and "
|
||||
"pygobject version 3.3.2 or later.\n"
|
||||
"Install then instrospection data for Gdk, Gtk and Pango\n\n"
|
||||
"Gramps will terminate now.")))
|
||||
sys.exit(0)
|
||||
|
||||
@@ -59,24 +93,6 @@ except ImportError:
|
||||
"version of python\n\n"
|
||||
"Gramps will terminate now.")))
|
||||
sys.exit(0)
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Miscellaneous initialization
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gi.repository import GObject
|
||||
|
||||
MIN_PYGOBJECT_VERSION = (3, 3, 2)
|
||||
if not GObject.pygobject_version >= MIN_PYGOBJECT_VERSION :
|
||||
print((_("Your pygobject version does not meet the "
|
||||
"requirements. At least pygobject "
|
||||
"%(major)d.%(feature)d.%(minor)d is needed to"
|
||||
" start Gramps with a GUI.\n\n"
|
||||
"Gramps will terminate now.") %
|
||||
{'major':MIN_PYGOBJECT_VERSION[0],
|
||||
'feature':MIN_PYGOBJECT_VERSION[1],
|
||||
'minor':MIN_PYGOBJECT_VERSION[2]}))
|
||||
sys.exit(0)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@@ -287,12 +303,14 @@ def __startgramps(errors, argparser):
|
||||
from .dialog import ErrorDialog
|
||||
#handle first existing errors in GUI fashion
|
||||
if errors:
|
||||
ErrorDialog(errors[0], errors[1])
|
||||
for error in errors:
|
||||
ErrorDialog(error[0], error[1])
|
||||
Gtk.main_quit()
|
||||
sys.exit(1)
|
||||
|
||||
if argparser.errors:
|
||||
ErrorDialog(argparser.errors[0], argparser.errors[1])
|
||||
for error in argparser.errors:
|
||||
ErrorDialog(error[0], error[1])
|
||||
Gtk.main_quit()
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
+135
-8
@@ -17,7 +17,7 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# $Id$
|
||||
# $Id: navigator.py 20492 2012-10-02 21:08:19Z nick-h $
|
||||
|
||||
"""
|
||||
A module that provides pluggable sidebars. These provide an interface to
|
||||
@@ -29,6 +29,7 @@ manage pages in the main Gramps window.
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gdk
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@@ -36,6 +37,38 @@ from gi.repository import Gtk
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.plug import (START, END)
|
||||
from .pluginmanager import GuiPluginManager
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Constants
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
UICATEGORY = '''<ui>
|
||||
<menubar name="MenuBar">
|
||||
<menu action="ViewMenu">
|
||||
<placeholder name="ViewsInCategory">%s
|
||||
</placeholder>
|
||||
</menu>
|
||||
</menubar>
|
||||
</ui>
|
||||
'''
|
||||
|
||||
CATEGORY_ICON = {
|
||||
'Dashboard': 'gramps-gramplet',
|
||||
'People': 'gramps-person',
|
||||
'Relationships': 'gramps-relation',
|
||||
'Families': 'gramps-family',
|
||||
'Events': 'gramps-event',
|
||||
'Ancestry': 'gramps-pedigree',
|
||||
'Places': 'gramps-place',
|
||||
'Geography': 'gramps-geo',
|
||||
'Sources': 'gramps-source',
|
||||
'Repositories': 'gramps-repository',
|
||||
'Media': 'gramps-media',
|
||||
'Notes': 'gramps-notes',
|
||||
'Citations': 'gramps-citation',
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@@ -50,6 +83,14 @@ class Navigator(object):
|
||||
|
||||
self.viewmanager = viewmanager
|
||||
self.pages = []
|
||||
self.active_cat = None
|
||||
self.active_view = None
|
||||
|
||||
self.ui_category = {}
|
||||
self.view_toggle_actions = {}
|
||||
self.cat_view_group = None
|
||||
self.merge_ids = []
|
||||
|
||||
self.top = Gtk.VBox()
|
||||
|
||||
frame = Gtk.Frame()
|
||||
@@ -92,6 +133,59 @@ class Navigator(object):
|
||||
self.top.show()
|
||||
self.top.pack_start(self.notebook, True, True, 0)
|
||||
|
||||
def load_plugins(self, dbstate, uistate):
|
||||
"""
|
||||
Load the sidebar plugins.
|
||||
"""
|
||||
plugman = GuiPluginManager.get_instance()
|
||||
|
||||
categories = []
|
||||
views = {}
|
||||
for cat_num, cat_views in enumerate(self.viewmanager.get_views()):
|
||||
uimenuitems = ''
|
||||
self.view_toggle_actions[cat_num] = []
|
||||
for view_num, page in enumerate(cat_views):
|
||||
|
||||
if view_num == 0:
|
||||
views[cat_num] = []
|
||||
cat_name = page[0].category[1]
|
||||
cat_icon = CATEGORY_ICON.get(page[0].category[0])
|
||||
if cat_icon is None:
|
||||
cat_icon = 'gramps-view'
|
||||
categories.append([cat_num, cat_name, cat_icon])
|
||||
|
||||
pageid = 'page_%i_%i' % (cat_num, view_num)
|
||||
uimenuitems += '\n<menuitem action="%s"/>' % pageid
|
||||
# id, stock, button text, UI, tooltip, page
|
||||
if view_num < 9:
|
||||
modifier = "<PRIMARY><ALT>%d" % ((view_num % 9) + 1)
|
||||
else:
|
||||
modifier = ""
|
||||
|
||||
stock_icon = page[0].stock_icon
|
||||
if stock_icon is None:
|
||||
stock_icon = cat_icon
|
||||
self.view_toggle_actions[cat_num].append((pageid,
|
||||
stock_icon,
|
||||
page[0].name, modifier, page[0].name, view_num))
|
||||
|
||||
views[cat_num].append((view_num, page[0].name, stock_icon))
|
||||
|
||||
if len(cat_views) > 1:
|
||||
#allow for switching views in a category
|
||||
self.ui_category[cat_num] = UICATEGORY % uimenuitems
|
||||
|
||||
for pdata in plugman.get_reg_sidebars():
|
||||
module = plugman.load_plugin(pdata)
|
||||
if not module:
|
||||
print("Error loading sidebar '%s': skipping content"
|
||||
% pdata.name)
|
||||
continue
|
||||
|
||||
sidebar_class = getattr(module, pdata.sidebarclass)
|
||||
sidebar_page = sidebar_class(dbstate, uistate, categories, views)
|
||||
self.add(pdata.menu_label, sidebar_page, pdata.order)
|
||||
|
||||
def get_top(self):
|
||||
"""
|
||||
Return the top container widget for the GUI.
|
||||
@@ -121,8 +215,37 @@ class Navigator(object):
|
||||
"""
|
||||
Called when a Gramps view is changed.
|
||||
"""
|
||||
for page in self.pages:
|
||||
page[1].view_changed(cat_num, view_num)
|
||||
self.active_cat = cat_num
|
||||
self.active_view = view_num
|
||||
|
||||
# Add buttons to the menu for the different view in the category
|
||||
uimanager = self.viewmanager.uimanager
|
||||
if self.cat_view_group:
|
||||
if self.cat_view_group in uimanager.get_action_groups():
|
||||
uimanager.remove_action_group(self.cat_view_group)
|
||||
|
||||
list(map(uimanager.remove_ui, self.merge_ids))
|
||||
|
||||
if cat_num in self.ui_category:
|
||||
self.cat_view_group = Gtk.ActionGroup('viewmenu')
|
||||
self.cat_view_group.add_radio_actions(
|
||||
self.view_toggle_actions[cat_num], value=view_num,
|
||||
on_change=self.cb_view_clicked, user_data=cat_num)
|
||||
self.cat_view_group.set_sensitive(True)
|
||||
uimanager.insert_action_group(self.cat_view_group, 1)
|
||||
mergeid = uimanager.add_ui_from_string(self.ui_category[cat_num])
|
||||
self.merge_ids.append(mergeid)
|
||||
|
||||
# Call the view_changed method for the active sidebar
|
||||
sidebar = self.pages[self.notebook.get_current_page()][1]
|
||||
sidebar.view_changed(cat_num, view_num)
|
||||
|
||||
def cb_view_clicked(self, radioaction, current, cat_num):
|
||||
"""
|
||||
Called when a view is selected from the menu.
|
||||
"""
|
||||
view_num = radioaction.get_current_value()
|
||||
self.viewmanager.goto_page(cat_num, view_num)
|
||||
|
||||
def __menu_button_pressed(self, button, event):
|
||||
"""
|
||||
@@ -145,8 +268,12 @@ class Navigator(object):
|
||||
"""
|
||||
Called when the user has switched to a new sidebar plugin page.
|
||||
"""
|
||||
if self.pages:
|
||||
self.title_label.set_text(self.pages[index][0])
|
||||
old_page = notebook.get_current_page()
|
||||
if old_page != -1:
|
||||
self.pages[old_page][1].inactive()
|
||||
self.pages[index][1].active(self.active_cat, self.active_view)
|
||||
self.pages[index][1].view_changed(self.active_cat, self.active_view)
|
||||
self.title_label.set_text(self.pages[index][0])
|
||||
|
||||
def cb_close_clicked(self, button):
|
||||
"""
|
||||
@@ -164,9 +291,9 @@ def cb_menu_position(menu, button):
|
||||
"""
|
||||
Determine the position of the popup menu.
|
||||
"""
|
||||
x_pos, y_pos = button.window.get_origin()
|
||||
x_pos += button.allocation.x
|
||||
y_pos += button.allocation.y + button.allocation.height
|
||||
ret_val, x_pos, y_pos = button.get_window().get_origin()
|
||||
x_pos += button.get_allocation().x
|
||||
y_pos += button.get_allocation().y + button.get_allocation().height
|
||||
|
||||
return (x_pos, y_pos, False)
|
||||
|
||||
|
||||
@@ -374,7 +374,7 @@ class WriterOptionBox(object):
|
||||
# Now, we can't add something that we want hidden
|
||||
for n in range(5):
|
||||
self.vbox_n[n].pack_start(self.up_n[n], True, True, 0)
|
||||
self.vbox_n[n].pack_end(self.down_n[n])
|
||||
self.vbox_n[n].pack_end(self.down_n[n], False, True, 0)
|
||||
# some spacer buttons:
|
||||
up = Gtk.Button()
|
||||
up.set_sensitive(0)
|
||||
|
||||
@@ -892,6 +892,7 @@ class BookDialog(DocReportDialog):
|
||||
self.doc = self.format(None, pstyle)
|
||||
user = User()
|
||||
self.rptlist = []
|
||||
self.global_style = None
|
||||
for item in self.book.get_item_list():
|
||||
item.option_class.set_document(self.doc)
|
||||
report_class = item.get_write_item()
|
||||
@@ -899,6 +900,13 @@ class BookDialog(DocReportDialog):
|
||||
item.option_class, user)
|
||||
style_sheet = create_style_sheet(item)
|
||||
self.rptlist.append((obj, style_sheet))
|
||||
if ( item.name == 'table_of_contents' or
|
||||
item.name == 'alphabetical_index' ): # ugly hack: FIXME
|
||||
if self.global_style is None:
|
||||
self.global_style = style_sheet
|
||||
else:
|
||||
self.global_style = create_style_sheet(item,
|
||||
self.global_style)
|
||||
self.doc.open(self.target_path)
|
||||
|
||||
def make_book(self):
|
||||
@@ -915,6 +923,8 @@ class BookDialog(DocReportDialog):
|
||||
if rpt:
|
||||
rpt.begin_report()
|
||||
rpt.write_report()
|
||||
if self.global_style:
|
||||
self.doc.set_style_sheet(self.global_style)
|
||||
self.doc.close()
|
||||
|
||||
if self.open_with_app.get_active():
|
||||
|
||||
@@ -179,12 +179,19 @@ class BaseSelector(ManagedWindow):
|
||||
|
||||
def get_selected_ids(self):
|
||||
mlist = []
|
||||
self.selection.selected_foreach(self.select_function,mlist)
|
||||
self.selection.selected_foreach(self.select_function, mlist)
|
||||
return mlist
|
||||
|
||||
def select_function(self,store,path,iter,id_list):
|
||||
handle_column = self.get_handle_column()
|
||||
id_list.append(self.model.get_value(iter, handle_column))
|
||||
def first_selected(self):
|
||||
""" first selected entry in the Selector tree
|
||||
"""
|
||||
mlist = []
|
||||
self.selection.selected_foreach(self.select_function, mlist)
|
||||
return mlist[0] if mlist else None
|
||||
|
||||
def select_function(self, store, path, iter_, id_list):
|
||||
handle = store.get_handle_from_iter(iter_)
|
||||
id_list.append(handle)
|
||||
|
||||
def run(self):
|
||||
val = self.window.run()
|
||||
@@ -230,10 +237,6 @@ class BaseSelector(ManagedWindow):
|
||||
def get_from_handle_func2(self):
|
||||
return None
|
||||
|
||||
def get_handle_column(self):
|
||||
# return 3
|
||||
assert False, "Must be defined in the subclass"
|
||||
|
||||
def set_show_search_bar(self, value):
|
||||
"""make the search bar at the top shown
|
||||
"""
|
||||
@@ -245,18 +248,6 @@ class BaseSelector(ManagedWindow):
|
||||
else :
|
||||
self.search_bar.hide()
|
||||
|
||||
def begintree(self, store, path, node, sel_list):
|
||||
handle_column = self.get_handle_column()
|
||||
handle = store.get_value(node, handle_column)
|
||||
sel_list.append(handle)
|
||||
|
||||
def first_selected(self):
|
||||
""" first selected entry in the Selector tree
|
||||
"""
|
||||
mlist = []
|
||||
self.selection.selected_foreach(self.begintree, mlist)
|
||||
return mlist[0] if mlist else None
|
||||
|
||||
def column_order(self):
|
||||
"""
|
||||
returns a tuple indicating the column order of the model
|
||||
|
||||
Loaded 100 of 463 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user