Multiple fixes
This commit is contained in:
@@ -451,7 +451,9 @@ class PliantQTextBrowser(QtWidgets.QTextBrowser):
|
|||||||
def record_position(self, return_as_bookmark=False):
|
def record_position(self, return_as_bookmark=False):
|
||||||
self.parent.metadata['position']['is_read'] = False
|
self.parent.metadata['position']['is_read'] = False
|
||||||
|
|
||||||
cursor = self.cursorForPosition(QtCore.QPoint(0, 0))
|
# The y coordinate is set to 10 because 0 tends to make
|
||||||
|
# cursor position a little finicky
|
||||||
|
cursor = self.cursorForPosition(QtCore.QPoint(0, 10))
|
||||||
cursor_position = cursor.position()
|
cursor_position = cursor.position()
|
||||||
|
|
||||||
# Current block for progress measurement
|
# Current block for progress measurement
|
||||||
@@ -728,10 +730,6 @@ class PliantWidgetsCommonFunctions:
|
|||||||
|
|
||||||
# Special cases for double page view
|
# Special cases for double page view
|
||||||
def get_modifier():
|
def get_modifier():
|
||||||
# if (self.main_window.settings['page_view_button'] == 'singlePageButton'
|
|
||||||
# or not self.are_we_doing_images_only):
|
|
||||||
# return 0
|
|
||||||
|
|
||||||
if (not self.main_window.settings['double_page_mode']
|
if (not self.main_window.settings['double_page_mode']
|
||||||
or not self.are_we_doing_images_only):
|
or not self.are_we_doing_images_only):
|
||||||
return 0
|
return 0
|
||||||
@@ -783,7 +781,8 @@ class PliantWidgetsCommonFunctions:
|
|||||||
if not self.are_we_doing_images_only:
|
if not self.are_we_doing_images_only:
|
||||||
cursor = self.pw.textCursor()
|
cursor = self.pw.textCursor()
|
||||||
cursor.setPosition(0)
|
cursor.setPosition(0)
|
||||||
cursor.movePosition(QtGui.QTextCursor.End, QtGui.QTextCursor.KeepAnchor)
|
cursor.movePosition(
|
||||||
|
QtGui.QTextCursor.End, QtGui.QTextCursor.KeepAnchor)
|
||||||
|
|
||||||
previewCharFormat = QtGui.QTextCharFormat()
|
previewCharFormat = QtGui.QTextCharFormat()
|
||||||
previewCharFormat.setFontStyleStrategy(
|
previewCharFormat.setFontStyleStrategy(
|
||||||
@@ -840,11 +839,13 @@ class PliantWidgetsCommonFunctions:
|
|||||||
1, QtCore.Qt.MatchExactly)
|
1, QtCore.Qt.MatchExactly)
|
||||||
|
|
||||||
if self.are_we_doing_images_only:
|
if self.are_we_doing_images_only:
|
||||||
position_percentage = (self.pw.parent.metadata['position']['current_chapter'] /
|
position_percentage = (
|
||||||
self.pw.parent.metadata['position']['total_chapters'])
|
self.pw.parent.metadata['position']['current_chapter'] /
|
||||||
|
self.pw.parent.metadata['position']['total_chapters'])
|
||||||
else:
|
else:
|
||||||
position_percentage = (self.pw.parent.metadata['position']['current_block'] /
|
position_percentage = (
|
||||||
self.pw.parent.metadata['position']['total_blocks'])
|
self.pw.parent.metadata['position']['current_block'] /
|
||||||
|
self.pw.parent.metadata['position']['total_blocks'])
|
||||||
|
|
||||||
# Update position percentage
|
# Update position percentage
|
||||||
if model_index:
|
if model_index:
|
||||||
|
@@ -114,3 +114,11 @@ class FB2:
|
|||||||
outimage.write(image_data)
|
outimage.write(image_data)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# Insert the book cover at the beginning
|
||||||
|
if self.book['cover']:
|
||||||
|
cover_path = os.path.join(temp_dir, 'cover')
|
||||||
|
with open(cover_path, 'wb') as outimage:
|
||||||
|
outimage.write(self.book['cover'])
|
||||||
|
self.book['book_list'].insert(
|
||||||
|
0, ('Cover', f'<center><img src="{cover_path}" alt="Cover"></center>'))
|
||||||
|
@@ -335,6 +335,11 @@ class Tab(QtWidgets.QWidget):
|
|||||||
self.contentView.setTextCursor(cursor)
|
self.contentView.setTextCursor(cursor)
|
||||||
self.contentView.ensureCursorVisible()
|
self.contentView.ensureCursorVisible()
|
||||||
|
|
||||||
|
# Finally, to make sure the cover image isn't
|
||||||
|
# scrolled halfway through on first open,
|
||||||
|
if self.main_window.bookToolBar.tocBox.currentIndex() == 0:
|
||||||
|
self.contentView.verticalScrollBar().setValue(0)
|
||||||
|
|
||||||
def generate_position(self, is_read=False):
|
def generate_position(self, is_read=False):
|
||||||
total_chapters = len(self.metadata['content'])
|
total_chapters = len(self.metadata['content'])
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user