mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Silence the webengine context debug print
This commit is contained in:
parent
563d9ca2f3
commit
abf7e4ac09
@ -35,7 +35,7 @@ QMessageBox.exec_ = QMessageBox.exec
|
||||
|
||||
# Restore ability to associate a menu with an action
|
||||
QAction.setMenu = lambda self, menu: progress_indicator.set_menu_on_action(self, menu)
|
||||
QAction.menu = lambda self, menu: progress_indicator.menu_for_action(self)
|
||||
QAction.menu = lambda self: progress_indicator.menu_for_action(self)
|
||||
|
||||
|
||||
# Restore QModelIndex child
|
||||
|
@ -29,6 +29,15 @@ def do_detach(fork=True, setsid=True, redirect=True):
|
||||
is_detached = True
|
||||
|
||||
|
||||
def setup_qt_logging():
|
||||
from calibre.constants import DEBUG
|
||||
if not DEBUG:
|
||||
from qt.core import QLoggingCategory
|
||||
QLoggingCategory.setFilterRules('''\
|
||||
qt.webenginecontext.info=false
|
||||
''')
|
||||
|
||||
|
||||
def detach_gui():
|
||||
from calibre.constants import islinux, isbsd, DEBUG
|
||||
if (islinux or isbsd) and not DEBUG and '--detach' in sys.argv:
|
||||
@ -58,6 +67,7 @@ def calibre(args=sys.argv):
|
||||
from calibre.debug import print_basic_debug_info
|
||||
print_basic_debug_info()
|
||||
detach_gui()
|
||||
setup_qt_logging()
|
||||
with register_with_default_programs():
|
||||
from calibre.gui2.main import main
|
||||
main(args)
|
||||
@ -65,6 +75,7 @@ def calibre(args=sys.argv):
|
||||
|
||||
def ebook_viewer(args=sys.argv):
|
||||
detach_gui()
|
||||
setup_qt_logging()
|
||||
with register_with_default_programs():
|
||||
from calibre.gui2.viewer.main import main
|
||||
main(args)
|
||||
@ -72,12 +83,14 @@ def ebook_viewer(args=sys.argv):
|
||||
|
||||
def store_dialog(args=sys.argv):
|
||||
detach_gui()
|
||||
setup_qt_logging()
|
||||
from calibre.gui2.store.web_store import main
|
||||
main(args)
|
||||
|
||||
|
||||
def webengine_dialog(**kw):
|
||||
detach_gui()
|
||||
setup_qt_logging()
|
||||
from calibre.debug import load_user_plugins
|
||||
load_user_plugins()
|
||||
import importlib
|
||||
@ -87,6 +100,7 @@ def webengine_dialog(**kw):
|
||||
|
||||
def toc_dialog(**kw):
|
||||
detach_gui()
|
||||
setup_qt_logging()
|
||||
from calibre.gui2.toc.main import main
|
||||
main(**kw)
|
||||
|
||||
@ -94,11 +108,13 @@ def toc_dialog(**kw):
|
||||
def gui_ebook_edit(path=None, notify=None):
|
||||
' For launching the editor from inside calibre '
|
||||
from calibre.gui2.tweak_book.main import gui_main
|
||||
setup_qt_logging()
|
||||
gui_main(path, notify)
|
||||
|
||||
|
||||
def ebook_edit(args=sys.argv):
|
||||
detach_gui()
|
||||
setup_qt_logging()
|
||||
with register_with_default_programs():
|
||||
from calibre.gui2.tweak_book.main import main
|
||||
main(args)
|
||||
|
Loading…
x
Reference in New Issue
Block a user