Make get_modeman private again.

This commit is contained in:
Florian Bruhin 2015-05-13 22:27:54 +02:00
parent 222627b08d
commit bc54eb8671

View File

@ -97,25 +97,25 @@ def init(win_id, parent):
return modeman return modeman
def get_modeman(win_id): def _get_modeman(win_id):
"""Get a modemanager object.""" """Get a modemanager object."""
return objreg.get('mode-manager', scope='window', window=win_id) return objreg.get('mode-manager', scope='window', window=win_id)
def enter(win_id, mode, reason=None, only_if_normal=False): def enter(win_id, mode, reason=None, only_if_normal=False):
"""Enter the mode 'mode'.""" """Enter the mode 'mode'."""
get_modeman(win_id).enter(mode, reason, only_if_normal) _get_modeman(win_id).enter(mode, reason, only_if_normal)
def leave(win_id, mode, reason=None): def leave(win_id, mode, reason=None):
"""Leave the mode 'mode'.""" """Leave the mode 'mode'."""
get_modeman(win_id).leave(mode, reason) _get_modeman(win_id).leave(mode, reason)
def maybe_leave(win_id, mode, reason=None): def maybe_leave(win_id, mode, reason=None):
"""Convenience method to leave 'mode' without exceptions.""" """Convenience method to leave 'mode' without exceptions."""
try: try:
get_modeman(win_id).leave(mode, reason) _get_modeman(win_id).leave(mode, reason)
except NotInModeError as e: except NotInModeError as e:
# This is rather likely to happen, so we only log to debug log. # This is rather likely to happen, so we only log to debug log.
log.modes.debug("{} (leave reason: {})".format(e, reason)) log.modes.debug("{} (leave reason: {})".format(e, reason))