diff --git a/ChangeLog b/ChangeLog index 9896ec296..9f7ad72ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,8 @@ 2006-03-21 Don Allingham + * src/Config/_GramspGconfKeys.py: family_warn flag + * src/Config/_GramspIniKeys.py: family_warn flag + * src/Editors/_EditFamily.py: display family_warn dialog + * src/glade/gramps.glade: family warn dialog * src/DisplayTabs.py: Send Attribute instead of None for new object * src/Editors/_EditAddress.py: specify callback diff --git a/src/Config/_GrampsGconfKeys.py b/src/Config/_GrampsGconfKeys.py index 12de930ee..7eba1e7cd 100644 --- a/src/Config/_GrampsGconfKeys.py +++ b/src/Config/_GrampsGconfKeys.py @@ -90,6 +90,12 @@ def get_dont_ask(): def save_dont_ask(val): set_bool("/apps/gramps/interface/dont-ask",val) +def get_family_warn(): + return get_bool("/apps/gramps/interface/family-warn") + +def save_family_warn(val): + set_bool("/apps/gramps/interface/family-warn",val) + def get_index_visible(): return get_bool("/apps/gramps/interface/index-visible") diff --git a/src/Config/_GrampsIniKeys.py b/src/Config/_GrampsIniKeys.py index aaf024a7c..4eee30628 100644 --- a/src/Config/_GrampsIniKeys.py +++ b/src/Config/_GrampsIniKeys.py @@ -260,6 +260,12 @@ def get_dont_ask(): def save_dont_ask(val): set_bool("interface", "dont-ask",val) +def get_family_warn(): + return get_bool("interface","family-warn") + +def save_family_warn(val): + set_bool("interface","family-warn",val) + def get_index_visible(): return get_bool("interface", "index-visible") diff --git a/src/DisplayTabs.py b/src/DisplayTabs.py index 35ce28679..b977ca333 100644 --- a/src/DisplayTabs.py +++ b/src/DisplayTabs.py @@ -1525,7 +1525,7 @@ class ChildModel(gtk.ListStore): self.column_birth_place(child), self.column_death_place(child), child.get_handle(), - NameDisplay.display.sort_string(child.primary_name), + NameDisplay.displayer.sort_string(child.primary_name), self.column_birth_sort(child), self.column_death_sort(child), ]) diff --git a/src/Editors/_EditFamily.py b/src/Editors/_EditFamily.py index 485670090..bead2f368 100644 --- a/src/Editors/_EditFamily.py +++ b/src/Editors/_EditFamily.py @@ -68,6 +68,7 @@ import Spell import GrampsDisplay import RelLib import AutoComp +import Config from _EditPrimary import EditPrimary from PluginUtils import ReportUtils @@ -297,6 +298,22 @@ class EditFamily(EditPrimary): EditPrimary.__init__(self, dbstate, uistate, track, family, dbstate.db.get_family_from_handle) + # look for the scenerio of a child and no parents on a new + # family + + if self.added and self.obj.get_father_handle() == None and \ + self.obj.get_mother_handle() == None and \ + len(self.obj.get_child_handle_list()) == 1: + if not Config.get_family_warn(): + for i in self.hidden: + i.set_sensitive(False) + + glade = gtk.glade.XML(const.gladeFile,'family_warn') + dialog = glade.get_widget('family_warn') + dialog.run() + if glade.get_widget('dont_show').get_active(): + Config.save_family_warn(True) + dialog.destroy() def _local_init(self): self.build_interface() @@ -356,6 +373,9 @@ class EditFamily(EditPrimary): self.define_ok_button(self.top.get_widget('ok'), self.save) self.define_cancel_button(self.top.get_widget('cancel')) + def _can_be_replaced(self): + pass + def _setup_fields(self): self.private= PrivacyButton( @@ -422,6 +442,8 @@ class EditFamily(EditPrimary): self.obj.get_media_list())) notebook.show_all() + + self.hidden = (notebook, self.top.get_widget('info')) self.top.get_widget('vbox').pack_start(notebook,True) def update_father(self,handle): @@ -453,49 +475,53 @@ class EditFamily(EditPrimary): selector_window.close() -# def mother_clicked(self, obj): + def mother_clicked(self, obj): + for i in self.hidden: + i.set_sensitive(True) + + handle = self.obj.get_mother_handle() + + if handle: + self.obj.set_mother_handle(None) + self.update_mother(None) + else: + from SelectPerson import SelectPerson + + data_filter = FastFemaleFilter(self.dbstate.db) + sel = SelectPerson(self.dbstate.db, "Select Mother", + filter=data_filter, + skip=self.obj.get_child_handle_list()) + person = sel.run() + + if person: + self.obj.set_mother_handle(person.handle) + self.update_mother(person.handle) + +# def mother_clicked(self,obj): # handle = self.obj.get_mother_handle() # if handle: # self.obj.set_mother_handle(None) # self.update_mother(None) # else: -# from SelectPerson import SelectPerson - -# data_filter = FastFemaleFilter(self.dbstate.db) -# sel = SelectPerson(self.dbstate.db, "Select Mother", -# filter=data_filter, -# skip=self.obj.get_child_handle_list()) -# person = sel.run() - -# if person: -# self.obj.set_mother_handle(person.handle) -# self.update_mother(person.handle) - - def mother_clicked(self,obj): - handle = self.obj.get_mother_handle() - if handle: - self.obj.set_mother_handle(None) - self.update_mother(None) - else: - filter_spec = PersonFilterSpec() - filter_spec.set_gender(RelLib.Person.FEMALE) +# filter_spec = PersonFilterSpec() +# filter_spec.set_gender(RelLib.Person.FEMALE) - child_birth_years = [] - for person_handle in self.obj.get_child_handle_list(): - person = self.db.get_person_from_handle(person_handle) - event_ref = person.get_birth_ref() - if event_ref and event_ref.ref: - event = self.db.get_event_from_handle(event_ref.ref) - child_birth_years.append(event.get_date_object().get_year()) +# child_birth_years = [] +# for person_handle in self.obj.get_child_handle_list(): +# person = self.db.get_person_from_handle(person_handle) +# event_ref = person.get_birth_ref() +# if event_ref and event_ref.ref: +# event = self.db.get_event_from_handle(event_ref.ref) +# child_birth_years.append(event.get_date_object().get_year()) - if len(child_birth_years) > 0: - filter_spec.set_birth_year(min(child_birth_years)) - filter_spec.set_birth_criteria(PersonFilterSpec.BEFORE) +# if len(child_birth_years) > 0: +# filter_spec.set_birth_year(min(child_birth_years)) +# filter_spec.set_birth_criteria(PersonFilterSpec.BEFORE) - selector = PersonSelector(self.dbstate,self.uistate, - self.track,filter_spec=filter_spec) - selector.connect('add-object',self.on_change_mother) +# selector = PersonSelector(self.dbstate,self.uistate, +# self.track,filter_spec=filter_spec) +# selector.connect('add-object',self.on_change_mother) def on_change_father(self, selector_window, obj): if obj.__class__ == RelLib.Person: @@ -518,6 +544,9 @@ class EditFamily(EditPrimary): selector_window.close() def father_clicked(self, obj): + for i in self.hidden: + i.set_sensitive(True) + handle = self.obj.get_father_handle() if handle: self.obj.set_father_handle(None) diff --git a/src/glade/gramps.glade b/src/glade/gramps.glade index 207f5d1ff..0484a5f50 100644 --- a/src/glade/gramps.glade +++ b/src/glade/gramps.glade @@ -1141,7 +1141,7 @@ - + 6 True 2 @@ -15548,4 +15548,172 @@ Very High + + + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True + False + False + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + gtk-close + True + GTK_RELIEF_NORMAL + True + -7 + + + + + 0 + False + True + GTK_PACK_END + + + + + + 12 + True + 3 + 3 + False + 0 + 0 + + + + True + It is possible to accidentally create multiple families with the same parents. To help avoid this problem, only the buttons to select parents are available when you create a new family. The remaining fields will become available after you attempt to select a parent. + +You should select parents before adding any new information. If you select parents that match an existing family, and your current family is empty, you will start editing the matching family. If you have already added data, you will create a duplicate family. + False + True + GTK_JUSTIFY_LEFT + True + False + 0 + 0.5 + 6 + 12 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 2 + 3 + 1 + 2 + fill + + + + + + + True + gtk-dialog-warning + 6 + 0.5 + 0 + 0 + 0 + + + 0 + 1 + 0 + 2 + fill + fill + + + + + + True + <span size="larger" weight="bold">Adding parents to a person</span> + False + True + GTK_JUSTIFY_LEFT + True + False + 0 + 0.5 + 6 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 2 + 3 + 0 + 1 + expand|shrink|fill + + + + + + + True + True + Do not show this dialog again + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 1 + 3 + 2 + 3 + + + + + + + 0 + True + True + + + + + +