From 35ff79bafa5d8c61fe8baf3a8723c652c7397edb Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Fri, 21 Sep 2001 22:35:23 +0000 Subject: [PATCH] no message svn: r419 --- src/Config.py | 10 +++++++++ src/EditPerson.glade | 50 +++++++++++++++++++++----------------------- src/EditPerson.py | 20 ++++++++++++++++-- src/config.glade | 39 +++++++++++++++++++++++++++++----- 4 files changed, 86 insertions(+), 33 deletions(-) diff --git a/src/Config.py b/src/Config.py index cf4a4c3e4..33d5db1d2 100644 --- a/src/Config.py +++ b/src/Config.py @@ -106,6 +106,7 @@ report_dir = "./" web_dir = "./" db_dir = "./" id_visible = 0 +id_edit = 0 #------------------------------------------------------------------------- # @@ -151,6 +152,7 @@ def loadConfig(call): global usetabs global uncompress global id_visible + global id_edit global show_detail global hide_altnames global lastfile @@ -172,6 +174,7 @@ def loadConfig(call): usetabs = gnome.config.get_bool("/gramps/config/UseTabs") uncompress = gnome.config.get_bool("/gramps/config/DontCompressXML") id_visible = gnome.config.get_bool("/gramps/config/IdVisible") + id_edit = gnome.config.get_bool("/gramps/config/IdEdit") show_detail = gnome.config.get_bool("/gramps/config/ShowDetail") status_bar = gnome.config.get_int("/gramps/config/StatusBar") display_attr = gnome.config.get_bool("/gramps/config/DisplayAttr") @@ -244,6 +247,8 @@ def loadConfig(call): uncompress = 0 if id_visible == None: id_visible = 0 + if id_edit == None: + id_edit = 0 if show_detail == None: show_detail = 0 if status_bar == None: @@ -345,6 +350,7 @@ def on_propertybox_apply(obj,page): global usetabs global uncompress global id_visible + global id_edit global status_bar global display_attr global attr_name @@ -366,6 +372,7 @@ def on_propertybox_apply(obj,page): usetabs = prefsTop.get_widget("usetabs").get_active() uncompress = prefsTop.get_widget("uncompress").get_active() id_visible = prefsTop.get_widget("gid_visible").get_active() + id_edit = prefsTop.get_widget("gid_edit").get_active() hide_altnames = prefsTop.get_widget("display_altnames").get_active() paper_obj = prefsTop.get_widget("paper_size").get_menu().get_active() output_obj = prefsTop.get_widget("output_format").get_menu().get_active() @@ -395,6 +402,7 @@ def on_propertybox_apply(obj,page): gnome.config.set_bool("/gramps/config/UseTabs",usetabs) gnome.config.set_bool("/gramps/config/DontCompressXML",uncompress) gnome.config.set_bool("/gramps/config/IdVisible",id_visible) + gnome.config.set_bool("/gramps/config/IdEdit",id_edit) gnome.config.set_bool("/gramps/config/ShowDetail",show_detail) gnome.config.set_int("/gramps/config/StatusBar",status_bar) gnome.config.set_bool("/gramps/config/DisplayAttr",display_attr) @@ -532,6 +540,7 @@ def display_preferences_box(): pbox = prefsTop.get_widget("propertybox") auto = prefsTop.get_widget("autoload") vis = prefsTop.get_widget("gid_visible") + idedit = prefsTop.get_widget("gid_edit") tabs = prefsTop.get_widget("usetabs") compress = prefsTop.get_widget("uncompress") detail = prefsTop.get_widget("showdetail") @@ -542,6 +551,7 @@ def display_preferences_box(): tabs.set_active(usetabs) compress.set_active(uncompress) vis.set_active(id_visible) + idedit.set_active(id_edit) if status_bar == 0: prefsTop.get_widget("stat1").set_active(1) diff --git a/src/EditPerson.glade b/src/EditPerson.glade index b3e8fdd60..5114ffea6 100644 --- a/src/EditPerson.glade +++ b/src/EditPerson.glade @@ -971,32 +971,6 @@ 0 0 - - GtkLabel - gid - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 2 - 3 - 0 - 1 - 5 - 5 - True - False - False - False - True - False - - - GtkLabel user_data @@ -1126,6 +1100,30 @@ False + + + GtkEntry + gid + True + False + True + 0 + + + 2 + 3 + 0 + 1 + 2 + 0 + True + False + False + False + True + False + + diff --git a/src/EditPerson.py b/src/EditPerson.py index 2c543daa6..11ae0736b 100644 --- a/src/EditPerson.py +++ b/src/EditPerson.py @@ -148,6 +148,7 @@ class EditPerson: self.attr_source = self.get_widget("attr_source") self.name_note = self.get_widget("name_note") self.name_source = self.get_widget("name_source") + self.gid = self.get_widget("gid") self.elist = person.getEventList()[:] self.nlist = person.getAlternateNames()[:] @@ -203,7 +204,8 @@ class EditPerson: const.surnames.sort() self.get_widget("lastNameList").set_popdown_strings(const.surnames) - self.get_widget("gid").set_text(person.getId()) + self.gid.set_text(person.getId()) + self.gid.set_editable(Config.id_edit) self.event_list.set_column_visibility(3,Config.show_detail) self.name_list.set_column_visibility(1,Config.show_detail) self.attr_list.set_column_visibility(2,Config.show_detail) @@ -453,10 +455,13 @@ def did_data_change(obj): dplace = epo.dplace.get_text() gender = epo.is_male.get_active() text = epo.notes_field.get_chars(0,-1) + idval = epo.gid.get_text() changed = 0 name = person.getPrimaryName() - + + if person.getId() != idval: + changed = 1 if suffix != name.getSuffix() or surname != name.getSurname(): changed = 1 if given != name.getFirstName() or nick != person.getNickName(): @@ -1108,9 +1113,20 @@ def save_person(obj): given = epo.given.get_text() nick = epo.nick.get_text() title = epo.title.get_text() + idval = epo.gid.get_text() name = epo.pname + if idval != person.getId(): + m = epo.db.getPersonMap() + if not m.has_key(idval): + person.setId(idval) + else: + n = Config.nameof(m[idval]) + msg1 = _("GRAMPS ID value was not changed.") + msg2 = _("%s is already used by %s") % (idval,n) + GnomeWarningDialog("%s\n%s" % (msg1,msg2)) + if suffix != name.getSuffix(): name.setSuffix(suffix) diff --git a/src/config.glade b/src/config.glade index 22092741d..45a4c6bde 100644 --- a/src/config.glade +++ b/src/config.glade @@ -59,7 +59,7 @@ GtkTable table13 - 5 + 6 2 False 0 @@ -82,8 +82,8 @@ 1 2 - 4 - 5 + 5 + 6 0 0 True @@ -111,8 +111,8 @@ 0 1 - 4 - 5 + 5 + 6 5 5 False @@ -239,6 +239,35 @@ False + + + GtkCheckButton + gid_edit + True + + toggled + on_object_toggled + propertybox + Thu, 12 Jul 2001 13:42:44 GMT + + + False + True + + 0 + 2 + 4 + 5 + 5 + 5 + False + False + False + False + True + False + +