mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
E-book viewer: Add a command line flag --new-instance to force the viewer to open a new window even if the option to always use a single viewer window is set. Fixes #2038760 [Enhancement Request: Parameter to open second instance of viewer](https://bugs.launchpad.net/calibre/+bug/2038760)
This commit is contained in:
parent
9d3fdf2214
commit
ac0ae71ae8
@ -137,6 +137,8 @@ View an e-book.
|
|||||||
))
|
))
|
||||||
a('--continue', default=False, action='store_true', dest='continue_reading',
|
a('--continue', default=False, action='store_true', dest='continue_reading',
|
||||||
help=_('Continue reading the last opened book'))
|
help=_('Continue reading the last opened book'))
|
||||||
|
a('--new-instance', default=False, action='store_true', help=_(
|
||||||
|
'Open a new viewer window even when the option to use only a single viewer window is set'))
|
||||||
|
|
||||||
setup_gui_option_parser(parser)
|
setup_gui_option_parser(parser)
|
||||||
return parser
|
return parser
|
||||||
@ -204,7 +206,7 @@ def main(args=sys.argv):
|
|||||||
oat.startswith('epubcfi(/') or is_float(oat) or oat.startswith('ref:') or oat.startswith('search:') or oat.startswith('regex:')):
|
oat.startswith('epubcfi(/') or is_float(oat) or oat.startswith('ref:') or oat.startswith('search:') or oat.startswith('regex:')):
|
||||||
raise SystemExit(f'Not a valid --open-at value: {opts.open_at}')
|
raise SystemExit(f'Not a valid --open-at value: {opts.open_at}')
|
||||||
|
|
||||||
if get_session_pref('singleinstance', False):
|
if not opts.new_instance and get_session_pref('singleinstance', False):
|
||||||
from calibre.gui2.listener import Listener
|
from calibre.gui2.listener import Listener
|
||||||
from calibre.utils.lock import SingleInstance
|
from calibre.utils.lock import SingleInstance
|
||||||
with SingleInstance(singleinstance_name) as si:
|
with SingleInstance(singleinstance_name) as si:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user