def on_state_changed(self, state):
if state:<EOL><INDENT>self.action.triggered.connect(self.comment)<EOL>self.editor.add_action(self.action, sub_menu='<STR_LIT>')<EOL>if '<STR_LIT>' in os.environ['<STR_LIT>'].lower():<EOL><INDENT>self.editor.key_pressed.connect(self.on_key_pressed)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>self.editor.remove_action(self.action, sub_menu='<STR_LIT>')<EOL>self.action.triggered.disconnect(self.comment)<EOL>if '<STR_LIT>' in os.environ['<STR_LIT>'].lower():<EOL><INDENT>self.editor.key_pressed.disconnect(self.on_key_pressed)<EOL><DEDENT><DEDENT>
Called when the mode is activated/deactivated