Fix StatusBar for potential HandleError
This commit is contained in:
parent
3601877a63
commit
1ce63261c3
@ -64,6 +64,7 @@ from .managedwindow import GrampsWindowManager
|
|||||||
from gramps.gen.relationship import get_relationship_calculator
|
from gramps.gen.relationship import get_relationship_calculator
|
||||||
from .glade import Glade
|
from .glade import Glade
|
||||||
from gramps.gen.utils.db import navigation_label
|
from gramps.gen.utils.db import navigation_label
|
||||||
|
from gramps.gen.errors import HandleError
|
||||||
from .widgets.progressdialog import ProgressMonitor, GtkProgressDialog
|
from .widgets.progressdialog import ProgressMonitor, GtkProgressDialog
|
||||||
from .dialog import ErrorDialog
|
from .dialog import ErrorDialog
|
||||||
from .uimanager import ActionGroup
|
from .uimanager import ActionGroup
|
||||||
@ -623,6 +624,14 @@ class DisplayState(Callback):
|
|||||||
self.status.clear_filter()
|
self.status.clear_filter()
|
||||||
|
|
||||||
def modify_statusbar(self, dbstate, active=None):
|
def modify_statusbar(self, dbstate, active=None):
|
||||||
|
""" Update the status bar with current object info.
|
||||||
|
|
||||||
|
Since this is called via GLib.timeout_add it can happen at any time
|
||||||
|
Gtk is idle or processing pending events. Even in the midst of a
|
||||||
|
multiple delete, before the GUI has been updated for missing objects.
|
||||||
|
So it is susceptible to HandleErrors for missing data, thus the 'try'.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
view = self.viewmanager.active_page
|
view = self.viewmanager.active_page
|
||||||
if not isinstance(view, NavigationView) or dbstate is None:
|
if not isinstance(view, NavigationView) or dbstate is None:
|
||||||
return
|
return
|
||||||
@ -633,9 +642,11 @@ class DisplayState(Callback):
|
|||||||
self.status.pop(self.status_id)
|
self.status.pop(self.status_id)
|
||||||
|
|
||||||
if active_handle and dbstate.is_open():
|
if active_handle and dbstate.is_open():
|
||||||
name, obj = navigation_label(dbstate.db, nav_type, active_handle)
|
name, _obj = navigation_label(dbstate.db, nav_type,
|
||||||
# Append relationship to default person if funtionality is enabled.
|
active_handle)
|
||||||
if nav_type == 'Person' and config.get('interface.statusbar') > 1:
|
# Append relationship to default person if enabled.
|
||||||
|
if(nav_type == 'Person' and
|
||||||
|
config.get('interface.statusbar') > 1):
|
||||||
if active_handle != dbstate.db.get_default_handle():
|
if active_handle != dbstate.db.get_default_handle():
|
||||||
msg = self.display_relationship(dbstate, active_handle)
|
msg = self.display_relationship(dbstate, active_handle)
|
||||||
if msg:
|
if msg:
|
||||||
@ -648,6 +659,8 @@ class DisplayState(Callback):
|
|||||||
|
|
||||||
self.status.push(self.status_id, name)
|
self.status.push(self.status_id, name)
|
||||||
process_pending_events()
|
process_pending_events()
|
||||||
|
except HandleError:
|
||||||
|
return
|
||||||
|
|
||||||
def pulse_progressbar(self, value, text=None):
|
def pulse_progressbar(self, value, text=None):
|
||||||
self.progress.set_fraction(min(value/100.0, 1.0))
|
self.progress.set_fraction(min(value/100.0, 1.0))
|
||||||
|
Loading…
Reference in New Issue
Block a user