Implement save as for comic/pdf view
Account for malformed container.xml for epubs
This commit is contained in:
3
TODO
3
TODO
@@ -55,7 +55,8 @@ TODO
|
||||
✓ Set context menu for definitions and the like
|
||||
✓ Paragraph indentation
|
||||
✓ Comic view keyboard shortcuts
|
||||
Comic view context menu
|
||||
✓ Comic view context menu
|
||||
Adjust key navigation according to viewport dimensions
|
||||
Search document using QTextCursor?
|
||||
Filetypes:
|
||||
✓ pdf support
|
||||
|
@@ -38,7 +38,7 @@ class EPUB:
|
||||
None, True)
|
||||
|
||||
if not contents_path:
|
||||
return False # No opf was found so processing cannot continue
|
||||
return False # No (valid) opf was found so processing cannot continue
|
||||
|
||||
self.generate_book_metadata(contents_path)
|
||||
self.parse_toc()
|
||||
@@ -76,13 +76,17 @@ class EPUB:
|
||||
|
||||
if xml:
|
||||
root_item = xml.find('rootfile')
|
||||
return root_item.get('full-path')
|
||||
else:
|
||||
possible_filenames = ('content.opf', 'package.opf')
|
||||
for i in possible_filenames:
|
||||
presumptive_location = self.get_file_path(i)
|
||||
if presumptive_location:
|
||||
return presumptive_location
|
||||
try:
|
||||
return root_item.get('full-path')
|
||||
except AttributeError:
|
||||
print(f'ePub module: {self.filename} has a malformed container.xml')
|
||||
return None
|
||||
|
||||
possible_filenames = ('content.opf', 'package.opf')
|
||||
for i in possible_filenames:
|
||||
presumptive_location = self.get_file_path(i)
|
||||
if presumptive_location:
|
||||
return presumptive_location
|
||||
|
||||
for i in self.zip_file.filelist:
|
||||
if os.path.basename(i.filename) == os.path.basename(filename):
|
||||
|
@@ -656,8 +656,8 @@ class PliantQGraphicsView(QtWidgets.QGraphicsView):
|
||||
next_val = 0
|
||||
self.verticalScrollBar().setValue(next_val)
|
||||
|
||||
small_increment = maximum // 5
|
||||
big_increment = maximum // 3
|
||||
small_increment = maximum // 4
|
||||
big_increment = maximum // 2
|
||||
|
||||
if event.key() == QtCore.Qt.Key_Up:
|
||||
scroller(small_increment, False)
|
||||
@@ -711,9 +711,15 @@ class PliantQGraphicsView(QtWidgets.QGraphicsView):
|
||||
action = contextMenu.exec_(self.sender().mapToGlobal(position))
|
||||
|
||||
if action == saveAction:
|
||||
# TODO
|
||||
# Save this page as an image
|
||||
pass
|
||||
dialog_prompt = self._translate('Main_UI', 'Save page as...')
|
||||
extension_string = self._translate('Main_UI', 'Images')
|
||||
save_file = QtWidgets.QFileDialog.getSaveFileName(
|
||||
self, dialog_prompt, self.main_window.settings['last_open_path'],
|
||||
f'{extension_string} (*.png *.jpg *.bmp)')
|
||||
|
||||
if save_file:
|
||||
self.image_pixmap.save(save_file[0])
|
||||
|
||||
if action == toggleAction:
|
||||
self.main_window.toggle_distraction_free()
|
||||
|
||||
|
Reference in New Issue
Block a user