From 1b684d51fad8de702c2919e2109d9813cd8797de Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sun, 10 Nov 2002 00:38:58 +0000 Subject: [PATCH] Tabbed pages in the person list svn: r1174 --- gramps2/configure | 2 +- gramps2/configure.in | 2 +- gramps2/gramps.spec | 12 +- gramps2/src/ListModel.py | 17 +- gramps2/src/const.py | 3 +- gramps2/src/const.py.in | 1 + gramps2/src/gramps.glade | 647 ++++++++++++++++++++++++++++++++++++- gramps2/src/gramps_main.py | 189 +++++++---- 8 files changed, 786 insertions(+), 87 deletions(-) diff --git a/gramps2/configure b/gramps2/configure index 2da7e9584..46c654a99 100755 --- a/gramps2/configure +++ b/gramps2/configure @@ -1567,7 +1567,7 @@ INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" -RELEASE=pre3 +RELEASE=pre4 VERSIONSTRING=$VERSION if test x"$RELEASE" != "x" diff --git a/gramps2/configure.in b/gramps2/configure.in index 4418c3270..3de86e064 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=pre3 +RELEASE=pre4 VERSIONSTRING=$VERSION if test x"$RELEASE" != "x" diff --git a/gramps2/gramps.spec b/gramps2/gramps.spec index c46bbb1e3..55efe15f0 100644 --- a/gramps2/gramps.spec +++ b/gramps2/gramps.spec @@ -1,5 +1,5 @@ %define ver 0.9.0 -%define rel pre3 +%define rel pre4 %define prefix /usr Summary: Genealogical Research and Analysis Management Programming System. @@ -13,10 +13,12 @@ BuildRoot: /var/tmp/%{name}-%{version}-root URL: http://gramps.sourceforge.net -Requires: python >= 1.5.2 -Requires: pygnome >= 1.0.53 -Requires: _gladegnomemodule.so -Requires: pyexpat.so +Requires: python >= 2.2 +Requires: gnome-python2 >= 1.99 +Requires: gnome-python2-gconf >= 1.99 +Requires: gnome-python2-canvas >= 1.99 +Requires: pygtk2 >= 1.99 +Requires: pygtk2-libglade >= 1.99 BuildRequires: scrollkeeper >= 0.1.4 BuildRequires: automake >= 1.6 diff --git a/gramps2/src/ListModel.py b/gramps2/src/ListModel.py index 20d70cca9..34dd66896 100644 --- a/gramps2/src/ListModel.py +++ b/gramps2/src/ListModel.py @@ -22,7 +22,7 @@ from gobject import TYPE_STRING import gtk class ListModel: - def __init__(self,tree,dlist): + def __init__(self,tree,dlist,select_func=None,event_func=None): self.tree = tree l = len(dlist) self.model = gtk.ListStore(*[TYPE_STRING]*l) @@ -31,13 +31,10 @@ class ListModel: self.tree.set_model(self.model) cnum = 0 - for name in dlist: renderer = gtk.CellRendererText() column = gtk.TreeViewColumn(name[0],renderer,text=cnum) - column.set_min_width(name[1]) - if name[2]: - column.set_sort_column_id(name[2]) + column.set_min_width(name[2]) if name[0] == '': column.set_clickable(gtk.TRUE) column.set_visible(gtk.FALSE) @@ -48,6 +45,16 @@ class ListModel: if cnum == 1: column.clicked() + cnum = 0 + for name in dlist: + column = tree.get_column(cnum) + column.set_sort_column_id(name[1]) + + if select_func: + self.selection.connect('changed',select_func) + if event_func: + self.tree.connect('event',event_func) + def clear(self): self.model.clear() diff --git a/gramps2/src/const.py b/gramps2/src/const.py index 13cf55089..7a3598928 100644 --- a/gramps2/src/const.py +++ b/gramps2/src/const.py @@ -96,12 +96,13 @@ startup = 1 # #------------------------------------------------------------------------- progName = "GRAMPS" -version = "0.9.0-pre3" +version = "0.9.0-pre4" copyright = "© 2001-2002 Donald N. Allingham" authors = ["Donald N. Allingham", "David Hampton","Donald A. Peterson"] comments = _("GRAMPS (Genealogical Research and Analysis " "Management Programming System) is a personal " "genealogy program.") +documenters = [ 'Don Allingham', 'Lawrence Allingham' ] #------------------------------------------------------------------------- # diff --git a/gramps2/src/const.py.in b/gramps2/src/const.py.in index 2d7f18d53..61a0c8761 100644 --- a/gramps2/src/const.py.in +++ b/gramps2/src/const.py.in @@ -102,6 +102,7 @@ authors = ["Donald N. Allingham", "David Hampton","Donald A. Peterson"] comments = _("GRAMPS (Genealogical Research and Analysis " "Management Programming System) is a personal " "genealogy program.") +documenters = { 'Don Allingham', 'Lawrence Allingham' ] #------------------------------------------------------------------------- # diff --git a/gramps2/src/gramps.glade b/gramps2/src/gramps.glade index ea60c3cb1..38994a2c6 100644 --- a/gramps2/src/gramps.glade +++ b/gramps2/src/gramps.glade @@ -1110,25 +1110,648 @@ - + True True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_NONE - GTK_CORNER_TOP_LEFT + True + True + GTK_POS_BOTTOM + False + 2 + 2 + False + - - 1 + True True - True - True - False - True - + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + 1 + True + True + True + True + False + True + + + + + False + True + + + + + + True + AB + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + True + True + True + False + True + + + + + False + True + + + + + + True + CD + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + True + True + True + False + True + + + + + False + True + + + + + + True + EF + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + True + True + True + False + True + + + + + False + True + + + + + + True + GH + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + True + True + True + False + True + + + + + False + True + + + + + + True + Ij + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + True + True + True + False + True + + + + + False + True + + + + + + True + KL + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + True + True + True + False + True + + + + + False + True + + + + + + True + MN + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + True + True + True + False + True + + + + + False + True + + + + + + True + OP + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + True + True + True + False + True + + + + + False + True + + + + + + True + QR + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + True + True + True + False + True + + + + + False + True + + + + + + True + ST + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + True + True + True + False + True + + + + + False + True + + + + + + True + UV + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + + + + + + True + True + GTK_POLICY_NEVER + GTK_POLICY_AUTOMATIC + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + True + True + True + False + True + + + + + False + True + + + + + + True + WX + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + True + True + True + False + True + + + + + False + True + + + + + + True + YZ + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + True + True + True + False + True + + + + + False + True + + + + + + True + Other + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + diff --git a/gramps2/src/gramps_main.py b/gramps2/src/gramps_main.py index 1aa6d7ba3..2bfde1129 100755 --- a/gramps2/src/gramps_main.py +++ b/gramps2/src/gramps_main.py @@ -72,6 +72,7 @@ import Find import VersionControl import ReadXML import AddSpouse +import ListModel from GrampsXML import GrampsXML try: @@ -80,6 +81,10 @@ try: except: zodb_ok = 0 +pl_titles = [ (_('Name'),5,250), (_('ID'),1,50), + (_('Gender'),2,70), (_('Birth Date'),6,150), + (_('Death Date'),7,150), ('',5,0), ('',6,0), ('',7,0) ] + #------------------------------------------------------------------------- # # Main GRAMPS class @@ -161,7 +166,72 @@ class Gramps: self.filter_btn = self.gtop.get_widget("filter1") self.statusbar = self.gtop.get_widget("statusbar") self.topWindow = self.gtop.get_widget("gramps") - self.person_list = self.gtop.get_widget("person_list") + + self.ptabs = self.gtop.get_widget("ptabs") + self.pl_ab = self.gtop.get_widget("pl_ab") + self.pl_cd = self.gtop.get_widget("pl_cd") + self.pl_ef = self.gtop.get_widget("pl_ef") + self.pl_gh = self.gtop.get_widget("pl_gh") + self.pl_ij = self.gtop.get_widget("pl_ij") + self.pl_kl = self.gtop.get_widget("pl_kl") + self.pl_mn = self.gtop.get_widget("pl_mn") + self.pl_op = self.gtop.get_widget("pl_op") + self.pl_qr = self.gtop.get_widget("pl_qr") + self.pl_st = self.gtop.get_widget("pl_st") + self.pl_uv = self.gtop.get_widget("pl_uv") + self.pl_wx = self.gtop.get_widget("pl_wx") + self.pl_yz = self.gtop.get_widget("pl_yz") + self.pl_other = self.gtop.get_widget("pl_other") + + self.pl_page = [ + ListModel.ListModel(self.pl_ab, pl_titles, self.row_changed, self.alpha_event), + ListModel.ListModel(self.pl_cd, pl_titles, self.row_changed, self.alpha_event), + ListModel.ListModel(self.pl_ef, pl_titles, self.row_changed, self.alpha_event), + ListModel.ListModel(self.pl_gh, pl_titles, self.row_changed, self.alpha_event), + ListModel.ListModel(self.pl_ij, pl_titles, self.row_changed, self.alpha_event), + ListModel.ListModel(self.pl_kl, pl_titles, self.row_changed, self.alpha_event), + ListModel.ListModel(self.pl_mn, pl_titles, self.row_changed, self.alpha_event), + ListModel.ListModel(self.pl_op, pl_titles, self.row_changed, self.alpha_event), + ListModel.ListModel(self.pl_qr, pl_titles, self.row_changed, self.alpha_event), + ListModel.ListModel(self.pl_st, pl_titles, self.row_changed, self.alpha_event), + ListModel.ListModel(self.pl_uv, pl_titles, self.row_changed, self.alpha_event), + ListModel.ListModel(self.pl_wx, pl_titles, self.row_changed, self.alpha_event), + ListModel.ListModel(self.pl_yz, pl_titles, self.row_changed, self.alpha_event), + ListModel.ListModel(self.pl_other, pl_titles, self.row_changed, self.alpha_event), + ] + + self.person_list = self.pl_page[0].tree + self.person_selection = self.pl_page[0].selection + self.person_model = self.pl_page[0].model + + self.default_list = self.pl_page[-1] + + self.alpha_page = { + 'a' : self.pl_page[0], 'b' : self.pl_page[0], + 'c' : self.pl_page[1], 'd' : self.pl_page[1], + 'e' : self.pl_page[2], 'f' : self.pl_page[2], + 'g' : self.pl_page[3], 'h' : self.pl_page[3], + 'i' : self.pl_page[4], 'j' : self.pl_page[4], + 'k' : self.pl_page[5], 'l' : self.pl_page[5], + 'm' : self.pl_page[6], 'n' : self.pl_page[6], + 'o' : self.pl_page[7], 'p' : self.pl_page[7], + 'q' : self.pl_page[8], 'r' : self.pl_page[8], + 's' : self.pl_page[9], 't' : self.pl_page[9], + 'u' : self.pl_page[10], 'v' : self.pl_page[10], + 'w' : self.pl_page[11], 'x' : self.pl_page[11], + 'y' : self.pl_page[12], 'z' : self.pl_page[12], + } + + self.model2page = { + self.pl_page[0] : 0, self.pl_page[1] : 1, + self.pl_page[2] : 2, self.pl_page[3] : 3, + self.pl_page[4] : 4, self.pl_page[5] : 5, + self.pl_page[6] : 6, self.pl_page[7] : 7, + self.pl_page[8] : 8, self.pl_page[9] : 9, + self.pl_page[10] : 10, self.pl_page[11] : 11, + self.pl_page[12] : 12, self.pl_page[13] : 13, + } + self.filter_list = self.gtop.get_widget("filter_list") self.notebook = self.gtop.get_widget("notebook1") self.merge_button= self.gtop.get_widget("merge") @@ -186,47 +256,12 @@ class Gramps: self.use_filter = GrampsCfg.get_filter() self.filter_btn.set_active(self.use_filter) - self.person_model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, - gobject.TYPE_STRING, gobject.TYPE_STRING, - gobject.TYPE_STRING, gobject.TYPE_STRING, - gobject.TYPE_STRING, gobject.TYPE_STRING - ) - self.child_model = gtk.ListStore(gobject.TYPE_INT, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, ) - self.person_list.set_model(self.person_model) - self.person_selection = self.person_list.get_selection() - self.person_selection.connect('changed',self.list_row_changed) - - colno = 0 - for title in [ (_('Name'),5,250), - (_('ID'),1,50), - (_('Gender'),2,70), - (_('Birth Date'),6,150), - (_('Death Date'),7,150), - ('',5,0), - ('',6,0), - ('',7,0) ]: - renderer = gtk.CellRendererText () - column = gtk.TreeViewColumn (title[0], renderer, text=colno) - colno = colno + 1 - column.set_clickable (gtk.TRUE) - if title[0] == '': - column.set_clickable(gtk.TRUE) - column.set_visible(gtk.FALSE) - else: - column.set_resizable(gtk.TRUE) - column.set_sort_column_id(title[1]) - column.set_min_width(title[2]) - self.person_list.append_column (column) - - self.person_list.set_search_column(0) - self.person_list.get_column(0).clicked() - self.build_plugin_menus() self.init_filters() @@ -252,6 +287,7 @@ class Gramps: "on_editbtn_clicked" : self.edit_button_clicked, "on_addbtn_clicked" : self.add_button_clicked, "on_removebtn_clicked" : self.remove_button_clicked, + "on_alpha_switch_page" : self.change_alpha_page, "delete_event" : self.delete_event, "destroy_passed_object" : Utils.destroy_passed_object, "on_family_up_clicked" : self.family_up_clicked, @@ -288,7 +324,7 @@ class Gramps: "on_open_activate" : self.on_open_activate, "on_pedigree1_activate" : self.on_pedigree1_activate, "on_person_list1_activate" : self.on_person_list1_activate, - "on_person_list_button_press" : self.on_person_list_button_press, + "on_person_list_button_press" : self.alpha_event, "on_main_key_release_event" : self.on_main_key_release_event, "on_add_media_clicked" : self.media_view.create_add_dialog, "on_media_activate" : self.on_media_activate, @@ -320,6 +356,11 @@ class Gramps: self.enable_sidebar(self.use_sidebar) self.enable_filter(self.use_filter) + def change_alpha_page(self,obj,junk,page): + self.person_list = self.pl_page[page].tree + self.person_selection = self.pl_page[page].selection + self.person_model = self.pl_page[page].model + def edit_button_clicked(self,obj): cpage = self.notebook.get_current_page() if cpage == 0: @@ -352,7 +393,7 @@ class Gramps: self.removebtn.set_sensitive(val) self.editbtn.set_sensitive(val) - def list_row_changed(self,obj): + def row_changed(self,obj): store,iter = obj.get_selected() if iter: id = store.get_value(iter,1) @@ -605,7 +646,8 @@ class Gramps: Utils.clearModified() Utils.clear_timer() self.change_active_person(None) - self.person_model.clear() + for model in self.pl_page: + model.clear() self.family_view.load_family() self.source_view.load_sources() self.place_view.load_places() @@ -619,7 +661,8 @@ class Gramps: def full_update(self): """Brute force display update, updating all the pages""" self.id2col = {} - self.person_model.clear() + for model in self.pl_page: + model.clear() self.apply_filter() self.family_view.load_family() self.source_view.load_sources() @@ -878,7 +921,8 @@ class Gramps: del_id = pid if self.id2col.has_key(del_id): - self.person_model.remove(self.id2col[del_id]) + (model,iter,page) = self.id2col[del_id] + model.model.remove(iter) del self.id2col[del_id] if person == self.active_person: @@ -890,7 +934,7 @@ class Gramps: self.redisplay_person_list(p1) self.update_display(0) - def on_person_list_button_press(self,obj,event): + def alpha_event(self,obj,event): if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: self.load_person(self.active_person) @@ -899,11 +943,12 @@ class Gramps: return id = self.active_person.getId() if self.id2col.has_key(id): - iter = self.id2col[id] - self.person_selection.select_iter(iter); - itpath = self.person_model.get_path(iter) - col = self.person_list.get_column(0) - self.person_list.scroll_to_cell(itpath,col,1,0.5,0.0) + (model,iter,page) = self.id2col[id] + self.ptabs.set_current_page(page) + model.selection.select_iter(iter); + itpath = model.model.get_path(iter) + col = model.tree.get_column(0) + model.tree.scroll_to_cell(itpath,col,1,0.5,0.0) def change_active_person(self,person): self.active_person = person @@ -1195,15 +1240,25 @@ class Gramps: self.update_display(0) def redisplay_person_list(self,person): + key = person.getId() + val = self.db.getPersonDisplay(person.getId()) + pg = val[0] + pg = pg[0].lower() if self.DataFilter.compare(person): - iter = self.person_model.append() - self.id2col[person.getId()] = iter - val = person.getDisplayInfo() - self.person_model.set(iter, 0, val[0], 1, val[1], 2, val[2], - 3, val[3], 4, val[4], 5, val[5], - 6, val[6], 7, val[7]) - self.person_model.sort_column_changed() - + if pg and self.alpha_page.has_key(pg): + model = self.alpha_page[pg] + else: + model = self.default_list + iter = model.model.append() + page = self.model2page[model] + self.id2col[key] = (model,iter,page) + + model.model.set(iter, 0, val[0], 1, val[1], 2, val[2], + 3, val[3], 4, val[4], 5, val[5], + 6, val[6], 7, val[7]) + self.change_active_person(person) + self.goto_active_person() + def load_person(self,person): if person: try: @@ -1351,19 +1406,29 @@ class Gramps: for key in self.db.getPersonKeys(): person = self.db.getPerson(key) + val = self.db.getPersonDisplay(key) + pg = val[0] + if pg: + pg = pg[0].lower() if datacomp(person): if self.id2col.has_key(key): continue + if pg and self.alpha_page.has_key(pg): + model = self.alpha_page[pg] + else: + model = self.default_list - val = self.db.getPersonDisplay(key) - iter = self.person_model.append() - self.id2col[key] = iter - self.person_model.set(iter, 0, val[0], 1, val[1], 2, val[2], - 3, val[3], 4, val[4], 5, val[5], - 6, val[6], 7, val[7]) + iter = model.model.append() + page = self.model2page[model] + self.id2col[key] = (model,iter,page) + + model.model.set(iter, 0, val[0], 1, val[1], 2, val[2], + 3, val[3], 4, val[4], 5, val[5], + 6, val[6], 7, val[7]) else: if self.id2col.has_key(key): - self.person_model.remove(self.id2col[key]) + (model,iter) = self.id2col[key] + model.remove(iter) def on_home_clicked(self,obj): temp = self.db.getDefaultPerson()