2007-06-25 Alex Roitman <shura@gramps-project.org>
* src/plugins/RemoveUnused.py (init_gui): Add missing argument. * src/GrampsDb/_GrampsInMemDB.py: Rename overridden methods. * src/GrampsDb/_GrampsDbBase.py: Rename overridden methods. * src/GrampsDb/_GrampsBSDDB.py: Rename overridden methods. * src/GrampsDb/_GrampsDBDir.py: Rename overridden methods. svn: r8671
This commit is contained in:
parent
ef7a215d1b
commit
1e8a8be782
@ -1,3 +1,10 @@
|
|||||||
|
2007-06-25 Alex Roitman <shura@gramps-project.org>
|
||||||
|
* src/plugins/RemoveUnused.py (init_gui): Add missing argument.
|
||||||
|
* src/GrampsDb/_GrampsInMemDB.py: Rename overridden methods.
|
||||||
|
* src/GrampsDb/_GrampsDbBase.py: Rename overridden methods.
|
||||||
|
* src/GrampsDb/_GrampsBSDDB.py: Rename overridden methods.
|
||||||
|
* src/GrampsDb/_GrampsDBDir.py: Rename overridden methods.
|
||||||
|
|
||||||
2007-06-25 Don Allingham <don@gramps-project.org>
|
2007-06-25 Don Allingham <don@gramps-project.org>
|
||||||
* src/DisplayTabs/_AddrEmbedList.py: pylint
|
* src/DisplayTabs/_AddrEmbedList.py: pylint
|
||||||
* src/DisplayTabs/_AddressModel.py: pylint
|
* src/DisplayTabs/_AddressModel.py: pylint
|
||||||
|
@ -172,7 +172,7 @@ class GrampsBSDDB(GrampsDbBase, UpdateCallback):
|
|||||||
"""creates a new GrampsDB"""
|
"""creates a new GrampsDB"""
|
||||||
|
|
||||||
GrampsDbBase.__init__(self)
|
GrampsDbBase.__init__(self)
|
||||||
#xUpdateCallback.__init__(self)
|
#UpdateCallback.__init__(self)
|
||||||
self.txn = None
|
self.txn = None
|
||||||
self.secondary_connected = False
|
self.secondary_connected = False
|
||||||
self.UseTXN = use_txn
|
self.UseTXN = use_txn
|
||||||
@ -193,7 +193,7 @@ class GrampsBSDDB(GrampsDbBase, UpdateCallback):
|
|||||||
dbmap.open(file_name, table_name, dbtype, self.__open_flags(), 0666)
|
dbmap.open(file_name, table_name, dbtype, self.__open_flags(), 0666)
|
||||||
return dbmap
|
return dbmap
|
||||||
|
|
||||||
def __all_handles(self, table):
|
def all_handles(self, table):
|
||||||
return table.keys(self.txn)
|
return table.keys(self.txn)
|
||||||
|
|
||||||
def get_person_cursor(self):
|
def get_person_cursor(self):
|
||||||
@ -800,7 +800,7 @@ class GrampsBSDDB(GrampsDbBase, UpdateCallback):
|
|||||||
|
|
||||||
referenced_cur.close()
|
referenced_cur.close()
|
||||||
|
|
||||||
def __delete_primary_from_reference_map(self, hndl, transaction, txn=None):
|
def delete_primary_from_reference_map(self, hndl, transaction, txn=None):
|
||||||
"""
|
"""
|
||||||
Remove all references to the primary object from the reference_map.
|
Remove all references to the primary object from the reference_map.
|
||||||
"""
|
"""
|
||||||
@ -837,7 +837,7 @@ class GrampsBSDDB(GrampsDbBase, UpdateCallback):
|
|||||||
for main_key in remove_list:
|
for main_key in remove_list:
|
||||||
self.__remove_reference(main_key, transaction, txn)
|
self.__remove_reference(main_key, transaction, txn)
|
||||||
|
|
||||||
def __update_reference_map(self, obj, transaction, txn=None):
|
def update_reference_map(self, obj, transaction, txn=None):
|
||||||
"""
|
"""
|
||||||
If txn is given, then changes are written right away using txn.
|
If txn is given, then changes are written right away using txn.
|
||||||
"""
|
"""
|
||||||
@ -1027,7 +1027,7 @@ class GrampsBSDDB(GrampsDbBase, UpdateCallback):
|
|||||||
the_txn = self.env.txn_begin()
|
the_txn = self.env.txn_begin()
|
||||||
else:
|
else:
|
||||||
the_txn = None
|
the_txn = None
|
||||||
self.__update_reference_map(obj, transaction, the_txn)
|
self.update_reference_map(obj, transaction, the_txn)
|
||||||
if not self.UseTXN:
|
if not self.UseTXN:
|
||||||
self.reference_map.sync()
|
self.reference_map.sync()
|
||||||
if the_txn:
|
if the_txn:
|
||||||
@ -1192,7 +1192,7 @@ class GrampsBSDDB(GrampsDbBase, UpdateCallback):
|
|||||||
self.metadata = None
|
self.metadata = None
|
||||||
self.db_is_open = False
|
self.db_is_open = False
|
||||||
|
|
||||||
def __do_remove_object(self, handle, transaction, data_map, key, del_list):
|
def do_remove_object(self, handle, transaction, data_map, key, del_list):
|
||||||
if self.readonly or not handle:
|
if self.readonly or not handle:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -1202,7 +1202,7 @@ class GrampsBSDDB(GrampsDbBase, UpdateCallback):
|
|||||||
the_txn = self.env.txn_begin()
|
the_txn = self.env.txn_begin()
|
||||||
else:
|
else:
|
||||||
the_txn = None
|
the_txn = None
|
||||||
self.__delete_primary_from_reference_map(handle, transaction,
|
self.delete_primary_from_reference_map(handle, transaction,
|
||||||
txn=the_txn)
|
txn=the_txn)
|
||||||
data_map.delete(handle, txn=the_txn)
|
data_map.delete(handle, txn=the_txn)
|
||||||
if not self.UseTXN:
|
if not self.UseTXN:
|
||||||
@ -1210,47 +1210,47 @@ class GrampsBSDDB(GrampsDbBase, UpdateCallback):
|
|||||||
if the_txn:
|
if the_txn:
|
||||||
the_txn.commit()
|
the_txn.commit()
|
||||||
else:
|
else:
|
||||||
self.__delete_primary_from_reference_map(handle, transaction)
|
self.delete_primary_from_reference_map(handle, transaction)
|
||||||
old_data = data_map.get(handle, txn=self.txn)
|
old_data = data_map.get(handle, txn=self.txn)
|
||||||
transaction.add(key, handle, old_data, None)
|
transaction.add(key, handle, old_data, None)
|
||||||
del_list.append(handle)
|
del_list.append(handle)
|
||||||
|
|
||||||
def __del_person(self, handle):
|
def del_person(self, handle):
|
||||||
self.person_map.delete(str(handle), txn=self.txn)
|
self.person_map.delete(str(handle), txn=self.txn)
|
||||||
if not self.UseTXN:
|
if not self.UseTXN:
|
||||||
self.person_map.sync()
|
self.person_map.sync()
|
||||||
|
|
||||||
def __del_source(self, handle):
|
def del_source(self, handle):
|
||||||
self.source_map.delete(str(handle), txn=self.txn)
|
self.source_map.delete(str(handle), txn=self.txn)
|
||||||
if not self.UseTXN:
|
if not self.UseTXN:
|
||||||
self.source_map.sync()
|
self.source_map.sync()
|
||||||
|
|
||||||
def __del_repository(self, handle):
|
def del_repository(self, handle):
|
||||||
self.repository_map.delete(str(handle), txn=self.txn)
|
self.repository_map.delete(str(handle), txn=self.txn)
|
||||||
if not self.UseTXN:
|
if not self.UseTXN:
|
||||||
self.repository_map.sync()
|
self.repository_map.sync()
|
||||||
|
|
||||||
def __del_note(self, handle):
|
def del_note(self, handle):
|
||||||
self.note_map.delete(str(handle), txn=self.txn)
|
self.note_map.delete(str(handle), txn=self.txn)
|
||||||
if not self.UseTXN:
|
if not self.UseTXN:
|
||||||
self.note_map.sync()
|
self.note_map.sync()
|
||||||
|
|
||||||
def __del_place(self, handle):
|
def del_place(self, handle):
|
||||||
self.place_map.delete(str(handle), txn=self.txn)
|
self.place_map.delete(str(handle), txn=self.txn)
|
||||||
if not self.UseTXN:
|
if not self.UseTXN:
|
||||||
self.place_map.sync()
|
self.place_map.sync()
|
||||||
|
|
||||||
def __del_media(self, handle):
|
def del_media(self, handle):
|
||||||
self.media_map.delete(str(handle), txn=self.txn)
|
self.media_map.delete(str(handle), txn=self.txn)
|
||||||
if not self.UseTXN:
|
if not self.UseTXN:
|
||||||
self.media_map.sync()
|
self.media_map.sync()
|
||||||
|
|
||||||
def __del_family(self, handle):
|
def del_family(self, handle):
|
||||||
self.family_map.delete(str(handle), txn=self.txn)
|
self.family_map.delete(str(handle), txn=self.txn)
|
||||||
if not self.UseTXN:
|
if not self.UseTXN:
|
||||||
self.family_map.sync()
|
self.family_map.sync()
|
||||||
|
|
||||||
def __del_event(self, handle):
|
def del_event(self, handle):
|
||||||
self.event_map.delete(str(handle), txn=self.txn)
|
self.event_map.delete(str(handle), txn=self.txn)
|
||||||
if not self.UseTXN:
|
if not self.UseTXN:
|
||||||
self.event_map.sync()
|
self.event_map.sync()
|
||||||
@ -1392,7 +1392,7 @@ class GrampsBSDDB(GrampsDbBase, UpdateCallback):
|
|||||||
the_txn = self.env.txn_begin()
|
the_txn = self.env.txn_begin()
|
||||||
else:
|
else:
|
||||||
the_txn = None
|
the_txn = None
|
||||||
self.__update_reference_map(obj, transaction, txn=the_txn)
|
self.update_reference_map(obj, transaction, txn=the_txn)
|
||||||
data_map.put(handle, obj.serialize(), txn=the_txn)
|
data_map.put(handle, obj.serialize(), txn=the_txn)
|
||||||
if not self.UseTXN:
|
if not self.UseTXN:
|
||||||
data_map.sync()
|
data_map.sync()
|
||||||
@ -1400,7 +1400,7 @@ class GrampsBSDDB(GrampsDbBase, UpdateCallback):
|
|||||||
the_txn.commit()
|
the_txn.commit()
|
||||||
old_data = None
|
old_data = None
|
||||||
else:
|
else:
|
||||||
self.__update_reference_map(obj, transaction)
|
self.update_reference_map(obj, transaction)
|
||||||
old_data = data_map.get(handle, txn=self.txn)
|
old_data = data_map.get(handle, txn=self.txn)
|
||||||
new_data = obj.serialize()
|
new_data = obj.serialize()
|
||||||
transaction.add(key, handle, old_data, new_data)
|
transaction.add(key, handle, old_data, new_data)
|
||||||
@ -1410,7 +1410,7 @@ class GrampsBSDDB(GrampsDbBase, UpdateCallback):
|
|||||||
add_list.append((handle, new_data))
|
add_list.append((handle, new_data))
|
||||||
return old_data
|
return old_data
|
||||||
|
|
||||||
def __do_commit(self, add_list, db_map):
|
def do_commit(self, add_list, db_map):
|
||||||
retlist = []
|
retlist = []
|
||||||
for (handle, data) in add_list:
|
for (handle, data) in add_list:
|
||||||
db_map.put(handle, data, self.txn)
|
db_map.put(handle, data, self.txn)
|
||||||
@ -1419,7 +1419,7 @@ class GrampsBSDDB(GrampsDbBase, UpdateCallback):
|
|||||||
retlist.append(str(handle))
|
retlist.append(str(handle))
|
||||||
return retlist
|
return retlist
|
||||||
|
|
||||||
def __get_from_handle(self, handle, class_type, data_map):
|
def get_from_handle(self, handle, class_type, data_map):
|
||||||
try:
|
try:
|
||||||
data = data_map.get(str(handle), txn=self.txn)
|
data = data_map.get(str(handle), txn=self.txn)
|
||||||
except:
|
except:
|
||||||
@ -1434,7 +1434,7 @@ class GrampsBSDDB(GrampsDbBase, UpdateCallback):
|
|||||||
return newobj
|
return newobj
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def __find_from_handle(self, hndl, transaction, class_type, dmap, add_func):
|
def find_from_handle(self, hndl, transaction, class_type, dmap, add_func):
|
||||||
obj = class_type()
|
obj = class_type()
|
||||||
hndl = str(hndl)
|
hndl = str(hndl)
|
||||||
if dmap.has_key(hndl):
|
if dmap.has_key(hndl):
|
||||||
|
@ -201,7 +201,7 @@ class GrampsDBDir(GrampsDbBase,UpdateCallback):
|
|||||||
dbmap.open(fname, table_name, dbtype, self.__open_flags(), 0666)
|
dbmap.open(fname, table_name, dbtype, self.__open_flags(), 0666)
|
||||||
return dbmap
|
return dbmap
|
||||||
|
|
||||||
def __all_handles(self,table):
|
def all_handles(self,table):
|
||||||
return table.keys(self.txn)
|
return table.keys(self.txn)
|
||||||
|
|
||||||
def __log_error(self):
|
def __log_error(self):
|
||||||
@ -406,7 +406,7 @@ class GrampsDBDir(GrampsDbBase,UpdateCallback):
|
|||||||
self.metadata.sync()
|
self.metadata.sync()
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def __set_column_order(self, col_list, name):
|
def set_column_order(self, col_list, name):
|
||||||
if self.metadata and not self.readonly:
|
if self.metadata and not self.readonly:
|
||||||
if self.UseTXN:
|
if self.UseTXN:
|
||||||
# Start transaction if needed
|
# Start transaction if needed
|
||||||
@ -867,7 +867,7 @@ class GrampsDBDir(GrampsDbBase,UpdateCallback):
|
|||||||
|
|
||||||
referenced_cur.close()
|
referenced_cur.close()
|
||||||
|
|
||||||
def __delete_primary_from_reference_map(self,handle,transaction,txn=None):
|
def delete_primary_from_reference_map(self,handle,transaction,txn=None):
|
||||||
"""
|
"""
|
||||||
Remove all references to the primary object from the reference_map.
|
Remove all references to the primary object from the reference_map.
|
||||||
"""
|
"""
|
||||||
@ -904,7 +904,7 @@ class GrampsDBDir(GrampsDbBase,UpdateCallback):
|
|||||||
for main_key in remove_list:
|
for main_key in remove_list:
|
||||||
self.__remove_reference(main_key,transaction,txn)
|
self.__remove_reference(main_key,transaction,txn)
|
||||||
|
|
||||||
def __update_reference_map(self, obj, transaction, txn=None):
|
def update_reference_map(self, obj, transaction, txn=None):
|
||||||
"""
|
"""
|
||||||
If txn is given, then changes are written right away using txn.
|
If txn is given, then changes are written right away using txn.
|
||||||
"""
|
"""
|
||||||
@ -1101,7 +1101,7 @@ class GrampsDBDir(GrampsDbBase,UpdateCallback):
|
|||||||
the_txn = self.env.txn_begin()
|
the_txn = self.env.txn_begin()
|
||||||
else:
|
else:
|
||||||
the_txn = None
|
the_txn = None
|
||||||
self.__update_reference_map(obj,transaction,the_txn)
|
self.update_reference_map(obj,transaction,the_txn)
|
||||||
if not self.UseTXN:
|
if not self.UseTXN:
|
||||||
self.reference_map.sync()
|
self.reference_map.sync()
|
||||||
if the_txn:
|
if the_txn:
|
||||||
@ -1274,7 +1274,7 @@ class GrampsDBDir(GrampsDbBase,UpdateCallback):
|
|||||||
self.metadata = None
|
self.metadata = None
|
||||||
self.db_is_open = False
|
self.db_is_open = False
|
||||||
|
|
||||||
def __do_remove_object(self,handle,transaction,data_map,key,del_list):
|
def do_remove_object(self,handle,transaction,data_map,key,del_list):
|
||||||
if self.readonly or not handle:
|
if self.readonly or not handle:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -1284,7 +1284,7 @@ class GrampsDBDir(GrampsDbBase,UpdateCallback):
|
|||||||
the_txn = self.env.txn_begin()
|
the_txn = self.env.txn_begin()
|
||||||
else:
|
else:
|
||||||
the_txn = None
|
the_txn = None
|
||||||
self.__delete_primary_from_reference_map(handle,transaction,
|
self.delete_primary_from_reference_map(handle,transaction,
|
||||||
txn=the_txn)
|
txn=the_txn)
|
||||||
data_map.delete(handle,txn=the_txn)
|
data_map.delete(handle,txn=the_txn)
|
||||||
if not self.UseTXN:
|
if not self.UseTXN:
|
||||||
@ -1292,47 +1292,47 @@ class GrampsDBDir(GrampsDbBase,UpdateCallback):
|
|||||||
if the_txn:
|
if the_txn:
|
||||||
the_txn.commit()
|
the_txn.commit()
|
||||||
else:
|
else:
|
||||||
self.__delete_primary_from_reference_map(handle,transaction)
|
self.delete_primary_from_reference_map(handle,transaction)
|
||||||
old_data = data_map.get(handle,txn=self.txn)
|
old_data = data_map.get(handle,txn=self.txn)
|
||||||
transaction.add(key,handle,old_data,None)
|
transaction.add(key,handle,old_data,None)
|
||||||
del_list.append(handle)
|
del_list.append(handle)
|
||||||
|
|
||||||
def __del_person(self,handle):
|
def del_person(self,handle):
|
||||||
self.person_map.delete(str(handle),txn=self.txn)
|
self.person_map.delete(str(handle),txn=self.txn)
|
||||||
if not self.UseTXN:
|
if not self.UseTXN:
|
||||||
self.person_map.sync()
|
self.person_map.sync()
|
||||||
|
|
||||||
def __del_source(self,handle):
|
def del_source(self,handle):
|
||||||
self.source_map.delete(str(handle),txn=self.txn)
|
self.source_map.delete(str(handle),txn=self.txn)
|
||||||
if not self.UseTXN:
|
if not self.UseTXN:
|
||||||
self.source_map.sync()
|
self.source_map.sync()
|
||||||
|
|
||||||
def __del_repository(self,handle):
|
def del_repository(self,handle):
|
||||||
self.repository_map.delete(str(handle),txn=self.txn)
|
self.repository_map.delete(str(handle),txn=self.txn)
|
||||||
if not self.UseTXN:
|
if not self.UseTXN:
|
||||||
self.repository_map.sync()
|
self.repository_map.sync()
|
||||||
|
|
||||||
def __del_note(self,handle):
|
def del_note(self,handle):
|
||||||
self.note_map.delete(str(handle),txn=self.txn)
|
self.note_map.delete(str(handle),txn=self.txn)
|
||||||
if not self.UseTXN:
|
if not self.UseTXN:
|
||||||
self.note_map.sync()
|
self.note_map.sync()
|
||||||
|
|
||||||
def __del_place(self,handle):
|
def del_place(self,handle):
|
||||||
self.place_map.delete(str(handle),txn=self.txn)
|
self.place_map.delete(str(handle),txn=self.txn)
|
||||||
if not self.UseTXN:
|
if not self.UseTXN:
|
||||||
self.place_map.sync()
|
self.place_map.sync()
|
||||||
|
|
||||||
def __del_media(self,handle):
|
def del_media(self,handle):
|
||||||
self.media_map.delete(str(handle),txn=self.txn)
|
self.media_map.delete(str(handle),txn=self.txn)
|
||||||
if not self.UseTXN:
|
if not self.UseTXN:
|
||||||
self.media_map.sync()
|
self.media_map.sync()
|
||||||
|
|
||||||
def __del_family(self,handle):
|
def del_family(self,handle):
|
||||||
self.family_map.delete(str(handle),txn=self.txn)
|
self.family_map.delete(str(handle),txn=self.txn)
|
||||||
if not self.UseTXN:
|
if not self.UseTXN:
|
||||||
self.family_map.sync()
|
self.family_map.sync()
|
||||||
|
|
||||||
def __del_event(self,handle):
|
def del_event(self,handle):
|
||||||
self.event_map.delete(str(handle),txn=self.txn)
|
self.event_map.delete(str(handle),txn=self.txn)
|
||||||
if not self.UseTXN:
|
if not self.UseTXN:
|
||||||
self.event_map.sync()
|
self.event_map.sync()
|
||||||
@ -1492,7 +1492,7 @@ class GrampsDBDir(GrampsDbBase,UpdateCallback):
|
|||||||
the_txn = self.env.txn_begin()
|
the_txn = self.env.txn_begin()
|
||||||
else:
|
else:
|
||||||
the_txn = None
|
the_txn = None
|
||||||
self.__update_reference_map(obj,transaction,txn=the_txn)
|
self.update_reference_map(obj,transaction,txn=the_txn)
|
||||||
data_map.put(handle,obj.serialize(),txn=the_txn)
|
data_map.put(handle,obj.serialize(),txn=the_txn)
|
||||||
if not self.UseTXN:
|
if not self.UseTXN:
|
||||||
data_map.sync()
|
data_map.sync()
|
||||||
@ -1500,7 +1500,7 @@ class GrampsDBDir(GrampsDbBase,UpdateCallback):
|
|||||||
the_txn.commit()
|
the_txn.commit()
|
||||||
old_data = None
|
old_data = None
|
||||||
else:
|
else:
|
||||||
self.__update_reference_map(obj,transaction)
|
self.update_reference_map(obj,transaction)
|
||||||
old_data = data_map.get(handle,txn=self.txn)
|
old_data = data_map.get(handle,txn=self.txn)
|
||||||
new_data = obj.serialize()
|
new_data = obj.serialize()
|
||||||
transaction.add(key,handle,old_data,new_data)
|
transaction.add(key,handle,old_data,new_data)
|
||||||
@ -1510,7 +1510,7 @@ class GrampsDBDir(GrampsDbBase,UpdateCallback):
|
|||||||
add_list.append((handle,new_data))
|
add_list.append((handle,new_data))
|
||||||
return old_data
|
return old_data
|
||||||
|
|
||||||
def __do_commit(self, add_list, db_map):
|
def do_commit(self, add_list, db_map):
|
||||||
retlist = []
|
retlist = []
|
||||||
for (handle, data) in add_list:
|
for (handle, data) in add_list:
|
||||||
db_map.put(handle, data, self.txn)
|
db_map.put(handle, data, self.txn)
|
||||||
@ -1519,7 +1519,7 @@ class GrampsDBDir(GrampsDbBase,UpdateCallback):
|
|||||||
retlist.append(str(handle))
|
retlist.append(str(handle))
|
||||||
return retlist
|
return retlist
|
||||||
|
|
||||||
def __get_from_handle(self, handle, class_type, data_map):
|
def get_from_handle(self, handle, class_type, data_map):
|
||||||
try:
|
try:
|
||||||
data = data_map.get(str(handle),txn=self.txn)
|
data = data_map.get(str(handle),txn=self.txn)
|
||||||
except:
|
except:
|
||||||
@ -1534,7 +1534,7 @@ class GrampsDBDir(GrampsDbBase,UpdateCallback):
|
|||||||
return newobj
|
return newobj
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def __find_from_handle(self, handle, transaction, class_type, dmap, add_func):
|
def find_from_handle(self,handle,transaction,class_type,dmap,add_func):
|
||||||
obj = class_type()
|
obj = class_type()
|
||||||
handle = str(handle)
|
handle = str(handle)
|
||||||
if dmap.has_key(handle):
|
if dmap.has_key(handle):
|
||||||
|
@ -288,28 +288,28 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
def gramps_upgrade(self):
|
def gramps_upgrade(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def __del_person(self, handle):
|
def del_person(self, handle):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def __del_source(self, handle):
|
def del_source(self, handle):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def __del_repository(self, handle):
|
def del_repository(self, handle):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def __del_note(self, handle):
|
def del_note(self, handle):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def __del_place(self, handle):
|
def del_place(self, handle):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def __del_media(self, handle):
|
def del_media(self, handle):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def __del_family(self, handle):
|
def del_family(self, handle):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def __del_event(self, handle):
|
def del_event(self, handle):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def create_id(self):
|
def create_id(self):
|
||||||
@ -435,7 +435,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
obj.change = int(time.time())
|
obj.change = int(time.time())
|
||||||
handle = str(obj.handle)
|
handle = str(obj.handle)
|
||||||
|
|
||||||
self.__update_reference_map(obj, transaction)
|
self.update_reference_map(obj, transaction)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if transaction.batch:
|
if transaction.batch:
|
||||||
@ -747,7 +747,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
self.nmap_index += 1
|
self.nmap_index += 1
|
||||||
return index
|
return index
|
||||||
|
|
||||||
def __get_from_handle(self, handle, class_type, data_map):
|
def get_from_handle(self, handle, class_type, data_map):
|
||||||
data = data_map.get(str(handle))
|
data = data_map.get(str(handle))
|
||||||
if data:
|
if data:
|
||||||
newobj = class_type()
|
newobj = class_type()
|
||||||
@ -760,58 +760,58 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
Finds a Person in the database from the passed gramps' ID.
|
Finds a Person in the database from the passed gramps' ID.
|
||||||
If no such Person exists, None is returned.
|
If no such Person exists, None is returned.
|
||||||
"""
|
"""
|
||||||
return self.__get_from_handle(handle, Person, self.person_map)
|
return self.get_from_handle(handle, Person, self.person_map)
|
||||||
|
|
||||||
def get_source_from_handle(self, handle):
|
def get_source_from_handle(self, handle):
|
||||||
"""
|
"""
|
||||||
Finds a Source in the database from the passed gramps' ID.
|
Finds a Source in the database from the passed gramps' ID.
|
||||||
If no such Source exists, None is returned.
|
If no such Source exists, None is returned.
|
||||||
"""
|
"""
|
||||||
return self.__get_from_handle(handle, Source, self.source_map)
|
return self.get_from_handle(handle, Source, self.source_map)
|
||||||
|
|
||||||
def get_object_from_handle(self, handle):
|
def get_object_from_handle(self, handle):
|
||||||
"""
|
"""
|
||||||
Finds an Object in the database from the passed gramps' ID.
|
Finds an Object in the database from the passed gramps' ID.
|
||||||
If no such Object exists, None is returned.
|
If no such Object exists, None is returned.
|
||||||
"""
|
"""
|
||||||
return self.__get_from_handle(handle, MediaObject, self.media_map)
|
return self.get_from_handle(handle, MediaObject, self.media_map)
|
||||||
|
|
||||||
def get_place_from_handle(self, handle):
|
def get_place_from_handle(self, handle):
|
||||||
"""
|
"""
|
||||||
Finds a Place in the database from the passed gramps' ID.
|
Finds a Place in the database from the passed gramps' ID.
|
||||||
If no such Place exists, None is returned.
|
If no such Place exists, None is returned.
|
||||||
"""
|
"""
|
||||||
return self.__get_from_handle(handle, Place, self.place_map)
|
return self.get_from_handle(handle, Place, self.place_map)
|
||||||
|
|
||||||
def get_event_from_handle(self, handle):
|
def get_event_from_handle(self, handle):
|
||||||
"""
|
"""
|
||||||
Finds a Event in the database from the passed gramps' ID.
|
Finds a Event in the database from the passed gramps' ID.
|
||||||
If no such Event exists, None is returned.
|
If no such Event exists, None is returned.
|
||||||
"""
|
"""
|
||||||
return self.__get_from_handle(handle, Event, self.event_map)
|
return self.get_from_handle(handle, Event, self.event_map)
|
||||||
|
|
||||||
def get_family_from_handle(self, handle):
|
def get_family_from_handle(self, handle):
|
||||||
"""
|
"""
|
||||||
Finds a Family in the database from the passed gramps' ID.
|
Finds a Family in the database from the passed gramps' ID.
|
||||||
If no such Family exists, None is returned.
|
If no such Family exists, None is returned.
|
||||||
"""
|
"""
|
||||||
return self.__get_from_handle(handle, Family, self.family_map)
|
return self.get_from_handle(handle, Family, self.family_map)
|
||||||
|
|
||||||
def get_repository_from_handle(self, handle):
|
def get_repository_from_handle(self, handle):
|
||||||
"""
|
"""
|
||||||
Finds a Repository in the database from the passed gramps' ID.
|
Finds a Repository in the database from the passed gramps' ID.
|
||||||
If no such Repository exists, None is returned.
|
If no such Repository exists, None is returned.
|
||||||
"""
|
"""
|
||||||
return self.__get_from_handle(handle, Repository, self.repository_map)
|
return self.get_from_handle(handle, Repository, self.repository_map)
|
||||||
|
|
||||||
def get_note_from_handle(self, handle):
|
def get_note_from_handle(self, handle):
|
||||||
"""
|
"""
|
||||||
Finds a Note in the database from the passed gramps' ID.
|
Finds a Note in the database from the passed gramps' ID.
|
||||||
If no such Note exists, None is returned.
|
If no such Note exists, None is returned.
|
||||||
"""
|
"""
|
||||||
return self.__get_from_handle(handle, Note, self.note_map)
|
return self.get_from_handle(handle, Note, self.note_map)
|
||||||
|
|
||||||
def _find_from_handle(self, handle, transaction, class_type, dmap,
|
def find_from_handle(self, handle, transaction, class_type, dmap,
|
||||||
add_func):
|
add_func):
|
||||||
obj = class_type()
|
obj = class_type()
|
||||||
handle = str(handle)
|
handle = str(handle)
|
||||||
@ -835,7 +835,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
Finds a Person in the database from the passed GRAMPS ID.
|
Finds a Person in the database from the passed GRAMPS ID.
|
||||||
If no such Person exists, a new Person is added to the database.
|
If no such Person exists, a new Person is added to the database.
|
||||||
"""
|
"""
|
||||||
return self._find_from_handle(handle, transaction, Person,
|
return self.find_from_handle(handle, transaction, Person,
|
||||||
self.person_map, self.add_person)
|
self.person_map, self.add_person)
|
||||||
|
|
||||||
def find_source_from_handle(self, handle, transaction):
|
def find_source_from_handle(self, handle, transaction):
|
||||||
@ -843,7 +843,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
Finds a Source in the database from the passed handle.
|
Finds a Source in the database from the passed handle.
|
||||||
If no such Source exists, a new Source is added to the database.
|
If no such Source exists, a new Source is added to the database.
|
||||||
"""
|
"""
|
||||||
return self._find_from_handle(handle, transaction, Source,
|
return self.find_from_handle(handle, transaction, Source,
|
||||||
self.source_map, self.add_source)
|
self.source_map, self.add_source)
|
||||||
|
|
||||||
def find_event_from_handle(self, handle, transaction):
|
def find_event_from_handle(self, handle, transaction):
|
||||||
@ -851,7 +851,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
Finds a Event in the database from the passed handle.
|
Finds a Event in the database from the passed handle.
|
||||||
If no such Event exists, a new Event is added to the database.
|
If no such Event exists, a new Event is added to the database.
|
||||||
"""
|
"""
|
||||||
return self._find_from_handle(handle, transaction, Event,
|
return self.find_from_handle(handle, transaction, Event,
|
||||||
self.event_map, self.add_event)
|
self.event_map, self.add_event)
|
||||||
|
|
||||||
def find_object_from_handle(self, handle, transaction):
|
def find_object_from_handle(self, handle, transaction):
|
||||||
@ -859,7 +859,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
Finds an MediaObject in the database from the passed handle.
|
Finds an MediaObject in the database from the passed handle.
|
||||||
If no such MediaObject exists, a new Object is added to the database.
|
If no such MediaObject exists, a new Object is added to the database.
|
||||||
"""
|
"""
|
||||||
return self._find_from_handle(handle, transaction, MediaObject,
|
return self.find_from_handle(handle, transaction, MediaObject,
|
||||||
self.media_map, self.add_object)
|
self.media_map, self.add_object)
|
||||||
|
|
||||||
def find_place_from_handle(self, handle, transaction):
|
def find_place_from_handle(self, handle, transaction):
|
||||||
@ -867,7 +867,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
Finds a Place in the database from the passed handle.
|
Finds a Place in the database from the passed handle.
|
||||||
If no such Place exists, a new Place is added to the database.
|
If no such Place exists, a new Place is added to the database.
|
||||||
"""
|
"""
|
||||||
return self._find_from_handle(handle, transaction, Place,
|
return self.find_from_handle(handle, transaction, Place,
|
||||||
self.place_map, self.add_place)
|
self.place_map, self.add_place)
|
||||||
|
|
||||||
def find_family_from_handle(self, handle, transaction):
|
def find_family_from_handle(self, handle, transaction):
|
||||||
@ -875,7 +875,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
Finds a Family in the database from the passed handle.
|
Finds a Family in the database from the passed handle.
|
||||||
If no such Family exists, a new Family is added to the database.
|
If no such Family exists, a new Family is added to the database.
|
||||||
"""
|
"""
|
||||||
return self._find_from_handle(handle, transaction, Family,
|
return self.find_from_handle(handle, transaction, Family,
|
||||||
self.family_map, self.add_family)
|
self.family_map, self.add_family)
|
||||||
|
|
||||||
def find_repository_from_handle(self, handle, transaction):
|
def find_repository_from_handle(self, handle, transaction):
|
||||||
@ -883,7 +883,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
Finds a Repository in the database from the passed handle.
|
Finds a Repository in the database from the passed handle.
|
||||||
If no such Repository exists, a new Repository is added to the database.
|
If no such Repository exists, a new Repository is added to the database.
|
||||||
"""
|
"""
|
||||||
return self._find_from_handle(handle, transaction, Repository,
|
return self.find_from_handle(handle, transaction, Repository,
|
||||||
self.repository_map, self.add_repository)
|
self.repository_map, self.add_repository)
|
||||||
|
|
||||||
def find_note_from_handle(self, handle, transaction):
|
def find_note_from_handle(self, handle, transaction):
|
||||||
@ -891,7 +891,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
Finds a Note in the database from the passed handle.
|
Finds a Note in the database from the passed handle.
|
||||||
If no such Note exists, a new Note is added to the database.
|
If no such Note exists, a new Note is added to the database.
|
||||||
"""
|
"""
|
||||||
return self._find_from_handle(handle, transaction, Note,
|
return self.find_from_handle(handle, transaction, Note,
|
||||||
self.note_map, self.add_note)
|
self.note_map, self.add_note)
|
||||||
|
|
||||||
def check_person_from_handle(self, handle, transaction):
|
def check_person_from_handle(self, handle, transaction):
|
||||||
@ -1204,7 +1204,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
"""
|
"""
|
||||||
return len(self.note_map)
|
return len(self.note_map)
|
||||||
|
|
||||||
def __all_handles(self, table):
|
def all_handles(self, table):
|
||||||
return table.keys()
|
return table.keys()
|
||||||
|
|
||||||
def get_person_handles(self, sort_handles=True):
|
def get_person_handles(self, sort_handles=True):
|
||||||
@ -1224,7 +1224,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
slist.sort()
|
slist.sort()
|
||||||
return map(lambda x: x[1], slist)
|
return map(lambda x: x[1], slist)
|
||||||
else:
|
else:
|
||||||
return self.__all_handles(self.person_map)
|
return self.all_handles(self.person_map)
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def get_place_handles(self, sort_handles=True):
|
def get_place_handles(self, sort_handles=True):
|
||||||
@ -1246,7 +1246,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
val = map(lambda x: x[1], slist)
|
val = map(lambda x: x[1], slist)
|
||||||
return val
|
return val
|
||||||
else:
|
else:
|
||||||
return self.__all_handles(self.place_map)
|
return self.all_handles(self.place_map)
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def get_source_handles(self, sort_handles=True):
|
def get_source_handles(self, sort_handles=True):
|
||||||
@ -1256,7 +1256,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
Source title.
|
Source title.
|
||||||
"""
|
"""
|
||||||
if self.db_is_open:
|
if self.db_is_open:
|
||||||
handle_list = self.__all_handles(self.source_map)
|
handle_list = self.all_handles(self.source_map)
|
||||||
if sort_handles:
|
if sort_handles:
|
||||||
handle_list.sort(self.__sortbysource)
|
handle_list.sort(self.__sortbysource)
|
||||||
return handle_list
|
return handle_list
|
||||||
@ -1268,7 +1268,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
the database. If sort_handles is True, the list is sorted by title.
|
the database. If sort_handles is True, the list is sorted by title.
|
||||||
"""
|
"""
|
||||||
if self.db_is_open:
|
if self.db_is_open:
|
||||||
handle_list = self.__all_handles(self.media_map)
|
handle_list = self.all_handles(self.media_map)
|
||||||
if sort_handles:
|
if sort_handles:
|
||||||
handle_list.sort(self.__sortbymedia)
|
handle_list.sort(self.__sortbymedia)
|
||||||
return handle_list
|
return handle_list
|
||||||
@ -1280,7 +1280,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
the database.
|
the database.
|
||||||
"""
|
"""
|
||||||
if self.db_is_open:
|
if self.db_is_open:
|
||||||
return self.__all_handles(self.event_map)
|
return self.all_handles(self.event_map)
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def get_family_handles(self):
|
def get_family_handles(self):
|
||||||
@ -1289,7 +1289,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
the database.
|
the database.
|
||||||
"""
|
"""
|
||||||
if self.db_is_open:
|
if self.db_is_open:
|
||||||
return self.__all_handles(self.family_map)
|
return self.all_handles(self.family_map)
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def get_repository_handles(self):
|
def get_repository_handles(self):
|
||||||
@ -1298,7 +1298,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
the database.
|
the database.
|
||||||
"""
|
"""
|
||||||
if self.db_is_open:
|
if self.db_is_open:
|
||||||
return self.__all_handles(self.repository_map)
|
return self.all_handles(self.repository_map)
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def get_note_handles(self):
|
def get_note_handles(self):
|
||||||
@ -1307,7 +1307,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
the database.
|
the database.
|
||||||
"""
|
"""
|
||||||
if self.db_is_open:
|
if self.db_is_open:
|
||||||
return self.__all_handles(self.note_map)
|
return self.all_handles(self.note_map)
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def get_gramps_ids(self, obj_key):
|
def get_gramps_ids(self, obj_key):
|
||||||
@ -1482,25 +1482,25 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
for index in range(self.undoindex+1, _UNDO_SIZE):
|
for index in range(self.undoindex+1, _UNDO_SIZE):
|
||||||
self.translist[index] = None
|
self.translist[index] = None
|
||||||
|
|
||||||
person_add = self.__do_commit(transaction.person_add, self.person_map)
|
person_add = self.do_commit(transaction.person_add, self.person_map)
|
||||||
family_add = self.__do_commit(transaction.family_add, self.family_map)
|
family_add = self.do_commit(transaction.family_add, self.family_map)
|
||||||
source_add = self.__do_commit(transaction.source_add, self.source_map)
|
source_add = self.do_commit(transaction.source_add, self.source_map)
|
||||||
place_add = self.__do_commit(transaction.place_add, self.place_map)
|
place_add = self.do_commit(transaction.place_add, self.place_map)
|
||||||
media_add = self.__do_commit(transaction.media_add, self.media_map)
|
media_add = self.do_commit(transaction.media_add, self.media_map)
|
||||||
event_add = self.__do_commit(transaction.event_add, self.event_map)
|
event_add = self.do_commit(transaction.event_add, self.event_map)
|
||||||
repository_add = self.__do_commit(transaction.repository_add,
|
repository_add = self.do_commit(transaction.repository_add,
|
||||||
self.repository_map)
|
self.repository_map)
|
||||||
|
|
||||||
note_add = self.__do_commit(transaction.note_add, self.note_map)
|
note_add = self.do_commit(transaction.note_add, self.note_map)
|
||||||
person_upd = self.__do_commit(transaction.person_update, self.person_map)
|
person_upd = self.do_commit(transaction.person_update, self.person_map)
|
||||||
family_upd = self.__do_commit(transaction.family_update, self.family_map)
|
family_upd = self.do_commit(transaction.family_update, self.family_map)
|
||||||
source_upd = self.__do_commit(transaction.source_update, self.source_map)
|
source_upd = self.do_commit(transaction.source_update, self.source_map)
|
||||||
place_upd = self.__do_commit(transaction.place_update, self.place_map)
|
place_upd = self.do_commit(transaction.place_update, self.place_map)
|
||||||
media_upd = self.__do_commit(transaction.media_update, self.media_map)
|
media_upd = self.do_commit(transaction.media_update, self.media_map)
|
||||||
event_upd = self.__do_commit(transaction.event_update, self.event_map)
|
event_upd = self.do_commit(transaction.event_update, self.event_map)
|
||||||
repository_upd = self.__do_commit(transaction.repository_update,
|
repository_upd = self.do_commit(transaction.repository_update,
|
||||||
self.repository_map)
|
self.repository_map)
|
||||||
note_upd = self.__do_commit(transaction.note_update, self.note_map)
|
note_upd = self.do_commit(transaction.note_update, self.note_map)
|
||||||
|
|
||||||
self.__do_emit('person', person_add, person_upd, transaction.person_del)
|
self.__do_emit('person', person_add, person_upd, transaction.person_del)
|
||||||
self.__do_emit('family', family_add, family_upd, transaction.family_del)
|
self.__do_emit('family', family_add, family_upd, transaction.family_del)
|
||||||
@ -1512,14 +1512,14 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
transaction.repository_del)
|
transaction.repository_del)
|
||||||
self.__do_emit('note', note_add, note_upd, transaction.note_del)
|
self.__do_emit('note', note_add, note_upd, transaction.note_del)
|
||||||
|
|
||||||
self.__do_del(transaction.person_del, self.__del_person)
|
self.__do_del(transaction.person_del, self.del_person)
|
||||||
self.__do_del(transaction.family_del, self.__del_family)
|
self.__do_del(transaction.family_del, self.del_family)
|
||||||
self.__do_del(transaction.place_del, self.__del_place)
|
self.__do_del(transaction.place_del, self.del_place)
|
||||||
self.__do_del(transaction.source_del, self.__del_source)
|
self.__do_del(transaction.source_del, self.del_source)
|
||||||
self.__do_del(transaction.event_del, self.__del_event)
|
self.__do_del(transaction.event_del, self.del_event)
|
||||||
self.__do_del(transaction.media_del, self.__del_media)
|
self.__do_del(transaction.media_del, self.del_media)
|
||||||
self.__do_del(transaction.repository_del, self.__del_repository)
|
self.__do_del(transaction.repository_del, self.del_repository)
|
||||||
self.__do_del(transaction.note_del, self.__del_note)
|
self.__do_del(transaction.note_del, self.del_note)
|
||||||
|
|
||||||
if self.undo_callback:
|
if self.undo_callback:
|
||||||
self.undo_callback(_("_Undo %s") % transaction.get_description())
|
self.undo_callback(_("_Undo %s") % transaction.get_description())
|
||||||
@ -1541,7 +1541,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
func(handle)
|
func(handle)
|
||||||
return del_list
|
return del_list
|
||||||
|
|
||||||
def __do_commit(self, add_list, db_map):
|
def do_commit(self, add_list, db_map):
|
||||||
retlist = []
|
retlist = []
|
||||||
for (handle, data) in add_list:
|
for (handle, data) in add_list:
|
||||||
db_map[handle] = data
|
db_map[handle] = data
|
||||||
@ -1868,35 +1868,35 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
|
|
||||||
if self.readonly or not handle:
|
if self.readonly or not handle:
|
||||||
return
|
return
|
||||||
self.__delete_primary_from_reference_map(handle, transaction)
|
self.delete_primary_from_reference_map(handle, transaction)
|
||||||
person = self.get_person_from_handle(handle)
|
person = self.get_person_from_handle(handle)
|
||||||
self.genderStats.uncount_person (person)
|
self.genderStats.uncount_person (person)
|
||||||
self.remove_from_surname_list(person)
|
self.remove_from_surname_list(person)
|
||||||
if transaction.batch:
|
if transaction.batch:
|
||||||
self.__del_person(handle)
|
self.del_person(handle)
|
||||||
else:
|
else:
|
||||||
transaction.add(PERSON_KEY, handle, person.serialize(), None)
|
transaction.add(PERSON_KEY, handle, person.serialize(), None)
|
||||||
transaction.person_del.append(str(handle))
|
transaction.person_del.append(str(handle))
|
||||||
|
|
||||||
def get_del_func(self, key):
|
def get_del_func(self, key):
|
||||||
key2del = {
|
key2del = {
|
||||||
PERSON_KEY: self.__del_person,
|
PERSON_KEY: self.del_person,
|
||||||
FAMILY_KEY: self.__del_family,
|
FAMILY_KEY: self.del_family,
|
||||||
SOURCE_KEY: self.__del_source,
|
SOURCE_KEY: self.del_source,
|
||||||
EVENT_KEY: self.__del_event,
|
EVENT_KEY: self.del_event,
|
||||||
MEDIA_KEY: self.__del_media,
|
MEDIA_KEY: self.del_media,
|
||||||
PLACE_KEY: self.__del_place,
|
PLACE_KEY: self.del_place,
|
||||||
REPOSITORY_KEY: self.__del_repository,
|
REPOSITORY_KEY: self.del_repository,
|
||||||
NOTE_KEY: self.__del_note,
|
NOTE_KEY: self.del_note,
|
||||||
}
|
}
|
||||||
return key2del[key]
|
return key2del[key]
|
||||||
|
|
||||||
def __do_remove_object(self, handle, trans, dmap, key, del_list):
|
def do_remove_object(self, handle, trans, dmap, key, del_list):
|
||||||
if self.readonly or not handle:
|
if self.readonly or not handle:
|
||||||
return
|
return
|
||||||
|
|
||||||
handle = str(handle)
|
handle = str(handle)
|
||||||
self.__delete_primary_from_reference_map(handle, trans)
|
self.delete_primary_from_reference_map(handle, trans)
|
||||||
if trans.batch:
|
if trans.batch:
|
||||||
del_func = self.get_del_func(key)
|
del_func = self.get_del_func(key)
|
||||||
del_func(handle)
|
del_func(handle)
|
||||||
@ -1911,7 +1911,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
database, preserving the change in the passed transaction. This
|
database, preserving the change in the passed transaction. This
|
||||||
method must be overridden in the derived class.
|
method must be overridden in the derived class.
|
||||||
"""
|
"""
|
||||||
self.__do_remove_object(handle, transaction, self.source_map,
|
self.do_remove_object(handle, transaction, self.source_map,
|
||||||
SOURCE_KEY, transaction.source_del)
|
SOURCE_KEY, transaction.source_del)
|
||||||
|
|
||||||
def remove_event(self, handle, transaction):
|
def remove_event(self, handle, transaction):
|
||||||
@ -1920,7 +1920,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
database, preserving the change in the passed transaction. This
|
database, preserving the change in the passed transaction. This
|
||||||
method must be overridden in the derived class.
|
method must be overridden in the derived class.
|
||||||
"""
|
"""
|
||||||
self.__do_remove_object(handle, transaction, self.event_map,
|
self.do_remove_object(handle, transaction, self.event_map,
|
||||||
EVENT_KEY, transaction.event_del)
|
EVENT_KEY, transaction.event_del)
|
||||||
|
|
||||||
def remove_object(self, handle, transaction):
|
def remove_object(self, handle, transaction):
|
||||||
@ -1929,7 +1929,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
database, preserving the change in the passed transaction. This
|
database, preserving the change in the passed transaction. This
|
||||||
method must be overridden in the derived class.
|
method must be overridden in the derived class.
|
||||||
"""
|
"""
|
||||||
self.__do_remove_object(handle, transaction, self.media_map,
|
self.do_remove_object(handle, transaction, self.media_map,
|
||||||
MEDIA_KEY, transaction.media_del)
|
MEDIA_KEY, transaction.media_del)
|
||||||
|
|
||||||
def remove_place(self, handle, transaction):
|
def remove_place(self, handle, transaction):
|
||||||
@ -1938,7 +1938,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
database, preserving the change in the passed transaction. This
|
database, preserving the change in the passed transaction. This
|
||||||
method must be overridden in the derived class.
|
method must be overridden in the derived class.
|
||||||
"""
|
"""
|
||||||
self.__do_remove_object(handle, transaction, self.place_map,
|
self.do_remove_object(handle, transaction, self.place_map,
|
||||||
PLACE_KEY, transaction.place_del)
|
PLACE_KEY, transaction.place_del)
|
||||||
|
|
||||||
def remove_family(self, handle, transaction):
|
def remove_family(self, handle, transaction):
|
||||||
@ -1947,7 +1947,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
database, preserving the change in the passed transaction. This
|
database, preserving the change in the passed transaction. This
|
||||||
method must be overridden in the derived class.
|
method must be overridden in the derived class.
|
||||||
"""
|
"""
|
||||||
self.__do_remove_object(handle, transaction, self.family_map,
|
self.do_remove_object(handle, transaction, self.family_map,
|
||||||
FAMILY_KEY, transaction.family_del)
|
FAMILY_KEY, transaction.family_del)
|
||||||
|
|
||||||
def remove_repository(self, handle, transaction):
|
def remove_repository(self, handle, transaction):
|
||||||
@ -1956,7 +1956,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
database, preserving the change in the passed transaction. This
|
database, preserving the change in the passed transaction. This
|
||||||
method must be overridden in the derived class.
|
method must be overridden in the derived class.
|
||||||
"""
|
"""
|
||||||
self.__do_remove_object(handle, transaction, self.repository_map,
|
self.do_remove_object(handle, transaction, self.repository_map,
|
||||||
REPOSITORY_KEY, transaction.repository_del)
|
REPOSITORY_KEY, transaction.repository_del)
|
||||||
|
|
||||||
def remove_note(self, handle, transaction):
|
def remove_note(self, handle, transaction):
|
||||||
@ -1965,7 +1965,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
database, preserving the change in the passed transaction. This
|
database, preserving the change in the passed transaction. This
|
||||||
method must be overridden in the derived class.
|
method must be overridden in the derived class.
|
||||||
"""
|
"""
|
||||||
self.__do_remove_object(handle, transaction, self.note_map,
|
self.do_remove_object(handle, transaction, self.note_map,
|
||||||
NOTE_KEY, transaction.note_del)
|
NOTE_KEY, transaction.note_del)
|
||||||
|
|
||||||
def get_raw_person_data(self, handle):
|
def get_raw_person_data(self, handle):
|
||||||
@ -2054,7 +2054,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
media2 = self.media_map[str(second)][4]
|
media2 = self.media_map[str(second)][4]
|
||||||
return locale.strcoll(media1, media2)
|
return locale.strcoll(media1, media2)
|
||||||
|
|
||||||
def __set_column_order(self, col_list, name):
|
def set_column_order(self, col_list, name):
|
||||||
if (self.metadata != None) and (not self.readonly):
|
if (self.metadata != None) and (not self.readonly):
|
||||||
self.metadata[name] = col_list
|
self.metadata[name] = col_list
|
||||||
|
|
||||||
@ -2227,13 +2227,13 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
default = [(1, 0, 100), (1, 1, 100), (0, 2, 100), (1, 3, 100)]
|
default = [(1, 0, 100), (1, 1, 100), (0, 2, 100), (1, 3, 100)]
|
||||||
return self.__get_columns(NOTE_COL_KEY, default)
|
return self.__get_columns(NOTE_COL_KEY, default)
|
||||||
|
|
||||||
def __delete_primary_from_reference_map(self, handle, transaction):
|
def delete_primary_from_reference_map(self, handle, transaction):
|
||||||
"""Called each time an object is removed from the database. This can
|
"""Called each time an object is removed from the database. This can
|
||||||
be used by subclasses to update any additional index tables that might
|
be used by subclasses to update any additional index tables that might
|
||||||
need to be changed."""
|
need to be changed."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def __update_reference_map(self, obj, transaction):
|
def update_reference_map(self, obj, transaction):
|
||||||
"""Called each time an object is writen to the database. This can
|
"""Called each time an object is writen to the database. This can
|
||||||
be used by subclasses to update any additional index tables that might
|
be used by subclasses to update any additional index tables that might
|
||||||
need to be changed."""
|
need to be changed."""
|
||||||
|
@ -163,42 +163,42 @@ class GrampsInMemDB(GrampsDbBase):
|
|||||||
if do_remove:
|
if do_remove:
|
||||||
self.surname_list.remove(unicode(name))
|
self.surname_list.remove(unicode(name))
|
||||||
|
|
||||||
def __del_person(self,handle):
|
def del_person(self,handle):
|
||||||
person = self.get_person_from_handle(str(handle))
|
person = self.get_person_from_handle(str(handle))
|
||||||
del self.id_trans[person.get_gramps_id()]
|
del self.id_trans[person.get_gramps_id()]
|
||||||
del self.person_map[str(handle)]
|
del self.person_map[str(handle)]
|
||||||
|
|
||||||
def __del_source(self,handle):
|
def del_source(self,handle):
|
||||||
source = self.get_source_from_handle(str(handle))
|
source = self.get_source_from_handle(str(handle))
|
||||||
del self.sid_trans[source.get_gramps_id()]
|
del self.sid_trans[source.get_gramps_id()]
|
||||||
del self.source_map[str(handle)]
|
del self.source_map[str(handle)]
|
||||||
|
|
||||||
def __del_repository(self,handle):
|
def del_repository(self,handle):
|
||||||
repository = self.get_repository_from_handle(str(handle))
|
repository = self.get_repository_from_handle(str(handle))
|
||||||
del self.rid_trans[repository.get_gramps_id()]
|
del self.rid_trans[repository.get_gramps_id()]
|
||||||
del self.repository_map[str(handle)]
|
del self.repository_map[str(handle)]
|
||||||
|
|
||||||
def __del_note(self,handle):
|
def del_note(self,handle):
|
||||||
note = self.get_note_from_handle(str(handle))
|
note = self.get_note_from_handle(str(handle))
|
||||||
del self.nid_trans[note.get_gramps_id()]
|
del self.nid_trans[note.get_gramps_id()]
|
||||||
del self.note_map[str(handle)]
|
del self.note_map[str(handle)]
|
||||||
|
|
||||||
def __del_place(self,handle):
|
def del_place(self,handle):
|
||||||
place = self.get_place_from_handle(str(handle))
|
place = self.get_place_from_handle(str(handle))
|
||||||
del self.pid_trans[place.get_gramps_id()]
|
del self.pid_trans[place.get_gramps_id()]
|
||||||
del self.place_map[str(handle)]
|
del self.place_map[str(handle)]
|
||||||
|
|
||||||
def __del_media(self,handle):
|
def del_media(self,handle):
|
||||||
obj = self.get_object_from_handle(str(handle))
|
obj = self.get_object_from_handle(str(handle))
|
||||||
del self.oid_trans[obj.get_gramps_id()]
|
del self.oid_trans[obj.get_gramps_id()]
|
||||||
del self.media_map[str(handle)]
|
del self.media_map[str(handle)]
|
||||||
|
|
||||||
def __del_family(self,handle):
|
def del_family(self,handle):
|
||||||
family = self.get_family_from_handle(str(handle))
|
family = self.get_family_from_handle(str(handle))
|
||||||
del self.fid_trans[family.get_gramps_id()]
|
del self.fid_trans[family.get_gramps_id()]
|
||||||
del self.family_map[str(handle)]
|
del self.family_map[str(handle)]
|
||||||
|
|
||||||
def __del_event(self,handle):
|
def del_event(self,handle):
|
||||||
event = self.get_event_from_handle(str(handle))
|
event = self.get_event_from_handle(str(handle))
|
||||||
del self.eid_trans[event.get_gramps_id()]
|
del self.eid_trans[event.get_gramps_id()]
|
||||||
del self.event_map[str(handle)]
|
del self.event_map[str(handle)]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2000-2005 Donald N. Allingham
|
# Copyright (C) 2000-2007 Donald N. Allingham
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -112,7 +112,7 @@ class RemoveUnused(Tool.Tool,ManagedWindow.ManagedWindow,UpdateCallback):
|
|||||||
|
|
||||||
self.init_gui()
|
self.init_gui()
|
||||||
|
|
||||||
def init_gui():
|
def init_gui(self):
|
||||||
base = os.path.dirname(__file__)
|
base = os.path.dirname(__file__)
|
||||||
self.glade_file = base + os.sep + "unused.glade"
|
self.glade_file = base + os.sep + "unused.glade"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user