From 5b8ec44fc7c362fc49493fdbb7e92be2aaeacc19 Mon Sep 17 00:00:00 2001 From: John Schember Date: Mon, 22 Jun 2009 20:22:08 -0400 Subject: [PATCH 1/4] Fix bug 2694: run rb though preprocessor when using ebook-viewer. Tweak kindle dx comic size. --- src/calibre/customize/profiles.py | 2 +- src/calibre/ebooks/oeb/iterator.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/customize/profiles.py b/src/calibre/customize/profiles.py index 8434773515..b57e15733d 100644 --- a/src/calibre/customize/profiles.py +++ b/src/calibre/customize/profiles.py @@ -244,7 +244,7 @@ class KindleDXOutput(OutputProfile): # Screen size is a best guess screen_size = (824, 1200) dpi = 150.0 - comic_screen_size = (775, 1128) + comic_screen_size = (741, 1080) @classmethod def tags_to_string(cls, tags): diff --git a/src/calibre/ebooks/oeb/iterator.py b/src/calibre/ebooks/oeb/iterator.py index af8dd84162..2b68b6cf57 100644 --- a/src/calibre/ebooks/oeb/iterator.py +++ b/src/calibre/ebooks/oeb/iterator.py @@ -135,7 +135,7 @@ class EbookIterator(object): plumber.opts, plumber.input_fmt, self.log, {}, self.base) - if plumber.input_fmt.lower() == 'pdf': + if plumber.input_fmt.lower() in ('pdf', 'rb'): self.pathtoopf = create_oebbook(self.log, self.pathtoopf, plumber.opts, plumber.input_plugin) if hasattr(self.pathtoopf, 'manifest'): From e426c9e60deefdb7fc8ff33e8d532aba9ab527e7 Mon Sep 17 00:00:00 2001 From: John Schember Date: Mon, 22 Jun 2009 20:51:43 -0400 Subject: [PATCH 2/4] Remove duplicate line lenghts from line unwrapping code. --- src/calibre/ebooks/conversion/preprocess.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/calibre/ebooks/conversion/preprocess.py b/src/calibre/ebooks/conversion/preprocess.py index a2794d94ec..1bbc59a6e4 100644 --- a/src/calibre/ebooks/conversion/preprocess.py +++ b/src/calibre/ebooks/conversion/preprocess.py @@ -56,6 +56,7 @@ def line_length(raw, percent): if not lengths: return 0 + lengths = list(set(lengths)) total = sum(lengths) avg = total / len(lengths) max_line = avg * 2 From 3a87f0d065c71e176f86abebe1a26989c362d6c6 Mon Sep 17 00:00:00 2001 From: John Schember Date: Mon, 22 Jun 2009 21:12:17 -0400 Subject: [PATCH 3/4] Change line length amount to work with duplicates removed lengths. Enhance the unwrapping regex to account for more cases. --- src/calibre/ebooks/conversion/preprocess.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/conversion/preprocess.py b/src/calibre/ebooks/conversion/preprocess.py index 1bbc59a6e4..a508a81b95 100644 --- a/src/calibre/ebooks/conversion/preprocess.py +++ b/src/calibre/ebooks/conversion/preprocess.py @@ -183,12 +183,12 @@ class HTMLPreProcessor(object): elif self.is_book_designer(html): rules = self.BOOK_DESIGNER elif self.is_pdftohtml(html): - length = line_length(html, .3) + length = line_length(html, .5) line_length_rules = [] if length: line_length_rules = [ # Un wrap using punctuation - (re.compile(r'(?<=.{%i}[a-z,;:-IA])\s*(?P)?\s*()\s*(?=(<(i|b|u)>)?[\w\d])' % length, re.UNICODE), wrap_lines), + (re.compile(r'(?<=.{%i}[a-z\.,;:)-IA])\s*(?P)?\s*()\s*(?=(<(i|b|u)>)?\s*[\w\d(])' % length, re.UNICODE), wrap_lines), ] rules = self.PDFTOHTML + line_length_rules From 60cbc6a2cb236240cd60cd29c2ef4cbbc8acd77a Mon Sep 17 00:00:00 2001 From: John Schember Date: Tue, 23 Jun 2009 07:10:14 -0400 Subject: [PATCH 4/4] GUI: txt output, default to system new line type if one is selected. --- src/calibre/gui2/convert/txt_output.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/convert/txt_output.py b/src/calibre/gui2/convert/txt_output.py index dd36dc8cfc..b3a79e1326 100644 --- a/src/calibre/gui2/convert/txt_output.py +++ b/src/calibre/gui2/convert/txt_output.py @@ -30,5 +30,5 @@ class PluginWidget(Widget, Ui_Form): self.opt_newline.setModel(self.newline_model) default_index = self.opt_newline.findText(default) - self.opt_newline.setCurrentIndex(default_index if default_index != -1 else 0) - + system_index = self.opt_newline.findText('system') + self.opt_newline.setCurrentIndex(default_index if default_index != -1 else system_index if system_index != -1 else 0)