'Get properties of focus widget
Returns tuple (widget, properties) where properties is a tuple of
booleans: (is_console, not_readonly, readwrite_editor)'

def get_focus_widget_properties(self):

    widget = QApplication.focusWidget()
    from spyder.widgets.shell import ShellBaseWidget
    from spyder.widgets.editor import TextEditBaseWidget
    from spyder.widgets.ipythonconsole import ControlWidget
    if (not isinstance(widget, (ShellBaseWidget, TextEditBaseWidget, ControlWidget))):
        widget = self.previous_focused_widget
    textedit_properties = None
    if isinstance(widget, (ShellBaseWidget, TextEditBaseWidget, ControlWidget)):
        console = isinstance(widget, (ShellBaseWidget, ControlWidget))
        not_readonly = (not widget.isReadOnly())
        readwrite_editor = (not_readonly and (not console))
        textedit_properties = (console, not_readonly, readwrite_editor)
    return (widget, textedit_properties)
