code: def update_browse_tabs_menu(self):
          
          self.browse_tabs_menu.clear()
          names = []
          dirnames = []
          for index in range(self.count()):
              if self.menu_use_tooltips:
                  text = to_text_string(self.tabToolTip(index))
              else:
                  text = to_text_string(self.tabText(index))
              names.append(text)
              if osp.isfile(text):
                  # Testing if tab names are filenames
                  dirnames.append(osp.dirname(text))
          offset = None
          
          # If tab names are all filenames, removing common path:
          if len(names) == len(dirnames):
              common = get_common_path(dirnames)
              if common is None:
                  offset = None
              else:
                  offset = len(common)+1
                  if offset <= 3:
                      # Common path is not a path but a drive letter...
                      offset = None
  
          for index, text in enumerate(names):
              tab_action = create_action(self, text[offset:],
                                         icon=self.tabIcon(index),
                                         toggled=lambda state, index=index:
                                                 self.setCurrentIndex(index),
                                         tip=self.tabToolTip(index))
              tab_action.setChecked(index == self.currentIndex())
              self.browse_tabs_menu.addAction(tab_action)
docs: Update browse tabs menu