Don't append mode to mode stack if it's already

This commit is contained in:
Florian Bruhin 2014-04-24 07:44:54 +02:00
parent b9d845180e
commit ff887c647d

View File

@ -111,6 +111,9 @@ class ModeManager(QObject):
logging.debug("Switching mode to {}".format(mode))
if mode not in self._handlers:
raise ValueError("No handler for mode {}".format(mode))
if self._mode_stack and self._mode_stack[-1] == mode:
logging.debug("Already at end of stack, doing nothing")
return
self._mode_stack.append(mode)
logging.debug("New mode stack: {}".format(self._mode_stack))
self.entered.emit(mode)