4669: Long transactions can cause unwanted effects in TreeViews
svn: r17422
This commit is contained in:
parent
4f9b943705
commit
66efd796c5
@ -1749,6 +1749,17 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
|||||||
self.bsddbtxn.abort()
|
self.bsddbtxn.abort()
|
||||||
self.bsddbtxn = None
|
self.bsddbtxn = None
|
||||||
self.txn = None
|
self.txn = None
|
||||||
|
if not transaction.batch:
|
||||||
|
# It can occur that the listview is already updated because of
|
||||||
|
# the "model-treeview automatic update" combined with a
|
||||||
|
# "while gtk.events_pending(): gtk.main_iteration() loop"
|
||||||
|
# (typically used in a progress bar), so emit rebuild signals
|
||||||
|
# to correct that.
|
||||||
|
object_types = set([x[0] for x in transaction.keys()])
|
||||||
|
for object_type in object_types:
|
||||||
|
if object_type == REFERENCE_KEY:
|
||||||
|
continue
|
||||||
|
self.emit('%s-rebuild' % KEY_TO_NAME_MAP[object_type], ())
|
||||||
self.transaction = None
|
self.transaction = None
|
||||||
transaction.clear()
|
transaction.clear()
|
||||||
transaction.first = None
|
transaction.first = None
|
||||||
|
@ -261,7 +261,7 @@ class Tags(DbGUIElement):
|
|||||||
view = self.uistate.viewmanager.active_page
|
view = self.uistate.viewmanager.active_page
|
||||||
selected = view.selected_handles()
|
selected = view.selected_handles()
|
||||||
pmon = progressdlg.ProgressMonitor(progressdlg.GtkProgressDialog,
|
pmon = progressdlg.ProgressMonitor(progressdlg.GtkProgressDialog,
|
||||||
popup_time=2)
|
("", self.uistate.window, gtk.DIALOG_MODAL), popup_time=2)
|
||||||
status = progressdlg.LongOpStatus(msg=_("Adding Tags"),
|
status = progressdlg.LongOpStatus(msg=_("Adding Tags"),
|
||||||
total_steps=len(selected),
|
total_steps=len(selected),
|
||||||
interval=len(selected)//20)
|
interval=len(selected)//20)
|
||||||
@ -496,7 +496,7 @@ class OrganizeTagsDialog(object):
|
|||||||
|
|
||||||
links = [link for link in self.db.find_backlink_handles(tag_handle)]
|
links = [link for link in self.db.find_backlink_handles(tag_handle)]
|
||||||
pmon = progressdlg.ProgressMonitor(progressdlg.GtkProgressDialog,
|
pmon = progressdlg.ProgressMonitor(progressdlg.GtkProgressDialog,
|
||||||
popup_time=2)
|
("", self.uistate.window, gtk.DIALOG_MODAL), popup_time=2)
|
||||||
status = progressdlg.LongOpStatus(msg=_("Removing Tags"),
|
status = progressdlg.LongOpStatus(msg=_("Removing Tags"),
|
||||||
total_steps=len(links),
|
total_steps=len(links),
|
||||||
interval=len(links)//20)
|
interval=len(links)//20)
|
||||||
|
@ -579,6 +579,8 @@ class FlatBaseModel(gtk.GenericTreeModel):
|
|||||||
Add a row. This is called after object with handle is created.
|
Add a row. This is called after object with handle is created.
|
||||||
Row is only added if search/filter data is such that it must be shown
|
Row is only added if search/filter data is such that it must be shown
|
||||||
"""
|
"""
|
||||||
|
if self.node_map.get_path(handle) is not None:
|
||||||
|
return # row is already displayed
|
||||||
data = self.map(handle)
|
data = self.map(handle)
|
||||||
insert_val = (map(conv_unicode_tosrtkey_ongtk, self.sort_func(data)),
|
insert_val = (map(conv_unicode_tosrtkey_ongtk, self.sort_func(data)),
|
||||||
handle)
|
handle)
|
||||||
|
@ -666,6 +666,8 @@ class TreeBaseModel(gtk.GenericTreeModel):
|
|||||||
"""
|
"""
|
||||||
Add a row to the model.
|
Add a row to the model.
|
||||||
"""
|
"""
|
||||||
|
if self.get_node(handle) is not None:
|
||||||
|
return # row already exists
|
||||||
cput = time.clock()
|
cput = time.clock()
|
||||||
if not self.search or \
|
if not self.search or \
|
||||||
(self.search and self.search.match(handle, self.db)):
|
(self.search and self.search.match(handle, self.db)):
|
||||||
|
Loading…
Reference in New Issue
Block a user