From 63a8ab5e163d4c2f58bf8450bb306df5c03bbd95 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sun, 17 Nov 2002 05:06:43 +0000 Subject: [PATCH] Delay attaching ListStore to TreeView until after names have been loaded. svn: r1191 --- gramps2/configure | 2 +- gramps2/configure.in | 2 +- gramps2/gramps.spec | 2 +- gramps2/src/ListModel.py | 13 ++++++++++--- gramps2/src/const.py | 2 +- gramps2/src/gramps_main.py | 25 +++++++++++++++++++------ 6 files changed, 33 insertions(+), 13 deletions(-) diff --git a/gramps2/configure b/gramps2/configure index 46c654a99..f9ca2fe5a 100755 --- a/gramps2/configure +++ b/gramps2/configure @@ -1567,7 +1567,7 @@ INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" -RELEASE=pre4 +RELEASE=pre5 VERSIONSTRING=$VERSION if test x"$RELEASE" != "x" diff --git a/gramps2/configure.in b/gramps2/configure.in index 3de86e064..b1fd727d7 100644 --- a/gramps2/configure.in +++ b/gramps2/configure.in @@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script. dnl May need to run automake && aclocal first AC_INIT(src/gramps.py) AM_INIT_AUTOMAKE(gramps, 0.9.0) -RELEASE=pre4 +RELEASE=pre5 VERSIONSTRING=$VERSION if test x"$RELEASE" != "x" diff --git a/gramps2/gramps.spec b/gramps2/gramps.spec index 55efe15f0..918c052aa 100644 --- a/gramps2/gramps.spec +++ b/gramps2/gramps.spec @@ -1,5 +1,5 @@ %define ver 0.9.0 -%define rel pre4 +%define rel pre5 %define prefix /usr Summary: Genealogical Research and Analysis Management Programming System. diff --git a/gramps2/src/ListModel.py b/gramps2/src/ListModel.py index b7b29cb93..5bdd1b2c0 100644 --- a/gramps2/src/ListModel.py +++ b/gramps2/src/ListModel.py @@ -25,11 +25,12 @@ class ListModel: def __init__(self,tree,dlist,select_func=None,event_func=None): self.tree = tree l = len(dlist) - mylist = [TYPE_STRING]*l + [TYPE_PYOBJECT] - self.model = gtk.ListStore(*mylist) + self.mylist = [TYPE_STRING]*l + [TYPE_PYOBJECT] + + self.new_model() + self.connect_model() self.selection = self.tree.get_selection() - self.tree.set_model(self.model) self.data_index = l @@ -61,6 +62,12 @@ class ListModel: self.double_click = event_func self.tree.connect('event',self.button_press) + def new_model(self): + self.model = gtk.ListStore(*self.mylist) + + def connect_model(self): + self.tree.set_model(self.model) + def get_selected(self): return self.selection.get_selected() diff --git a/gramps2/src/const.py b/gramps2/src/const.py index 5f74b4c2a..d8a6cc647 100644 --- a/gramps2/src/const.py +++ b/gramps2/src/const.py @@ -99,7 +99,7 @@ startup = 1 # #------------------------------------------------------------------------- progName = "GRAMPS" -version = "0.9.0-pre4" +version = "0.9.0-pre5" copyright = "© 2001-2002 Donald N. Allingham" authors = ["Donald N. Allingham", "David Hampton","Donald A. Peterson"] comments = _("GRAMPS (Genealogical Research and Analysis " diff --git a/gramps2/src/gramps_main.py b/gramps2/src/gramps_main.py index c562bff67..4df47d2f4 100755 --- a/gramps2/src/gramps_main.py +++ b/gramps2/src/gramps_main.py @@ -148,11 +148,15 @@ class Gramps: self.report_button = self.gtop.get_widget("reports") self.tool_button = self.gtop.get_widget("tools") + self.remove_button = self.gtop.get_widget("removebtn") + self.edit_button = self.gtop.get_widget("editbtn") self.sidebar = self.gtop.get_widget('side_event') self.filterbar = self.gtop.get_widget('filterbar') self.tool_button.set_sensitive(0) self.report_button.set_sensitive(0) + self.remove_button.set_sensitive(0) + self.edit_button.set_sensitive(0) set_panel(self.sidebar) set_panel(self.gtop.get_widget('side_people')) @@ -632,10 +636,7 @@ class Gramps: def full_update(self): """Brute force display update, updating all the pages""" - self.id2col = {} - for model in self.pl_page: - model.clear() - self.apply_filter() + self.complete_rebuild() self.family_view.load_family() self.source_view.load_sources() self.place_view.load_places() @@ -927,11 +928,15 @@ class Gramps: self.tools_menu.set_sensitive(1) self.report_button.set_sensitive(1) self.tool_button.set_sensitive(1) + self.remove_button.set_sensitive(1) + self.edit_button.set_sensitive(1) else: self.report_menu.set_sensitive(0) self.tools_menu.set_sensitive(0) self.report_button.set_sensitive(0) self.tool_button.set_sensitive(0) + self.remove_button.set_sensitive(0) + self.edit_button.set_sensitive(0) def modify_statusbar(self): if self.active_person == None: @@ -1343,8 +1348,17 @@ class Gramps: ErrorDialog(msg) self.status_text("") + def complete_rebuild(self): + self.status_text(_("Updating display...")) + keys = self.alpha_page.keys() + for key in keys: + self.alpha_page[key].new_model() + self.apply_filter() + for key in keys: + self.alpha_page[key].connect_model() + self.modify_statusbar() + def apply_filter(self): - self.status_text(_("Updating display")) datacomp = self.DataFilter.compare for key in self.db.getPersonKeys(): @@ -1372,7 +1386,6 @@ class Gramps: if self.id2col.has_key(key): (model,iter,page) = self.id2col[key] model.remove(iter) - self.modify_statusbar() def on_home_clicked(self,obj): temp = self.db.getDefaultPerson()