code: def add_tab(self, widget):
          
          self.clients.append(widget)
          index = self.tabwidget.addTab(widget, widget.get_short_name())
          self.tabwidget.setCurrentIndex(index)
          self.tabwidget.setTabToolTip(index, widget.get_filename())
          if self.dockwidget and not self.ismaximized:
              self.dockwidget.setVisible(True)
              self.dockwidget.raise_()
          self.activateWindow()
          widget.notebookwidget.setFocus()
docs: Add tab.