* 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 33246ec700
commit 77fce526cf
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> 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.) * 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() filename = choose.get_filename()
if save and os.path.splitext(filename)[1] != ".grdb": if save and os.path.splitext(filename)[1] != ".grdb":
filename = filename + ".grdb" filename = filename + ".grdb"
self.db.read_file(filename)
choose.destroy() choose.destroy()
self.db.read_file(filename)
return 1 return 1
else: else:
choose.destroy() choose.destroy()

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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