code: def qteMakeWidgetActive(self, widgetObj: QtGui.QWidget):
          if widgetObj is None:
              self._qteActiveWidget = None
              return
          if qteGetAppletFromWidget(widgetObj) is not self:
              msg = 'The specified widget is not inside the current applet.'
              raise QtmacsOtherError(msg)
          if not hasattr(widgetObj, '_qteAdmin'):
              self._qteActiveWidget = widgetObj
              return
          if widgetObj._qteAdmin.isQtmacsApplet:
              self._qteActiveWidget = None
              return
          self.qteAutoremoveDeletedWidgets()
          if widgetObj not in self._qteAdmin.widgetList:
              msg = 'Widget is not registered for this applet.'
              self.qteLogger.error(msg, stack_info=True)
              self._qteActiveWidget = None
              return
          self.qteSetWidgetFocusOrder((self._qteActiveWidget, widgetObj))
          self._qteActiveWidget = widgetObj