mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Default values for GUI conversion for PDF and PDB. Help text for PDF line unwrap factor.
This commit is contained in:
parent
970af577e5
commit
c47f23802b
@ -42,7 +42,9 @@ def line_length(raw, percent):
|
||||
'''
|
||||
raw is the raw text to find the line length to use for wrapping.
|
||||
percentage is a decimal number, 0 - 1 which is used to determine
|
||||
how far in the list of line lengths to use.
|
||||
how far in the list of line lengths to use. The list of line lengths is
|
||||
ordered smallest to larged and does not include duplicates. 0.5 is the
|
||||
median value.
|
||||
'''
|
||||
raw = raw.replace(' ', ' ')
|
||||
linere = re.compile('(?<=<br>).*?(?=<br>)', re.DOTALL)
|
||||
|
@ -21,7 +21,9 @@ class PDFInput(InputFormatPlugin):
|
||||
OptionRecommendation(name='no_images', recommended_value=False,
|
||||
help=_('Do not extract images from the document')),
|
||||
OptionRecommendation(name='pdf_line_length', recommended_value=0.5,
|
||||
help=_('Average line length for line breaking')),
|
||||
help=_('Scale used to determine the length at which a line should '
|
||||
'be unwrapped. Valid values are a decimal between 0 and 1. The '
|
||||
'default is 0.5, this is the median line length.')),
|
||||
])
|
||||
|
||||
def convert(self, stream, options, file_ext, log,
|
||||
@ -41,7 +43,7 @@ class PDFInput(InputFormatPlugin):
|
||||
images.remove('index.html')
|
||||
for i in images:
|
||||
# Remove the - from the file name because it causes problems.
|
||||
# The referenec to the image with the - will be changed to not
|
||||
# The reference to the image with the - will be changed to not
|
||||
# include it later in the conversion process.
|
||||
new_i = i.replace('-', '')
|
||||
os.rename(i, new_i)
|
||||
|
@ -30,5 +30,6 @@ class PluginWidget(Widget, Ui_Form):
|
||||
self.opt_format.setModel(self.format_model)
|
||||
|
||||
default_index = self.opt_format.findText(default)
|
||||
self.opt_format.setCurrentIndex(default_index if default_index != -1 else 0)
|
||||
format_index = self.opt_format.findText('doc')
|
||||
self.opt_format.setCurrentIndex(default_index if default_index != -1 else format_index if format_index != -1 else 0)
|
||||
|
||||
|
@ -31,8 +31,9 @@ class PluginWidget(Widget, Ui_Form):
|
||||
self.paper_size_model = paper_size_model
|
||||
self.opt_paper_size.setModel(self.paper_size_model)
|
||||
|
||||
default_index = self.opt_paper_size.findText(default_paper_size)
|
||||
self.opt_paper_size.setCurrentIndex(default_index if default_index != -1 else 0)
|
||||
default_paper_size_index = self.opt_paper_size.findText(default_paper_size)
|
||||
letter_index = self.opt_paper_size.findText('letter')
|
||||
self.opt_paper_size.setCurrentIndex(default_paper_size_index if default_paper_size_index != -1 else letter_index if letter_index != -1 else 0)
|
||||
|
||||
global orientation_model
|
||||
if orientation_model is None:
|
||||
@ -40,6 +41,7 @@ class PluginWidget(Widget, Ui_Form):
|
||||
self.orientation_model = orientation_model
|
||||
self.opt_orientation.setModel(self.orientation_model)
|
||||
|
||||
default_index = self.opt_orientation.findText(default_orientation)
|
||||
self.opt_orientation.setCurrentIndex(default_index if default_index != -1 else 0)
|
||||
default_orientation_index = self.opt_orientation.findText(default_orientation)
|
||||
orientation_index = self.opt_orientation.findText('portrait')
|
||||
self.opt_orientation.setCurrentIndex(default_orientation_index if default_orientation_index != -1 else orientation_index if orientation_index != -1 else 0)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user