2006-08-25 Alex Roitman <shura@gramps-project.org>
* src/plugins/ChangeTypes.py: Clean up type name conversions; work over all the events, regardless of who references them. * src/RelLib/_GrampsType.py (get_standard_names, get_standard_xml): Add methods to obtain standard type lists. svn: r7264
This commit is contained in:
parent
87bda8431d
commit
9081b54202
@ -1,3 +1,9 @@
|
|||||||
|
2006-08-25 Alex Roitman <shura@gramps-project.org>
|
||||||
|
* src/plugins/ChangeTypes.py: Clean up type name conversions; work
|
||||||
|
over all the events, regardless of who references them.
|
||||||
|
* src/RelLib/_GrampsType.py (get_standard_names, get_standard_xml):
|
||||||
|
Add methods to obtain standard type lists.
|
||||||
|
|
||||||
2006-08-25 Zsolt Foldvari <zsolt.foldvari@nokia.com>
|
2006-08-25 Zsolt Foldvari <zsolt.foldvari@nokia.com>
|
||||||
* src/GrampsCfg.py: Implement callback mechanism for dynamic name format
|
* src/GrampsCfg.py: Implement callback mechanism for dynamic name format
|
||||||
change.
|
change.
|
||||||
|
@ -103,6 +103,20 @@ class GrampsType:
|
|||||||
def get_map(self):
|
def get_map(self):
|
||||||
return self._I2SMAP
|
return self._I2SMAP
|
||||||
|
|
||||||
|
def get_standard_names(self):
|
||||||
|
"""
|
||||||
|
Return the list of localized names for all standard types.
|
||||||
|
"""
|
||||||
|
return [s for (i,s) in self._I2SMAP.items()
|
||||||
|
if (i != self._CUSTOM) and s.strip()]
|
||||||
|
|
||||||
|
def get_standard_xml(self):
|
||||||
|
"""
|
||||||
|
Return the list of XML (english) names for all standard types.
|
||||||
|
"""
|
||||||
|
return [s for (i,s) in self._I2EMAP.items()
|
||||||
|
if (i != self._CUSTOM) and s.strip()]
|
||||||
|
|
||||||
def is_custom(self):
|
def is_custom(self):
|
||||||
return self.val == self._CUSTOM
|
return self.val == self._CUSTOM
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
"Database Processing/Rename personal event types"
|
"Database Processing/Rename event types"
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -82,15 +82,20 @@ class ChangeTypes(Tool.BatchTool, ManagedWindow.ManagedWindow):
|
|||||||
|
|
||||||
self.auto1 = self.glade.get_widget("original")
|
self.auto1 = self.glade.get_widget("original")
|
||||||
self.auto2 = self.glade.get_widget("new")
|
self.auto2 = self.glade.get_widget("new")
|
||||||
event_names = [item[1] for item in EventType._DATAMAP if item[0] > 0 ]
|
|
||||||
|
# Need to display localized event names
|
||||||
|
etype = EventType()
|
||||||
|
event_names = etype.get_standard_names()
|
||||||
event_names.sort(locale.strcoll)
|
event_names.sort(locale.strcoll)
|
||||||
|
|
||||||
AutoComp.fill_combo(self.auto1,event_names)
|
AutoComp.fill_combo(self.auto1,event_names)
|
||||||
AutoComp.fill_combo(self.auto2,event_names)
|
AutoComp.fill_combo(self.auto2,event_names)
|
||||||
# Need to display localized event names
|
|
||||||
fromtype = self.options.handler.options_dict['fromtype']
|
etype.set_from_xml_str(self.options.handler.options_dict['fromtype'])
|
||||||
totype = self.options.handler.options_dict['totype']
|
self.auto1.child.set_text(str(etype))
|
||||||
self.auto1.child.set_text(_(fromtype))
|
|
||||||
self.auto2.child.set_text(_(totype))
|
etype.set_from_xml_str(self.options.handler.options_dict['totype'])
|
||||||
|
self.auto2.child.set_text(str(etype))
|
||||||
|
|
||||||
window = self.glade.get_widget('top')
|
window = self.glade.get_widget('top')
|
||||||
self.set_window(window,self.glade.get_widget('title'),self.title)
|
self.set_window(window,self.glade.get_widget('title'),self.title)
|
||||||
@ -117,18 +122,14 @@ class ChangeTypes(Tool.BatchTool, ManagedWindow.ManagedWindow):
|
|||||||
self.db.disable_signals()
|
self.db.disable_signals()
|
||||||
if not cli:
|
if not cli:
|
||||||
progress = Utils.ProgressMeter(_('Analyzing events'),'')
|
progress = Utils.ProgressMeter(_('Analyzing events'),'')
|
||||||
progress.set_pass('',self.db.get_number_of_people())
|
progress.set_pass('',self.db.get_number_of_events())
|
||||||
|
|
||||||
for person_handle in self.db.get_person_handles(sort_handles=False):
|
for event_handle in self.db.get_event_handles():
|
||||||
person = self.db.get_person_from_handle(person_handle)
|
event = self.db.get_event_from_handle(event_handle)
|
||||||
for event_ref in person.get_event_ref_list():
|
if event.get_type().xml_str() == fromtype:
|
||||||
if not event_ref.ref:
|
event.type.set_from_xml_str(totype)
|
||||||
continue
|
modified += 1
|
||||||
event = self.db.get_event_from_handle(event_ref.ref)
|
self.db.commit_event(event,self.trans)
|
||||||
if event.get_type().xml_str() == fromtype:
|
|
||||||
event.type.set_from_xml_str(totype)
|
|
||||||
modified = modified + 1
|
|
||||||
self.db.commit_event(event,self.trans)
|
|
||||||
if not cli:
|
if not cli:
|
||||||
progress.step()
|
progress.step()
|
||||||
if not cli:
|
if not cli:
|
||||||
@ -203,7 +204,7 @@ register_tool(
|
|||||||
tool_class = ChangeTypes,
|
tool_class = ChangeTypes,
|
||||||
options_class = ChangeTypesOptions,
|
options_class = ChangeTypesOptions,
|
||||||
modes = Tool.MODE_GUI | Tool.MODE_CLI,
|
modes = Tool.MODE_GUI | Tool.MODE_CLI,
|
||||||
translated_name = _("Rename personal event types"),
|
translated_name = _("Rename event types"),
|
||||||
status = _("Stable"),
|
status = _("Stable"),
|
||||||
author_name = "Donald N. Allingham",
|
author_name = "Donald N. Allingham",
|
||||||
author_email = "don@gramps-project.org",
|
author_email = "don@gramps-project.org",
|
||||||
|
Loading…
Reference in New Issue
Block a user