* 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:
parent
373821f214
commit
70550f3321
@ -1,4 +1,12 @@
|
|||||||
2006-12-20 Don Allingham <don@gramps-project.org>
|
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
|
* src/DisplayModels/_BaseModel.py (BaseModel.__init__): choose
|
||||||
correct sort column
|
correct sort column
|
||||||
|
|
||||||
|
@ -116,11 +116,11 @@ class Bookmarks :
|
|||||||
actions = []
|
actions = []
|
||||||
count = 0
|
count = 0
|
||||||
|
|
||||||
if len(self.bookmarks) > 0:
|
if len(self.bookmarks.get()) > 0:
|
||||||
f.write('<placeholder name="GoToBook">')
|
f.write('<placeholder name="GoToBook">')
|
||||||
|
|
||||||
new_list = []
|
new_list = []
|
||||||
for item in self.bookmarks:
|
for item in self.bookmarks.get():
|
||||||
try:
|
try:
|
||||||
label, obj = self.make_label(item)
|
label, obj = self.make_label(item)
|
||||||
func = self.callback(item)
|
func = self.callback(item)
|
||||||
@ -132,7 +132,7 @@ class Bookmarks :
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
f.write('</placeholder>')
|
f.write('</placeholder>')
|
||||||
self.bookmarks = new_list
|
self.bookmarks.set(new_list)
|
||||||
|
|
||||||
f.write(_btm)
|
f.write(_btm)
|
||||||
self.action_group.add_actions(actions)
|
self.action_group.add_actions(actions)
|
||||||
@ -151,7 +151,7 @@ class Bookmarks :
|
|||||||
|
|
||||||
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.get():
|
||||||
self.bookmarks.append(person_handle)
|
self.bookmarks.append(person_handle)
|
||||||
self.redraw()
|
self.redraw()
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ class Bookmarks :
|
|||||||
|
|
||||||
modified = False
|
modified = False
|
||||||
for handle in handle_list:
|
for handle in handle_list:
|
||||||
if handle in self.bookmarks:
|
if handle in self.bookmarks.get():
|
||||||
self.bookmarks.remove(handle)
|
self.bookmarks.remove(handle)
|
||||||
modified = True
|
modified = True
|
||||||
if modified:
|
if modified:
|
||||||
@ -221,7 +221,7 @@ class Bookmarks :
|
|||||||
list is not empty, or -1 if it is.
|
list is not empty, or -1 if it is.
|
||||||
"""
|
"""
|
||||||
self.draw_window()
|
self.draw_window()
|
||||||
for handle in self.bookmarks:
|
for handle in self.bookmarks.get():
|
||||||
name, obj = self.make_label(handle)
|
name, obj = self.make_label(handle)
|
||||||
if obj:
|
if obj:
|
||||||
gramps_id = obj.get_gramps_id()
|
gramps_id = obj.get_gramps_id()
|
||||||
|
@ -601,8 +601,6 @@ class PersonView(PageView.PersonNavView):
|
|||||||
|
|
||||||
person_list = [ phandle for phandle in self.dbstate.db.get_person_handles(False)
|
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) ]
|
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:
|
for phandle in person_list:
|
||||||
person = self.dbstate.db.get_person_from_handle(phandle)
|
person = self.dbstate.db.get_person_from_handle(phandle)
|
||||||
person.remove_handle_references('Person',handle)
|
person.remove_handle_references('Person',handle)
|
||||||
@ -721,12 +719,10 @@ class PersonView(PageView.PersonNavView):
|
|||||||
else:
|
else:
|
||||||
col,text,inv = self.search_bar.get_value()
|
col,text,inv = self.search_bar.get_value()
|
||||||
func = lambda x: self.model.on_get_value(x, col) or u""
|
func = lambda x: self.model.on_get_value(x, col) or u""
|
||||||
print col, PeopleModel._GENDER_COL
|
|
||||||
if col == PeopleModel._GENDER_COL:
|
if col == PeopleModel._GENDER_COL:
|
||||||
data_filter = ExactSearchFilter(func, text, inv)
|
data_filter = ExactSearchFilter(func, text, inv)
|
||||||
else:
|
else:
|
||||||
data_filter = SearchFilter(func, text, inv)
|
data_filter = SearchFilter(func, text, inv)
|
||||||
print data_filter
|
|
||||||
|
|
||||||
self.model.clear_cache()
|
self.model.clear_cache()
|
||||||
for node in handle_list:
|
for node in handle_list:
|
||||||
|
@ -476,19 +476,19 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback):
|
|||||||
format = format + (True,)
|
format = format + (True,)
|
||||||
self.name_formats[format_ix] = format
|
self.name_formats[format_ix] = format
|
||||||
# bookmarks
|
# bookmarks
|
||||||
self.bookmarks = self.metadata.get('bookmarks',default=[])
|
self.bookmarks.set(self.metadata.get('bookmarks',default=[]))
|
||||||
self.family_bookmarks = self.metadata.get('family_bookmarks',
|
self.family_bookmarks.set(self.metadata.get('family_bookmarks',
|
||||||
default=[])
|
default=[]))
|
||||||
self.event_bookmarks = self.metadata.get('event_bookmarks',
|
self.event_bookmarks.set(self.metadata.get('event_bookmarks',
|
||||||
default=[])
|
default=[]))
|
||||||
self.source_bookmarks = self.metadata.get('source_bookmarks',
|
self.source_bookmarks.set(self.metadata.get('source_bookmarks',
|
||||||
default=[])
|
default=[]))
|
||||||
self.repo_bookmarks = self.metadata.get('repo_bookmarks',
|
self.repo_bookmarks.set(self.metadata.get('repo_bookmarks',
|
||||||
default=[])
|
default=[]))
|
||||||
self.media_bookmarks = self.metadata.get('media_bookmarks',
|
self.media_bookmarks.set(self.metadata.get('media_bookmarks',
|
||||||
default=[])
|
default=[]))
|
||||||
self.place_bookmarks = self.metadata.get('place_bookmarks',
|
self.place_bookmarks.set(self.metadata.get('place_bookmarks',
|
||||||
default=[])
|
default=[]))
|
||||||
# Custom type values
|
# Custom type values
|
||||||
self.family_event_names = set(self.metadata.get('fevent_names',
|
self.family_event_names = set(self.metadata.get('fevent_names',
|
||||||
default=[]))
|
default=[]))
|
||||||
@ -987,19 +987,22 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback):
|
|||||||
|
|
||||||
# name display formats
|
# name display formats
|
||||||
self.metadata.put('name_formats',self.name_formats,txn=the_txn)
|
self.metadata.put('name_formats',self.name_formats,txn=the_txn)
|
||||||
|
|
||||||
# bookmarks
|
# bookmarks
|
||||||
self.metadata.put('bookmarks',self.bookmarks,txn=the_txn)
|
self.metadata.put('bookmarks',self.bookmarks.get(),txn=the_txn)
|
||||||
self.metadata.put('family_bookmarks',self.family_bookmarks,
|
self.metadata.put('family_bookmarks',self.family_bookmarks.get(),
|
||||||
txn=the_txn)
|
txn=the_txn)
|
||||||
self.metadata.put('event_bookmarks',self.event_bookmarks,
|
self.metadata.put('event_bookmarks',self.event_bookmarks.get(),
|
||||||
txn=the_txn)
|
txn=the_txn)
|
||||||
self.metadata.put('source_bookmarks',self.source_bookmarks,
|
self.metadata.put('source_bookmarks',self.source_bookmarks.get(),
|
||||||
txn=the_txn)
|
txn=the_txn)
|
||||||
self.metadata.put('place_bookmarks',self.place_bookmarks,
|
self.metadata.put('place_bookmarks',self.place_bookmarks.get(),
|
||||||
txn=the_txn)
|
txn=the_txn)
|
||||||
self.metadata.put('repo_bookmarks',self.repo_bookmarks,txn=the_txn)
|
self.metadata.put('repo_bookmarks',self.repo_bookmarks.get(),
|
||||||
self.metadata.put('media_bookmarks',self.media_bookmarks,
|
|
||||||
txn=the_txn)
|
txn=the_txn)
|
||||||
|
self.metadata.put('media_bookmarks',self.media_bookmarks.get(),
|
||||||
|
txn=the_txn)
|
||||||
|
|
||||||
# gender stats
|
# gender stats
|
||||||
self.metadata.put('gender_stats',self.genderStats.save_stats(),
|
self.metadata.put('gender_stats',self.genderStats.save_stats(),
|
||||||
txn=the_txn)
|
txn=the_txn)
|
||||||
|
@ -154,6 +154,28 @@ class GrampsCursor:
|
|||||||
"""
|
"""
|
||||||
pass
|
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):
|
class GrampsDbBase(GrampsDBCallback):
|
||||||
"""
|
"""
|
||||||
GRAMPS database object. This object is a base class for all
|
GRAMPS database object. This object is a base class for all
|
||||||
@ -273,13 +295,13 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
self.default = None
|
self.default = None
|
||||||
self.owner = Researcher()
|
self.owner = Researcher()
|
||||||
self.name_formats = []
|
self.name_formats = []
|
||||||
self.bookmarks = []
|
self.bookmarks = GrampsDbBookmarks()
|
||||||
self.family_bookmarks = []
|
self.family_bookmarks = GrampsDbBookmarks()
|
||||||
self.event_bookmarks = []
|
self.event_bookmarks = GrampsDbBookmarks()
|
||||||
self.place_bookmarks = []
|
self.place_bookmarks = GrampsDbBookmarks()
|
||||||
self.source_bookmarks = []
|
self.source_bookmarks = GrampsDbBookmarks()
|
||||||
self.repo_bookmarks = []
|
self.repo_bookmarks = GrampsDbBookmarks()
|
||||||
self.media_bookmarks = []
|
self.media_bookmarks = GrampsDbBookmarks()
|
||||||
self.path = ""
|
self.path = ""
|
||||||
self.name_group = {}
|
self.name_group = {}
|
||||||
|
|
||||||
|
@ -78,6 +78,7 @@ import GrampsWidgets
|
|||||||
import UndoHistory
|
import UndoHistory
|
||||||
from DbLoader import DbLoader
|
from DbLoader import DbLoader
|
||||||
import GrampsDisplay
|
import GrampsDisplay
|
||||||
|
|
||||||
def show_url(dialog,link,user_data):
|
def show_url(dialog,link,user_data):
|
||||||
GrampsDisplay.url(link)
|
GrampsDisplay.url(link)
|
||||||
gtk.about_dialog_set_url_hook(show_url,None)
|
gtk.about_dialog_set_url_hook(show_url,None)
|
||||||
|
Loading…
Reference in New Issue
Block a user