mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Initialize the dbus library when launching a GUI app and use the central GUI app launch points when using calibre-debug as well
This commit is contained in:
parent
23dce4673d
commit
a1d3533d3f
@ -182,8 +182,8 @@ def run_debug_gui(logpath):
|
||||
from calibre.constants import __appname__
|
||||
prints(__appname__, _('Debug log'))
|
||||
print_basic_debug_info()
|
||||
from calibre.gui2.main import main
|
||||
main(['__CALIBRE_GUI_DEBUG__', logpath])
|
||||
from calibre.gui_launch import calibre
|
||||
calibre(['__CALIBRE_GUI_DEBUG__', logpath])
|
||||
|
||||
def run_script(path, args):
|
||||
# Load all user defined plugins so the script can import from the
|
||||
@ -212,14 +212,14 @@ def main(args=sys.argv):
|
||||
|
||||
opts, args = option_parser().parse_args(args)
|
||||
if opts.gui:
|
||||
from calibre.gui2.main import main
|
||||
from calibre.gui_launch import calibre
|
||||
print_basic_debug_info()
|
||||
main(['calibre'])
|
||||
calibre(['calibre'])
|
||||
elif opts.gui_debug is not None:
|
||||
run_debug_gui(opts.gui_debug)
|
||||
elif opts.viewer:
|
||||
from calibre.gui2.viewer.main import main
|
||||
main(['ebook-viewer', '--debug-javascript'] + args[1:])
|
||||
from calibre.gui_launch import ebook_viewer
|
||||
ebook_viewer(['ebook-viewer', '--debug-javascript'] + args[1:])
|
||||
elif opts.py_console:
|
||||
from calibre.utils.pyconsole.main import main
|
||||
main()
|
||||
@ -240,8 +240,8 @@ def main(args=sys.argv):
|
||||
for path in args[1:]:
|
||||
inspect_mobi(path)
|
||||
elif opts.edit_book:
|
||||
from calibre.gui2.tweak_book.main import main
|
||||
main(['ebook-edit'] + args[1:])
|
||||
from calibre.gui_launch import ebook_edit
|
||||
ebook_edit(['ebook-edit'] + args[1:])
|
||||
elif opts.explode_book:
|
||||
from calibre.ebooks.tweak import tweak
|
||||
tweak(opts.explode_book)
|
||||
|
@ -33,21 +33,30 @@ def detach_gui():
|
||||
if (islinux or isbsd) and not DEBUG and '--detach' in sys.argv:
|
||||
do_detach()
|
||||
|
||||
def init_dbus():
|
||||
from calibre.constants import islinux, isbsd
|
||||
if islinux or isbsd:
|
||||
from dbus.mainloop.glib import DBusGMainLoop, threads_init
|
||||
threads_init()
|
||||
DBusGMainLoop(set_as_default=True)
|
||||
|
||||
def calibre():
|
||||
def calibre(args=sys.argv):
|
||||
detach_gui()
|
||||
init_dbus()
|
||||
from calibre.gui2.main import main
|
||||
main()
|
||||
main(args)
|
||||
|
||||
def ebook_viewer():
|
||||
def ebook_viewer(args=sys.argv):
|
||||
detach_gui()
|
||||
init_dbus()
|
||||
from calibre.gui2.viewer.main import main
|
||||
main()
|
||||
main(args)
|
||||
|
||||
def ebook_edit():
|
||||
def ebook_edit(args=sys.argv):
|
||||
detach_gui()
|
||||
init_dbus()
|
||||
from calibre.gui2.tweak_book.main import main
|
||||
main()
|
||||
main(args)
|
||||
|
||||
def option_parser(basename):
|
||||
if basename == 'calibre':
|
||||
|
Loading…
x
Reference in New Issue
Block a user