Significant improvements to bookmark dock display

This commit is contained in:
BasioMeusPuga
2018-03-28 00:46:12 +05:30
parent 5fa724ae69
commit 66c8626d43
6 changed files with 80 additions and 42 deletions

View File

@@ -83,8 +83,9 @@ class LibraryDelegate(QtWidgets.QStyledItemDelegate):
class BookmarkDelegate(QtWidgets.QStyledItemDelegate):
def __init__(self, parent=None):
super(BookmarkDelegate, self).__init__(parent)
def __init__(self, main_window, parent=None):
super(BookmarkDelegate, self).__init__()
self.main_window = main_window
self.parent = parent
def sizeHint(self, *args):
@@ -98,7 +99,7 @@ class BookmarkDelegate(QtWidgets.QStyledItemDelegate):
option = option.__class__(option)
chapter_index = index.data(QtCore.Qt.UserRole)
chapter_name = self.parent.window().bookToolBar.tocBox.itemText(chapter_index - 1)
chapter_name = self.main_window.bookToolBar.tocBox.itemText(chapter_index - 1)
if len(chapter_name) > 25:
chapter_name = chapter_name[:25] + '...'