docs: def qteNewApplet(self, appletName: str, appletID: str=None,
                       windowObj: QtmacsWindow=None):
          """
          Create a new instance of ``appletName`` and assign it the
          ``appletID``.
  
          This method creates a new instance of ``appletName``, as
          registered by the ``qteRegisterApplet`` method. If an applet
          with ``appletID`` already exists then the method does nothing
          and returns **None**, otherwise the newly created instance.
  
          If ``appletID`` is **None** then the method will create an
          applet with the next unique ID that fits the format
          ``appletName_0``, eg. 'RichEditor_0', 'RichEditor_1', etc.
  
          .. note:: The applet is not automatically made visible.
  
          |Args|
  
          * ``appletName`` (**str**): name of applet to create
            (eg. 'LogViewer')
          * ``appletID`` (**str**): unique applet identifier.
          * ``windowObj`` (**QtmacsWindow**): the window in which
            the applet should be created.
  
          |Returns|
  
          * **QtmacsApplet**: applet handle or **None** if no applet
            was created.
  
          |Raises|
  
          * **QtmacsArgumentError** if at least one argument has an invalid type.
          """
          # Use the currently active window if none was specified.
          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
  
          # Determine an automatic applet ID if none was provided.
          if appletID is None:
              cnt = 0
              while True:
                  appletID = appletName + '_' + str(cnt)
                  if self.qteGetAppletHandle(appletID) is None:
                      break
                  else:
                      cnt += 1
  
          # Return immediately if an applet with the same ID already
          # exists.
          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
  
          # Verify that the requested applet class was registered
          # beforehand and fetch it.
          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 to instantiate the class.
          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
  
          # Ensure the applet class has an applet signature.
          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
  
          # Add the applet to the list of instantiated Qtmacs applets.
          self._qteAppletList.insert(0, app)
  
          # If the new applet does not yet have an internal layout then
          # arrange all its children automatically. The layout used for
          # this is horizontal and the widgets are added in the order in
          # which they were registered with Qtmacs.
          if app.layout() is None:
              appLayout = QtGui.QHBoxLayout()
              for handle in app._qteAdmin.widgetList:
                  appLayout.addWidget(handle)
              app.setLayout(appLayout)
  
          # Initially, the window does not have a parent. A parent will
          # be assigned automatically once the applet is made visible,
          # in which case it is re-parented into a QtmacsSplitter.
          app.qteReparent(None)
  
          # Emit the init hook for this applet.
          self.qteRunHook('init', QtmacsMessage(None, app))
  
          # Return applet handle.
          return app