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:
Kovid Goyal 2014-04-26 14:25:47 +05:30
parent 7e9d8e1c5d
commit dad004e03c
4 changed files with 0 additions and 37 deletions

View File

@ -882,8 +882,6 @@ class Application(QApplication):
args = [override_program_name] + args[1:]
qargs = [i.encode('utf-8') if isinstance(i, unicode) else i for i in args]
self.pi = plugins['progress_indicator'][0]
if DEBUG:
self.redirect_notify = True
self.setup_styles(force_calibre_style)
QApplication.__init__(self, qargs)
f = QFont(QApplication.font())
@ -913,15 +911,6 @@ class Application(QApplication):
qt_app = self
self._file_open_paths = []
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):
if scan_for_fonts:

View File

@ -219,18 +219,6 @@ int load_style(QHash<int,QString> icon_map) {
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 {
public:
int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const {

View File

@ -92,16 +92,6 @@ private:
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);
bool do_notify(QObject *receiver, QEvent *event);
void set_no_activate_on_click(QWidget *widget);
void set_touch_menu_style(QWidget *widget, int margin=14);

View File

@ -7,7 +7,6 @@
%ModuleHeaderCode
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_touch_menu_style(QWidget *widget, int margin);
%End
@ -58,8 +57,5 @@ protected:
};
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_touch_menu_style(QWidget *widget, int margin=20);