Small fixes

This commit is contained in:
BasioMeusPuga
2019-02-02 00:53:09 +05:30
parent dfe0fceea9
commit d1662b47d9
4 changed files with 16 additions and 10 deletions

2
TODO
View File

@@ -92,8 +92,10 @@ TODO
Deselecting all directories in the settings dialog also filters out manually added books Deselecting all directories in the settings dialog also filters out manually added books
Last line in QTextBrowser should never be cut off Last line in QTextBrowser should never be cut off
Does image alignment need to be centered? Does image alignment need to be centered?
Bookmark name for a page that's not on the TOC or has nothing before
Secondary: Secondary:
The cover page needs to be marked separately
Graphical themes Graphical themes
Change focus rectangle dimensions Change focus rectangle dimensions
Universal Ctrl + Tab Universal Ctrl + Tab

View File

@@ -719,6 +719,10 @@ class PliantWidgetsCommonFunctions:
current_tab = self.pw.parent current_tab = self.pw.parent
current_position = current_tab.metadata['position']['current_chapter'] current_position = current_tab.metadata['position']['current_chapter']
# Prevent scrolling below page 1
if current_position == 1 and direction == -1:
return
# Special cases for double page view # Special cases for double page view
# Page limits are taken care of by the set_content method # Page limits are taken care of by the set_content method
def get_modifier(): def get_modifier():

View File

@@ -92,16 +92,18 @@ class FB2:
self.book['cover'] = None self.book['cover'] = None
def parse_chapters(self, temp_dir): def parse_chapters(self, temp_dir):
# There's no need to parse the TOC separately because
# everything is linear
for i in self.xml.find_all('section'): for i in self.xml.find_all('section'):
this_title = '<No title>' this_title = '<No title>'
for j in i: for j in i:
if j.name == 'title': if j.name == 'title':
this_title = j.getText(separator=' ') this_title = j.getText(separator=' ')
this_title = this_title.replace('\n', '').strip()
# This comes later because the tag is changed in place
title_xml = j.unwrap()
break
self.book['book_list'].append( self.book['book_list'].append(
[this_title, str(i)]) [this_title, str(title_xml) + str(i)])
# Extract all images to the temp_dir # Extract all images to the temp_dir
for i in self.xml.find_all('binary'): for i in self.xml.find_all('binary'):

View File

@@ -423,11 +423,6 @@ class Tab(QtWidgets.QWidget):
# This function will decide how to relate # This function will decide how to relate
# entries in the toc to the actual content # entries in the toc to the actual content
# Do not allow cycling below page 1
# Required position goes to -1 in double page view
if required_position <= 0:
return
# Set the required page to the corresponding index # Set the required page to the corresponding index
# For images this is simply a page number # For images this is simply a page number
# For text based books, this is the entire text of the chapter # For text based books, this is the entire text of the chapter
@@ -526,8 +521,11 @@ class Tab(QtWidgets.QWidget):
'center': QtCore.Qt.AlignCenter, 'center': QtCore.Qt.AlignCenter,
'justify': QtCore.Qt.AlignJustify} 'justify': QtCore.Qt.AlignJustify}
current_index = self.main_window.bookToolBar.tocBox.currentIndex() # Adjusted for books without covers
if current_index == 0: current_position = self.metadata['position']['current_chapter']
chapter_name = self.metadata['toc'][current_position - 1][1]
if current_position == 1 and chapter_name == 'Cover':
block_format.setAlignment( block_format.setAlignment(
QtCore.Qt.AlignVCenter | QtCore.Qt.AlignHCenter) QtCore.Qt.AlignVCenter | QtCore.Qt.AlignHCenter)
else: else: