def qteNewApplet(self, appletName: str, appletID: str=None,
                     windowObj: QtmacsWindow=None):
        if windowObj is None:
            windowObj = self.qteActiveWindow()
            if windowObj is None:
                msg = 'Cannot determine the currently active window.'
                self.qteLogger.error(msg, stack_info=True)
                return
        if appletID is None:
            cnt = 0
            while True:
                appletID = appletName + '_' + str(cnt)
                if self.qteGetAppletHandle(appletID) is None:
                    break
                else:
                    cnt += 1
        if self.qteGetAppletHandle(appletID) is not None:
            msg = 'Applet with ID <b>{}</b> already exists'.format(appletID)
            self.qteLogger.error(msg, stack_info=True)
            return None
        if appletName not in self._qteRegistryApplets:
            msg = 'Unknown applet <b>{}</b>'.format(appletName)
            self.qteLogger.error(msg, stack_info=True)
            return None
        else:
            cls = self._qteRegistryApplets[appletName]
        try:
            app = cls(appletID)
        except Exception:
            msg = 'Applet <b>{}</b> has a faulty constructor.'.format(appletID)
            self.qteLogger.exception(msg, exc_info=True, stack_info=True)
            return None
        if app.qteAppletSignature() is None:
            msg = 'Cannot add applet <b>{}</b> '.format(app.qteAppletID())
            msg += 'because it has not applet signature.'
            msg += ' Use self.qteSetAppletSignature in the constructor'
            msg += ' of the class to fix this.'
            self.qteLogger.error(msg, stack_info=True)
            return None
        self._qteAppletList.insert(0, app)
        if app.layout() is None:
            appLayout = QtGui.QHBoxLayout()
            for handle in app._qteAdmin.widgetList:
                appLayout.addWidget(handle)
            app.setLayout(appLayout)
        app.qteReparent(None)
        self.qteRunHook('init', QtmacsMessage(None, app))
        return app