

def on_state_changed(self, state):
    if state:
        self.editor.new_text_set.connect(self._update_mtime)
        self.editor.new_text_set.connect(self._timer.start)
        self.editor.text_saving.connect(self._cancel_next_change)
        self.editor.text_saved.connect(self._update_mtime)
        self.editor.text_saved.connect(self._restart_monitoring)
        self.editor.focused_in.connect(self._check_for_pending)
    else:
        self._timer.stop()
        self.editor.new_text_set.connect(self._update_mtime)
        self.editor.new_text_set.connect(self._timer.start)
        state.editor.text_saving.disconnect(self._cancel_next_change)
        self.editor.text_saved.disconnect(self._restart_monitoring)
        self.editor.focused_in.disconnect(self._check_for_pending)
        self._timer.stop()

dataset/ETHPy150Open OpenCobolIDE/OpenCobolIDE/open_cobol_ide/extlibs/pyqode/core/modes/filewatcher.py FileWatcherMode.on_state_changed/VarMisuse@138/175 `self`->`state`