def _qteRunQueuedMacro(self, macroName: str,
                           widgetObj: QtGui.QWidget=None,
                           keysequence: QtmacsKeysequence=None):
        app = qteGetAppletFromWidget(widgetObj)
        if app is not None:
            if sip.isdeleted(app):
                msg = 'Ignored macro <b>{}</b> because it targeted a'
                msg += '  nonexistent applet.'.format(macroName)
                self.qteLogger.warning(msg)
                return
        macroObj = self.qteGetMacroObject(macroName, widgetObj)
        if macroObj is None:
            msg = 'No <b>{}</b>-macro compatible with {}:{}-type applet'
            msg = msg.format(macroName, app.qteAppletSignature(),
                             widgetObj._qteAdmin.widgetSignature)
            self.qteLogger.warning(msg)
            return
        self.qteDefVar('last_key_sequence', keysequence,
                       doc="Last valid key sequence that triggered a macro.")
        if app is None:
            macroObj.qteApplet = macroObj.qteWidget = None
        else:
            macroObj.qteApplet = app
            macroObj.qteWidget = widgetObj
        macroObj.qtePrepareToRun()