change __rebuild_search to use status bar progress

This commit is contained in:
prculley 2017-01-14 16:47:14 -06:00 committed by Nick Hall
parent 2574202a46
commit 04b7888817

View File

@ -528,11 +528,11 @@ class TreeBaseModel(GObject.GObject, Gtk.TreeModel, BaseModel):
Rebuild the data map for a single Gramps object type, where a search Rebuild the data map for a single Gramps object type, where a search
condition is applied. condition is applied.
""" """
pmon = progressdlg.ProgressMonitor(progressdlg.GtkProgressDialog, pmon = progressdlg.ProgressMonitor(
popup_time=2) progressdlg.StatusProgress, (self.uistate,), popup_time=2,
status = progressdlg.LongOpStatus(msg=_("Building View"), title=_("Loading items..."))
total_steps=items, interval=items//20, status = progressdlg.LongOpStatus(total_steps=items,
can_cancel=True) interval=items // 20)
pmon.add_op(status) pmon.add_op(status)
with gen_cursor() as cursor: with gen_cursor() as cursor:
for handle, data in cursor: for handle, data in cursor:
@ -540,15 +540,12 @@ class TreeBaseModel(GObject.GObject, Gtk.TreeModel, BaseModel):
if not isinstance(handle, str): if not isinstance(handle, str):
handle = handle.decode('utf-8') handle = handle.decode('utf-8')
status.heartbeat() status.heartbeat()
if status.should_cancel():
break
self.__total += 1 self.__total += 1
if not (handle in skip or (dfilter and not if not (handle in skip or (dfilter and not
dfilter.match(handle, self.db))): dfilter.match(handle, self.db))):
_LOG.debug(" add %s %s" % (handle, data)) _LOG.debug(" add %s %s" % (handle, data))
self.__displayed += 1 self.__displayed += 1
add_func(handle, data) add_func(handle, data)
if not status.was_cancelled():
status.end() status.end()
def _rebuild_filter(self, dfilter, dfilter2, skip): def _rebuild_filter(self, dfilter, dfilter2, skip):