Major improvements to epub parser

This commit is contained in:
BasioMeusPuga
2018-03-10 15:56:04 +05:30
parent 51d00bb9b5
commit ed8f676a05
9 changed files with 117 additions and 60 deletions

View File

@@ -53,8 +53,7 @@ class Tab(QtWidgets.QWidget):
self.generate_position()
current_chapter = 1
chapter_name = list(self.metadata['content'])[current_chapter - 1]
chapter_content = self.metadata['content'][chapter_name]
chapter_content = self.metadata['content'][current_chapter - 1][1]
# The content display widget is, by default a QTextBrowser.
# In case the incoming data is only images
@@ -190,7 +189,7 @@ class Tab(QtWidgets.QWidget):
# TODO
# Calculate lines to incorporate into progress
total_chapters = len(self.metadata['content'].keys())
total_chapters = len(self.metadata['content'])
current_chapter = 1
scroll_value = 0
@@ -250,8 +249,8 @@ class Tab(QtWidgets.QWidget):
self.contentView.show()
def change_chapter_tocBox(self):
chapter_name = self.window().bookToolBar.tocBox.currentText()
required_content = self.metadata['content'][chapter_name]
chapter_number = self.window().bookToolBar.tocBox.currentIndex()
required_content = self.metadata['content'][chapter_number][1]
if self.are_we_doing_images_only:
self.contentView.loadImage(required_content)
@@ -447,7 +446,7 @@ class PliantQGraphicsView(QtWidgets.QGraphicsView):
# Image panning with mouse
content = self.parent.metadata['content']
image_paths = [i[1] for i in content.items()]
image_paths = [i[1] for i in content]
def generate_image_cache(current_image):
print('Building image cache')