toggle-selection cleanup

This commit is contained in:
Florian Bruhin 2015-05-13 21:52:42 +02:00
parent f59a147589
commit a728704cce
2 changed files with 4 additions and 4 deletions

View File

@ -1423,7 +1423,7 @@ class CommandDispatcher:
widget.selection_enabled = not widget.selection_enabled widget.selection_enabled = not widget.selection_enabled
mainwindow = objreg.get('main-window', scope='window', mainwindow = objreg.get('main-window', scope='window',
window=self._win_id) window=self._win_id)
mainwindow.status.on_mode_entered(usertypes.KeyMode.caret) mainwindow.status.set_mode_active(usertypes.KeyMode.caret, True)
@cmdutils.register(instance='command-dispatcher', hide=True, @cmdutils.register(instance='command-dispatcher', hide=True,
modes=[KeyMode.caret], scope='window') modes=[KeyMode.caret], scope='window')

View File

@ -273,7 +273,7 @@ class StatusBar(QWidget):
"""Getter for caret_selection_active, so it can be used as property.""" """Getter for caret_selection_active, so it can be used as property."""
return self._caret_selection_active return self._caret_selection_active
def _set_mode_active(self, mode, val): def set_mode_active(self, mode, val):
"""Setter for self.{insert,caret}_active. """Setter for self.{insert,caret}_active.
Re-set the stylesheet after setting the value, so everything gets Re-set the stylesheet after setting the value, so everything gets
@ -474,7 +474,7 @@ class StatusBar(QWidget):
if mode in mode_manager.passthrough: if mode in mode_manager.passthrough:
self._set_mode_text(mode.name) self._set_mode_text(mode.name)
if mode in (usertypes.KeyMode.insert, usertypes.KeyMode.caret): if mode in (usertypes.KeyMode.insert, usertypes.KeyMode.caret):
self._set_mode_active(mode, True) self.set_mode_active(mode, True)
@pyqtSlot(usertypes.KeyMode, usertypes.KeyMode) @pyqtSlot(usertypes.KeyMode, usertypes.KeyMode)
def on_mode_left(self, old_mode, new_mode): def on_mode_left(self, old_mode, new_mode):
@ -487,7 +487,7 @@ class StatusBar(QWidget):
else: else:
self.txt.set_text(self.txt.Text.normal, '') self.txt.set_text(self.txt.Text.normal, '')
if old_mode in (usertypes.KeyMode.insert, usertypes.KeyMode.caret): if old_mode in (usertypes.KeyMode.insert, usertypes.KeyMode.caret):
self._set_mode_active(old_mode, False) self.set_mode_active(old_mode, False)
@config.change_filter('ui', 'message-timeout') @config.change_filter('ui', 'message-timeout')
def set_pop_timer_interval(self): def set_pop_timer_interval(self):