* src/ViewManager.py (post_load_newdb): Upgrade path for different

grdb custom name format table versions
	* src/NameDisplay.py (register_custom_formats): Upgrade path for
	different grdb custom name format table versions

2006-07-27  Zsolt Foldvari  <zfoldvar@users.sourceforge.net>


svn: r7084
This commit is contained in:
Zsolt Foldvari 2006-07-27 11:53:47 +00:00
parent c7d9e4b9fe
commit 1d9e6da05a
3 changed files with 21 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2006-07-27 Zsolt Foldvari <zfoldvar@users.sourceforge.net>
* src/ViewManager.py (post_load_newdb): Upgrade path for different
grdb custom name format table versions
* src/NameDisplay.py (register_custom_formats): Upgrade path for
different grdb custom name format table versions
2006-07-27 Zsolt Foldvari <zfoldvar@users.sourceforge.net>
* src/GrampsCfg.py: Custom name format support improvements.
* src/Editors/_EditName.py: Custom name format support improvements.

View File

@ -119,8 +119,19 @@ class NameDisplay:
self.raw_fn_array[0] = self.raw_fn_array[idx]
def register_custom_formats(self,formats):
self.CUSTOM_FORMATS = formats[:]
# magic is needed due to different name format table structure
# in different revisions:
# r <= 7082: (number, name, format_string)
# r >= 7083: (number, name, format_string, active)
self.CUSTOM_FORMATS = []
changed = False
for format in formats:
if len(format) == 3:
format = format + (1,)
changed = True
self.CUSTOM_FORMATS.append(format)
self.set_format_fn()
return changed
def update_custom_formats(self,num,name,str,act):
i = 0

View File

@ -768,7 +768,9 @@ class ViewManager:
self.state.db.set_researcher(owner)
self.setup_bookmarks()
NameDisplay.displayer.register_custom_formats(self.state.db.name_formats)
if NameDisplay.displayer.register_custom_formats(self.state.db.name_formats):
self.state.db.name_formats = NameDisplay.displayer.CUSTOM_FORMATS
fmt_default = Config.get(Config.NAME_FORMAT)
if fmt_default < 0:
NameDisplay.displayer.set_format_default(fmt_default)