* src/GrampsDb/_GrampsBSDDB.py: upgrade of grdb now sets correct notetype, and

inherits the public/private setting of the parent object it is created from, 
          instead of defaulting to public.

2007-05-07 Benny Malengier <bm@cage.ugent.be>


svn: r8442
This commit is contained in:
Benny Malengier 2007-05-07 23:02:03 +00:00
parent 0182f42307
commit c5916814e8
3 changed files with 59 additions and 22 deletions

View File

@ -1,3 +1,8 @@
2007-05-07 Benny Malengier <bm@cage.ugent.be>
* src/GrampsDb/_GrampsBSDDB.py: upgrade of grdb now sets correct notetype, and
inherits the public/private setting of the parent object it is created from,
instead of defaulting to public.
2007-05-07 Benny Malengier <bm@cage.ugent.be> 2007-05-07 Benny Malengier <bm@cage.ugent.be>
* src/Editors/_EditPlace.py: * src/Editors/_EditPlace.py:
* src/Editors/_EditAddress.py: * src/Editors/_EditAddress.py:

4
TODO
View File

@ -15,9 +15,9 @@
* before release on multiple notes: * before release on multiple notes:
--> in note view: only show orphaned notes (notes are NOT in remove --> in note view: only show orphaned notes (notes are NOT in remove
orphaned notes tool which is what we want ) orphaned notes tool which is what we want )
--> in note: also public/private (database, xml, editor) --> in note: also public/private on GUI
--> on upgrade, the notetype should correspond to the object the note is made --> on upgrade, the notetype should correspond to the object the note is made
from, so notetype SOURCE, SOURCEREF, ... from, so notetype SOURCE, SOURCEREF, ... (DONE for GRDB)
--> in sourceref: --> in sourceref:
* remove text tab. * remove text tab.
* On import of GEDCOM text tag, or upgrade of < 2.2 database, * On import of GEDCOM text tag, or upgrade of < 2.2 database,

View File

@ -2011,7 +2011,7 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback):
if the_txn: if the_txn:
the_txn.commit() the_txn.commit()
def convert_notes_13(self,name,obj): def convert_notes_13(self,name,obj,nttype=NoteType._DEFAULT, private=False):
""" """
This is the function for conversion all notes in all objects This is the function for conversion all notes in all objects
and their child objects to the top-level notes and handle references. and their child objects to the top-level notes and handle references.
@ -2034,8 +2034,8 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback):
(text,format) = obj (text,format) = obj
handle = str(self.create_id()) handle = str(self.create_id())
gramps_id = self.find_next_note_gramps_id() gramps_id = self.find_next_note_gramps_id()
note_tuple = (handle,gramps_id,text,format,(0,'',), note_tuple = (handle,gramps_id,text,format,(nttype,'',),
self.change_13,(-1,'',),False) self.change_13,(-1,'',),private)
self.commit_13(note_tuple,NOTE_KEY,self.note_map,[]) self.commit_13(note_tuple,NOTE_KEY,self.note_map,[])
new_obj = [handle] new_obj = [handle]
note_handles = [handle] note_handles = [handle]
@ -2044,15 +2044,20 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback):
note_handles = [] note_handles = []
elif name == 'RepoRef': elif name == 'RepoRef':
(note,ref,call_number,media_type) = obj (note,ref,call_number,media_type) = obj
(note_list,note_handles) = self.convert_notes_13('Note',note) (note_list,note_handles) = self.convert_notes_13('Note',note,
nttype=NoteType.REPOREF)
new_obj = (note_list,ref,call_number,media_type) new_obj = (note_list,ref,call_number,media_type)
elif name == 'SourceRef': elif name == 'SourceRef':
(date,priv,note,conf,ref,page,text) = obj (date,priv,note,conf,ref,page,text) = obj
(note_list,note_handles) = self.convert_notes_13('Note',note) (note_list,note_handles) = self.convert_notes_13('Note',note,
nttype=NoteType.SOURCEREF,
private=priv)
new_obj = (date,priv,note_list,conf,ref,page,text) new_obj = (date,priv,note_list,conf,ref,page,text)
elif name == 'Attribute': elif name == 'Attribute':
(priv,source_list,note,the_type,value) = obj (priv,source_list,note,the_type,value) = obj
(note_list,note_handles) = self.convert_notes_13('Note',note) (note_list,note_handles) = self.convert_notes_13('Note',note,
nttype=NoteType.ATTRIBUTE,
private=priv)
tuples = [self.convert_notes_13('SourceRef',item) tuples = [self.convert_notes_13('SourceRef',item)
for item in source_list] for item in source_list]
new_source_list = [item[0] for item in tuples] new_source_list = [item[0] for item in tuples]
@ -2060,7 +2065,9 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback):
new_obj = (priv,new_source_list,note_list,the_type,value) new_obj = (priv,new_source_list,note_list,the_type,value)
elif name == 'Address': elif name == 'Address':
(priv,source_list,note,date,loc) = obj (priv,source_list,note,date,loc) = obj
(note_list,note_handles) = self.convert_notes_13('Note',note) (note_list,note_handles) = self.convert_notes_13('Note',note,
nttype=NoteType.ADDRESS,
private=priv)
tuples = [self.convert_notes_13('SourceRef',item) tuples = [self.convert_notes_13('SourceRef',item)
for item in source_list] for item in source_list]
new_source_list = [item[0] for item in tuples] new_source_list = [item[0] for item in tuples]
@ -2068,7 +2075,9 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback):
new_obj = (priv,new_source_list,note_list,date,loc) new_obj = (priv,new_source_list,note_list,date,loc)
elif name == 'EventRef': elif name == 'EventRef':
(priv,note,attr_list,ref,role) = obj (priv,note,attr_list,ref,role) = obj
(note_list,note_handles) = self.convert_notes_13('Note',note) (note_list,note_handles) = self.convert_notes_13('Note',note,
nttype=NoteType.EVENTREF,
private=priv)
tuples = [self.convert_notes_13('Attribute',item) tuples = [self.convert_notes_13('Attribute',item)
for item in attr_list] for item in attr_list]
new_attr_list = [item[0] for item in tuples] new_attr_list = [item[0] for item in tuples]
@ -2076,7 +2085,9 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback):
new_obj = (priv,note_list,new_attr_list,ref,role) new_obj = (priv,note_list,new_attr_list,ref,role)
elif name == 'ChildRef': elif name == 'ChildRef':
(pri,source_list,note,ref,frel,mrel) = obj (pri,source_list,note,ref,frel,mrel) = obj
(note_list,note_handles) = self.convert_notes_13('Note',note) (note_list,note_handles) = self.convert_notes_13('Note',note,
nttype=NoteType.CHILDREF,
private=pri)
tuples = [self.convert_notes_13('SourceRef',item) tuples = [self.convert_notes_13('SourceRef',item)
for item in source_list] for item in source_list]
new_source_list = [item[0] for item in tuples] new_source_list = [item[0] for item in tuples]
@ -2084,7 +2095,9 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback):
new_obj = (pri,new_source_list,note_list,ref,frel,mrel) new_obj = (pri,new_source_list,note_list,ref,frel,mrel)
elif name == 'PersonRef': elif name == 'PersonRef':
(priv,source_list,note,ref,rel) = obj (priv,source_list,note,ref,rel) = obj
(note_list,note_handles) = self.convert_notes_13('Note',note) (note_list,note_handles) = self.convert_notes_13('Note',note,
nttype=NoteType.ASSOCIATION,
private=priv)
tuples = [self.convert_notes_13('SourceRef',item) tuples = [self.convert_notes_13('SourceRef',item)
for item in source_list] for item in source_list]
new_source_list = [item[0] for item in tuples] new_source_list = [item[0] for item in tuples]
@ -2092,7 +2105,9 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback):
new_obj = (priv,new_source_list,note_list,ref,rel) new_obj = (priv,new_source_list,note_list,ref,rel)
elif name == 'MediaRef': elif name == 'MediaRef':
(priv,source_list,note,attr_list,ref,rect) = obj (priv,source_list,note,attr_list,ref,rect) = obj
(note_list,note_handles) = self.convert_notes_13('Note',note) (note_list,note_handles) = self.convert_notes_13('Note',note,
nttype=NoteType.MEDIAREF,
private=priv)
tuples = [self.convert_notes_13('SourceRef',item) tuples = [self.convert_notes_13('SourceRef',item)
for item in source_list] for item in source_list]
new_source_list = [item[0] for item in tuples] new_source_list = [item[0] for item in tuples]
@ -2104,7 +2119,9 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback):
new_obj = (priv,new_source_list,note_list,new_attr_list,ref,rect) new_obj = (priv,new_source_list,note_list,new_attr_list,ref,rect)
elif name == 'Name': elif name == 'Name':
(priv,source_list,note,date,f,s,su,t,ty,p,pa,g,so,di,call) = obj (priv,source_list,note,date,f,s,su,t,ty,p,pa,g,so,di,call) = obj
(note_list,note_handles) = self.convert_notes_13('Note',note) (note_list,note_handles) = self.convert_notes_13('Note',note,
nttype=NoteType.PERSONNAME,
private=priv)
tuples = [self.convert_notes_13('SourceRef',item) tuples = [self.convert_notes_13('SourceRef',item)
for item in source_list] for item in source_list]
new_source_list = [item[0] for item in tuples] new_source_list = [item[0] for item in tuples]
@ -2113,7 +2130,8 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback):
date,f,s,su,t,ty,p,pa,g,so,di,call) date,f,s,su,t,ty,p,pa,g,so,di,call)
elif name == 'LdsOrd': elif name == 'LdsOrd':
(source_list,note,date,t,place,famc,temple,st) = obj (source_list,note,date,t,place,famc,temple,st) = obj
(note_list,note_handles) = self.convert_notes_13('Note',note) (note_list,note_handles) = self.convert_notes_13('Note',note,
nttype=NoteType.LDS)
tuples = [self.convert_notes_13('SourceRef',item) tuples = [self.convert_notes_13('SourceRef',item)
for item in source_list] for item in source_list]
new_source_list = [item[0] for item in tuples] new_source_list = [item[0] for item in tuples]
@ -2123,7 +2141,9 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback):
(handle,gramps_id,the_type,date,description,place, (handle,gramps_id,the_type,date,description,place,
source_list,note,media_list,attr_list, source_list,note,media_list,attr_list,
change,marker,priv) = obj change,marker,priv) = obj
(note_list,note_handles) = self.convert_notes_13('Note',note) (note_list,note_handles) = self.convert_notes_13('Note',note,
nttype=NoteType.EVENT,
private=priv)
tuples = [self.convert_notes_13('SourceRef',item) tuples = [self.convert_notes_13('SourceRef',item)
for item in source_list] for item in source_list]
new_source_list = [item[0] for item in tuples] new_source_list = [item[0] for item in tuples]
@ -2143,7 +2163,9 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback):
(handle,gramps_id,fh,mh,child_ref_list,the_type,event_ref_list, (handle,gramps_id,fh,mh,child_ref_list,the_type,event_ref_list,
media_list,attr_list,lds_list,source_list,note, media_list,attr_list,lds_list,source_list,note,
change, marker, priv) = obj change, marker, priv) = obj
(note_list,note_handles) = self.convert_notes_13('Note',note) (note_list,note_handles) = self.convert_notes_13('Note',note,
nttype=NoteType.FAMILY,
private=priv)
tuples = [self.convert_notes_13('SourceRef',item) tuples = [self.convert_notes_13('SourceRef',item)
for item in source_list] for item in source_list]
new_source_list = [item[0] for item in tuples] new_source_list = [item[0] for item in tuples]
@ -2175,7 +2197,9 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback):
elif name == 'MediaObject': elif name == 'MediaObject':
(handle,gramps_id,path,mime,desc,attr_list,source_list,note,change, (handle,gramps_id,path,mime,desc,attr_list,source_list,note,change,
date, marker, priv) = obj date, marker, priv) = obj
(note_list,note_handles) = self.convert_notes_13('Note',note) (note_list,note_handles) = self.convert_notes_13('Note',note,
nttype=NoteType.MEDIA,
private=priv)
tuples = [self.convert_notes_13('SourceRef',item) tuples = [self.convert_notes_13('SourceRef',item)
for item in source_list] for item in source_list]
new_source_list = [item[0] for item in tuples] new_source_list = [item[0] for item in tuples]
@ -2189,7 +2213,9 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback):
elif name == 'Place': elif name == 'Place':
(handle,gramps_id,title,long,lat,main_loc,alt_loc,urls, (handle,gramps_id,title,long,lat,main_loc,alt_loc,urls,
media_list,source_list,note,change,marker,priv) = obj media_list,source_list,note,change,marker,priv) = obj
(note_list,note_handles) = self.convert_notes_13('Note',note) (note_list,note_handles) = self.convert_notes_13('Note',note,
nttype=NoteType.PLACE,
private=priv)
tuples = [self.convert_notes_13('SourceRef',item) tuples = [self.convert_notes_13('SourceRef',item)
for item in source_list] for item in source_list]
new_source_list = [item[0] for item in tuples] new_source_list = [item[0] for item in tuples]
@ -2204,7 +2230,9 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback):
elif name == 'Source': elif name == 'Source':
(handle,gramps_id,title,author,pubinfo,note,media_list, (handle,gramps_id,title,author,pubinfo,note,media_list,
abbrev,change,datamap,reporef_list,marker,priv) = obj abbrev,change,datamap,reporef_list,marker,priv) = obj
(note_list,note_handles) = self.convert_notes_13('Note',note) (note_list,note_handles) = self.convert_notes_13('Note',note,
nttype=NoteType.SOURCE,
private=priv)
tuples = [self.convert_notes_13('MediaRef',item) tuples = [self.convert_notes_13('MediaRef',item)
for item in media_list] for item in media_list]
new_media_list = [item[0] for item in tuples] new_media_list = [item[0] for item in tuples]
@ -2218,7 +2246,9 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback):
marker,priv) marker,priv)
elif name == 'Repository': elif name == 'Repository':
(handle,gramps_id,t,n,note,addr_list,urls,marker,priv) = obj (handle,gramps_id,t,n,note,addr_list,urls,marker,priv) = obj
(note_list,note_handles) = self.convert_notes_13('Note',note) (note_list,note_handles) = self.convert_notes_13('Note',note,
nttype=NoteType.REPO,
private=priv)
tuples = [self.convert_notes_13('Address',item) tuples = [self.convert_notes_13('Address',item)
for item in addr_list] for item in addr_list]
new_addr_list = [item[0] for item in tuples] new_addr_list = [item[0] for item in tuples]
@ -2230,7 +2260,9 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback):
dri,bri,event_ref_list,fl,pfl,media_list,addr_list,attr_list, dri,bri,event_ref_list,fl,pfl,media_list,addr_list,attr_list,
urls,lds_list,source_list,note,change,marker,priv, urls,lds_list,source_list,note,change,marker,priv,
person_ref_list) = obj person_ref_list) = obj
(note_list,note_handles) = self.convert_notes_13('Note',note) (note_list,note_handles) = self.convert_notes_13('Note',note,
nttype=NoteType.PERSON,
private=priv)
(new_primary_name,nh) = self.convert_notes_13('Name',primary_name) (new_primary_name,nh) = self.convert_notes_13('Name',primary_name)
note_handles += nh note_handles += nh
tuples = [self.convert_notes_13('Name',item) tuples = [self.convert_notes_13('Name',item)