From 71162563ed34ff298beec189dae592c39f8d7aef Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Wed, 18 Apr 2007 03:59:34 +0000 Subject: [PATCH] 2007-04-17 Don Allingham * src/Editors/_EditRepository.py: fix double click save bug * src/Editors/_EditSource.py: fix double click save bug * src/Editors/_EditEvent.py: fix double click save bug * src/Editors/_EditPlace.py: fix double click save bug * src/Editors/_EditFamily.py (EditFamily.save): fix potential double click of Family Editor dialog svn: r8399 --- ChangeLog | 8 ++++++++ src/Editors/_EditEvent.py | 12 ++++++------ src/Editors/_EditFamily.py | 3 +++ src/Editors/_EditPlace.py | 1 + src/Editors/_EditRepository.py | 2 ++ src/Editors/_EditSource.py | 3 +++ 6 files changed, 23 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index e5a3dc8bc..5b50a8e47 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-04-17 Don Allingham + * src/Editors/_EditRepository.py: fix double click save bug + * src/Editors/_EditSource.py: fix double click save bug + * src/Editors/_EditEvent.py: fix double click save bug + * src/Editors/_EditPlace.py: fix double click save bug + * src/Editors/_EditFamily.py (EditFamily.save): fix potential double click of Family + Editor dialog + 2007-04-16 Martin Hawlisch * src/ViewManager.py (create_pages): fix off-by-one error when preselecting last view diff --git a/src/Editors/_EditEvent.py b/src/Editors/_EditEvent.py index 53299ab0e..caaaf92e5 100644 --- a/src/Editors/_EditEvent.py +++ b/src/Editors/_EditEvent.py @@ -103,12 +103,9 @@ class EditEvent(EditPrimary): self.window.resize(width, height) def _connect_signals(self): - self.top.get_widget('button111').connect('clicked',self.close) - self.top.get_widget('button126').connect('clicked',self.help_clicked) - - ok = self.top.get_widget('ok') - ok.set_sensitive(not self.db.readonly) - ok.connect('clicked',self.save) + self.define_cancel_button(self.top.get_widget('button111')) + self.define_help_button(self.top.get_widget('button126'), 'adv_ev') + self.define_ok_button(self.top.get_widget('ok'), self.save) def _setup_fields(self): @@ -214,10 +211,12 @@ class EditEvent(EditPrimary): GrampsDisplay.help('adv-ev') def save(self,*obj): + self.ok_button.set_sensitive(False) if self.object_is_empty(): ErrorDialog(_("Cannot save event"), _("No data exists for this event. Please " "enter data or cancel the edit.")) + self.ok_button.set_sensitive(True) return t = self.obj.get_type() @@ -225,6 +224,7 @@ class EditEvent(EditPrimary): ErrorDialog( _("Cannot save event"), _("The event type cannot be empty")) + self.ok_button.set_sensitive(True) return if self.obj.handle == None: diff --git a/src/Editors/_EditFamily.py b/src/Editors/_EditFamily.py index 1c357973b..a2cb6d210 100644 --- a/src/Editors/_EditFamily.py +++ b/src/Editors/_EditFamily.py @@ -774,6 +774,7 @@ class EditFamily(EditPrimary): def save(self,*obj): + self.ok_button.set_sensitive(False) if not self.added: original = self.db.get_family_from_handle(self.obj.handle) else: @@ -791,6 +792,7 @@ class EditFamily(EditPrimary): QuestionDialog.ErrorDialog(_("A father cannot be his own child"), _("%s is listed as both the father and child " "of the family.") % name) + self.ok_button.set_sensitive(True) return elif self.obj.get_mother_handle() in child_list: @@ -800,6 +802,7 @@ class EditFamily(EditPrimary): QuestionDialog.ErrorDialog(_("A mother cannot be her own child"), _("%s is listed as both the mother and child " "of the family.") % name) + self.ok_button.set_sensitive(True) return diff --git a/src/Editors/_EditPlace.py b/src/Editors/_EditPlace.py index 5fa12df14..483af25ba 100644 --- a/src/Editors/_EditPlace.py +++ b/src/Editors/_EditPlace.py @@ -194,6 +194,7 @@ class EditPlace(EditPrimary): Config.sync() def save(self,*obj): + self.ok_button.set_sensitive(False) title = self.obj.get_title() trans = self.db.transaction_begin() diff --git a/src/Editors/_EditRepository.py b/src/Editors/_EditRepository.py index 7a3d45098..4b413a884 100644 --- a/src/Editors/_EditRepository.py +++ b/src/Editors/_EditRepository.py @@ -141,11 +141,13 @@ class EditRepository(EditPrimary): self.define_ok_button(self.glade.get_widget('ok'), self.save) def save(self,*obj): + self.ok_button.set_sensitive(False) if self.object_is_empty(): from QuestionDialog import ErrorDialog ErrorDialog(_("Cannot save repository"), _("No data exists for this repository. Please " "enter data or cancel the edit.")) + self.ok_button.set_sensitive(True) return trans = self.db.transaction_begin() diff --git a/src/Editors/_EditSource.py b/src/Editors/_EditSource.py index 56d7e41f2..ccab40180 100644 --- a/src/Editors/_EditSource.py +++ b/src/Editors/_EditSource.py @@ -160,12 +160,15 @@ class EditSource(EditPrimary): return (_('Edit Source'), self.get_menu_title()) def save(self,*obj): + + self.ok_button.set_sensitive(False) if self.object_is_empty(): from QuestionDialog import ErrorDialog ErrorDialog(_("Cannot save source"), _("No data exists for this source. Please " "enter data or cancel the edit.")) + self.ok_button.set_sensitive(True) return trans = self.db.transaction_begin()