'Update browse tabs menu'

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):
            dirnames.append(osp.dirname(text))
    offset = None
    if (len(names) == len(dirnames)):
        common = get_common_path(dirnames)
        if (common is None):
            offset = None
        else:
            offset = (len(common) + 1)
            if (offset <= 3):
                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)
