This commit is contained in:
Kovid Goyal 2010-06-02 14:24:36 -06:00
parent 6221f67473
commit 4bd4ce1678
2 changed files with 9 additions and 3 deletions

View File

@ -121,7 +121,8 @@ class GuiRunner(QObject):
def start_gui(self): def start_gui(self):
from calibre.gui2.ui import Main from calibre.gui2.ui import Main
main = Main(self.library_path, self.db, self.listener, self.opts, self.actions) main = Main(self.opts)
main.initialize(self.library_path, self.db, self.listener, self.actions)
add_filesystem_book = partial(main.add_filesystem_book, allow_device=False) add_filesystem_book = partial(main.add_filesystem_book, allow_device=False)
sys.excepthook = main.unhandled_exception sys.excepthook = main.unhandled_exception
if len(self.args) > 1: if len(self.args) > 1:

View File

@ -127,13 +127,18 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
pixmap_to_data(pixmap)) pixmap_to_data(pixmap))
self.last_time = datetime.datetime.now() self.last_time = datetime.datetime.now()
def __init__(self, library_path, db, listener, opts, actions, parent=None):
def __init__(self, opts, parent=None):
MainWindow.__init__(self, opts, parent)
self.opts = opts
def initialize(self, library_path, db, listener, actions):
opts = self.opts
self.last_time = datetime.datetime.now() self.last_time = datetime.datetime.now()
self.preferences_action, self.quit_action = actions self.preferences_action, self.quit_action = actions
self.library_path = library_path self.library_path = library_path
self.spare_servers = [] self.spare_servers = []
self.must_restart_before_config = False self.must_restart_before_config = False
MainWindow.__init__(self, opts, parent)
# Initialize fontconfig in a separate thread as this can be a lengthy # Initialize fontconfig in a separate thread as this can be a lengthy
# process if run for the first time on this machine # process if run for the first time on this machine
from calibre.utils.fonts import fontconfig from calibre.utils.fonts import fontconfig