* src/QuestionDialog.py: close window before calling callback

if the view is not in focus. Fix delete display by calling build_tree


svn: r7944
This commit is contained in:
Don Allingham 2007-01-21 00:16:08 +00:00
parent 76c966b2b6
commit bb4205598c
3 changed files with 16 additions and 32 deletions

View File

@ -1,7 +1,8 @@
2007-01-20 Don Allingham <don@gramps-project.org> 2007-01-20 Don Allingham <don@gramps-project.org>
* src/QuestionDialog.py: close window before calling callback
* src/DataViews/_PersonView.py (PersonView.change_db): apply * src/DataViews/_PersonView.py (PersonView.change_db): apply
dirty flag to initial build to prevent forcing of build on load dirty flag to initial build to prevent forcing of build on load
if the view is not in focus. if the view is not in focus. Fix delete display by calling build_tree
2007-01-20 Alex Roitman <shura@gramps-project.org> 2007-01-20 Alex Roitman <shura@gramps-project.org>
* src/DataViews/_EventView.py (remove): Use reference map to find * src/DataViews/_EventView.py (remove): Use reference map to find

View File

@ -507,7 +507,7 @@ class PersonView(PageView.PersonNavView):
self.search_bar.setup_filter(cols) self.search_bar.setup_filter(cols)
def build_tree(self): def build_tree(self, skip=[]):
""" """
Creates a new PeopleModel instance. Essentially creates a complete Creates a new PeopleModel instance. Essentially creates a complete
rebuild of the data. We need to temporarily store the active person, rebuild of the data. We need to temporarily store the active person,
@ -519,8 +519,7 @@ class PersonView(PageView.PersonNavView):
else: else:
filter_info = (PeopleModel.SEARCH, self.search_bar.get_value()) filter_info = (PeopleModel.SEARCH, self.search_bar.get_value())
self.model = PeopleModel(self.dbstate.db, filter_info) self.model = PeopleModel(self.dbstate.db, filter_info, skip)
active = self.dbstate.active active = self.dbstate.active
self.tree.set_model(self.model) self.tree.set_model(self.model)
@ -602,7 +601,6 @@ class PersonView(PageView.PersonNavView):
self.delete_person_response) self.delete_person_response)
def delete_person_response(self): def delete_person_response(self):
#self.disable_interface()
self.uistate.set_busy_cursor(1) self.uistate.set_busy_cursor(1)
trans = self.dbstate.db.transaction_begin() trans = self.dbstate.db.transaction_begin()
@ -759,36 +757,21 @@ class PersonView(PageView.PersonNavView):
else: else:
self.dirty = True self.dirty = True
def func(self, tree, path, ex_list):
ex_list.append(self.model.top_path2iter[path[0]])
def person_removed(self, handle_list): def person_removed(self, handle_list):
if not self.model: if not self.model:
return return
if Config.get(Config.FILTER):
data_filter = self.generic_filter
else:
col, text, inv = self.search_bar.get_value()
func = lambda x: self.model.on_get_value(x, col) or u""
if col == PeopleModel._GENDER_COL:
data_filter = ExactSearchFilter(func, text, inv)
else:
data_filter = SearchFilter(func, text, inv)
self.model.clear_cache() expand = []
for node in handle_list: self.tree.map_expanded_rows(self.func, expand)
person = self.dbstate.db.get_person_from_handle(node)
top = person.get_primary_name().get_group_name() self.build_tree(handle_list)
mylist = self.model.sname_sub.get(top, []) for i in expand:
self.model.calculate_data(data_filter, skip=set(handle_list)) path = self.model.top_iter2path.get(i)
if mylist: if path:
try: self.tree.expand_row(path, False)
path = self.model.on_get_path(node)
self.model.row_deleted(path)
if len(mylist) == 1:
path = self.model.on_get_path(top)
self.model.row_deleted(path)
except KeyError:
pass
self.model.assign_data()
def person_updated(self, handle_list): def person_updated(self, handle_list):
if not self.model: if not self.model:

View File

@ -99,9 +99,9 @@ class QuestionDialog:
if parent: if parent:
self.top.set_transient_for(parent) self.top.set_transient_for(parent)
response = self.top.run() response = self.top.run()
self.top.destroy()
if response == gtk.RESPONSE_ACCEPT: if response == gtk.RESPONSE_ACCEPT:
task() task()
self.top.destroy()
class QuestionDialog2: class QuestionDialog2:
def __init__(self,msg1,msg2,label_msg1,label_msg2,parent=None): def __init__(self,msg1,msg2,label_msg1,label_msg2,parent=None):