* src/DisplayModels,py: faster sorting of places

* src/PlaceView,py: faster sorting of places
* src/RelLib,py: faster sorting of places
* src/gramp_main.py: removed new database info message


svn: r3217
This commit is contained in:
Don Allingham 2004-06-20 03:06:21 +00:00
parent 18fecafb91
commit ab131c3f0c
8 changed files with 48 additions and 53 deletions

View File

@ -1,3 +1,9 @@
2004-06-19 Don Allingham <dallingham@users.sourceforge.net>
* src/DisplayModels,py: faster sorting of places
* src/PlaceView,py: faster sorting of places
* src/RelLib,py: faster sorting of places
* src/gramp_main.py: removed new database info message
2004-06-18 Jason Salaz <whatsizbucket@users.sourceforge.net>
* src/plugins/ReadGedcom.py Fixed typos preventing import. (i.e. set_type instead of SetType, etc.)

View File

@ -117,8 +117,8 @@ class DbPrompter:
filename = choose.get_filename()
if save and os.path.splitext(filename)[1] != ".grdb":
filename = filename + ".grdb"
self.db.read_file(filename)
choose.destroy()
self.db.read_file(filename)
return 1
else:
choose.destroy()

View File

@ -51,7 +51,8 @@ class BaseModel(gtk.GenericTreeModel):
return
val = 0
for place_id in self.sort_keys():
keys = self.sort_keys()
for place_id in keys:
self.iter2path[place_id] = (val,)
self.path2iter[(val,)] = place_id
val += 1

View File

@ -79,10 +79,7 @@ class PlaceView:
self.renderer = gtk.CellRendererText()
if const.nosort_tree:
self.model = DisplayModels.PlaceModel(self.db)
else:
self.model = gtk.TreeModelSort(DisplayModels.PlaceModel(self.db))
self.model = gtk.TreeModelSort(DisplayModels.PlaceModel(self.db))
self.list.set_model(self.model)
self.topWindow = self.glade.get_widget("gramps")
@ -96,9 +93,8 @@ class PlaceView:
column = gtk.TreeViewColumn(_('Place Name'), self.renderer,text=0)
column.set_resizable(gtk.TRUE)
if not const.nosort_tree:
column.set_clickable(gtk.TRUE)
column.set_sort_column_id(0)
column.set_clickable(gtk.TRUE)
column.set_sort_column_id(0)
column.set_min_width(225)
self.list.append_column(column)
@ -111,9 +107,8 @@ class PlaceView:
name = column_names[pair[1]]
column = gtk.TreeViewColumn(name, self.renderer, text=pair[1])
column.set_resizable(gtk.TRUE)
if not const.nosort_tree:
column.set_clickable(gtk.TRUE)
column.set_sort_column_id(index)
column.set_clickable(gtk.TRUE)
column.set_sort_column_id(index)
column.set_min_width(75)
self.columns.append(column)
self.list.append_column(column)
@ -128,10 +123,7 @@ class PlaceView:
def build_tree(self):
self.list.set_model(None)
if const.nosort_tree:
self.model = DisplayModels.PlaceModel(self.parent.db)
else:
self.model = gtk.TreeModelSort(DisplayModels.PlaceModel(self.parent.db))
self.model = gtk.TreeModelSort(DisplayModels.PlaceModel(self.parent.db))
self.list.set_model(self.model)
self.selection = self.list.get_selection()
@ -212,7 +204,6 @@ class PlaceView:
event_list.append(p.get_lds_sealing())
for event in event_list:
if event.get_place_id() == place.get_id():
print event.get_id()
used = 1
for fid in self.db.get_family_keys():
@ -226,7 +217,6 @@ class PlaceView:
event_list.append(f.get_lds_sealing())
for event in event_list:
if event.get_place_id() == place.get_id():
print event.get_id()
used = 1
if used == 1:

View File

@ -2390,6 +2390,7 @@ class GrampsDB:
self.metadata = None
self.undolabel = None
self.redolabel = None
self.undodb = None
def set_undo_label(self,label):
self.undolabel = label
@ -2404,6 +2405,7 @@ class GrampsDB:
self.close()
self.env = db.DBEnv()
self.env.set_cachesize(0,4*1024*1024) # 2MB
flags = db.DB_CREATE|db.DB_INIT_MPOOL|db.DB_PRIVATE
self.undolog = "%s.log" % name
@ -3299,9 +3301,7 @@ class GrampsDB:
return None
def sortbyplace(self,f,s):
fp = self.place_map[f][1].upper()
sp = self.place_map[s][1].upper()
return cmp(fp,sp)
return cmp(self.placesortmap[f], self.placesortmap[s])
def sortbysource(self,f,s):
fp = self.source_map[f][1].upper()
@ -3315,9 +3315,12 @@ class GrampsDB:
def sort_place_keys(self):
if self.place_map:
keys = self.place_map.keys()
if type(keys) == type([]):
keys.sort(self.sortbyplace)
self.placesortmap = {}
for key in self.place_map.keys():
self.placesortmap[key] = self.place_map[key][1].upper()
keys = self.placesortmap.keys()
keys.sort(self.sortbyplace)
del self.placesortmap
return keys
return []

View File

@ -2,7 +2,7 @@
SUBDIRS = templates
pkgdatadir = $(datadir)/@PACKAGE@/data
pkgdata_DATA = gedcom.xml \
dist_pkgdata_DATA = gedcom.xml \
papersize.xml \
tips.xml \
gnome-mime-application-x-gramps.png \

View File

@ -34,7 +34,8 @@ NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = src/data
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
DIST_COMMON = $(dist_pkgdata_DATA) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@ -50,8 +51,8 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
pdf-recursive ps-recursive uninstall-info-recursive \
uninstall-recursive
am__installdirs = "$(DESTDIR)$(pkgdatadir)"
pkgdataDATA_INSTALL = $(INSTALL_DATA)
DATA = $(pkgdata_DATA)
dist_pkgdataDATA_INSTALL = $(INSTALL_DATA)
DATA = $(dist_pkgdata_DATA)
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
@ -137,7 +138,7 @@ target_alias = @target_alias@
# This is the src/data level Makefile
SUBDIRS = templates
pkgdata_DATA = gedcom.xml \
dist_pkgdata_DATA = gedcom.xml \
papersize.xml \
tips.xml \
gnome-mime-application-x-gramps.png \
@ -181,19 +182,19 @@ $(top_srcdir)/configure: $(am__configure_deps)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
uninstall-info-am:
install-pkgdataDATA: $(pkgdata_DATA)
install-dist_pkgdataDATA: $(dist_pkgdata_DATA)
@$(NORMAL_INSTALL)
test -z "$(pkgdatadir)" || $(mkdir_p) "$(DESTDIR)$(pkgdatadir)"
@list='$(pkgdata_DATA)'; for p in $$list; do \
@list='$(dist_pkgdata_DATA)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f="`echo $$p | sed -e 's|^.*/||'`"; \
echo " $(pkgdataDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgdatadir)/$$f'"; \
$(pkgdataDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgdatadir)/$$f"; \
echo " $(dist_pkgdataDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgdatadir)/$$f'"; \
$(dist_pkgdataDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgdatadir)/$$f"; \
done
uninstall-pkgdataDATA:
uninstall-dist_pkgdataDATA:
@$(NORMAL_UNINSTALL)
@list='$(pkgdata_DATA)'; for p in $$list; do \
@list='$(dist_pkgdata_DATA)'; for p in $$list; do \
f="`echo $$p | sed -e 's|^.*/||'`"; \
echo " rm -f '$(DESTDIR)$(pkgdatadir)/$$f'"; \
rm -f "$(DESTDIR)$(pkgdatadir)/$$f"; \
@ -409,7 +410,7 @@ info: info-recursive
info-am:
install-data-am: install-data-local install-pkgdataDATA
install-data-am: install-data-local install-dist_pkgdataDATA
install-exec-am:
@ -435,7 +436,8 @@ ps: ps-recursive
ps-am:
uninstall-am: uninstall-info-am uninstall-local uninstall-pkgdataDATA
uninstall-am: uninstall-dist_pkgdataDATA uninstall-info-am \
uninstall-local
uninstall-info: uninstall-info-recursive
@ -444,13 +446,14 @@ uninstall-info: uninstall-info-recursive
distclean distclean-generic distclean-recursive distclean-tags \
distdir dvi dvi-am html html-am info info-am install \
install-am install-data install-data-am install-data-local \
install-exec install-exec-am install-info install-info-am \
install-man install-pkgdataDATA install-strip installcheck \
installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic maintainer-clean-recursive \
mostlyclean mostlyclean-generic mostlyclean-recursive pdf \
pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
uninstall-info-am uninstall-local uninstall-pkgdataDATA
install-dist_pkgdataDATA install-exec install-exec-am \
install-info install-info-am install-man install-strip \
installcheck installcheck-am installdirs installdirs-am \
maintainer-clean maintainer-clean-generic \
maintainer-clean-recursive mostlyclean mostlyclean-generic \
mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
uninstall uninstall-am uninstall-dist_pkgdataDATA \
uninstall-info-am uninstall-local
install-data-local:

View File

@ -1080,11 +1080,6 @@ class Gramps:
_('%s could not be opened.' % filename) + '\n' + msg[1])
return 0
if new_db:
OkDialog(_('New database created'),
_('GRAMPS has created a new database called %s') %
filename)
self.topWindow.set_resizable(gtk.TRUE)
self.people_view.apply_filter()
self.goto_active_person()
@ -1484,10 +1479,7 @@ class Gramps:
def on_places_activate(self,obj):
"""Switches to the places view"""
if len(self.db.get_place_id_keys()) > 2000:
self.status_text(_('Updating display - this may take a few seconds...'))
else:
self.status_text(_('Updating display...'))
self.status_text(_('Updating display...'))
self.views.set_current_page(PLACE_VIEW)
self.modify_statusbar()