code: def qteRemoveAppletFromLayout(self, applet: (QtmacsApplet, str)):
          if isinstance(applet, str):
              appletObj = self.qteGetAppletHandle(applet)
          else:
              appletObj = applet
          for window in self._qteWindowList:
              split = self._qteFindAppletInSplitter(
                  appletObj, window.qteAppletSplitter)
              if split is not None:
                  break
          if split is None:
              return
          if (split is window.qteAppletSplitter) and (split.count() == 1):
              split.widget(0).hide(True)
              nextApp = self.qteNextApplet(windowObj=window)
              if nextApp is None:
                  nextApp = self.qteNextApplet(skipInvisible=False,
                                               skipVisible=True)
                  if nextApp is None:
                      return
              split.qteAddWidget(nextApp)
              return
          appletIdx = split.indexOf(appletObj)
          appletObj.hide(True)
          if split.count() != 1:
              msg = ('Splitter has <b>{}</b> elements left instead of'
                     ' exactly one.'.format(split.count()))
              self.qteLogger.warning(msg)
          otherWidget = split.widget(0)
          if otherWidget._qteAdmin.widgetSignature == '__QtmacsLayoutSplitter__':
              for ii in range(otherWidget.count()):
                  obj = otherWidget.widget(0)
                  if appletIdx == 0:
                      split.qteAddWidget(obj)
                  else:
                      split.qteInsertWidget(1 + ii, obj)
              otherWidget.setParent(None)
              otherWidget.close()
          else:
              if split is not window.qteAppletSplitter:
                  otherWidget.qteReparent(split.parent())
                  split.setParent(None)
                  split.close()