Fix #946 (comic2lrf doesn't convert manga properly (read right to left))

This commit is contained in:
Kovid Goyal 2008-08-13 11:29:12 -07:00
parent 1c3a870814
commit 50bb12561b
3 changed files with 16 additions and 6 deletions

View File

@ -121,7 +121,7 @@ class PageProcessor(list):
DestroyMagickWand(img) DestroyMagickWand(img)
MagickCropImage(split1, (width/2)-1, height, 0, 0) MagickCropImage(split1, (width/2)-1, height, 0, 0)
MagickCropImage(split2, (width/2)-1, height, width/2, 0 ) MagickCropImage(split2, (width/2)-1, height, width/2, 0 )
self.pages = [split1, split2] self.pages = [split2, split1] if self.opts.right2left else [split1, split2]
self.process_pages() self.process_pages()
except Exception, err: except Exception, err:
@ -219,7 +219,7 @@ def process_pages(pages, opts, update):
for pp in processed_pages: for pp in processed_pages:
if len(pp) == 0: if len(pp) == 0:
failures.append(os.path.basename(pp.path_to_page())) failures.append(os.path.basename(pp.path_to_page))
else: else:
ans += pp ans += pp
return ans, failures, tdir return ans, failures, tdir
@ -238,7 +238,7 @@ def config(defaults=None):
c.add_opt('output', ['-o', '--output'], c.add_opt('output', ['-o', '--output'],
help=_('Path to output LRF file. By default a file is created in the current directory.')) help=_('Path to output LRF file. By default a file is created in the current directory.'))
c.add_opt('colors', ['-c', '--colors'], type='int', default=64, c.add_opt('colors', ['-c', '--colors'], type='int', default=64,
help=_('Number of colors for Grayscale image conversion. Default: %default')) help=_('Number of colors for grayscale image conversion. Default: %default'))
c.add_opt('dont_normalize', ['-n', '--disable-normalize'], default=False, c.add_opt('dont_normalize', ['-n', '--disable-normalize'], default=False,
help=_('Disable normalize (improve contrast) color range for pictures. Default: False')) help=_('Disable normalize (improve contrast) color range for pictures. Default: False'))
c.add_opt('keep_aspect_ratio', ['-r', '--keep-aspect-ratio'], default=False, c.add_opt('keep_aspect_ratio', ['-r', '--keep-aspect-ratio'], default=False,
@ -247,6 +247,8 @@ def config(defaults=None):
help=_('Disable sharpening.')) help=_('Disable sharpening.'))
c.add_opt('landscape', ['-l', '--landscape'], default=False, c.add_opt('landscape', ['-l', '--landscape'], default=False,
help=_("Don't split landscape images into two portrait images")) help=_("Don't split landscape images into two portrait images"))
c.add_opt('right2left', ['--right2left'], default=False, action='store_true',
help=_('Used for right-to-left publications like manga. Causes landscape pages to be split into portrait pages from right to left.'))
c.add_opt('no_sort', ['--no-sort'], default=False, c.add_opt('no_sort', ['--no-sort'], default=False,
help=_("Don't sort the files found in the comic alphabetically by name. Instead use the order they were added to the comic.")) help=_("Don't sort the files found in the comic alphabetically by name. Instead use the order they were added to the comic."))
c.add_opt('profile', ['-p', '--profile'], default='prs500', choices=PROFILES.keys(), c.add_opt('profile', ['-p', '--profile'], default='prs500', choices=PROFILES.keys(),

View File

@ -57,6 +57,7 @@ class ComicConf(QDialog, Ui_Dialog):
self.opt_dont_sharpen.setChecked(opts.dont_sharpen) self.opt_dont_sharpen.setChecked(opts.dont_sharpen)
self.opt_landscape.setChecked(opts.landscape) self.opt_landscape.setChecked(opts.landscape)
self.opt_no_sort.setChecked(opts.no_sort) self.opt_no_sort.setChecked(opts.no_sort)
self.opt_right2left.setChecked(opts.right2left)
for opt in self.config.option_set.preferences: for opt in self.config.option_set.preferences:
g = getattr(self, 'opt_'+opt.name, False) g = getattr(self, 'opt_'+opt.name, False)

View File

@ -107,14 +107,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="0" > <item row="9" column="0" >
<widget class="QCheckBox" name="opt_no_sort" > <widget class="QCheckBox" name="opt_no_sort" >
<property name="text" > <property name="text" >
<string>Don't so&amp;rt</string> <string>Don't so&amp;rt</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="1" > <item row="10" column="1" >
<widget class="QDialogButtonBox" name="buttonBox" > <widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" > <property name="orientation" >
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -124,6 +124,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="0" >
<widget class="QCheckBox" name="opt_right2left" >
<property name="text" >
<string>&amp;Right to left</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<resources> <resources>