Esempio n. 1
0
def get_container(*args, **kwargs):
    kwargs['tweak_mode'] = True
    container = _gc(*args, **kwargs)
    # We preload the embedded fonts from this book, so that the preview panel
    # works
    font_cache.remove_fonts()
    for name, mt in container.mime_map.iteritems():
        if mt in OEB_FONTS and container.exists(name):
            with container.open(name, 'rb') as f:
                raw = f.read()
            font_cache.add_font(raw)
    return container
Esempio n. 2
0
def get_container(*args, **kwargs):
    kwargs['tweak_mode'] = True
    container = _gc(*args, **kwargs)
    # We preload the embedded fonts from this book, so that the preview panel
    # works
    font_cache.remove_fonts()
    for name, mt in container.mime_map.iteritems():
        if mt in OEB_FONTS and container.exists(name):
            with container.open(name, 'rb') as f:
                raw = f.read()
            font_cache.add_font(raw)
    return container
Esempio n. 3
0
 def book_opened(self, job):
     if job.traceback is not None:
         return error_dialog(self.gui, _('Failed to open book'),
                 _('Failed to open book, click Show details for more information.'),
                             det_msg=job.traceback, show=True)
     parse_worker.clear()
     container = job.result
     set_current_container(container)
     font_cache.remove_fonts()
     self.current_metadata = self.gui.current_metadata = container.mi
     self.global_undo.open_book(container)
     self.gui.update_window_title()
     self.gui.file_list.build(container, preserve_state=False)
     self.gui.action_save.setEnabled(False)
     self.update_global_history_actions()