code: def __sort_toplevel_items(self):
          
          if self.show_all_files is False:
              return
  
          current_ordered_items = [self.topLevelItem(index) for index in
                                   range(self.topLevelItemCount())]
          if self.sort_files_alphabetically:
              new_ordered_items = sorted(
                  current_ordered_items,
                  key=lambda item: osp.basename(item.path.lower()))
          else:
              new_ordered_items = [
                  self.editor_items.get(e_id) for e_id in
                  self.ordered_editor_ids if
                  self.editor_items.get(e_id) is not None]
  
          if current_ordered_items != new_ordered_items:
              selected_items = self.selectedItems()
              self.save_expanded_state()
              for index in range(self.topLevelItemCount()):
                  self.takeTopLevelItem(0)
              for index, item in enumerate(new_ordered_items):
                  self.insertTopLevelItem(index, item)
              self.restore_expanded_state()
              self.clearSelection()
              if selected_items:
                  selected_items[-1].setSelected(True)
docs: Sort the root file items in alphabetical order if
          'sort_files_alphabetically' is True, else order the items as
          specified in the 'self.ordered_editor_ids' list.