* src/GrampsDb/_GrampsDbBase.py: error message on disk space full
* src/Bookmarks.py: removed deleted items svn: r7375
This commit is contained in:
parent
872e88bdde
commit
68db1c3efa
@ -3,6 +3,8 @@
|
|||||||
* src/plugins/DetDescendantReport.py: fix DDR-Endnotes indent
|
* src/plugins/DetDescendantReport.py: fix DDR-Endnotes indent
|
||||||
|
|
||||||
2006-10-08 Don Allingham <don@gramps-project.org>
|
2006-10-08 Don Allingham <don@gramps-project.org>
|
||||||
|
* src/GrampsDb/_GrampsDbBase.py: error message on disk space full
|
||||||
|
* src/Bookmarks.py: removed deleted items
|
||||||
* src/Editors/_EditReference.py: call cancel_and_close on window
|
* src/Editors/_EditReference.py: call cancel_and_close on window
|
||||||
cancel
|
cancel
|
||||||
* src/DisplayTabs/_SourceRefModel.py: remove debug
|
* src/DisplayTabs/_SourceRefModel.py: remove debug
|
||||||
|
@ -85,6 +85,14 @@ class Bookmarks :
|
|||||||
self.bookmarks = bookmarks
|
self.bookmarks = bookmarks
|
||||||
self.active = DISABLED
|
self.active = DISABLED
|
||||||
self.action_group = gtk.ActionGroup('Bookmarks')
|
self.action_group = gtk.ActionGroup('Bookmarks')
|
||||||
|
self.connect_signals()
|
||||||
|
self.dbstate.connect('database-changed', self.db_changed)
|
||||||
|
|
||||||
|
def db_changed(self, data):
|
||||||
|
self.connect_signals()
|
||||||
|
|
||||||
|
def connect_signals(self):
|
||||||
|
self.dbstate.db.connect('person-delete', self.remove_handles)
|
||||||
|
|
||||||
def update_bookmarks(self, bookmarks):
|
def update_bookmarks(self, bookmarks):
|
||||||
self.bookmarks = bookmarks
|
self.bookmarks = bookmarks
|
||||||
@ -110,14 +118,22 @@ class Bookmarks :
|
|||||||
|
|
||||||
if len(self.bookmarks) > 0:
|
if len(self.bookmarks) > 0:
|
||||||
f.write('<placeholder name="GoToBook">')
|
f.write('<placeholder name="GoToBook">')
|
||||||
|
|
||||||
|
new_list = []
|
||||||
for item in self.bookmarks:
|
for item in self.bookmarks:
|
||||||
|
try:
|
||||||
label, obj = self.make_label(item)
|
label, obj = self.make_label(item)
|
||||||
func = self.callback(item)
|
func = self.callback(item)
|
||||||
action_id = "BM:%s" % item
|
action_id = "BM:%s" % item
|
||||||
actions.append((action_id,None,label,None,None,func))
|
actions.append((action_id,None,label,None,None,func))
|
||||||
f.write('<menuitem action="%s"/>' % action_id)
|
f.write('<menuitem action="%s"/>' % action_id)
|
||||||
count +=1
|
count +=1
|
||||||
|
new_list.append(item)
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
f.write('</placeholder>')
|
f.write('</placeholder>')
|
||||||
|
self.bookmarks = new_list
|
||||||
|
|
||||||
f.write(_btm)
|
f.write(_btm)
|
||||||
self.action_group.add_actions(actions)
|
self.action_group.add_actions(actions)
|
||||||
self.uistate.uimanager.insert_action_group(self.action_group,1)
|
self.uistate.uimanager.insert_action_group(self.action_group,1)
|
||||||
@ -133,23 +149,24 @@ class Bookmarks :
|
|||||||
def callback(self, handle):
|
def callback(self, handle):
|
||||||
return make_callback(handle, self.dbstate.change_active_handle)
|
return make_callback(handle, self.dbstate.change_active_handle)
|
||||||
|
|
||||||
def add(self,person_handle):
|
def add(self, person_handle):
|
||||||
"""appends the person to the bottom of the bookmarks"""
|
"""appends the person to the bottom of the bookmarks"""
|
||||||
if person_handle not in self.bookmarks:
|
if person_handle not in self.bookmarks:
|
||||||
self.bookmarks.append(person_handle)
|
self.bookmarks.append(person_handle)
|
||||||
self.redraw()
|
self.redraw()
|
||||||
|
|
||||||
def remove_people(self,person_handle_list):
|
def remove_handles(self, handle_list):
|
||||||
"""
|
"""
|
||||||
Removes people from the list of bookmarked people.
|
Removes people from the list of bookmarked people.
|
||||||
|
|
||||||
This function is for use *outside* the bookmark editor
|
This function is for use *outside* the bookmark editor
|
||||||
(removal when person is deleted or merged away).
|
(removal when person is deleted or merged away).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
modified = False
|
modified = False
|
||||||
for person_handle in person_handle_list:
|
for handle in handle_list:
|
||||||
if person_handle in self.bookmarks:
|
if handle in self.bookmarks:
|
||||||
self.bookmarks.remove(person_handle)
|
self.bookmarks.remove(handle)
|
||||||
modified = True
|
modified = True
|
||||||
if modified:
|
if modified:
|
||||||
self.redraw()
|
self.redraw()
|
||||||
@ -285,6 +302,9 @@ class FamilyBookmarks(ListBookmarks) :
|
|||||||
name = Utils.family_name(obj, self.dbstate.db)
|
name = Utils.family_name(obj, self.dbstate.db)
|
||||||
return ("%s [%s]" % (name, obj.gramps_id), obj)
|
return ("%s [%s]" % (name, obj.gramps_id), obj)
|
||||||
|
|
||||||
|
def connect_signals(self):
|
||||||
|
self.dbstate.db.connect('family-delete', self.remove_handles)
|
||||||
|
|
||||||
class EventBookmarks(ListBookmarks) :
|
class EventBookmarks(ListBookmarks) :
|
||||||
"Handle the bookmarks interface for Gramps"
|
"Handle the bookmarks interface for Gramps"
|
||||||
|
|
||||||
@ -300,6 +320,9 @@ class EventBookmarks(ListBookmarks) :
|
|||||||
name = obj.get_description()
|
name = obj.get_description()
|
||||||
return ("%s [%s]" % (name, obj.gramps_id), obj)
|
return ("%s [%s]" % (name, obj.gramps_id), obj)
|
||||||
|
|
||||||
|
def connect_signals(self):
|
||||||
|
self.dbstate.db.connect('event-delete', self.remove_handles)
|
||||||
|
|
||||||
class SourceBookmarks(ListBookmarks) :
|
class SourceBookmarks(ListBookmarks) :
|
||||||
"Handle the bookmarks interface for Gramps"
|
"Handle the bookmarks interface for Gramps"
|
||||||
def __init__(self,dbstate,uistate,bookmarks, goto_handle):
|
def __init__(self,dbstate,uistate,bookmarks, goto_handle):
|
||||||
@ -311,6 +334,9 @@ class SourceBookmarks(ListBookmarks) :
|
|||||||
name = obj.get_title()
|
name = obj.get_title()
|
||||||
return ("%s [%s]" % (name, obj.gramps_id), obj)
|
return ("%s [%s]" % (name, obj.gramps_id), obj)
|
||||||
|
|
||||||
|
def connect_signals(self):
|
||||||
|
self.dbstate.db.connect('source-delete', self.remove_handles)
|
||||||
|
|
||||||
class MediaBookmarks(ListBookmarks) :
|
class MediaBookmarks(ListBookmarks) :
|
||||||
"Handle the bookmarks interface for Gramps"
|
"Handle the bookmarks interface for Gramps"
|
||||||
|
|
||||||
@ -323,6 +349,9 @@ class MediaBookmarks(ListBookmarks) :
|
|||||||
name = obj.get_description()
|
name = obj.get_description()
|
||||||
return ("%s [%s]" % (name, obj.gramps_id), obj)
|
return ("%s [%s]" % (name, obj.gramps_id), obj)
|
||||||
|
|
||||||
|
def connect_signals(self):
|
||||||
|
self.dbstate.db.connect('media-delete', self.remove_handles)
|
||||||
|
|
||||||
class RepoBookmarks(ListBookmarks) :
|
class RepoBookmarks(ListBookmarks) :
|
||||||
"Handle the bookmarks interface for Gramps"
|
"Handle the bookmarks interface for Gramps"
|
||||||
|
|
||||||
@ -335,6 +364,9 @@ class RepoBookmarks(ListBookmarks) :
|
|||||||
name = obj.get_name()
|
name = obj.get_name()
|
||||||
return ("%s [%s]" % (name, obj.gramps_id), obj)
|
return ("%s [%s]" % (name, obj.gramps_id), obj)
|
||||||
|
|
||||||
|
def connect_signals(self):
|
||||||
|
self.dbstate.db.connect('repository-delete', self.remove_handles)
|
||||||
|
|
||||||
class PlaceBookmarks(ListBookmarks) :
|
class PlaceBookmarks(ListBookmarks) :
|
||||||
"Handle the bookmarks interface for Gramps"
|
"Handle the bookmarks interface for Gramps"
|
||||||
|
|
||||||
@ -347,5 +379,8 @@ class PlaceBookmarks(ListBookmarks) :
|
|||||||
name = obj.get_title()
|
name = obj.get_title()
|
||||||
return ("%s [%s]" % (name, obj.gramps_id), obj)
|
return ("%s [%s]" % (name, obj.gramps_id), obj)
|
||||||
|
|
||||||
|
def connect_signals(self):
|
||||||
|
self.dbstate.db.connect('place-delete', self.remove_handles)
|
||||||
|
|
||||||
def make_callback(n,f):
|
def make_callback(n,f):
|
||||||
return lambda x: f(n)
|
return lambda x: f(n)
|
||||||
|
@ -414,6 +414,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
|
|
||||||
self._update_reference_map(obj, transaction)
|
self._update_reference_map(obj, transaction)
|
||||||
|
|
||||||
|
try:
|
||||||
if transaction.batch:
|
if transaction.batch:
|
||||||
data_map[handle] = obj.serialize()
|
data_map[handle] = obj.serialize()
|
||||||
old_data = None
|
old_data = None
|
||||||
@ -425,6 +426,13 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
update_list.append((handle, new_data))
|
update_list.append((handle, new_data))
|
||||||
else:
|
else:
|
||||||
add_list.append((handle, new_data))
|
add_list.append((handle, new_data))
|
||||||
|
except db.DBNoSpaceError, msg:
|
||||||
|
from QuestionDialog import ErrorDialog
|
||||||
|
|
||||||
|
ErrorDialog(_("Out of disk space"),
|
||||||
|
_("Your data cannot be saved because you are out "
|
||||||
|
"of disk space. Please free up some disk space "
|
||||||
|
"and try again.\n\n%s") % msg[1])
|
||||||
return old_data
|
return old_data
|
||||||
|
|
||||||
def commit_person(self, person, transaction, change_time=None):
|
def commit_person(self, person, transaction, change_time=None):
|
||||||
|
Loading…
Reference in New Issue
Block a user