From c5247c4d024f294e867cb233f5559c5f2f5a5de4 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Thu, 11 Nov 2004 04:28:40 +0000 Subject: [PATCH] * src/EditPerson.py: handle the new "dont-ask" key * src/GrampsGconfKeys.py: handle the new "dont-ask" key * src/ImageSelect.py: remove debugging statements * src/Marriage.py: handle the new "dont-ask" key * src/QuestionDialog.py: handle the new "dont-ask" key * src/gramps.glade: added "dont ask" button to SaveDialog to turn off the nagging * src/data/gramps.schemas: added the "dont-ask" key svn: r3721 --- ChangeLog | 10 ++++++++++ src/EditPerson.py | 5 +++-- src/GrampsGconfKeys.py | 6 ++++++ src/ImageSelect.py | 2 -- src/Marriage.py | 3 ++- src/QuestionDialog.py | 4 ++++ src/data/gramps.schemas | 13 +++++++++++++ src/gramps.glade | 24 +++++++++++++++++++++++- 8 files changed, 61 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2aec3d83e..f08259127 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2004-11-10 Don Allingham + * src/EditPerson.py: handle the new "dont-ask" key + * src/GrampsGconfKeys.py: handle the new "dont-ask" key + * src/ImageSelect.py: remove debugging statements + * src/Marriage.py: handle the new "dont-ask" key + * src/QuestionDialog.py: handle the new "dont-ask" key + * src/gramps.glade: added "dont ask" button to SaveDialog + to turn off the nagging + * src/data/gramps.schemas: added the "dont-ask" key + 2004-11-09 Don Allingham * src/gramps_main.py: fix goto_active_person * src/DateParser.py: Handle month=12 in gregorian_valid diff --git a/src/EditPerson.py b/src/EditPerson.py index 103be6f33..026d513ec 100644 --- a/src/EditPerson.py +++ b/src/EditPerson.py @@ -1070,7 +1070,8 @@ class EditPerson: def on_cancel_edit(self,obj): """If the data has changed, give the user a chance to cancel the close window""" - if self.did_data_change(): + + if self.did_data_change() and not GrampsGconfKeys.get_dont_ask(): n = "%s" % self.person.get_primary_name().get_regular_name() SaveDialog(_('Save changes to %s?') % n, _('If you close without saving, the changes you ' @@ -1086,7 +1087,7 @@ class EditPerson: def on_delete_event(self,obj,b): """If the data has changed, give the user a chance to cancel the close window""" - if self.did_data_change(): + if self.did_data_change() and not GrampsGconfKeys.get_dont_ask(): n = "%s" % self.person.get_primary_name().get_regular_name() SaveDialog(_('Save Changes to %s?') % n, _('If you close without saving, the changes you ' diff --git a/src/GrampsGconfKeys.py b/src/GrampsGconfKeys.py index 51e18088b..55580972a 100644 --- a/src/GrampsGconfKeys.py +++ b/src/GrampsGconfKeys.py @@ -70,6 +70,12 @@ def get_filter(): def save_filter(val): set_bool("/apps/gramps/interface/filter",val) +def get_dont_ask(): + return get_bool("/apps/gramps/interface/dont-ask") + +def save_dont_ask(val): + set_bool("/apps/gramps/interface/dont-ask",val) + def get_index_visible(): return get_bool("/apps/gramps/interface/index-visible") diff --git a/src/ImageSelect.py b/src/ImageSelect.py index eeadeb40f..a026ac31c 100644 --- a/src/ImageSelect.py +++ b/src/ImageSelect.py @@ -353,11 +353,9 @@ class Gallery(ImageSelect): def savephoto(self, photo): """Save the photo in the dataobj object. (Required function)""" - print "In save photo" self.db.add_object(photo,None) oref = RelLib.MediaRef() oref.set_reference_handle(photo.get_handle()) - print photo.get_handle(), photo.get_path() self.db.set_thumbnail_image(photo.get_handle(),photo.get_path()) self.dataobj.add_media_reference(oref) diff --git a/src/Marriage.py b/src/Marriage.py index 1dce8bbb3..c1d1eb1ed 100644 --- a/src/Marriage.py +++ b/src/Marriage.py @@ -48,6 +48,7 @@ import RelLib import ImageSelect import DateHandler import Sources +import GrampsGconfKeys from QuestionDialog import QuestionDialog, WarningDialog, SaveDialog from gettext import gettext as _ @@ -555,7 +556,7 @@ class Marriage: self.close(0) def on_cancel_edit(self,obj): - if self.did_data_change(): + if self.did_data_change() and not GrampsGconfKeys.get_dont_ask(): global quit self.quit = obj SaveDialog(_('Save Changes?'), diff --git a/src/QuestionDialog.py b/src/QuestionDialog.py index ee9d847cc..55f43eec7 100644 --- a/src/QuestionDialog.py +++ b/src/QuestionDialog.py @@ -21,6 +21,7 @@ import gtk import gtk.glade import const +import GrampsGconfKeys from gettext import gettext as _ @@ -28,6 +29,7 @@ class SaveDialog: def __init__(self,msg1,msg2,task1,task2,parent=None): self.xml = gtk.glade.XML(const.errdialogsFile,"savedialog","gramps") self.top = self.xml.get_widget('savedialog') + self.dontask = self.xml.get_widget('dontask') self.task1 = task1 self.task2 = task2 @@ -47,6 +49,8 @@ class SaveDialog: self.task1() elif response == gtk.RESPONSE_YES: self.task2() + + GrampsGconfKeys.save_dont_ask(self.dontask.get_active()) self.top.destroy() class QuestionDialog: diff --git a/src/data/gramps.schemas b/src/data/gramps.schemas index ca6b07fb5..948e45083 100644 --- a/src/data/gramps.schemas +++ b/src/data/gramps.schemas @@ -42,6 +42,19 @@ + + /schemas/apps/gramps/preferences/dont-ask + /apps/gramps/preferences/dont-ask + gramps + bool + 0 + + Do not prompt on save + This key disables prompting when data has changed + and the Cancel button has been pressed. + + + /schemas/apps/gramps/interface/defaultview /apps/gramps/interface/defaultview diff --git a/src/gramps.glade b/src/gramps.glade index 99082a51c..c11d4b22c 100644 --- a/src/gramps.glade +++ b/src/gramps.glade @@ -25121,7 +25121,7 @@ Other 12 True - 2 + 3 3 False 0 @@ -25194,6 +25194,28 @@ Other + + + + True + True + Do not ask again + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 1 + 3 + 2 + 3 + fill + + + 0