A new person editor
svn: r15951
This commit is contained in:
parent
371205ec70
commit
5013162ded
@ -211,7 +211,6 @@ register('interface.note-height', 500)
|
|||||||
register('interface.note-sel-height', 450)
|
register('interface.note-sel-height', 450)
|
||||||
register('interface.note-sel-width', 600)
|
register('interface.note-sel-width', 600)
|
||||||
register('interface.note-width', 700)
|
register('interface.note-width', 700)
|
||||||
register('interface.patro-title', 0)
|
|
||||||
register('interface.pedview-layout', 0)
|
register('interface.pedview-layout', 0)
|
||||||
register('interface.pedview-show-images', True)
|
register('interface.pedview-show-images', True)
|
||||||
register('interface.pedview-show-marriage', False)
|
register('interface.pedview-show-marriage', False)
|
||||||
@ -228,7 +227,6 @@ register('interface.place-height', 450)
|
|||||||
register('interface.place-sel-height', 450)
|
register('interface.place-sel-height', 450)
|
||||||
register('interface.place-sel-width', 600)
|
register('interface.place-sel-width', 600)
|
||||||
register('interface.place-width', 650)
|
register('interface.place-width', 650)
|
||||||
register('interface.prefix-suffix', 0)
|
|
||||||
register('interface.repo-height', 450)
|
register('interface.repo-height', 450)
|
||||||
register('interface.repo-ref-height', 450)
|
register('interface.repo-ref-height', 450)
|
||||||
register('interface.repo-ref-width', 600)
|
register('interface.repo-ref-width', 600)
|
||||||
|
@ -361,6 +361,13 @@ class DbReadBase(object):
|
|||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
def get_origin_types(self):
|
||||||
|
"""
|
||||||
|
Return a list of all custom origin types associated with Person/Surname
|
||||||
|
instances in the database.
|
||||||
|
"""
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
def get_note_bookmarks(self):
|
def get_note_bookmarks(self):
|
||||||
"""
|
"""
|
||||||
Return the list of Note handles in the bookmarks.
|
Return the list of Note handles in the bookmarks.
|
||||||
|
@ -297,6 +297,7 @@ class DbBsddbRead(DbReadBase, Callback):
|
|||||||
self.family_rel_types = set()
|
self.family_rel_types = set()
|
||||||
self.event_role_names = set()
|
self.event_role_names = set()
|
||||||
self.name_types = set()
|
self.name_types = set()
|
||||||
|
self.origin_types = set()
|
||||||
self.repository_types = set()
|
self.repository_types = set()
|
||||||
self.note_types = set()
|
self.note_types = set()
|
||||||
self.source_media_types = set()
|
self.source_media_types = set()
|
||||||
@ -1267,6 +1268,13 @@ class DbBsddbRead(DbReadBase, Callback):
|
|||||||
"""
|
"""
|
||||||
return list(self.name_types)
|
return list(self.name_types)
|
||||||
|
|
||||||
|
def get_origin_types(self):
|
||||||
|
"""
|
||||||
|
Return a list of all custom origin types assocated with Person/Surname
|
||||||
|
instances in the database.
|
||||||
|
"""
|
||||||
|
return list(self.origin_types)
|
||||||
|
|
||||||
def get_repository_types(self):
|
def get_repository_types(self):
|
||||||
"""
|
"""
|
||||||
Return a list of all custom repository types assocated with Repository
|
Return a list of all custom repository types assocated with Repository
|
||||||
|
@ -555,6 +555,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
|||||||
self.family_rel_types = set(meta('family_rels'))
|
self.family_rel_types = set(meta('family_rels'))
|
||||||
self.event_role_names = set(meta('event_roles'))
|
self.event_role_names = set(meta('event_roles'))
|
||||||
self.name_types = set(meta('name_types'))
|
self.name_types = set(meta('name_types'))
|
||||||
|
self.origin_types = set(meta('origin_types'))
|
||||||
self.repository_types = set(meta('repo_types'))
|
self.repository_types = set(meta('repo_types'))
|
||||||
self.note_types = set(meta('note_types'))
|
self.note_types = set(meta('note_types'))
|
||||||
self.source_media_types = set(meta('sm_types'))
|
self.source_media_types = set(meta('sm_types'))
|
||||||
@ -980,6 +981,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
|||||||
txn.put('family_rels', list(self.family_rel_types))
|
txn.put('family_rels', list(self.family_rel_types))
|
||||||
txn.put('event_roles', list(self.event_role_names))
|
txn.put('event_roles', list(self.event_role_names))
|
||||||
txn.put('name_types', list(self.name_types))
|
txn.put('name_types', list(self.name_types))
|
||||||
|
txn.put('origin_types', list(self.origin_types))
|
||||||
txn.put('repo_types', list(self.repository_types))
|
txn.put('repo_types', list(self.repository_types))
|
||||||
txn.put('note_types', list(self.note_types))
|
txn.put('note_types', list(self.note_types))
|
||||||
txn.put('sm_types', list(self.source_media_types))
|
txn.put('sm_types', list(self.source_media_types))
|
||||||
@ -1425,7 +1427,13 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
|||||||
for name in ([person.primary_name]
|
for name in ([person.primary_name]
|
||||||
+ person.alternate_names)
|
+ person.alternate_names)
|
||||||
if name.type.is_custom()])
|
if name.type.is_custom()])
|
||||||
|
|
||||||
|
all_surn = person.primary_name.get_surname_list()
|
||||||
|
for asurname in person.alternate_names:
|
||||||
|
all_surn += asurname.get_surname_list()
|
||||||
|
self.origin_types.update([str(surn.origintype) for surn in all_surn
|
||||||
|
if surn.origintype.is_custom()])
|
||||||
|
|
||||||
self.url_types.update([str(url.type) for url in person.urls
|
self.url_types.update([str(url.type) for url in person.urls
|
||||||
if url.type.is_custom()])
|
if url.type.is_custom()])
|
||||||
|
|
||||||
|
@ -581,6 +581,11 @@ class ProxyDbBase(DbReadBase):
|
|||||||
instances in the database"""
|
instances in the database"""
|
||||||
return self.db.get_name_types()
|
return self.db.get_name_types()
|
||||||
|
|
||||||
|
def get_origin_types(self):
|
||||||
|
"""returns a list of all custom origin types associated with Person/Surname
|
||||||
|
instances in the database"""
|
||||||
|
return self.db.get_origin_types()
|
||||||
|
|
||||||
def get_repository_types(self):
|
def get_repository_types(self):
|
||||||
"""returns a list of all custom repository types associated with
|
"""returns a list of all custom repository types associated with
|
||||||
Repository instances in the database"""
|
Repository instances in the database"""
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -142,9 +142,11 @@ class EditPerson(EditPrimary):
|
|||||||
|
|
||||||
self.obj_photo = self.top.get_object("personPix")
|
self.obj_photo = self.top.get_object("personPix")
|
||||||
self.eventbox = self.top.get_object("eventbox1")
|
self.eventbox = self.top.get_object("eventbox1")
|
||||||
|
self.singsurnfr = self.top.get_object("surnamefr")
|
||||||
|
self.multsurnfr = self.top.get_object("multsurnamefr")
|
||||||
|
self.singlesurn_active = True
|
||||||
|
|
||||||
self.set_contexteventbox(self.top.get_object("eventboxtop"))
|
self.set_contexteventbox(self.top.get_object("eventboxtop"))
|
||||||
|
|
||||||
|
|
||||||
def _post_init(self):
|
def _post_init(self):
|
||||||
"""
|
"""
|
||||||
@ -157,10 +159,13 @@ class EditPerson(EditPrimary):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
self.load_person_image()
|
self.load_person_image()
|
||||||
if self.pname.get_surname() and not self.pname.get_first_name():
|
self.given.grab_focus()
|
||||||
self.given.grab_focus()
|
|
||||||
else:
|
self.multsurnfr.hide_all()
|
||||||
self.surname_field.grab_focus()
|
#if self.pname.get_surname() and not self.pname.get_first_name():
|
||||||
|
# self.given.grab_focus()
|
||||||
|
#else:
|
||||||
|
# self.surname_field.grab_focus()
|
||||||
|
|
||||||
def _connect_signals(self):
|
def _connect_signals(self):
|
||||||
"""
|
"""
|
||||||
@ -172,7 +177,7 @@ class EditPerson(EditPrimary):
|
|||||||
self.define_help_button(self.top.get_object("button134"))
|
self.define_help_button(self.top.get_object("button134"))
|
||||||
|
|
||||||
self.given.connect("focus_out_event", self._given_focus_out_event)
|
self.given.connect("focus_out_event", self._given_focus_out_event)
|
||||||
self.top.get_object("button177").connect("clicked",
|
self.top.get_object("editnamebtn").connect("clicked",
|
||||||
self._edit_name_clicked)
|
self._edit_name_clicked)
|
||||||
|
|
||||||
self.eventbox.connect('button-press-event',
|
self.eventbox.connect('button-press-event',
|
||||||
@ -228,6 +233,11 @@ class EditPerson(EditPrimary):
|
|||||||
# we just rebuild the view always
|
# we just rebuild the view always
|
||||||
self.event_list.rebuild_callback()
|
self.event_list.rebuild_callback()
|
||||||
|
|
||||||
|
def _validate_call(self, widget, text):
|
||||||
|
""" a callname must be a part of the given name, see if this is the
|
||||||
|
case """
|
||||||
|
return text in self.given.obj.get_text().split()
|
||||||
|
|
||||||
def _setup_fields(self):
|
def _setup_fields(self):
|
||||||
"""
|
"""
|
||||||
Connect the GrampsWidget objects to field in the interface.
|
Connect the GrampsWidget objects to field in the interface.
|
||||||
@ -267,44 +277,56 @@ class EditPerson(EditPrimary):
|
|||||||
self.pname.get_type,
|
self.pname.get_type,
|
||||||
self.db.readonly,
|
self.db.readonly,
|
||||||
self.db.get_name_types())
|
self.db.get_name_types())
|
||||||
|
|
||||||
self.prefix_suffix = widgets.MonitoredComboSelectedEntry(
|
|
||||||
self.top.get_object("prefixcmb"),
|
|
||||||
self.top.get_object("prefixentry"),
|
|
||||||
[_('Prefix'), _('Suffix')],
|
|
||||||
[self.pname.set_surname_prefix, self.pname.set_suffix],
|
|
||||||
[self.pname.get_surname_prefix, self.pname.get_suffix],
|
|
||||||
default = config.get('interface.prefix-suffix'),
|
|
||||||
read_only = self.db.readonly)
|
|
||||||
|
|
||||||
self.patro_title = widgets.MonitoredComboSelectedEntry(
|
#part of Given Name section
|
||||||
self.top.get_object("patrocmb"),
|
|
||||||
self.top.get_object("patroentry"),
|
|
||||||
[_('Patronymic'), _('Person|Title')],
|
|
||||||
[self.pname.set_patronymic, self.pname.set_title],
|
|
||||||
[self.pname.get_patronymic, self.pname.get_title],
|
|
||||||
default = config.get('interface.patro-title'),
|
|
||||||
read_only = self.db.readonly)
|
|
||||||
|
|
||||||
self.call = widgets.MonitoredEntry(
|
|
||||||
self.top.get_object("call"),
|
|
||||||
self.pname.set_call_name,
|
|
||||||
self.pname.get_call_name,
|
|
||||||
self.db.readonly)
|
|
||||||
|
|
||||||
self.given = widgets.MonitoredEntry(
|
self.given = widgets.MonitoredEntry(
|
||||||
self.top.get_object("given_name"),
|
self.top.get_object("given_name"),
|
||||||
self.pname.set_first_name,
|
self.pname.set_first_name,
|
||||||
self.pname.get_first_name,
|
self.pname.get_first_name,
|
||||||
self.db.readonly)
|
self.db.readonly)
|
||||||
|
|
||||||
|
self.call = widgets.MonitoredEntry(
|
||||||
|
self.top.get_object("call"),
|
||||||
|
self.pname.set_call_name,
|
||||||
|
self.pname.get_call_name,
|
||||||
|
self.db.readonly)
|
||||||
|
self.call.connect("validate", self._validate_call)
|
||||||
|
|
||||||
|
self.title = widgets.MonitoredEntry(
|
||||||
|
self.top.get_object("title"),
|
||||||
|
self.pname.set_title,
|
||||||
|
self.pname.get_title,
|
||||||
|
self.db.readonly)
|
||||||
|
|
||||||
|
self.suffix = widgets.MonitoredEntry(
|
||||||
|
self.top.get_object("suffix"),
|
||||||
|
self.pname.set_suffix,
|
||||||
|
self.pname.get_suffix,
|
||||||
|
self.db.readonly)
|
||||||
|
|
||||||
|
#part of Single Surname section
|
||||||
self.surname_field = widgets.MonitoredEntry(
|
self.surname_field = widgets.MonitoredEntry(
|
||||||
self.top.get_object("surname"),
|
self.top.get_object("surname"),
|
||||||
self.pname.set_surname,
|
self.pname.get_primary_surname().set_surname,
|
||||||
self.pname.get_surname,
|
self.pname.get_primary_surname().get_surname,
|
||||||
self.db.readonly,
|
self.db.readonly,
|
||||||
autolist=self.db.get_surname_list() if not self.db.readonly else [])
|
autolist=self.db.get_surname_list() if not self.db.readonly else [])
|
||||||
|
|
||||||
|
self.prefix = widgets.MonitoredEntry(
|
||||||
|
self.top.get_object("prefix"),
|
||||||
|
self.pname.get_primary_surname().set_prefix,
|
||||||
|
self.pname.get_primary_surname().get_prefix,
|
||||||
|
self.db.readonly)
|
||||||
|
|
||||||
|
self.ortype_field = widgets.MonitoredDataType(
|
||||||
|
self.top.get_object("cmborigin"),
|
||||||
|
self.pname.get_primary_surname().set_origintype,
|
||||||
|
self.pname.get_primary_surname().get_origintype,
|
||||||
|
self.db.readonly,
|
||||||
|
self.db.get_origin_types())
|
||||||
|
|
||||||
|
#other fields
|
||||||
|
|
||||||
self.tags = widgets.MonitoredTagList(
|
self.tags = widgets.MonitoredTagList(
|
||||||
self.top.get_object("tag_label"),
|
self.top.get_object("tag_label"),
|
||||||
self.top.get_object("tag_button"),
|
self.top.get_object("tag_button"),
|
||||||
@ -321,11 +343,11 @@ class EditPerson(EditPrimary):
|
|||||||
self.db.readonly)
|
self.db.readonly)
|
||||||
|
|
||||||
#make sure title updates automatically
|
#make sure title updates automatically
|
||||||
for obj in [self.top.get_object("surname"),
|
for obj in [self.top.get_object("given_name"),
|
||||||
self.top.get_object("given_name"),
|
|
||||||
self.top.get_object("patroentry"),
|
|
||||||
self.top.get_object("call"),
|
self.top.get_object("call"),
|
||||||
self.top.get_object("prefixentry"),
|
self.top.get_object("suffix"),
|
||||||
|
self.top.get_object("prefix"),
|
||||||
|
self.top.get_object("surname"),
|
||||||
]:
|
]:
|
||||||
obj.connect('changed', self._changed_name)
|
obj.connect('changed', self._changed_name)
|
||||||
|
|
||||||
@ -894,9 +916,8 @@ class EditPerson(EditPrimary):
|
|||||||
return child_ref_list
|
return child_ref_list
|
||||||
|
|
||||||
def _cleanup_on_exit(self):
|
def _cleanup_on_exit(self):
|
||||||
config.set('interface.prefix-suffix', self.prefix_suffix.active_key)
|
pass
|
||||||
config.set('interface.patro-title', self.patro_title.active_key)
|
#config.save()
|
||||||
config.save()
|
|
||||||
|
|
||||||
|
|
||||||
class GenderDialog(gtk.MessageDialog):
|
class GenderDialog(gtk.MessageDialog):
|
||||||
|
@ -211,6 +211,7 @@ class DbGrdb(Callback):
|
|||||||
self.family_rel_types = set()
|
self.family_rel_types = set()
|
||||||
self.event_role_names = set()
|
self.event_role_names = set()
|
||||||
self.name_types = set()
|
self.name_types = set()
|
||||||
|
self.origin_types = set()
|
||||||
self.repository_types = set()
|
self.repository_types = set()
|
||||||
self.note_types = set()
|
self.note_types = set()
|
||||||
self.source_media_types = set()
|
self.source_media_types = set()
|
||||||
|
Loading…
Reference in New Issue
Block a user