* src/DataViews/_PersonView.py: use a container for bookmarks to prevent

lost of data (bug #777)
	* src/GrampsDb/_GrampsDbBase.py: use a container for bookmarks to prevent
	lost of data (bug #777)
	* src/GrampsDb/_GrampsBSDDB.py: use a container for bookmarks to prevent
	lost of data (bug #777)
	* src/Bookmarks.py: use a container for bookmarks to prevent
	lost of data (bug #777)


svn: r7830
This commit is contained in:
Don Allingham 2006-12-21 03:28:44 +00:00
parent 373821f214
commit 70550f3321
6 changed files with 67 additions and 37 deletions

View File

@ -1,4 +1,12 @@
2006-12-20 Don Allingham <don@gramps-project.org>
* src/DataViews/_PersonView.py: use a container for bookmarks to prevent
lost of data (bug #777)
* src/GrampsDb/_GrampsDbBase.py: use a container for bookmarks to prevent
lost of data (bug #777)
* src/GrampsDb/_GrampsBSDDB.py: use a container for bookmarks to prevent
lost of data (bug #777)
* src/Bookmarks.py: use a container for bookmarks to prevent
lost of data (bug #777)
* src/DisplayModels/_BaseModel.py (BaseModel.__init__): choose
correct sort column

View File

@ -116,11 +116,11 @@ class Bookmarks :
actions = []
count = 0
if len(self.bookmarks) > 0:
if len(self.bookmarks.get()) > 0:
f.write('<placeholder name="GoToBook">')
new_list = []
for item in self.bookmarks:
for item in self.bookmarks.get():
try:
label, obj = self.make_label(item)
func = self.callback(item)
@ -132,7 +132,7 @@ class Bookmarks :
except AttributeError:
pass
f.write('</placeholder>')
self.bookmarks = new_list
self.bookmarks.set(new_list)
f.write(_btm)
self.action_group.add_actions(actions)
@ -151,7 +151,7 @@ class Bookmarks :
def add(self, person_handle):
"""appends the person to the bottom of the bookmarks"""
if person_handle not in self.bookmarks:
if person_handle not in self.bookmarks.get():
self.bookmarks.append(person_handle)
self.redraw()
@ -165,7 +165,7 @@ class Bookmarks :
modified = False
for handle in handle_list:
if handle in self.bookmarks:
if handle in self.bookmarks.get():
self.bookmarks.remove(handle)
modified = True
if modified:
@ -221,7 +221,7 @@ class Bookmarks :
list is not empty, or -1 if it is.
"""
self.draw_window()
for handle in self.bookmarks:
for handle in self.bookmarks.get():
name, obj = self.make_label(handle)
if obj:
gramps_id = obj.get_gramps_id()

View File

@ -601,8 +601,6 @@ class PersonView(PageView.PersonNavView):
person_list = [ phandle for phandle in self.dbstate.db.get_person_handles(False)
if self.dbstate.db.get_person_from_handle(phandle).has_handle_reference('Person',handle) ]
print "_PersonView.delete_person_response"
print person_list
for phandle in person_list:
person = self.dbstate.db.get_person_from_handle(phandle)
person.remove_handle_references('Person',handle)
@ -721,12 +719,10 @@ class PersonView(PageView.PersonNavView):
else:
col,text,inv = self.search_bar.get_value()
func = lambda x: self.model.on_get_value(x, col) or u""
print col, PeopleModel._GENDER_COL
if col == PeopleModel._GENDER_COL:
data_filter = ExactSearchFilter(func, text, inv)
else:
data_filter = SearchFilter(func, text, inv)
print data_filter
self.model.clear_cache()
for node in handle_list:

View File

@ -476,19 +476,19 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback):
format = format + (True,)
self.name_formats[format_ix] = format
# bookmarks
self.bookmarks = self.metadata.get('bookmarks',default=[])
self.family_bookmarks = self.metadata.get('family_bookmarks',
default=[])
self.event_bookmarks = self.metadata.get('event_bookmarks',
default=[])
self.source_bookmarks = self.metadata.get('source_bookmarks',
default=[])
self.repo_bookmarks = self.metadata.get('repo_bookmarks',
default=[])
self.media_bookmarks = self.metadata.get('media_bookmarks',
default=[])
self.place_bookmarks = self.metadata.get('place_bookmarks',
default=[])
self.bookmarks.set(self.metadata.get('bookmarks',default=[]))
self.family_bookmarks.set(self.metadata.get('family_bookmarks',
default=[]))
self.event_bookmarks.set(self.metadata.get('event_bookmarks',
default=[]))
self.source_bookmarks.set(self.metadata.get('source_bookmarks',
default=[]))
self.repo_bookmarks.set(self.metadata.get('repo_bookmarks',
default=[]))
self.media_bookmarks.set(self.metadata.get('media_bookmarks',
default=[]))
self.place_bookmarks.set(self.metadata.get('place_bookmarks',
default=[]))
# Custom type values
self.family_event_names = set(self.metadata.get('fevent_names',
default=[]))
@ -987,19 +987,22 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback):
# name display formats
self.metadata.put('name_formats',self.name_formats,txn=the_txn)
# bookmarks
self.metadata.put('bookmarks',self.bookmarks,txn=the_txn)
self.metadata.put('family_bookmarks',self.family_bookmarks,
self.metadata.put('bookmarks',self.bookmarks.get(),txn=the_txn)
self.metadata.put('family_bookmarks',self.family_bookmarks.get(),
txn=the_txn)
self.metadata.put('event_bookmarks',self.event_bookmarks,
self.metadata.put('event_bookmarks',self.event_bookmarks.get(),
txn=the_txn)
self.metadata.put('source_bookmarks',self.source_bookmarks,
self.metadata.put('source_bookmarks',self.source_bookmarks.get(),
txn=the_txn)
self.metadata.put('place_bookmarks',self.place_bookmarks,
self.metadata.put('place_bookmarks',self.place_bookmarks.get(),
txn=the_txn)
self.metadata.put('repo_bookmarks',self.repo_bookmarks,txn=the_txn)
self.metadata.put('media_bookmarks',self.media_bookmarks,
self.metadata.put('repo_bookmarks',self.repo_bookmarks.get(),
txn=the_txn)
self.metadata.put('media_bookmarks',self.media_bookmarks.get(),
txn=the_txn)
# gender stats
self.metadata.put('gender_stats',self.genderStats.save_stats(),
txn=the_txn)

View File

@ -154,6 +154,28 @@ class GrampsCursor:
"""
pass
class GrampsDbBookmarks:
def __init__(self, default = []):
self.bookmarks = default
def set(self, new_list):
self.bookmarks = new_list
def get(self):
return self.bookmarks
def append(self, item):
self.bookmarks.append(item)
def remove(self, item):
self.bookmarks.remove(item)
def pop(self, item):
self.bookmarks.pop(item)
def insert(self, item):
self.bookmarks.insert(item)
class GrampsDbBase(GrampsDBCallback):
"""
GRAMPS database object. This object is a base class for all
@ -273,13 +295,13 @@ class GrampsDbBase(GrampsDBCallback):
self.default = None
self.owner = Researcher()
self.name_formats = []
self.bookmarks = []
self.family_bookmarks = []
self.event_bookmarks = []
self.place_bookmarks = []
self.source_bookmarks = []
self.repo_bookmarks = []
self.media_bookmarks = []
self.bookmarks = GrampsDbBookmarks()
self.family_bookmarks = GrampsDbBookmarks()
self.event_bookmarks = GrampsDbBookmarks()
self.place_bookmarks = GrampsDbBookmarks()
self.source_bookmarks = GrampsDbBookmarks()
self.repo_bookmarks = GrampsDbBookmarks()
self.media_bookmarks = GrampsDbBookmarks()
self.path = ""
self.name_group = {}

View File

@ -78,6 +78,7 @@ import GrampsWidgets
import UndoHistory
from DbLoader import DbLoader
import GrampsDisplay
def show_url(dialog,link,user_data):
GrampsDisplay.url(link)
gtk.about_dialog_set_url_hook(show_url,None)