Fix #1797684 [Multiple "Split the book list" entries](https://bugs.launchpad.net/calibre/+bug/1797684)

This commit is contained in:
Kovid Goyal 2018-10-18 09:50:25 +05:30
parent 542c35a6cf
commit 934cb71e16
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -487,8 +487,9 @@ class BooksView(QTableView): # {{{
name = unicode(self.model().headerData(idx, Qt.Horizontal, Qt.DisplayRole) or '') name = unicode(self.model().headerData(idx, Qt.Horizontal, Qt.DisplayRole) or '')
view.column_header_context_menu = self.create_context_menu(col, name, view) view.column_header_context_menu = self.create_context_menu(col, name, view)
has_context_menu = hasattr(view, 'column_header_context_menu') has_context_menu = hasattr(view, 'column_header_context_menu')
if self.is_library_view and has_context_menu: if self.is_library_view and has_context_menu and not hasattr(view.column_header_context_menu, 'added_split_book_list_entry'):
view.column_header_context_menu.addSeparator() view.column_header_context_menu.addSeparator()
view.column_header_context_menu.added_split_book_list_entry = True
view.column_header_context_menu.addAction( view.column_header_context_menu.addAction(
_('Un-split the book list') if self.pin_view.isVisible() else _('Split the book list'), _('Un-split the book list') if self.pin_view.isVisible() else _('Split the book list'),
partial(self.column_header_context_handler, action='split', column=col or 'title')) partial(self.column_header_context_handler, action='split', column=col or 'title'))