code: def on_state_changed(self, state):
          
          if state:
              self.action.triggered.connect(self.comment)
              self.editor.add_action(self.action, sub_menu='Python')
              if 'pyqt5' in os.environ['QT_API'].lower():
                  self.editor.key_pressed.connect(self.on_key_pressed)
          else:
              self.editor.remove_action(self.action, sub_menu='Python')
              self.action.triggered.disconnect(self.comment)
              if 'pyqt5' in os.environ['QT_API'].lower():
                  self.editor.key_pressed.disconnect(self.on_key_pressed)
docs: Called when the mode is activated/deactivated