diff --git a/src/libprs500/lrf/__init__.py b/src/libprs500/lrf/__init__.py index 7305de89ca..efc01cf09a 100644 --- a/src/libprs500/lrf/__init__.py +++ b/src/libprs500/lrf/__init__.py @@ -68,6 +68,11 @@ def option_parser(usage): help='''Profile of the target device for which this LRF is ''' '''being generated. Default: ''' + profiles[0] + ''' Supported profiles: '''+', '.join(profiles)) + debug = parser.add_option_group('DEBUG OPTIONS') + debug.add_option('--verbose', dest='verbose', action='store_true', default=False, + help='''Be verbose while processing''') + debug.add_option('--lrs', action='store_true', dest='lrs', \ + help='Convert to LRS', default=False) return parser def Book(font_delta=0, header=None, profile=PRS500_PROFILE, **settings): diff --git a/src/libprs500/lrf/html/convert_from.py b/src/libprs500/lrf/html/convert_from.py index c5f8e83ef5..b7cbdc00c8 100644 --- a/src/libprs500/lrf/html/convert_from.py +++ b/src/libprs500/lrf/html/convert_from.py @@ -1109,11 +1109,10 @@ def parse_options(argv=None, cli=True): prepro = parser.add_option_group('PREPROCESSING OPTIONS') prepro.add_option('--baen', action='store_true', default=False, dest='baen', help='''Preprocess Baen HTML files to improve generated LRF.''') - debug = parser.add_option_group('DEBUG OPTIONS') - debug.add_option('--verbose', dest='verbose', action='store_true', default=False, - help='''Be verbose while processing''') - debug.add_option('--lrs', action='store_true', dest='lrs', \ - help='Convert to LRS', default=False) + debug = None + for g in parser.option_groups: + if g.title == 'DEBUG OPTIONS': + debug = g debug.add_option('--show-broken-links', dest='show_broken_links', action='store_true', default=False, help='''Show the href of broken links in generated LRF''') options, args = parser.parse_args(args=argv) diff --git a/src/libprs500/lrf/txt/convert_from.py b/src/libprs500/lrf/txt/convert_from.py index 8cc00a6a5a..cdebeb09f6 100644 --- a/src/libprs500/lrf/txt/convert_from.py +++ b/src/libprs500/lrf/txt/convert_from.py @@ -53,7 +53,7 @@ def main(): src = os.path.abspath(os.path.expanduser(args[0])) except: sys.exit(1) - convert_txt(src, options) + print 'Output written to ', convert_txt(src, options) def convert_txt(path, options): @@ -77,7 +77,7 @@ def convert_txt(path, options): category=options.category, booksetting=BookSetting (dpi=10*options.profile.dpi, screenheight=options.profile.screen_height, - screenwidth=options.profile.screen_height)) + screenwidth=options.profile.screen_width)) buffer = '' pg = book.create_page() block = book.create_text_block() @@ -91,12 +91,12 @@ def convert_txt(path, options): block.Paragraph(buffer) buffer = '' basename = os.path.basename(path) - oname = options.output - oname = os.path.abspath(os.path.expanduser(oname)) + oname = options.output if not oname: - oname = os.path.splitext(basename)[0]+'.lrf' + oname = os.path.splitext(basename)[0]+('.lrs' if options.lrs else '.lrf') + oname = os.path.abspath(os.path.expanduser(oname)) try: - book.renderLrf(oname) + book.renderLrs(oname) if options.lrs else book.renderLrf(oname) except UnicodeDecodeError: raise ConversionError(path + ' is not encoded in ' + \ options.encoding +'. Specify the '+ \