From 7fd574b4c0bb93b7d1bee0ae8ff47f8c43de5893 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sat, 14 Dec 2002 05:07:09 +0000 Subject: [PATCH] Gedcom export, complete_rebuild fix, merge support svn: r1223 --- gramps2/configure | 4 +- gramps2/gramps.spec | 2 +- gramps2/src/EditPerson.py | 9 ++ gramps2/src/EditPlace.py | 3 +- gramps2/src/FamilyView.py | 4 +- gramps2/src/ListModel.py | 3 +- gramps2/src/Makefile.in | 2 +- gramps2/src/Marriage.py | 6 +- gramps2/src/PlaceView.py | 19 +-- gramps2/src/const.py | 2 +- gramps2/src/gramps_main.py | 58 ++++---- gramps2/src/plugins/Summary.py | 2 +- gramps2/src/plugins/WriteGedcom.py | 2 +- gramps2/src/plugins/count_anc.py | 5 +- gramps2/src/plugins/summary.glade | 222 ++++++++++++++++------------- 15 files changed, 194 insertions(+), 149 deletions(-) diff --git a/gramps2/configure b/gramps2/configure index 6d02471af..67071b2c2 100755 --- a/gramps2/configure +++ b/gramps2/configure @@ -1567,7 +1567,7 @@ INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" -RELEASE=pre6 +RELEASE=pre7 VERSIONSTRING=$VERSION if test x"$RELEASE" != "x" @@ -1621,7 +1621,7 @@ fi -LANGUAGES="sv de fr es it pt_BR ru da_DK cs" +LANGUAGES="sv pl de fr es it pt_BR ru da_DK cs" DISTLANGS= diff --git a/gramps2/gramps.spec b/gramps2/gramps.spec index 50b404c80..611bfd939 100644 --- a/gramps2/gramps.spec +++ b/gramps2/gramps.spec @@ -1,5 +1,5 @@ %define ver 0.9.0 -%define rel pre6 +%define rel pre7 %define prefix /usr Summary: Genealogical Research and Analysis Management Programming System. diff --git a/gramps2/src/EditPerson.py b/gramps2/src/EditPerson.py index e719161a4..fe6a74b0b 100644 --- a/gramps2/src/EditPerson.py +++ b/gramps2/src/EditPerson.py @@ -565,6 +565,8 @@ class EditPerson: self.ntree.clear() for name in self.nlist: self.ntree.add([name.getName(),_(name.getType())],name) + if self.ntree: + self.ntree.select_row(0) def redraw_url_list(self): """redraws the url list, disabling the go button if no url @@ -575,6 +577,7 @@ class EditPerson: if len(self.ulist) > 0: self.web_go.set_sensitive(0) + self.wtree.select_row(0) else: self.web_go.set_sensitive(0) self.web_url.set_text("") @@ -587,12 +590,16 @@ class EditPerson: location = "%s %s %s %s" % (addr.getStreet(),addr.getCity(), addr.getState(),addr.getCountry()) self.ptree.add([addr.getDate(),location],addr) + if self.plist: + self.ptree.select_row(0) def redraw_attr_list(self): """redraws the attribute list for the person""" self.atree.clear() for attr in self.alist: self.atree.add([const.display_pattr(attr.getType()),attr.getValue()],attr) + if self.alist: + self.atree.select_row(0) def redraw_event_list(self): """redraw_event_list - Update both the birth and death place combo @@ -606,6 +613,8 @@ class EditPerson: for event in self.elist: self.etree.add([const.display_pevent(event.getName()),event.getDescription(), event.getQuoteDate(),event.getPlaceName()],event) + if self.elist: + self.etree.select_row(0) # Remember old combo list input prev_btext = Utils.strip_id(self.bplace.get_text()) diff --git a/gramps2/src/EditPlace.py b/gramps2/src/EditPlace.py index d42810d98..289240945 100644 --- a/gramps2/src/EditPlace.py +++ b/gramps2/src/EditPlace.py @@ -118,7 +118,8 @@ class EditPlace: self.build_columns(self.loc_list, [(_('City'),150), (_('County'),100), (_('State'),100), (_('Country'),50)]) self.loc_list.set_model(self.loc_model) - self.loc_list.get_selection().connect('changed',self.on_loc_list_select_row) + self.sel = self.loc_list.get_selection() + self.sel.connect('changed',self.on_loc_list_select_row) self.title.set_text(place.get_title()) mloc = place.get_main_location() diff --git a/gramps2/src/FamilyView.py b/gramps2/src/FamilyView.py index 937351638..d35a9adba 100644 --- a/gramps2/src/FamilyView.py +++ b/gramps2/src/FamilyView.py @@ -440,9 +440,9 @@ class FamilyView: return QuestionDialog(_('Delete Parents'), _('Do you wish to remove the selected parents?'), - self.really_del_parents) + self.really_del_sp_parents) - def really_del_parents(self): + def really_del_sp_parents(self): self.parent_deleter(self.selected_spouse,self.sp_selection) def child_back(self,obj): diff --git a/gramps2/src/ListModel.py b/gramps2/src/ListModel.py index 41c008ab4..b0e45552b 100644 --- a/gramps2/src/ListModel.py +++ b/gramps2/src/ListModel.py @@ -22,7 +22,7 @@ from gobject import TYPE_STRING, TYPE_PYOBJECT import gtk class ListModel: - def __init__(self,tree,dlist,select_func=None,event_func=None): + def __init__(self,tree,dlist,select_func=None,event_func=None,mode=gtk.SELECTION_SINGLE): self.tree = tree l = len(dlist) self.mylist = [TYPE_STRING]*l + [TYPE_PYOBJECT] @@ -30,6 +30,7 @@ class ListModel: self.tree.set_rules_hint(gtk.TRUE) self.new_model() self.selection = self.tree.get_selection() + self.selection.set_mode(mode) self.data_index = l diff --git a/gramps2/src/Makefile.in b/gramps2/src/Makefile.in index 75f2780eb..d630c9884 100644 --- a/gramps2/src/Makefile.in +++ b/gramps2/src/Makefile.in @@ -136,7 +136,7 @@ pkgdata_DATA = ${INTLLIBS} ${GLADEFILES} ${GRAPHICS} gramps.desktop grampslib.so EXTRA_DIST = grampslib.i -DIST_SOURCES = intl.c +DIST_SOURCES = intl.c grampslib_wrap.c dist_pkgdata_DATA = ${pkgdata_DATA} subdir = src mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs diff --git a/gramps2/src/Marriage.py b/gramps2/src/Marriage.py index 17b6ebe01..7c27d20c4 100644 --- a/gramps2/src/Marriage.py +++ b/gramps2/src/Marriage.py @@ -131,7 +131,7 @@ class Marriage: self.gallery.load_images() etitles = [(_('Event'),0,150),(_('Date'),1,150),(_('Place'),2,150)] - atitles = [(_('Attribute'),-1,150),(_('Value'),-1,150)] + atitles = [(_('Attribute'),0,150),(_('Value'),1,150)] self.etree = ListModel.ListModel(self.event_list, etitles, self.on_select_row, @@ -315,11 +315,15 @@ class Marriage: for attr in self.alist: d = [const.display_fattr(attr.getType()),attr.getValue()] self.atree.add(d,attr) + if self.alist: + self.atree.select_row(0) def redraw_event_list(self): self.etree.clear() for data in self.elist: self.etree.add([data.getName(),data.getQuoteDate(),data.getPlaceName()],data) + if self.elist: + self.etree.select_row(0) def get_widget(self,name): return self.top.get_widget(name) diff --git a/gramps2/src/PlaceView.py b/gramps2/src/PlaceView.py index 852b596ab..4148283ec 100644 --- a/gramps2/src/PlaceView.py +++ b/gramps2/src/PlaceView.py @@ -77,6 +77,7 @@ class PlaceView: self.id2col = {} self.selection = self.list.get_selection() + self.selection.set_mode(gtk.SELECTION_MULTIPLE) colno = 0 for title in _column_headers: renderer = gtk.CellRendererText () @@ -128,16 +129,16 @@ class PlaceView: self.list.connect('button-press-event',self.button_press) def merge(self): - if len(self.place_list.selection) != 2: + + mlist = [] + self.selection.selected_foreach(self.blist,mlist) + + if len(mlist) != 2: msg = _("Exactly two places must be selected to perform a merge") ErrorDialog(msg) else: import MergeData - p1 = self.place_list.get_row_data(self.place_list.selection[0]) - P2 = self.place_list.get_row_data(self.place_list.selection[1]) - p1 = self.db.getPlace(p1) - p2 = self.db.getPlace(p2) - MergeData.MergePlaces(self.db,p1,p2,self.load_places) + MergeData.MergePlaces(self.db,mlist[0],mlist[1],self.load_places) def button_press(self,obj,event): if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: @@ -217,6 +218,6 @@ class PlaceView: place = self.db.getPlace(id) EditPlace.EditPlace(self, place, self.update_display) - - - + def blist(self,store,path,iter,list): + id = self.db.getPlace(store.get_value(iter,1)) + list.append(id) diff --git a/gramps2/src/const.py b/gramps2/src/const.py index 5fee1fc11..4f4f115c3 100644 --- a/gramps2/src/const.py +++ b/gramps2/src/const.py @@ -100,7 +100,7 @@ startup = 1 # #------------------------------------------------------------------------- progName = "GRAMPS" -version = "0.9.0-pre6" +version = "0.9.0-pre7" 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 00d6d5d56..3bce4ebb0 100755 --- a/gramps2/src/gramps_main.py +++ b/gramps2/src/gramps_main.py @@ -187,21 +187,22 @@ class Gramps: self.pl_yz = self.gtop.get_widget("pl_yz") self.pl_other = self.gtop.get_widget("pl_other") + m = gtk.SELECTION_MULTIPLE 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), + ListModel.ListModel(self.pl_ab, pl_titles, self.row_changed, self.alpha_event,m), + ListModel.ListModel(self.pl_cd, pl_titles, self.row_changed, self.alpha_event,m), + ListModel.ListModel(self.pl_ef, pl_titles, self.row_changed, self.alpha_event,m), + ListModel.ListModel(self.pl_gh, pl_titles, self.row_changed, self.alpha_event,m), + ListModel.ListModel(self.pl_ij, pl_titles, self.row_changed, self.alpha_event,m), + ListModel.ListModel(self.pl_kl, pl_titles, self.row_changed, self.alpha_event,m), + ListModel.ListModel(self.pl_mn, pl_titles, self.row_changed, self.alpha_event,m), + ListModel.ListModel(self.pl_op, pl_titles, self.row_changed, self.alpha_event,m), + ListModel.ListModel(self.pl_qr, pl_titles, self.row_changed, self.alpha_event,m), + ListModel.ListModel(self.pl_st, pl_titles, self.row_changed, self.alpha_event,m), + ListModel.ListModel(self.pl_uv, pl_titles, self.row_changed, self.alpha_event,m), + ListModel.ListModel(self.pl_wx, pl_titles, self.row_changed, self.alpha_event,m), + ListModel.ListModel(self.pl_yz, pl_titles, self.row_changed, self.alpha_event,m), + ListModel.ListModel(self.pl_other, pl_titles, self.row_changed, self.alpha_event,m), ] self.person_list = self.pl_page[0].tree @@ -398,10 +399,10 @@ class Gramps: self.editbtn.set_sensitive(val) def row_changed(self,obj): - store,iter = obj.get_selected() - if iter: - id = store.get_value(iter,1) - self.change_active_person(self.db.getPerson(id)) + mlist = [] + self.person_selection.selected_foreach(self.blist,mlist) + if mlist: + self.change_active_person(mlist[0]) def on_show_plugin_status(self,obj): Plugins.PluginStatus() @@ -503,21 +504,25 @@ class Gramps: def on_gramps_report_bug_activate(self,obj): import gnome.url gnome.url.show("http://sourceforge.net/tracker/?group_id=25770&atid=385137") + + def blist(self,store,path,iter,list): + id = self.db.getPerson(store.get_value(iter,1)) + list.append(id) def on_merge_activate(self,obj): """Calls up the merge dialog for the selection""" page = self.notebook.get_current_page() if page == 0: - if len(self.person_list.selection) != 2: + + mlist = [] + self.person_selection.selected_foreach(self.blist,mlist) + + if len(mlist) != 2: msg = _("Exactly two people must be selected to perform a merge") ErrorDialog(msg) else: import MergeData - p1 = self.person_list.get_row_data(self.person_list.selection[0]) - p2 = self.person_list.get_row_data(self.person_list.selection[1]) - p1 = self.db.getPerson(p1) - p2 = self.db.getPerson(p2) - MergeData.MergePeople(self.db,p1,p2,self.merge_update, + MergeData.MergePeople(self.db,mlist[0],mlist[1],self.merge_update, self.update_after_edit) elif page == 4: self.place_view.merge() @@ -638,6 +643,7 @@ class Gramps: def full_update(self): """Brute force display update, updating all the pages""" + self.complete_rebuild() self.family_view.load_family() self.source_view.load_sources() @@ -1354,11 +1360,7 @@ class Gramps: 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): diff --git a/gramps2/src/plugins/Summary.py b/gramps2/src/plugins/Summary.py index cf74120a3..88b03097d 100644 --- a/gramps2/src/plugins/Summary.py +++ b/gramps2/src/plugins/Summary.py @@ -130,7 +130,7 @@ def report(database,person): top = topDialog.get_widget("summary") textwindow = topDialog.get_widget("textwindow") - textwindow.show_string(text) + textwindow.get_buffer().set_text(text) top.show() #------------------------------------------------------------------------- diff --git a/gramps2/src/plugins/WriteGedcom.py b/gramps2/src/plugins/WriteGedcom.py index 6eda24a14..d52b0417f 100644 --- a/gramps2/src/plugins/WriteGedcom.py +++ b/gramps2/src/plugins/WriteGedcom.py @@ -917,7 +917,7 @@ class GedcomWriter: else: if surPref: self.g.write("2 SURN %s %s\n" % (surPref,surName)) - else if surName: + elif surName: self.g.write("2 SURN %s\n" % surName) if name.getSuffix() != "": diff --git a/gramps2/src/plugins/count_anc.py b/gramps2/src/plugins/count_anc.py index 8d2e88545..7f746cc18 100644 --- a/gramps2/src/plugins/count_anc.py +++ b/gramps2/src/plugins/count_anc.py @@ -41,8 +41,7 @@ class CountAncestors: def __init__(self,database,person): text = "" - base = os.path.dirname(__file__) - glade_file = base + os.sep + "summary.glade" + glade_file = "%s/summary.glade" % os.path.dirname(__file__) topDialog = gtk.glade.XML(glade_file,"summary") topDialog.signal_autoconnect({ "destroy_passed_object" : Utils.destroy_passed_object, @@ -81,7 +80,7 @@ class CountAncestors: top = topDialog.get_widget("summary") textwindow = topDialog.get_widget("textwindow") topDialog.get_widget("summaryTitle").set_text(title) - textwindow.show_string(text) + textwindow.get_buffer().set_text(text) top.show() #------------------------------------------------------------------------- diff --git a/gramps2/src/plugins/summary.glade b/gramps2/src/plugins/summary.glade index b121677c5..b02806316 100644 --- a/gramps2/src/plugins/summary.glade +++ b/gramps2/src/plugins/summary.glade @@ -1,111 +1,139 @@ - + - - - Database Summary - GRAMPS - GTK_WINDOW_TOPLEVEL - no - yes - yes - yes - GTK_WIN_POS_NONE + + True + Database Summary - GRAMPS + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + 450 + 400 + True + False + True - - - no - 0 - yes + + + True + False + 0 - - - 10 - yes - 5 - yes + + + True + GTK_BUTTONBOX_END - - - GTK_BUTTONBOX_END - 30 - yes + + + True + GTK_BUTTONBOX_END + 30 - - - yes - yes - GTK_RELIEF_NORMAL - yes - gtk-close - yes - yes + + + True + True + True + gtk-close + True + GTK_RELIEF_NORMAL + + + + + + + + 0 + False + True + GTK_PACK_END + + - - - - - - 0 - yes - yes - - - - - 0 - no - yes - GTK_PACK_END - - + + + True + False + 0 - - - no - 0 - yes + + + True + Database Summary + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + + + 8 + False + False + + - - - Database Summary - GTK_JUSTIFY_CENTER - no - 0.5 - 0.5 - 0 - 0 - 500 - 16 - yes - - - 8 - no - no - - + + + True + + + 4 + False + True + + - - - yes - - - 4 - no - yes - - + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + True + True + GTK_JUSTIFY_LEFT + GTK_WRAP_NONE + True + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + 0 + True + True + + + + + 0 + True + True + + + + + - - - 0 - yes - yes - - - - -