code: def get_focus_widget_properties(self):
          
          from spyder.plugins.editor.widgets.editor import TextEditBaseWidget
          from spyder.plugins.ipythonconsole.widgets import ControlWidget
          widget = QApplication.focusWidget()
  
          textedit_properties = None
          if isinstance(widget, (TextEditBaseWidget, ControlWidget)):
              console = isinstance(widget, ControlWidget)
              not_readonly = not widget.isReadOnly()
              readwrite_editor = not_readonly and not console
              textedit_properties = (console, not_readonly, readwrite_editor)
          return widget, textedit_properties
docs: Get properties of focus widget
          Returns tuple (widget, properties) where properties is a tuple of
          booleans: (is_console, not_readonly, readwrite_editor)