Fix event filter when a non-Mainwindow dialog has an event.

This commit is contained in:
Florian Bruhin 2014-09-28 22:53:24 +02:00
parent 16c067e32d
commit 9533312e0d
2 changed files with 9 additions and 3 deletions

View File

@ -121,7 +121,7 @@ class EventFilter(QObject):
window='current')
return modeman.eventFilter(obj, event)
except objreg.RegistryUnavailableError:
# No window available yet
# No window available yet, or not a MainWindow
return False
except:
# If there is an exception in here and we leave the eventfilter

View File

@ -99,7 +99,10 @@ def _get_registry(scope, window):
widget = tabbed_browser.currentWidget()
if widget is None:
raise RegistryUnavailableError(scope)
return widget.registry
try:
return widget.registry
except AttributeError:
raise RegistryUnavailableError(scope)
elif scope == 'window':
if window is None:
raise TypeError("window is None with scope window!")
@ -113,7 +116,10 @@ def _get_registry(scope, window):
win = window_registry[window]
except KeyError:
raise RegistryUnavailableError(scope)
return win.registry
try:
return win.registry
except AttributeError:
raise RegistryUnavailableError(scope)
elif scope == 'meta':
return meta_registry
else: