Fix lint
This commit is contained in:
parent
cdb2e34513
commit
26604a683b
@ -91,6 +91,40 @@ meta_registry['global'] = global_registry
|
|||||||
window_registry = ObjectRegistry()
|
window_registry = ObjectRegistry()
|
||||||
|
|
||||||
|
|
||||||
|
def _get_tab_registry():
|
||||||
|
"""Get the registry of a tab."""
|
||||||
|
app = get('app')
|
||||||
|
win = app.activeWindow()
|
||||||
|
tabbed_browser = get('tabbed-browser', scope='window', window=win)
|
||||||
|
widget = tabbed_browser.currentWidget()
|
||||||
|
if widget is None:
|
||||||
|
raise RegistryUnavailableError('tab')
|
||||||
|
try:
|
||||||
|
return widget.registry
|
||||||
|
except AttributeError:
|
||||||
|
raise RegistryUnavailableError('tab')
|
||||||
|
|
||||||
|
|
||||||
|
def _get_window_registry(window):
|
||||||
|
"""Get the registry of a window."""
|
||||||
|
if window is None:
|
||||||
|
raise TypeError("window is None with scope window!")
|
||||||
|
if window is 'current':
|
||||||
|
app = get('app')
|
||||||
|
win = app.activeWindow()
|
||||||
|
if win is None:
|
||||||
|
raise RegistryUnavailableError('window')
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
win = window_registry[window]
|
||||||
|
except KeyError:
|
||||||
|
raise RegistryUnavailableError('window')
|
||||||
|
try:
|
||||||
|
return win.registry
|
||||||
|
except AttributeError:
|
||||||
|
raise RegistryUnavailableError('window')
|
||||||
|
|
||||||
|
|
||||||
def _get_registry(scope, window):
|
def _get_registry(scope, window):
|
||||||
"""Get the correct registry for a given scope."""
|
"""Get the correct registry for a given scope."""
|
||||||
if window is not None and scope is not 'window':
|
if window is not None and scope is not 'window':
|
||||||
@ -98,33 +132,9 @@ def _get_registry(scope, window):
|
|||||||
if scope == 'global':
|
if scope == 'global':
|
||||||
return global_registry
|
return global_registry
|
||||||
elif scope == 'tab':
|
elif scope == 'tab':
|
||||||
app = get('app')
|
return _get_tab_registry()
|
||||||
win = app.activeWindow()
|
|
||||||
tabbed_browser = get('tabbed-browser', scope='window', window=win)
|
|
||||||
widget = tabbed_browser.currentWidget()
|
|
||||||
if widget is None:
|
|
||||||
raise RegistryUnavailableError(scope)
|
|
||||||
try:
|
|
||||||
return widget.registry
|
|
||||||
except AttributeError:
|
|
||||||
raise RegistryUnavailableError(scope)
|
|
||||||
elif scope == 'window':
|
elif scope == 'window':
|
||||||
if window is None:
|
return _get_window_registry(window)
|
||||||
raise TypeError("window is None with scope window!")
|
|
||||||
if window is 'current':
|
|
||||||
app = get('app')
|
|
||||||
win = app.activeWindow()
|
|
||||||
if win is None:
|
|
||||||
raise RegistryUnavailableError(scope)
|
|
||||||
else:
|
|
||||||
try:
|
|
||||||
win = window_registry[window]
|
|
||||||
except KeyError:
|
|
||||||
raise RegistryUnavailableError(scope)
|
|
||||||
try:
|
|
||||||
return win.registry
|
|
||||||
except AttributeError:
|
|
||||||
raise RegistryUnavailableError(scope)
|
|
||||||
elif scope == 'meta':
|
elif scope == 'meta':
|
||||||
return meta_registry
|
return meta_registry
|
||||||
else:
|
else:
|
||||||
|
@ -228,9 +228,9 @@ class CompletionView(QTreeView):
|
|||||||
def selectionChanged(self, selected, deselected):
|
def selectionChanged(self, selected, deselected):
|
||||||
"""Extend selectionChanged to call completers selection_changed."""
|
"""Extend selectionChanged to call completers selection_changed."""
|
||||||
super().selectionChanged(selected, deselected)
|
super().selectionChanged(selected, deselected)
|
||||||
completer = objreg.get('completer', scope='window',
|
completer_obj = objreg.get('completer', scope='window',
|
||||||
window=self._win_id)
|
window=self._win_id)
|
||||||
completer.selection_changed(selected, deselected)
|
completer_obj.selection_changed(selected, deselected)
|
||||||
|
|
||||||
def resizeEvent(self, e):
|
def resizeEvent(self, e):
|
||||||
"""Extend resizeEvent to adjust column size."""
|
"""Extend resizeEvent to adjust column size."""
|
||||||
|
Loading…
Reference in New Issue
Block a user