From ef6e9a9abc6434bd970c956b46aee9db998c88eb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 29 Oct 2009 11:52:06 -0600 Subject: [PATCH] calibre-debug: -e switch now allows you to pass arbitrary command line options to your script --- src/calibre/debug.py | 10 ++++++++++ src/calibre/ebooks/__init__.py | 1 - 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/calibre/debug.py b/src/calibre/debug.py index 224186878d..39c323825f 100644 --- a/src/calibre/debug.py +++ b/src/calibre/debug.py @@ -157,6 +157,16 @@ def add_simple_plugin(path_to_plugin): def main(args=sys.argv): from calibre.constants import debug debug() + if len(args) > 2 and args[1] in ('-e', '--exec-file'): + sys.argv = [args[2]] + args[3:] + ef = os.path.abspath(args[2]) + base = os.path.dirname(ef) + sys.path.insert(0, base) + g = globals() + g['__name__'] = '__main__' + execfile(ef, g) + return + opts, args = option_parser().parse_args(args) if opts.gui: from calibre.gui2.main import main diff --git a/src/calibre/ebooks/__init__.py b/src/calibre/ebooks/__init__.py index 15f172815c..219eac1dca 100644 --- a/src/calibre/ebooks/__init__.py +++ b/src/calibre/ebooks/__init__.py @@ -102,7 +102,6 @@ def render_html(path_to_html, width=590, height=750): page.mainFrame().setScrollBarPolicy(Qt.Horizontal, Qt.ScrollBarAlwaysOff) loop = QEventLoop() renderer = HTMLRenderer(page, loop) - page.connect(page, SIGNAL('loadFinished(bool)'), renderer, Qt.QueuedConnection) page.mainFrame().load(QUrl.fromLocalFile(path_to_html))