diff --git a/manual/creating_plugins.rst b/manual/creating_plugins.rst index a5b5c8be0c..6189f69243 100644 --- a/manual/creating_plugins.rst +++ b/manual/creating_plugins.rst @@ -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 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|. diff --git a/src/calibre/debug.py b/src/calibre/debug.py index e451b516cb..2a3cee9b15 100644 --- a/src/calibre/debug.py +++ b/src/calibre/debug.py @@ -60,6 +60,11 @@ Run an embedded python interpreter. 'editing tools, and then rebuilds the file from the edited HTML. ' 'Makes no additional changes to the HTML, unlike a full calibre ' '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', action='store_true', default=False) @@ -258,6 +263,9 @@ def main(args=sys.argv): elif opts.test_build: from calibre.test_build import test test() + elif opts.shutdown_running_calibre: + from calibre.gui2.main import shutdown_other + shutdown_other() else: from calibre import ipython ipython() diff --git a/src/calibre/gui2/main.py b/src/calibre/gui2/main.py index 20ce759498..9a49b01764 100644 --- a/src/calibre/gui2/main.py +++ b/src/calibre/gui2/main.py @@ -313,8 +313,8 @@ def cant_start(msg=_('If you are sure it is not running')+', ', raise SystemExit(1) -def build_pipe(): - t = RC() +def build_pipe(print_error=True): + t = RC(print_error=print_error) t.start() t.join(3.0) if t.is_alive(): @@ -328,8 +328,10 @@ def build_pipe(): def shutdown_other(rc=None): if rc is None: - rc = build_pipe() - if rc.conn is None: return # No running instance found + rc = build_pipe(print_error=False) + if rc.conn is None: + prints(_('No running calibre found')) + return # No running instance found from calibre.utils.lock import singleinstance rc.conn.send('shutdown:') prints(_('Shutdown command sent, waiting for shutdown...'))