mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
calibre-debug: -e switch now allows you to pass arbitrary command line options to your script
This commit is contained in:
parent
4c415a5ce0
commit
ef6e9a9abc
@ -157,6 +157,16 @@ def add_simple_plugin(path_to_plugin):
|
|||||||
def main(args=sys.argv):
|
def main(args=sys.argv):
|
||||||
from calibre.constants import debug
|
from calibre.constants import debug
|
||||||
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)
|
opts, args = option_parser().parse_args(args)
|
||||||
if opts.gui:
|
if opts.gui:
|
||||||
from calibre.gui2.main import main
|
from calibre.gui2.main import main
|
||||||
|
@ -102,7 +102,6 @@ def render_html(path_to_html, width=590, height=750):
|
|||||||
page.mainFrame().setScrollBarPolicy(Qt.Horizontal, Qt.ScrollBarAlwaysOff)
|
page.mainFrame().setScrollBarPolicy(Qt.Horizontal, Qt.ScrollBarAlwaysOff)
|
||||||
loop = QEventLoop()
|
loop = QEventLoop()
|
||||||
renderer = HTMLRenderer(page, loop)
|
renderer = HTMLRenderer(page, loop)
|
||||||
|
|
||||||
page.connect(page, SIGNAL('loadFinished(bool)'), renderer,
|
page.connect(page, SIGNAL('loadFinished(bool)'), renderer,
|
||||||
Qt.QueuedConnection)
|
Qt.QueuedConnection)
|
||||||
page.mainFrame().load(QUrl.fromLocalFile(path_to_html))
|
page.mainFrame().load(QUrl.fromLocalFile(path_to_html))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user