mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Speedup import of gui2.__init__
This commit is contained in:
parent
e835131c82
commit
f76307f9d5
@ -4,19 +4,17 @@ __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
|||||||
import os, sys, Queue, threading
|
import os, sys, Queue, threading
|
||||||
from threading import RLock
|
from threading import RLock
|
||||||
from urllib import unquote
|
from urllib import unquote
|
||||||
|
from PyQt4.Qt import (QVariant, QFileInfo, QObject, SIGNAL, QBuffer, Qt,
|
||||||
from PyQt4.Qt import QVariant, QFileInfo, QObject, SIGNAL, QBuffer, Qt, \
|
QByteArray, QTranslator, QCoreApplication, QThread,
|
||||||
QByteArray, QTranslator, QCoreApplication, QThread, \
|
QEvent, QTimer, pyqtSignal, QDate, QDesktopServices,
|
||||||
QEvent, QTimer, pyqtSignal, QDate, QDesktopServices, \
|
QFileDialog, QFileIconProvider,
|
||||||
QFileDialog, QFileIconProvider, \
|
QIcon, QApplication, QDialog, QUrl, QFont)
|
||||||
QIcon, QApplication, QDialog, QUrl, QFont
|
|
||||||
|
|
||||||
ORG_NAME = 'KovidsBrain'
|
ORG_NAME = 'KovidsBrain'
|
||||||
APP_UID = 'libprs500'
|
APP_UID = 'libprs500'
|
||||||
from calibre.constants import islinux, iswindows, isfreebsd, isfrozen, isosx
|
from calibre.constants import islinux, iswindows, isfreebsd, isfrozen, isosx
|
||||||
from calibre.utils.config import Config, ConfigProxy, dynamic, JSONConfig
|
from calibre.utils.config import Config, ConfigProxy, dynamic, JSONConfig
|
||||||
from calibre.utils.localization import set_qt_translator
|
from calibre.utils.localization import set_qt_translator
|
||||||
from calibre.ebooks.metadata.meta import get_metadata, metadata_from_formats
|
|
||||||
from calibre.ebooks.metadata import MetaInformation
|
from calibre.ebooks.metadata import MetaInformation
|
||||||
from calibre.utils.date import UNDEFINED_DATE
|
from calibre.utils.date import UNDEFINED_DATE
|
||||||
|
|
||||||
@ -332,6 +330,7 @@ class GetMetadata(QObject):
|
|||||||
id, args, kwargs)
|
id, args, kwargs)
|
||||||
|
|
||||||
def _from_formats(self, id, args, kwargs):
|
def _from_formats(self, id, args, kwargs):
|
||||||
|
from calibre.ebooks.metadata.meta import metadata_from_formats
|
||||||
try:
|
try:
|
||||||
mi = metadata_from_formats(*args, **kwargs)
|
mi = metadata_from_formats(*args, **kwargs)
|
||||||
except:
|
except:
|
||||||
@ -339,6 +338,7 @@ class GetMetadata(QObject):
|
|||||||
self.emit(SIGNAL('metadataf(PyQt_PyObject, PyQt_PyObject)'), id, mi)
|
self.emit(SIGNAL('metadataf(PyQt_PyObject, PyQt_PyObject)'), id, mi)
|
||||||
|
|
||||||
def _get_metadata(self, id, args, kwargs):
|
def _get_metadata(self, id, args, kwargs):
|
||||||
|
from calibre.ebooks.metadata.meta import get_metadata
|
||||||
try:
|
try:
|
||||||
mi = get_metadata(*args, **kwargs)
|
mi = get_metadata(*args, **kwargs)
|
||||||
except:
|
except:
|
||||||
@ -740,3 +740,4 @@ def build_forms(srcdir, info=None):
|
|||||||
_df = os.environ.get('CALIBRE_DEVELOP_FROM', None)
|
_df = os.environ.get('CALIBRE_DEVELOP_FROM', None)
|
||||||
if _df and os.path.exists(_df):
|
if _df and os.path.exists(_df):
|
||||||
build_forms(_df)
|
build_forms(_df)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user