* src/DbPrompter.py: remove unused functions

* src/DisplayModels.py: filtering support
* src/GenericFilter.py: filtering support
* src/PeopleModel.py: support for filtering
* src/PeopleView.py: support for filtering
* src/RelLib.py: filtering support
* src/Utils.py: filtering support
* src/gramps.glade: remove invert for filters
* src/gramps_main.py: filtering support


svn: r3114
This commit is contained in:
Don Allingham 2004-04-28 04:06:25 +00:00
parent 162ca85ba0
commit 4407b69063
32 changed files with 476 additions and 207 deletions

View File

@ -1,3 +1,14 @@
2004-04-27 Don Allingham <dallingham@users.sourceforge.net>
* src/DbPrompter.py: remove unused functions
* src/DisplayModels.py: filtering support
* src/GenericFilter.py: filtering support
* src/PeopleModel.py: support for filtering
* src/PeopleView.py: support for filtering
* src/RelLib.py: filtering support
* src/Utils.py: filtering support
* src/gramps.glade: remove invert for filters
* src/gramps_main.py: filtering support
2004-04-25 Alex Roitman <shura@alex.neuro.umn.edu>
* src/plugins/IndivComplete.py: Convert to db interface.
* src/plugins/DescendReport.py: Convert to db interface.

View File

@ -109,7 +109,10 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
POFILES = @POFILES@
PYGTK_CFLAGS = @PYGTK_CFLAGS@
PYGTK_LIBS = @PYGTK_LIBS@
PYTHON = @PYTHON@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_PLATFORM = @PYTHON_PLATFORM@

58
gramps2/aclocal.m4 vendored
View File

@ -11,6 +11,64 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
dnl also defines GSTUFF_PKG_ERRORS on error
AC_DEFUN(PKG_CHECK_MODULES, [
succeeded=no
if test -z "$PKG_CONFIG"; then
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
fi
if test "$PKG_CONFIG" = "no" ; then
echo "*** The pkg-config script could not be found. Make sure it is"
echo "*** in your path, or set the PKG_CONFIG environment variable"
echo "*** to the full path to pkg-config."
echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
else
PKG_CONFIG_MIN_VERSION=0.9.0
if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
AC_MSG_CHECKING(for $2)
if $PKG_CONFIG --exists "$2" ; then
AC_MSG_RESULT(yes)
succeeded=yes
AC_MSG_CHECKING($1_CFLAGS)
$1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
AC_MSG_RESULT($$1_CFLAGS)
AC_MSG_CHECKING($1_LIBS)
$1_LIBS=`$PKG_CONFIG --libs "$2"`
AC_MSG_RESULT($$1_LIBS)
else
$1_CFLAGS=""
$1_LIBS=""
## If we have a custom action on failure, don't print errors, but
## do set a variable so people can do so.
$1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
ifelse([$4], ,echo $$1_PKG_ERRORS,)
fi
AC_SUBST($1_CFLAGS)
AC_SUBST($1_LIBS)
else
echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
echo "*** See http://www.freedesktop.org/software/pkgconfig"
fi
fi
if test $succeeded = yes; then
ifelse([$3], , :, [$3])
else
ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
fi
])
# -*- Autoconf -*-
# Copyright (C) 2002, 2003 Free Software Foundation, Inc.
# Generated from amversion.in; do not edit by hand.

121
gramps2/configure vendored
View File

@ -274,7 +274,7 @@ PACKAGE_STRING='gramps 1.1.0'
PACKAGE_BUGREPORT='gramps-bugs@lists.sourceforge.net'
ac_unique_file="src/gramps.py"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot RELEASE VERSIONSTRING MSGFMT MSGCONV ICONV LANGUAGES POFILES MOFILES PYTHON PYTHON_VERSION PYTHON_PREFIX PYTHON_EXEC_PREFIX PYTHON_PLATFORM pythondir pkgpythondir pyexecdir pkgpyexecdir BINSH SK_CONFIG SCROLLKEEPER_BUILD_REQUIRED GNOMEHELP GPREFIX LIBOBJS LTLIBOBJS'
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot RELEASE VERSIONSTRING MSGFMT MSGCONV ICONV LANGUAGES POFILES MOFILES PYTHON PYTHON_VERSION PYTHON_PREFIX PYTHON_EXEC_PREFIX PYTHON_PLATFORM pythondir pkgpythondir pyexecdir pkgpyexecdir BINSH PKG_CONFIG PYGTK_CFLAGS PYGTK_LIBS SK_CONFIG SCROLLKEEPER_BUILD_REQUIRED GNOMEHELP GPREFIX LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@ -2042,31 +2042,103 @@ def out(str):
"
echo "$as_me:$LINENO: checking Python bindings for gtk" >&5
echo $ECHO_N "checking Python bindings for gtk... $ECHO_C" >&6
cat > conftest.py <<EOF
$pygtk_require
try:
import gobject
out("YES")
except ImportError:
out("No")
EOF
$PYTHON conftest.py
has_pygtk=`cat conftest.out`
rm -f conftest.out conftest.py
if test YES != "$has_pygtk"
then
{ { echo "$as_me:$LINENO: error:
succeeded=no
**** The python bindings for gtk 2.0 (pygtk2) could not be found." >&5
echo "$as_me: error:
if test -z "$PKG_CONFIG"; then
# Extract the first word of "pkg-config", so it can be a program name with args.
set dummy pkg-config; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_PKG_CONFIG+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
case $PKG_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
**** The python bindings for gtk 2.0 (pygtk2) could not be found." >&2;}
{ (exit 1); exit 1; }; }
test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
;;
esac
fi
echo "$as_me:$LINENO: result: ok" >&5
echo "${ECHO_T}ok" >&6
PKG_CONFIG=$ac_cv_path_PKG_CONFIG
if test -n "$PKG_CONFIG"; then
echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5
echo "${ECHO_T}$PKG_CONFIG" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
fi
if test "$PKG_CONFIG" = "no" ; then
echo "*** The pkg-config script could not be found. Make sure it is"
echo "*** in your path, or set the PKG_CONFIG environment variable"
echo "*** to the full path to pkg-config."
echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
else
PKG_CONFIG_MIN_VERSION=0.9.0
if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
echo "$as_me:$LINENO: checking for pygtk-2.0 >= 2.3.4" >&5
echo $ECHO_N "checking for pygtk-2.0 >= 2.3.4... $ECHO_C" >&6
if $PKG_CONFIG --exists "pygtk-2.0 >= 2.3.4" ; then
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
succeeded=yes
echo "$as_me:$LINENO: checking PYGTK_CFLAGS" >&5
echo $ECHO_N "checking PYGTK_CFLAGS... $ECHO_C" >&6
PYGTK_CFLAGS=`$PKG_CONFIG --cflags "pygtk-2.0 >= 2.3.4"`
echo "$as_me:$LINENO: result: $PYGTK_CFLAGS" >&5
echo "${ECHO_T}$PYGTK_CFLAGS" >&6
echo "$as_me:$LINENO: checking PYGTK_LIBS" >&5
echo $ECHO_N "checking PYGTK_LIBS... $ECHO_C" >&6
PYGTK_LIBS=`$PKG_CONFIG --libs "pygtk-2.0 >= 2.3.4"`
echo "$as_me:$LINENO: result: $PYGTK_LIBS" >&5
echo "${ECHO_T}$PYGTK_LIBS" >&6
else
PYGTK_CFLAGS=""
PYGTK_LIBS=""
## If we have a custom action on failure, don't print errors, but
## do set a variable so people can do so.
PYGTK_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "pygtk-2.0 >= 2.3.4"`
echo $PYGTK_PKG_ERRORS
fi
else
echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
echo "*** See http://www.freedesktop.org/software/pkgconfig"
fi
fi
if test $succeeded = yes; then
:
else
{ { echo "$as_me:$LINENO: error: Library requirements (pygtk-2.0 >= 2.3.4) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5
echo "$as_me: error: Library requirements (pygtk-2.0 >= 2.3.4) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;}
{ (exit 1); exit 1; }; }
fi
echo "$as_me:$LINENO: checking Python bindings for gnome" >&5
echo $ECHO_N "checking Python bindings for gnome... $ECHO_C" >&6
@ -2962,6 +3034,9 @@ s,@pkgpythondir@,$pkgpythondir,;t t
s,@pyexecdir@,$pyexecdir,;t t
s,@pkgpyexecdir@,$pkgpyexecdir,;t t
s,@BINSH@,$BINSH,;t t
s,@PKG_CONFIG@,$PKG_CONFIG,;t t
s,@PYGTK_CFLAGS@,$PYGTK_CFLAGS,;t t
s,@PYGTK_LIBS@,$PYGTK_LIBS,;t t
s,@SK_CONFIG@,$SK_CONFIG,;t t
s,@SCROLLKEEPER_BUILD_REQUIRED@,$SCROLLKEEPER_BUILD_REQUIRED,;t t
s,@GNOMEHELP@,$GNOMEHELP,;t t

View File

@ -54,26 +54,7 @@ def out(str):
"
dnl Check if python bindings for gtk are installed
AC_MSG_CHECKING(Python bindings for gtk)
cat > conftest.py <<EOF
$pygtk_require
try:
import gobject
out("YES")
except ImportError:
out("No")
EOF
$PYTHON conftest.py
has_pygtk=`cat conftest.out`
rm -f conftest.out conftest.py
if test YES != "$has_pygtk"
then
AC_MSG_ERROR([
**** The python bindings for gtk 2.0 (pygtk2) could not be found.])
fi
AC_MSG_RESULT(ok)
PKG_CHECK_MODULES(PYGTK,pygtk-2.0 >= 2.3.4)
AC_MSG_CHECKING(Python bindings for gnome)
cat > conftest.py <<EOF

View File

@ -93,7 +93,10 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
POFILES = @POFILES@
PYGTK_CFLAGS = @PYGTK_CFLAGS@
PYGTK_LIBS = @PYGTK_LIBS@
PYTHON = @PYTHON@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_PLATFORM = @PYTHON_PLATFORM@

View File

@ -141,7 +141,10 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
POFILES = @POFILES@
PYGTK_CFLAGS = @PYGTK_CFLAGS@
PYGTK_LIBS = @PYGTK_LIBS@
PYTHON = @PYTHON@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_PLATFORM = @PYTHON_PLATFORM@

View File

@ -89,7 +89,10 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
POFILES = @POFILES@
PYGTK_CFLAGS = @PYGTK_CFLAGS@
PYGTK_LIBS = @PYGTK_LIBS@
PYTHON = @PYTHON@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_PLATFORM = @PYTHON_PLATFORM@

View File

@ -141,7 +141,10 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
POFILES = @POFILES@
PYGTK_CFLAGS = @PYGTK_CFLAGS@
PYGTK_LIBS = @PYGTK_LIBS@
PYTHON = @PYTHON@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_PLATFORM = @PYTHON_PLATFORM@

View File

@ -141,7 +141,10 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
POFILES = @POFILES@
PYGTK_CFLAGS = @PYGTK_CFLAGS@
PYGTK_LIBS = @PYGTK_LIBS@
PYTHON = @PYTHON@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_PLATFORM = @PYTHON_PLATFORM@

View File

@ -87,7 +87,10 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
POFILES = @POFILES@
PYGTK_CFLAGS = @PYGTK_CFLAGS@
PYGTK_LIBS = @PYGTK_LIBS@
PYTHON = @PYTHON@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_PLATFORM = @PYTHON_PLATFORM@

View File

@ -82,7 +82,10 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
POFILES = @POFILES@
PYGTK_CFLAGS = @PYGTK_CFLAGS@
PYGTK_LIBS = @PYGTK_LIBS@
PYTHON = @PYTHON@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_PLATFORM = @PYTHON_PLATFORM@

View File

@ -1,5 +1,5 @@
%define ver 1.1.0
%define rel 0.CVS20040410
%define rel 0.CVS20040421
%define prefix /usr
%define localstatedir /var/lib
# Ensure that internal RPM macros for configure & makeinstall

View File

@ -1,5 +1,5 @@
%define ver 1.1.0
%define rel 0.CVS20040410
%define rel 0.CVS20040421
%define prefix /usr
%define localstatedir /var/lib
# Ensure that internal RPM macros for configure & makeinstall

View File

@ -176,8 +176,8 @@ class DbPrompter:
Utils.destroy_passed_object(obj)
def open_delete_event(self,obj,event):
gtk.mainquit()
gtk.main_quit()
def open_cancel_clicked(self,obj):
gtk.mainquit()
gtk.main_quit()

View File

@ -62,12 +62,9 @@ class BaseModel(gtk.GenericTreeModel):
def on_row_deleted(self,obj,path):
self.rebuild_data()
# def find_path(self,iter):
# return self.iter2path.get(iter)
def on_get_flags(self):
'''returns the GtkTreeModelFlags for this particular type of model'''
return 0
return gtk.TREE_MODEL_LIST_ONLY
def on_get_n_columns(self):
return 9

View File

@ -282,7 +282,6 @@ class HasCompleteRecord(Rule):
def apply(self,db,p_id):
return db.find_person_from_id(p_id).get_complete() == 1
#-------------------------------------------------------------------------
#
# IsFemale
@ -939,7 +938,7 @@ class IsMale(Rule):
return _('Matches all males')
def apply(self,db,p_id):
return self.db.find_person_from_id(p_id).get_gender() == RelLib.Person.male
return db.find_person_from_id(p_id).get_gender() == RelLib.Person.male
#-------------------------------------------------------------------------
#

View File

@ -95,7 +95,10 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
POFILES = @POFILES@
PYGTK_CFLAGS = @PYGTK_CFLAGS@
PYGTK_LIBS = @PYGTK_LIBS@
PYTHON = @PYTHON@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_PLATFORM = @PYTHON_PLATFORM@

View File

@ -18,30 +18,53 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------
#
# Standard python modules
#
#-------------------------------------------------------------------------
from gettext import gettext as _
#-------------------------------------------------------------------------
#
# GTK modules
#
#-------------------------------------------------------------------------
import gobject
import gtk
import gtk.glade
import gnome
import gnome.ui
COLUMN_NAME = 0
COLUMN_NAME_SORT = 7
import pango
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
from RelLib import *
#-------------------------------------------------------------------------
#
# constants
#
#-------------------------------------------------------------------------
COLUMN_NAME = 0
COLUMN_NAME_SORT = 7
COLUMN_VIEW = 8
COLUMN_BOLD = 9
#-------------------------------------------------------------------------
#
# PeopleModel
#
#-------------------------------------------------------------------------
class PeopleModel(gtk.GenericTreeModel):
def __init__(self,db,filter=None):
gtk.GenericTreeModel.__init__(self)
self.set_property("leak_references",0)
self.db = db
self.filter = filter
self.visible = {}
self.rebuild_data()
self.connect('row-inserted',self.on_row_inserted)
self.connect('row-deleted',self.on_row_deleted)
self.fmap = [
self.column_name,
self.column_id,
@ -53,24 +76,52 @@ class PeopleModel(gtk.GenericTreeModel):
self.sort_name,
]
maps = self.db.get_people_view_maps()
if maps[0] != None:
self.top_iter2path = maps[0]
self.top_path2iter = maps[1]
self.iter2path = maps[2]
self.path2iter = maps[3]
self.sname_sub = maps[4]
else:
self.rebuild_data()
self.connect('row-deleted',self.on_row_deleted)
def on_row_deleted(self,model,path):
surname = self.top_path2iter[path[0]]
pid = self.path2iter[(surname,path[1])]
for idval in self.sname_sub[surname]:
key = self.iter2path[idval]
del self.iter2path[idval]
del self.path2iter[key]
self.sname_sub[surname].remove(pid)
val = 0
entries = self.sname_sub[surname]
entries.sort(self.byname)
for person_id in entries:
tpl = (surname,val)
self.iter2path[person_id] = tpl
self.path2iter[tpl] = person_id
val += 1
return 0
def rebuild_data(self):
self.top_iter2path = {}
self.top_path2iter = {}
self.iter2path = {}
self.path2iter = {}
self.sname_sub = {}
self.visible = {}
if not self.db.is_open():
return
import time
t = time.time()
for person_id in self.db.get_person_keys():
person = self.db.find_person_from_id(person_id)
if self.filter and not self.filter(person):
continue
surname = unicode(person.get_primary_name().get_surname())
if self.sname_sub.has_key(surname):
@ -93,25 +144,55 @@ class PeopleModel(gtk.GenericTreeModel):
self.path2iter[tpl] = person_id
val += 1
sval += 1
print time.time() - t
def add_person(self,person):
pid = person.get_id()
surname = person.get_primary_name().get_surname()
if self.sname_sub.has_key(surname):
self.sname_sub[surname].append(pid)
else:
self.sname_sub[surname] = [pid]
inscol = 0
sval = 0
name_list = self.db.get_surnames()
for name in name_list:
if self.sname_sub.has_key(name):
self.top_iter2path[name] = (sval,)
self.top_path2iter[sval] = name
if name == surname:
inscol = (sval,)
sval += 1
self.row_inserted(inscol,self.get_iter(inscol))
inscol = 0
val = 0
entries = self.sname_sub[surname]
entries.sort(self.byname)
for person_id in entries:
tpl = (surname,val)
self.iter2path[person_id] = tpl
self.path2iter[tpl] = person_id
if person_id == pid:
inscol = val
val += 1
col = self.top_iter2path[surname]
mypath = (col[0],inscol)
self.row_inserted(mypath,self.get_iter(mypath))
def byname(self,f,s):
n1 = self.db.person_map.get(str(f))[2].get_sort_name()
n2 = self.db.person_map.get(str(s))[2].get_sort_name()
return cmp(n1,n2)
def on_row_inserted(self,obj,path,iter):
self.rebuild_data()
def on_row_deleted(self,obj,path):
self.rebuild_data()
def on_get_flags(self):
'''returns the GtkTreeModelFlags for this particular type of model'''
return 1
return gtk.TREE_MODEL_ITERS_PERSIST
def on_get_n_columns(self):
return 8
return 9
def on_get_path(self, node):
'''returns the tree path (a tuple of indices at the various
@ -123,20 +204,36 @@ class PeopleModel(gtk.GenericTreeModel):
return (self.top_iter2path[surname][0],index)
def on_get_column_type(self,index):
return gobject.TYPE_STRING
"""The visibility column is a boolean, the weight column is an integer,
everthing else is a string"""
if index == COLUMN_VIEW:
return gobject.TYPE_BOOLEAN
elif index == COLUMN_BOLD:
return gobject.TYPE_INT
else:
return gobject.TYPE_STRING
def on_get_iter(self, path):
try:
if len(path)==1:
if len(path)==1: # Top Level
return self.top_path2iter[path[0]]
else:
else: # Sublevel
surname = self.top_path2iter[path[0]]
return self.path2iter[(surname,path[1])]
except:
return None
def on_get_value(self,iter,col):
if self.top_iter2path.has_key(iter):
if col == COLUMN_BOLD:
if self.top_iter2path.has_key(iter):
return pango.WEIGHT_BOLD
else:
return pango.WEIGHT_NORMAL
elif col == COLUMN_VIEW:
if self.top_iter2path.has_key(iter):
return 1
return self.visible.has_key(iter)
elif self.top_iter2path.has_key(iter):
if col == 0:
return iter
elif col == COLUMN_NAME_SORT:
@ -147,6 +244,12 @@ class PeopleModel(gtk.GenericTreeModel):
val = self.fmap[col](self.db.person_map[str(iter)])
return val
def reset_visible(self):
self.visible = {}
def set_visible(self,iter,val):
self.visible[iter] = val
def on_iter_next(self, node):
'''returns the next node at this level of the tree'''
if self.top_iter2path.has_key(node):
@ -160,15 +263,19 @@ class PeopleModel(gtk.GenericTreeModel):
"""Return the first child of the node"""
if node == None:
return self.top_path2iter[0]
return self.path2iter.get((node,0))
else:
return self.path2iter.get((node,0))
def on_iter_has_child(self, node):
'''returns true if this node has children'''
if node == None:
return len(top_iter2path) > 0
if len(self.top_iter2path) > 0:
return gtk.TRUE
else:
return gtk.FALSE
if self.sname_sub.has_key(node) and len(self.sname_sub[node]) > 0:
return 1
return 0
return gtk.TRUE
return gtk.FALSE
def on_iter_n_children(self,node):
if node == None:
@ -178,6 +285,8 @@ class PeopleModel(gtk.GenericTreeModel):
return 0
def on_iter_nth_child(self,node,n):
if node == None:
return self.top_path2iter.get(n)
path = self.top_iter2path.get(node)
if path:
return self.path2iter.get((node,n))
@ -233,4 +342,4 @@ class PeopleModel(gtk.GenericTreeModel):
return self.db.find_place_from_id(place_id).get_title()
return u""
_GENDER = [ _('female'), _('male'), _('unknown') ]
_GENDER = [ _(u'female'), _(u'male'), _(u'unknown') ]

View File

@ -48,6 +48,7 @@ _sel_mode = gtk.SELECTION_SINGLE
#-------------------------------------------------------------------------
import PeopleModel
import Filter
import GenericFilter
import const
column_names = [
@ -70,7 +71,11 @@ class PeopleView:
def __init__(self,parent):
self.parent = parent
self.DataFilter = Filter.Filter("")
all = GenericFilter.GenericFilter()
all.set_name(_("Entire Database"))
all.add_rule(GenericFilter.Everyone([]))
self.DataFilter = all
self.pscroll = self.parent.gtop.get_widget("pscroll")
self.person_tree = self.parent.gtop.get_widget("person_tree")
self.person_tree.set_rules_hint(gtk.TRUE)
@ -78,18 +83,27 @@ class PeopleView:
self.columns = []
self.build_columns()
self.build_tree()
self.person_selection = self.person_tree.get_selection()
self.person_selection.connect('changed',self.row_changed)
self.person_tree.connect('row_activated', self.alpha_event)
self.person_tree.connect('button-press-event',self.on_plist_button_press)
def get_maps(self):
return (self.person_model.top_iter2path,
self.person_model.top_path2iter,
self.person_model.iter2path,
self.person_model.path2iter,
self.person_model.sname_sub)
def build_columns(self):
for column in self.columns:
self.person_tree.remove_column(column)
column = gtk.TreeViewColumn(_('Name'), self.renderer,text=0)
column = gtk.TreeViewColumn(_('Name'), self.renderer,text=0,weight=9)
column.set_resizable(gtk.TRUE)
column.set_min_width(225)
if not const.nosort_tree:
column.set_clickable(gtk.TRUE)
column.set_sort_column_id(PeopleModel.COLUMN_NAME_SORT)
column.set_clickable(gtk.TRUE)
column.set_sort_column_id(PeopleModel.COLUMN_NAME_SORT)
self.person_tree.append_column(column)
self.columns = [column]
@ -108,20 +122,14 @@ class PeopleView:
index += 1
def build_tree(self):
self.person_tree.set_model(None)
self.person_model = PeopleModel.PeopleModel(self.parent.db)
if const.nosort_tree:
self.sort_model = self.person_model
if gtk.pygtk_version >= (2,3,92):
self.sort_model = gtk.TreeModelSort(self.person_model).filter_new()
else:
self.sort_model = gtk.TreeModelSort(self.person_model)
self.sort_model.set_visible_column(PeopleModel.COLUMN_VIEW)
self.person_tree.set_model(self.sort_model)
self.person_selection = self.person_tree.get_selection()
self.person_selection.connect('changed',self.row_changed)
self.person_tree.connect('row_activated', self.alpha_event)
self.person_tree.connect('button-press-event',self.on_plist_button_press)
def blist(self,store,path,iter,id_list):
id_list.append(self.sort_model.get_value(iter,1))
@ -146,20 +154,31 @@ class PeopleView:
def change_db(self,db):
self.build_columns()
self.build_tree()
maps = db.get_people_view_maps()
self.person_model = PeopleModel.PeopleModel(db)
if not maps[0]:
self.build_tree()
if gtk.pygtk_version >= (2,3,92):
self.sort_model = gtk.TreeModelSort(self.person_model).filter_new()
else:
self.sort_model = gtk.TreeModelSort(self.person_model)
self.sort_model.set_visible_column(PeopleModel.COLUMN_VIEW)
self.person_tree.set_model(self.sort_model)
def clear(self):
pass
def remove_from_person_list(self,person,old_id=None):
"""Remove the selected person from the list. A person object is expected,
not an ID"""
self.build_tree()
if old_id == None:
old_id = person.get_id()
path = self.person_model.on_get_path(old_id)
self.person_model.row_deleted(path)
def remove_from_history(self,person,old_id=None):
def remove_from_history(self,person_id,old_id=None):
"""Removes a person from the history list"""
person_id = person.get_id()
if old_id:
del_id = old_id
else:
@ -175,19 +194,14 @@ class PeopleView:
self.parent.mhistory.remove(del_id)
def apply_filter_clicked(self):
invert_filter = self.parent.filter_inv.get_active()
qualifer = unicode(self.parent.filter_text.get_text())
mi = self.parent.filter_list.get_menu().get_active()
class_init = mi.get_data("function")
self.DataFilter = class_init(qualifer)
self.DataFilter.set_invert(invert_filter)
self.model_used = {}
self.clear_person_tabs()
self.apply_filter(self.person_tree)
self.DataFilter = mi.get_data("filter")
self.apply_filter()
self.goto_active_person()
def add_to_person_list(self,person,change=0):
self.build_tree()
path = self.person_model.add_person(person)
def goto_active_person(self,first=0):
if not self.parent.active_person:
@ -205,6 +219,13 @@ class PeopleView:
def apply_filter(self,current_model=None):
self.parent.status_text(_('Updating display...'))
keys = self.DataFilter.apply(self.parent.db,self.parent.db.get_person_keys())
self.person_model.reset_visible()
for person_id in keys:
self.person_model.set_visible(person_id,1)
self.sort_model.refilter()
self.parent.modify_statusbar()
def on_plist_button_press(self,obj,event):
@ -253,9 +274,10 @@ class PeopleView:
def redisplay_person_list(self,person):
self.person_model = PeopleModel.PeopleModel(self.parent.db)
if const.nosort_tree:
self.sort_model = self.person_model
if gtk.pygtk_version >= (2,3,92):
self.sort_model = gtk.TreeModelSort(self.person_model).filter_new()
else:
self.sort_model = gtk.TreeModelSort(self.person_model)
self.sort_model.set_visible_column(PeopleModel.COLUMN_VIEW)
self.person_tree.set_model(self.sort_model)

View File

@ -1789,7 +1789,6 @@ class Event(DataObj):
return 1
elif not (witness_list and other_list):
return 0
other_list = other_list[:]
for a in witness_list:
if a in other_list:
other_list.remove(a)
@ -2430,6 +2429,24 @@ class GrampsDB:
self.bookmarks = []
return 1
def get_people_view_maps(self):
if self.metadata:
return (self.metadata.get('tp_iter'),
self.metadata.get('tp_path'),
self.metadata.get('p_iter'),
self.metadata.get('p_path'),
self.metadata.get('sname'))
else:
return (None,None,None,None,None)
def set_people_view_maps(self,maps):
if self.metadata:
self.metadata['tp_iter'] = maps[0]
self.metadata['tp_path'] = maps[1]
self.metadata['p_iter'] = maps[2]
self.metadata['p_path'] = maps[3]
self.metadata['sname'] = maps[4]
def close(self):
self.person_map.close()
self.family_map.close()
@ -2494,10 +2511,6 @@ class GrampsDB:
return keys
else:
return []
# keys = self.person_map.keys()
# if type(keys) == type([]):
# keys.sort(self.sort_by_name)
# return keys
def get_person_display(self,key):
data = self.person_map.get(str(key))
@ -2515,8 +2528,6 @@ class GrampsDB:
data[6],
data[5],
data[2].get_sort_name(),
# sort.build_sort_date(bday),
# sort.build_sort_date(dday),
data[6],
data[5],
GrampsCfg.display_surname(data[2])]
@ -3142,7 +3153,7 @@ class GrampsDB:
def add_place_as(self,place,trans=None):
if trans != None:
trans.add(PLACE_KEY,index,None)
trans.add(PLACE_KEY,place.get_id(),None)
self.place_map.put(str(place.get_id()),place.serialize())
return place.get_id()

View File

@ -209,7 +209,7 @@ def family_upper_name(family,db):
def destroy_passed_object(obj):
obj.destroy()
while gtk.events_pending():
gtk.mainiteration()
gtk.main_iteration()
#-------------------------------------------------------------------------
#

View File

@ -86,7 +86,10 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
POFILES = @POFILES@
PYGTK_CFLAGS = @PYGTK_CFLAGS@
PYGTK_LIBS = @PYGTK_LIBS@
PYTHON = @PYTHON@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_PLATFORM = @PYTHON_PLATFORM@

View File

@ -91,7 +91,10 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
POFILES = @POFILES@
PYGTK_CFLAGS = @PYGTK_CFLAGS@
PYGTK_LIBS = @PYGTK_LIBS@
PYTHON = @PYTHON@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_PLATFORM = @PYTHON_PLATFORM@

View File

@ -82,7 +82,10 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
POFILES = @POFILES@
PYGTK_CFLAGS = @PYGTK_CFLAGS@
PYGTK_LIBS = @PYGTK_LIBS@
PYTHON = @PYTHON@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_PLATFORM = @PYTHON_PLATFORM@

View File

@ -86,7 +86,10 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
POFILES = @POFILES@
PYGTK_CFLAGS = @PYGTK_CFLAGS@
PYGTK_LIBS = @PYGTK_LIBS@
PYTHON = @PYTHON@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_PLATFORM = @PYTHON_PLATFORM@

View File

@ -82,7 +82,10 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
POFILES = @POFILES@
PYGTK_CFLAGS = @PYGTK_CFLAGS@
PYGTK_LIBS = @PYGTK_LIBS@
PYTHON = @PYTHON@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_PLATFORM = @PYTHON_PLATFORM@

View File

@ -1365,27 +1365,6 @@
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkCheckButton" id="invert">
<property name="border_width">6</property>
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Show people that do not match the filtering rule</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Invert</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="apply_filter">
<property name="visible">True</property>

View File

@ -58,6 +58,7 @@ import PlaceView
import FamilyView
import SourceView
import PeopleView
import GenericFilter
from QuestionDialog import *
@ -709,10 +710,28 @@ class Gramps:
def init_filters(self):
Filter.load_filters(const.filtersDir)
Filter.load_filters(os.path.expanduser("~/.gramps/filters"))
#Filter.load_filters(const.filtersDir)
#Filter.load_filters(os.path.expanduser("~/.gramps/filters"))
#menu = Filter.build_filter_menu(self.on_filter_name_changed,self.filter_text)
menu = Filter.build_filter_menu(self.on_filter_name_changed,self.filter_text)
filter_list = []
all = GenericFilter.GenericFilter()
all.set_name(_("Females"))
all.add_rule(GenericFilter.IsFemale([]))
filter_list.append(all)
all = GenericFilter.GenericFilter()
all.set_name(_("Males"))
all.add_rule(GenericFilter.IsMale([]))
filter_list.append(all)
all = GenericFilter.GenericFilter()
all.set_name(_("Entire Database"))
all.add_rule(GenericFilter.Everyone([]))
filter_list.append(all)
menu = GenericFilter.build_filter_menu(filter_list)
self.filter_list.set_menu(menu)
self.filter_text.set_sensitive(0)
@ -803,14 +822,14 @@ class Gramps:
"""Prompt to save on exit if needed"""
self.delete_abandoned_photos()
self.db.close()
gtk.mainquit()
gtk.main_quit()
def save_query(self):
"""Catch the reponse to the save on exit question"""
self.on_save_activate_quit()
self.delete_abandoned_photos()
self.db.close()
gtk.mainquit()
gtk.main_quit()
def save_query_noquit(self):
"""Catch the reponse to the save question, no quitting"""
@ -822,7 +841,7 @@ class Gramps:
"""Catch the reponse to the save on exit question"""
self.delete_abandoned_photos()
self.db.close()
gtk.mainquit()
gtk.main_quit()
def close_noquit(self):
"""Close database and delete abandoned photos, no quit"""
@ -835,7 +854,7 @@ class Gramps:
can delete any thumbnail images. The thumbnails may or may not exist, depending
on if the image was previewed.
"""
pass
self.db.set_people_view_maps(self.people_view.get_maps())
def on_about_activate(self,obj):
"""Displays the about box. Called from Help menu"""
@ -1242,7 +1261,6 @@ class Gramps:
self.update_display(0)
def delete_person_response(self):
trans = self.db.start_transaction()
if self.db.get_default_person() == self.active_person:
@ -1277,13 +1295,14 @@ class Gramps:
family = self.db.find_family_from_id(family_id)
family.remove_child_id(self.active_person.get_id())
self.db.commit_family(family,trans)
self.people_view.remove_from_history(self.active_person)
self.db.remove_person_id(self.active_person.get_id(),trans)
id = self.active_person.get_id()
self.people_view.remove_from_person_list(self.active_person)
self.people_view.remove_from_history(id)
self.db.remove_person_id(id, trans)
if self.hindex >= 0:
self.active_person = self.db.get_person(self.history[self.hindex])
self.active_person = self.db.find_person_from_id(self.history[self.hindex])
else:
self.change_active_person(None)
self.db.add_transaction(trans)
@ -1537,12 +1556,12 @@ class Gramps:
def load_progress(self,value):
self.statusbar.set_progress_percentage(value)
while gtk.events_pending():
gtk.mainiteration()
gtk.main_iteration()
def status_text(self,text):
self.statusbar.set_status(text)
while gtk.events_pending():
gtk.mainiteration()
gtk.main_iteration()
def post_load(self,name):
self.db.set_save_path(name)
@ -1726,49 +1745,7 @@ class Gramps:
# self.load_new_person(obj)
def open_example(self,obj):
if Utils.wasModified():
self.delobj = obj
SaveDialog(_('Save Changes Made to the Database?'),
_("Unsaved changes exist in the current database. If you "
"close without saving, the changes you have made will "
"be lost."),
self.close_noquit,
self.save_query_noquit)
if not Utils.wasModified():
import shutil
dest = os.path.expanduser("~/.gramps/example")
if not os.path.isdir(dest):
try:
os.mkdir(dest)
except IOError,msg:
ErrorDialog(_('Could not create database'),
_('The directory ~/.gramps/example could not '
'be created.') + '\n' + str(msg) )
except OSError,msg:
ErrorDialog(_('Could not create database'),
_('The directory ~/.gramps/example could not '
'be created.') + '\n' + str(msg) )
except:
ErrorDialog(_('Could not create database'),
_('The directory ~/.gramps/example could not '
'be created.'))
try:
dir = "%s/share/gramps/example" % const.prefixdir
for file in os.listdir(dir):
shutil.copyfile("%s/%s" % (dir,file),
"%s/%s" % (dest,file) )
try:
shutil.copystat("%s/%s" % (dir,file),
"%s/%s" % (dest,file))
except:
pass
except IOError,msg:
ErrorDialog(_('Example database not created'),str(msg))
except OSError,msg:
ErrorDialog(_('Example database not created'),str(msg))
self.read_file(dest)
pass
DARKEN = 1.4

View File

@ -85,7 +85,10 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
POFILES = @POFILES@
PYGTK_CFLAGS = @PYGTK_CFLAGS@
PYGTK_LIBS = @PYGTK_LIBS@
PYTHON = @PYTHON@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_PLATFORM = @PYTHON_PLATFORM@

View File

@ -63,9 +63,11 @@ class CountAncestors:
text = text + _("Generation %d has %d individuals.\n") % (gen, thisgensize)
temp = thisgen
thisgen = []
for person in temp:
family = person.get_main_parents_family_id()
if family != None:
for person_id in temp:
person = database.find_person_from_id(person_id)
family_id = person.get_main_parents_family_id()
if family_id:
family = database.find_family_from_id(family_id)
father = family.get_father_id()
mother = family.get_mother_id()
if father != None:

View File

@ -78,7 +78,10 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
POFILES = @POFILES@
PYGTK_CFLAGS = @PYGTK_CFLAGS@
PYGTK_LIBS = @PYGTK_LIBS@
PYTHON = @PYTHON@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_PLATFORM = @PYTHON_PLATFORM@