family warn dialog
svn: r6192
This commit is contained in:
parent
5d34cd3446
commit
936b073c02
@ -1,4 +1,8 @@
|
||||
2006-03-21 Don Allingham <don@gramps-project.org>
|
||||
* 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
|
||||
|
@ -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")
|
||||
|
||||
|
@ -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")
|
||||
|
||||
|
@ -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),
|
||||
])
|
||||
|
@ -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)
|
||||
|
@ -1141,7 +1141,7 @@
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTable" id="table10">
|
||||
<widget class="GtkTable" id="info">
|
||||
<property name="border_width">6</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">2</property>
|
||||
@ -15548,4 +15548,172 @@ Very High</property>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget class="GtkDialog" id="family_warn">
|
||||
<property name="title" translatable="yes"></property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||
<property name="modal">False</property>
|
||||
<property name="resizable">True</property>
|
||||
<property name="destroy_with_parent">False</property>
|
||||
<property name="decorated">True</property>
|
||||
<property name="skip_taskbar_hint">False</property>
|
||||
<property name="skip_pager_hint">False</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
<property name="focus_on_map">True</property>
|
||||
<property name="urgency_hint">False</property>
|
||||
<property name="has_separator">False</property>
|
||||
|
||||
<child internal-child="vbox">
|
||||
<widget class="GtkVBox" id="vbox122">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child internal-child="action_area">
|
||||
<widget class="GtkHButtonBox" id="hbuttonbox42">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="button179">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-close</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="response_id">-7</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">GTK_PACK_END</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTable" id="table71">
|
||||
<property name="border_width">12</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">3</property>
|
||||
<property name="n_columns">3</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="row_spacing">0</property>
|
||||
<property name="column_spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label635">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">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.</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">6</property>
|
||||
<property name="ypad">12</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="image2690">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-dialog-warning</property>
|
||||
<property name="icon_size">6</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options">fill</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label636">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><span size="larger" weight="bold">Adding parents to a person</span></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">6</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="bottom_attach">1</property>
|
||||
<property name="x_options">expand|shrink|fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="dont_show">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Do not show this dialog again</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_options"></property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
</glade-interface>
|
||||
|
Loading…
Reference in New Issue
Block a user