This commit is contained in:
Kovid Goyal 2012-07-09 22:59:02 +05:30
parent dea53616c1
commit 29c090e111
3 changed files with 15 additions and 5 deletions

View File

@ -198,7 +198,7 @@ You can insert print statements anywhere in your plugin code, they will be outpu
You can quickly test changes to your plugin by using the following command You can quickly test changes to your plugin by using the following command
line:: line::
calibre -s; calibre-customize -b /path/to/your/plugin/directory; calibre calibre-debug -s; calibre-customize -b /path/to/your/plugin/directory; calibre
This will shutdown a running calibre, wait for the shutdown to complete, then update your plugin in |app| and relaunch |app|. This will shutdown a running calibre, wait for the shutdown to complete, then update your plugin in |app| and relaunch |app|.

View File

@ -60,6 +60,11 @@ Run an embedded python interpreter.
'editing tools, and then rebuilds the file from the edited HTML. ' 'editing tools, and then rebuilds the file from the edited HTML. '
'Makes no additional changes to the HTML, unlike a full calibre ' 'Makes no additional changes to the HTML, unlike a full calibre '
'conversion).') 'conversion).')
parser.add_option('-s', '--shutdown-running-calibre', default=False,
action='store_true',
help=_('Cause a running calibre instance, if any, to be'
' shutdown. Note that if there are running jobs, they '
'will be silently aborted, so use with care.'))
parser.add_option('--test-build', help='Test binary modules in build', parser.add_option('--test-build', help='Test binary modules in build',
action='store_true', default=False) action='store_true', default=False)
@ -258,6 +263,9 @@ def main(args=sys.argv):
elif opts.test_build: elif opts.test_build:
from calibre.test_build import test from calibre.test_build import test
test() test()
elif opts.shutdown_running_calibre:
from calibre.gui2.main import shutdown_other
shutdown_other()
else: else:
from calibre import ipython from calibre import ipython
ipython() ipython()

View File

@ -313,8 +313,8 @@ def cant_start(msg=_('If you are sure it is not running')+', ',
raise SystemExit(1) raise SystemExit(1)
def build_pipe(): def build_pipe(print_error=True):
t = RC() t = RC(print_error=print_error)
t.start() t.start()
t.join(3.0) t.join(3.0)
if t.is_alive(): if t.is_alive():
@ -328,8 +328,10 @@ def build_pipe():
def shutdown_other(rc=None): def shutdown_other(rc=None):
if rc is None: if rc is None:
rc = build_pipe() rc = build_pipe(print_error=False)
if rc.conn is None: return # No running instance found if rc.conn is None:
prints(_('No running calibre found'))
return # No running instance found
from calibre.utils.lock import singleinstance from calibre.utils.lock import singleinstance
rc.conn.send('shutdown:') rc.conn.send('shutdown:')
prints(_('Shutdown command sent, waiting for shutdown...')) prints(_('Shutdown command sent, waiting for shutdown...'))