diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 2c7126ce4..2586c8301 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,18 @@ +2004-08-03 Don Allingham + * src/WriteXML.py: always write the default location for a place + * src/EditPerson.py: don't for write of multimedia objects if + not edited + * src/ImageSelect.py: don't for write of multimedia objects if + not edited + * src/AutoComp.py: build ListStore for ComboBox and Entry + * src/AddSpouse.py: use ComboBox + * src/Marriage.py: use ComboBox + * src/gramps.glade: Switch from gtk.Combo to gtk.ComboBox and + gtk.ComboxEntry + * src/EventEdit.py: handle autocompletion + * src/RelLib.py: remove cPickle import + * src/GrampsDbBase.py: fix has_handle functions + 2004-08-01 Don Allingham * src/WriteGedcom.py: move up from plugins directory * src/ReadGedcom.py: move up from plugins directory diff --git a/gramps2/example/gramps/data.gramps b/gramps2/example/gramps/data.gramps index ee302713f..65d86ea43 100644 Binary files a/gramps2/example/gramps/data.gramps and b/gramps2/example/gramps/data.gramps differ diff --git a/gramps2/src/AddSpouse.py b/gramps2/src/AddSpouse.py index db57c2a50..49a4e857c 100644 --- a/gramps2/src/AddSpouse.py +++ b/gramps2/src/AddSpouse.py @@ -109,7 +109,6 @@ class AddSpouse: self.relation_def = self.glade.get_widget("reldef") self.rel_combo = self.glade.get_widget("rel_combo") - self.relation_type = self.glade.get_widget("rel_type") self.spouse_list = self.glade.get_widget("spouse_list") self.showall = self.glade.get_widget('showall') @@ -126,7 +125,6 @@ class AddSpouse: self.ok = self.glade.get_widget('spouse_ok') self.ok.set_sensitive(0) - self.rel_combo.set_popdown_strings(const.familyRelations) title = _("Choose Spouse/Partner of %s") % GrampsCfg.get_nameof()(person) Utils.set_titles(self.glade.get_widget('spouseDialog'), @@ -143,7 +141,7 @@ class AddSpouse: "destroy_passed_object" : Utils.destroy_passed_object }) - self.relation_type.set_text(const.family_relations[const.FREL_MARRIED][0]) + self.rel_combo.set_active(const.FAMILY_MARRIED) self.update_data() def add_columns(self,tree): @@ -192,8 +190,8 @@ class AddSpouse: """ import EditPerson - relation = const.save_frel(unicode(self.relation_type.get_text())) - if relation == "Partners": + relation = self.rel_combo.get_active() + if relation == const.FAMILY_CIVIL_UNION: if self.person.get_gender() == RelLib.Person.male: gen = RelLib.Person.male else: @@ -275,7 +273,7 @@ class AddSpouse: self.active_family.set_father_handle(spouse.get_handle()) self.active_family.set_mother_handle(self.person.get_handle()) - rtype = const.save_frel(unicode(self.relation_type.get_text())) + rtype = self.rel_combo.get_active() self.active_family.set_relationship(rtype) self.db.commit_family(self.active_family,trans) self.db.add_transaction(trans,_("Add Spouse")) @@ -342,7 +340,7 @@ class AddSpouse: return 1 def set_gender(self): - if self.rel_type.get_active() == const.FAMILY_CIVIL_UNION: + if self.rel_combo.get_active() == const.FAMILY_CIVIL_UNION: if self.gender == RelLib.Person.male: self.sgender = RelLib.Person.female else: diff --git a/gramps2/src/AutoComp.py b/gramps2/src/AutoComp.py index cdabf8863..387533bd2 100644 --- a/gramps2/src/AutoComp.py +++ b/gramps2/src/AutoComp.py @@ -290,4 +290,29 @@ class AutoEntry(AutoCompBase): gtk.Editable.select_region(entry,self.l, -1) return +def fill_combo(combo,data_list): + store = gtk.ListStore(gobject.TYPE_STRING) + + for data in data_list: + store.append(row=[data]) + + combo.set_model(store) + combo.set_text_column(0) + completion = gtk.EntryCompletion() + completion.set_model(store) + completion.set_minimum_key_length(1) + completion.set_text_column(0) + combo.child.set_completion(completion) + +def fill_entry(entry,data_list): + store = gtk.ListStore(gobject.TYPE_STRING) + + for data in data_list: + store.append(row=[data]) + + completion = gtk.EntryCompletion() + completion.set_model(store) + completion.set_minimum_key_length(1) + completion.set_text_column(0) + entry.set_completion(completion) diff --git a/gramps2/src/EditPerson.py b/gramps2/src/EditPerson.py index d1b1f2656..3c27cece4 100644 --- a/gramps2/src/EditPerson.py +++ b/gramps2/src/EditPerson.py @@ -308,7 +308,7 @@ class EditPerson: types = const.NameTypesMap.get_values() types.sort() - self.autotype = AutoComp.AutoCombo(self.ntype_field,types) + AutoComp.fill_combo(self.ntype_field,types) self.write_primary_name() if person.get_gender() == RelLib.Person.male: @@ -435,13 +435,13 @@ class EditPerson: child_window.close(None) self.child_windows = {} - def close(self,ok=0): + def close(self): event_list = [] for col in self.event_list.get_columns(): event_list.append(self.event_trans.find_key(col.get_title())) self.db.metadata['event_order'] = event_list - self.gallery.close(ok) + self.gallery.close() self.close_child_windows() self.remove_itself_from_winsmenu() self.window.destroy() @@ -484,7 +484,7 @@ class EditPerson: tree.append_column(column) def lds_field(self,ord,combo,date,place): - combo.set_popdown_strings(_temple_names) + AutoComp.fill_combo(combo,_temple_names) if not ord.is_empty(): stat = ord.get_status() date.set_text(ord.get_date()) @@ -492,10 +492,10 @@ class EditPerson: name = const.lds_temple_to_abrev[ord.get_temple()] else: name = "" - combo.entry.set_text(name) + combo.child.set_text(name) else: stat = 0 - combo.entry.set_text("") + combo.child.set_text("") build_dropdown(place,self.place_list) if ord and ord.get_place_handle(): @@ -1042,7 +1042,7 @@ class EditPerson: self.cancel_callback, self.save) else: - self.close(0) + self.close() def save(self): self.on_apply_person_clicked(None) @@ -1059,12 +1059,12 @@ class EditPerson: self.save) return 1 else: - self.close(0) + self.close() return 0 def cancel_callback(self): """If the user answered yes to abandoning changes, close the window""" - self.close(0) + self.close() def did_data_change(self): """Check to see if any of the data has changed from the @@ -1074,7 +1074,7 @@ class EditPerson: self.birth.set_date(unicode(self.bdate.get_text())) self.death.set_date(unicode(self.ddate.get_text())) - ntype = unicode(self.ntype_field.entry.get_text()) + ntype = unicode(self.ntype_field.child.get_text()) suffix = unicode(self.suffix.get_text()) prefix = unicode(self.prefix.get_text()) given = unicode(self.given.get_text()) @@ -1163,7 +1163,7 @@ class EditPerson: def check_lds(self): self.lds_baptism.set_date(unicode(self.ldsbap_date.get_text())) - temple = unicode(self.ldsbap_temple.entry.get_text()) + temple = unicode(self.ldsbap_temple.child.get_text()) if const.lds_temple_codes.has_key(temple): self.lds_baptism.set_temple(const.lds_temple_codes[temple]) else: @@ -1171,7 +1171,7 @@ class EditPerson: self.lds_baptism.set_place_handle(self.get_place(self.ldsbapplace,1)) self.lds_endowment.set_date(unicode(self.ldsend_date.get_text())) - temple = unicode(self.ldsend_temple.entry.get_text()) + temple = unicode(self.ldsend_temple.child.get_text()) if const.lds_temple_codes.has_key(temple): self.lds_endowment.set_temple(const.lds_temple_codes[temple]) else: @@ -1179,7 +1179,7 @@ class EditPerson: self.lds_endowment.set_place_handle(self.get_place(self.ldsendowplace,1)) self.lds_sealing.set_date(unicode(self.ldsseal_date.get_text())) - temple = unicode(self.ldsseal_temple.entry.get_text()) + temple = unicode(self.ldsseal_temple.child.get_text()) if const.lds_temple_codes.has_key(temple): self.lds_sealing.set_temple(const.lds_temple_codes[temple]) else: @@ -1438,7 +1438,7 @@ class EditPerson: surname = unicode(self.surname.get_text()) suffix = unicode(self.suffix.get_text()) prefix = unicode(self.prefix.get_text()) - ntype = unicode(self.ntype_field.entry.get_text()) + ntype = unicode(self.ntype_field.child.get_text()) given = unicode(self.given.get_text()) nick = unicode(self.nick.get_text()) title = unicode(self.title.get_text()) @@ -1607,7 +1607,7 @@ class EditPerson: self.db.commit_person(self.person, trans) n = self.person.get_primary_name().get_regular_name() self.db.add_transaction(trans,_("Edit Person (%s)") % n) - self.close(1) + self.close() def get_place(self,field,makenew=0): text = unicode(string.strip(field.get_text())) @@ -1747,7 +1747,7 @@ class EditPerson: self.surname.set_text(self.pname.get_surname()) self.given.set_text(self.pname.get_first_name()) - self.ntype_field.entry.set_text(_(self.pname.get_type())) + self.ntype_field.child.set_text(_(self.pname.get_type())) self.title.set_text(self.pname.get_title()) def birth_dates_in_order(self,list): diff --git a/gramps2/src/EventEdit.py b/gramps2/src/EventEdit.py index 0c55174e7..519a86204 100644 --- a/gramps2/src/EventEdit.py +++ b/gramps2/src/EventEdit.py @@ -121,7 +121,6 @@ class EventEditor: Utils.set_titles(self.window,title_label, etitle, _('Event Editor')) - self.name_field = self.top.get_widget("eventName") self.place_field = self.top.get_widget("eventPlace") self.cause_field = self.top.get_widget("eventCause") self.slist = self.top.get_widget("slist") @@ -131,7 +130,7 @@ class EventEditor: self.cause_field = self.top.get_widget("eventCause") self.descr_field = self.top.get_widget("event_description") self.note_field = self.top.get_widget("eventNote") - self.event_menu = self.top.get_widget("personalEvents") + self.event_menu = self.top.get_widget("personal_events") self.priv = self.top.get_widget("priv") self.calendar = self.top.get_widget("calendar") self.sources_label = self.top.get_widget("sourcesEvent") @@ -162,11 +161,11 @@ class EventEditor: self.top.get_widget('edit_witness'), self.top.get_widget('del_witness')) - AutoComp.AutoCombo(self.event_menu,self.elist) - AutoComp.AutoEntry(self.place_field,self.pmap.keys()) + AutoComp.fill_combo(self.event_menu,self.elist) + AutoComp.fill_entry(self.place_field,self.pmap.keys()) if event != None: - self.name_field.set_text(transname) + self.event_menu.child.set_text(transname) if (def_placename): self.place_field.set_text(def_placename) else: @@ -194,7 +193,7 @@ class EventEditor: Utils.bold_label(self.gallery_label) else: if def_event: - self.name_field.set_text(def_event) + self.event_menu.child.set_text(def_event) if def_placename: self.place_field.set_text(def_placename) self.date_check = DateEdit(self.date_field,self.top.get_widget("date_stat")) @@ -237,12 +236,12 @@ class EventEditor: self.window.show() def on_delete_event(self,obj,b): - self.gallery.close(0) + self.gallery.close() self.close_child_windows() self.remove_itself_from_menu() - def close(self,obj,ok=0): - self.gallery.close(ok) + def close(self,obj): + self.gallery.close() self.close_child_windows() self.remove_itself_from_menu() self.window.destroy() @@ -305,7 +304,7 @@ class EventEditor: trans = self.db.start_transaction() - ename = unicode(self.name_field.get_text()) + ename = unicode(self.event_menu.child.get_text()) self.date.set(unicode(self.date_field.get_text())) ecause = unicode(self.cause_field.get_text()) eplace_obj = self.get_place(self.place_field,trans) @@ -333,7 +332,7 @@ class EventEditor: self.update_event(ename,self.date,eplace_obj,edesc,enote,eformat, epriv,ecause,trans) self.db.add_transaction(trans,_("Edit Event")) - self.close(obj,1) + self.close(obj) self.parent.redraw_event_list() self.callback(self.event) diff --git a/gramps2/src/GrampsDbBase.py b/gramps2/src/GrampsDbBase.py index 9cc2eae7f..53d251897 100644 --- a/gramps2/src/GrampsDbBase.py +++ b/gramps2/src/GrampsDbBase.py @@ -488,10 +488,10 @@ class GrampsDbBase: return person.get_handle() def has_person_handle(self,val): - return self.person_map.get(val) + return self.person_map.has_key(str(val)) def has_family_handle(self,val): - return self.family_map.get(str(val)) + return self.family_map.has_key(str(val)) def try_to_find_person_from_handle(self,val): """finds a Person in the database from the passed gramps' ID. @@ -1123,7 +1123,6 @@ class GrampsDbBase: class Transaction: def __init__(self,msg,db): - print db self.db = db self.first = None self.last = None diff --git a/gramps2/src/ImageSelect.py b/gramps2/src/ImageSelect.py index d671611a8..3dbf28030 100644 --- a/gramps2/src/ImageSelect.py +++ b/gramps2/src/ImageSelect.py @@ -250,7 +250,7 @@ class Gallery(ImageSelect): self.sel = None self.photo = None - def close(self,ok=0): + def close(self): self.iconlist.hide() if self.canvas_list: for a in self.canvas_list.values(): @@ -259,14 +259,6 @@ class Gallery(ImageSelect): a[2].destroy() self.p_map = None self.canvas_list = None - # restore old photo list, in case we removed some and then - # hit cancel button or closed the window - if not ok: - if self.old_media_list is not None: - self.dataobj.set_media_list(self.old_media_list) - trans = self.db.start_transaction() - self.commit(self.dataobj,trans) - self.db.add_transaction(trans,_("Edit Media Object")) def on_canvas1_event(self,obj,event): """ diff --git a/gramps2/src/Marriage.py b/gramps2/src/Marriage.py index cfc97a961..5ac67bd78 100644 --- a/gramps2/src/Marriage.py +++ b/gramps2/src/Marriage.py @@ -204,11 +204,11 @@ class Marriage: self.gid.set_text(family.get_handle()) self.gid.set_editable(1) - self.lds_temple.set_popdown_strings(_temple_names) + AutoComp.fill_combo(self.lds_temple,_temple_names) place_list = self.pmap.keys() place_list.sort() - self.autoplace = AutoComp.AutoCombo(self.lds_place, place_list) + self.autoplace = AutoComp.fill_combo(self.lds_place, place_list) ord = self.family.get_lds_sealing() if ord: @@ -219,10 +219,10 @@ class Marriage: name = const.lds_temple_to_abrev[ord.get_temple()] else: name = "" - self.lds_temple.entry.set_text(name) + self.lds_temple.child.set_text(name) self.seal_stat = ord.get_status() else: - self.lds_temple.entry.set_text("") + self.lds_temple.child.set_text("") self.lds_place.entry.set_text("") self.seal_stat = 0 @@ -511,7 +511,7 @@ class Marriage: changed = 1 date = unicode(self.lds_date.get_text()) - temple = unicode(self.lds_temple.entry.get_text()) + temple = unicode(self.lds_temple.child.get_text()) if const.lds_temple_codes.has_key(temple): temple = const.lds_temple_codes[temple] else: @@ -588,7 +588,7 @@ class Marriage: self.family.set_complete(self.complete.get_active()) date = unicode(self.lds_date.get_text()) - temple = unicode(self.lds_temple.entry.get_text()) + temple = unicode(self.lds_temple.child.get_text()) if const.lds_temple_codes.has_key(temple): temple = const.lds_temple_codes[temple] else: @@ -760,7 +760,7 @@ class Marriage: Utils.unbold_label(self.notes_label) date = unicode(self.lds_date.get_text()) - temple = unicode(self.lds_temple.entry.get_text()) + temple = unicode(self.lds_temple.child.get_text()) if const.lds_temple_codes.has_key(temple): temple = const.lds_temple_codes[temple] else: diff --git a/gramps2/src/ReadXML.py b/gramps2/src/ReadXML.py index f239bc27e..89cf6bec2 100644 --- a/gramps2/src/ReadXML.py +++ b/gramps2/src/ReadXML.py @@ -427,14 +427,12 @@ class GrampsParser: return person def map_gid(self,id): - if self.idswap.get(id): - return self.idswap[id] - else: + if not self.idswap.get(id): if self.db.id_trans.get(str(id)): self.idswap[id] = self.db.find_next_gramps_id() else: self.idswap[id] = id - return self.idswap[id] + return self.idswap[id] def parse(self,file): self.trans = self.db.start_transaction() @@ -590,7 +588,8 @@ class GrampsParser: self.callback(float(self.count)/float(self.entries)) self.count = self.count + 1 - self.person = self.find_person_by_gramps_id(self.map_gid(attrs['id'])) + new_id = self.map_gid(attrs['id']) + self.person = self.find_person_by_gramps_id(new_id) if attrs.has_key("complete"): self.person.set_complete(int(attrs['complete'])) diff --git a/gramps2/src/RelLib.py b/gramps2/src/RelLib.py index cec9bbbbd..510f0e98b 100644 --- a/gramps2/src/RelLib.py +++ b/gramps2/src/RelLib.py @@ -35,7 +35,6 @@ import os import os.path import types from gettext import gettext as _ -import cPickle #------------------------------------------------------------------------- # diff --git a/gramps2/src/WriteXML.py b/gramps2/src/WriteXML.py index 182e05b1b..841966c33 100644 --- a/gramps2/src/WriteXML.py +++ b/gramps2/src/WriteXML.py @@ -211,7 +211,8 @@ class XmlWriter: self.g.write('\n') self.g.write("\n") self.g.write("
\n") - self.g.write(" \n' % (sp2,ord.get_status())) if ord.get_family_handle(): - self.g.write('%s\n' % (sp2,self.fix(ord.get_family_handle().get_gramps_id()))) + self.g.write('%s\n' % \ + (sp2,self.fix(ord.get_family_handle().get_gramps_id()))) if ord.get_note() != "": self.write_note("note",ord.get_note_object(),index+1) for s in ord.get_source_references(): @@ -657,9 +659,6 @@ class XmlWriter: zip = self.fix(loc.get_postal_code()) phone = self.fix(loc.get_phone()) - if not city and not state and not parish and not county and not country: - return - self.g.write(' GTK_ORIENTATION_HORIZONTAL GTK_TOOLBAR_BOTH True + True - + True Open database Open True - gtk-open + gtk-open + True + True + False + + False + True + - + True Save database Save As... True - gtk-save-as + gtk-save-as + True + True + False + + False + True + - + + True + True + True + True + + + False + False + + + + + True Go back in history Back True - gtk-go-back - True + gtk-go-back + True + True + False - True + False + True - + True Go forward in history Forward True - gtk-go-forward + gtk-go-forward + True + True + False - - - - - True - Make the Home Person the active person - Home - True - gtk-home - - - - - - - True - Generate reports - Reports - True - gtk-dnd-multiple - True - - - True + False + True - + + True + Make the Home Person the active person + Home + True + gtk-home + True + True + False + + + + False + True + + + + + + True + True + True + True + + + False + False + + + + + + True + Generate reports + Reports + True + gtk-dnd-multiple + True + True + False + + + + False + True + + + + + True Run tools Tools True tools.png + True + True + False - - - - - True - Add a new item - Add - True - gtk-add - True - - - True + False + True - + + True + True + True + True + + + False + False + + + + + + True + Add a new item + Add + True + gtk-add + True + True + False + + + + False + True + + + + + True Remove the currently selected item Remove True - gtk-remove + gtk-remove + True + True + False + + False + True + - + True Edit the selected item Edit True edit.png + True + True + False + + False + True + @@ -3654,10 +3752,6 @@ 0.5 0 0 - rel_type - - - 0 @@ -3669,68 +3763,6 @@ - - - True - True - True - False - True - False - - - - True - True - False - True - 0 - - True - * - False - - - - - - - True - GTK_SELECTION_BROWSE - - - - True - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - - - - - - - 1 - 2 - 0 - 1 - - - - True @@ -3755,6 +3787,25 @@ + + + + True + Married +Unmarried +Civil Union +Unknown +Other + + + 1 + 2 + 0 + 1 + fill + fill + + 0 @@ -8108,7 +8159,6 @@ Other 0.5 0 0 - combo-entry3 1 @@ -8363,89 +8413,6 @@ Other - - - True - False - False - False - True - False - - - - True - True - True - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - - - True - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - - - - - - True - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - - - - - - - 2 - 5 - 7 - 8 - - - - True @@ -8937,6 +8904,20 @@ Other + + + + True + + + 2 + 5 + 7 + 8 + fill + fill + + 0 @@ -12193,10 +12174,8 @@ Other 0.5 0 0 - combo-entry7 Temple: - @@ -12209,45 +12188,6 @@ Other - - - True - False - True - False - True - False - - - - True - True - True - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - - - - 2 - 3 - 2 - 3 - - - - True @@ -12403,10 +12343,6 @@ Other 0.5 0 0 - combo-entry8 - - - 1 @@ -12467,45 +12403,6 @@ Other - - - True - False - True - False - True - False - - - - True - True - True - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - - - - 2 - 3 - 7 - 8 - - - - True @@ -12673,10 +12570,6 @@ Other 0.5 0 0 - combo-entry9 - - - 1 @@ -12688,45 +12581,6 @@ Other - - - True - False - True - False - True - False - - - - True - True - True - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - - - - 2 - 3 - 12 - 13 - - - - True @@ -12889,6 +12743,48 @@ Other + + + + True + + + 2 + 3 + 2 + 3 + fill + fill + + + + + + True + + + 2 + 3 + 7 + 8 + fill + fill + + + + + + True + + + 2 + 3 + 12 + 13 + fill + fill + + False @@ -14704,128 +14600,6 @@ Other - - - True - True - True - False - True - False - - - - True - True - True - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - - - True - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - - - - - - - 2 - 3 - 2 - 3 - - - - - - - True - False - True - False - True - False - - - - True - True - True - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - - - True - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - - - - - - - 2 - 3 - 3 - 4 - - - - True @@ -14887,6 +14661,34 @@ Other + + + + True + + + 2 + 3 + 3 + 4 + fill + fill + + + + + + True + + + 2 + 3 + 2 + 3 + fill + fill + + 0 @@ -26321,10 +26123,6 @@ Other 0.5 0 0 - eventName - - - 0 @@ -26586,68 +26384,6 @@ Other - - - True - False - True - False - True - False - - - - True - True - True - True - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - - - True - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - - - - - - - 1 - 4 - 0 - 1 - - - - True @@ -26687,6 +26423,20 @@ Other fill + + + + True + + + 1 + 4 + 0 + 1 + fill + fill + + False