mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix plugins that use the polish infrastructure causing circular imports when start tweak book
This commit is contained in:
parent
3d55cac971
commit
3ab2f07a7d
@ -6,7 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import,
|
|||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||||
|
|
||||||
import sys, os
|
import sys, os, importlib
|
||||||
|
|
||||||
from PyQt4.Qt import QIcon
|
from PyQt4.Qt import QIcon
|
||||||
|
|
||||||
@ -14,7 +14,6 @@ from calibre.constants import islinux
|
|||||||
from calibre.gui2 import Application, ORG_NAME, APP_UID, setup_gui_option_parser, detach_gui
|
from calibre.gui2 import Application, ORG_NAME, APP_UID, setup_gui_option_parser, detach_gui
|
||||||
from calibre.ptempfile import reset_base_dir
|
from calibre.ptempfile import reset_base_dir
|
||||||
from calibre.utils.config import OptionParser
|
from calibre.utils.config import OptionParser
|
||||||
from calibre.gui2.tweak_book.ui import Main
|
|
||||||
|
|
||||||
def option_parser():
|
def option_parser():
|
||||||
parser = OptionParser('''\
|
parser = OptionParser('''\
|
||||||
@ -31,6 +30,12 @@ def main(args=sys.argv):
|
|||||||
os.environ.pop('CALIBRE_WORKER_TEMP_DIR', None)
|
os.environ.pop('CALIBRE_WORKER_TEMP_DIR', None)
|
||||||
reset_base_dir()
|
reset_base_dir()
|
||||||
|
|
||||||
|
# The following two lines are needed to prevent circular imports causing
|
||||||
|
# errors during initialization of plugins that use the polish container
|
||||||
|
# infrastructure.
|
||||||
|
importlib.import_module('calibre.customize.ui')
|
||||||
|
from calibre.gui2.tweak_book.ui import Main
|
||||||
|
|
||||||
parser = option_parser()
|
parser = option_parser()
|
||||||
opts, args = parser.parse_args(args)
|
opts, args = parser.parse_args(args)
|
||||||
if getattr(opts, 'detach', False):
|
if getattr(opts, 'detach', False):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user