mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Remove the notify() debug redirection as it greatly slows down startup and also causes hangs in some not fully understood situations
This commit is contained in:
parent
7e9d8e1c5d
commit
dad004e03c
@ -882,8 +882,6 @@ class Application(QApplication):
|
|||||||
args = [override_program_name] + args[1:]
|
args = [override_program_name] + args[1:]
|
||||||
qargs = [i.encode('utf-8') if isinstance(i, unicode) else i for i in args]
|
qargs = [i.encode('utf-8') if isinstance(i, unicode) else i for i in args]
|
||||||
self.pi = plugins['progress_indicator'][0]
|
self.pi = plugins['progress_indicator'][0]
|
||||||
if DEBUG:
|
|
||||||
self.redirect_notify = True
|
|
||||||
self.setup_styles(force_calibre_style)
|
self.setup_styles(force_calibre_style)
|
||||||
QApplication.__init__(self, qargs)
|
QApplication.__init__(self, qargs)
|
||||||
f = QFont(QApplication.font())
|
f = QFont(QApplication.font())
|
||||||
@ -913,15 +911,6 @@ class Application(QApplication):
|
|||||||
qt_app = self
|
qt_app = self
|
||||||
self._file_open_paths = []
|
self._file_open_paths = []
|
||||||
self._file_open_lock = RLock()
|
self._file_open_lock = RLock()
|
||||||
if DEBUG:
|
|
||||||
def notify(self, receiver, event):
|
|
||||||
if self.redirect_notify:
|
|
||||||
self.redirect_notify = False
|
|
||||||
return self.pi.do_notify(receiver, event)
|
|
||||||
else:
|
|
||||||
ret = QApplication.notify(self, receiver, event)
|
|
||||||
self.redirect_notify = True
|
|
||||||
return ret
|
|
||||||
|
|
||||||
def load_builtin_fonts(self, scan_for_fonts=False):
|
def load_builtin_fonts(self, scan_for_fonts=False):
|
||||||
if scan_for_fonts:
|
if scan_for_fonts:
|
||||||
|
@ -219,18 +219,6 @@ int load_style(QHash<int,QString> icon_map) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool do_notify(QObject *receiver, QEvent *event) {
|
|
||||||
try {
|
|
||||||
return QApplication::instance()->notify(receiver, event);
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
qCritical() << "C++ exception thrown in slot: " << e.what();
|
|
||||||
} catch (...) {
|
|
||||||
qCritical() << "Unknown C++ exception thrown in slot";
|
|
||||||
}
|
|
||||||
qCritical() << "Receiver name:" << receiver->objectName() << "Receiver class:" << receiver->metaObject()->className() << "Event type: " << event->type();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
class NoActivateStyle: public QProxyStyle {
|
class NoActivateStyle: public QProxyStyle {
|
||||||
public:
|
public:
|
||||||
int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const {
|
int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const {
|
||||||
|
@ -92,16 +92,6 @@ private:
|
|||||||
QColor m_color;
|
QColor m_color;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Utility function that can be used to load a QStyle from a Qt plugin. This is
|
|
||||||
* here so that there is no need to create a separate PyQt plugin just for this
|
|
||||||
* simple functionality.
|
|
||||||
* \param path The full path to the DLL containing the plugin
|
|
||||||
* \param name The name of the style plugin to load
|
|
||||||
* \return 1 if succeeds 0 otherwise. The objectName of the loaded style is set to name
|
|
||||||
*/
|
|
||||||
int load_style(QHash<int,QString> icon_map);
|
int load_style(QHash<int,QString> icon_map);
|
||||||
|
|
||||||
bool do_notify(QObject *receiver, QEvent *event);
|
|
||||||
|
|
||||||
void set_no_activate_on_click(QWidget *widget);
|
void set_no_activate_on_click(QWidget *widget);
|
||||||
void set_touch_menu_style(QWidget *widget, int margin=14);
|
void set_touch_menu_style(QWidget *widget, int margin=14);
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
%ModuleHeaderCode
|
%ModuleHeaderCode
|
||||||
int load_style(QHash<int,QString> icon_map);
|
int load_style(QHash<int,QString> icon_map);
|
||||||
bool do_notify(QObject *receiver, QEvent *event);
|
|
||||||
void set_no_activate_on_click(QWidget *widget);
|
void set_no_activate_on_click(QWidget *widget);
|
||||||
void set_touch_menu_style(QWidget *widget, int margin);
|
void set_touch_menu_style(QWidget *widget, int margin);
|
||||||
%End
|
%End
|
||||||
@ -58,8 +57,5 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
int load_style(QHash<int,QString> icon_map);
|
int load_style(QHash<int,QString> icon_map);
|
||||||
|
|
||||||
bool do_notify(QObject *receiver, QEvent *event);
|
|
||||||
|
|
||||||
void set_no_activate_on_click(QWidget *widget);
|
void set_no_activate_on_click(QWidget *widget);
|
||||||
void set_touch_menu_style(QWidget *widget, int margin=20);
|
void set_touch_menu_style(QWidget *widget, int margin=20);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user