##// END OF EJS Templates
Backport PR #2294: inputhook_qt4: Use QEventLoop instead of starting up the QCoreApplication...
Backport PR #2294: inputhook_qt4: Use QEventLoop instead of starting up the QCoreApplication I referenced this branch in #2080 and was letting it sit for a little while, but I have decided to make it a full pull request to get some additional visibility. Essentially our Qt event loop mechanism repeatedly starts and quits a `QCoreApplication` object. Unfortunately the `QCoreApplication::quit` slot has a lot of unintended side effects (like emitting an `aboutToQuit` signal which closes all open file dialogs). For our input hook, we _might_ be able to get by with just using a `QEventLoop` whose quit slot is much simpler and less destructive. For a little bit of background on why one might want to just use `QEventLoop::exec`, let's examine what `QCoreApplication::exec` does: ```c++ int QCoreApplication::exec() { if (!QCoreApplicationPrivate::checkInstance("exec")) return -1; // ... [some assertions] threadData->quitNow = false; QEventLoop eventLoop; self->d_func()->in_exec = true; self->d_func()->aboutToQuitEmitted = false; int returnCode = eventLoop.exec(); threadData->quitNow = false; if (self) { self->d_func()->in_exec = false; if (!self->d_func()->aboutToQuitEmitted) emit self->aboutToQuit(); self->d_func()->aboutToQuitEmitted = true; sendPostedEvents(0, QEvent::DeferredDelete); } return returnCode; } ``` As far as I can tell, it's a small wrapper around `QEventLoop::exec` which also: * Sets some variables regarding the current status * Emits an `aboutToQuit` signal right before the function returns (which is the root cause of @denisri's problem in #2080). Historically, our Qt event loop is a python implementation of the (win 32) input hook supplied with the PyQt4 source (see qtcore_input_hook` in `python-qt4/sip/QtCore/qcoreapplication.sip`), which more or less dates to a [mailing list post](http://www.riverbankcomputing.com/pipermail/pyqt/2007-July/016512.html) from July 2007.

File last commit:

r6192:a53b1a9f
r9834:71196839
Show More
page.html
58 lines | 1.7 KiB | text/html | HtmlLexer
Stefan van der Walt
Use template inheritance.
r5324 <!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>{% block title %}IPython Notebook{% end %}</title>
Andrew Straw
use Tornado's handler.static_url() in templates
r6002 <link rel="stylesheet" href="{{static_url("jquery/css/themes/base/jquery-ui.min.css") }}" type="text/css" />
<link rel="stylesheet" href="{{static_url("css/boilerplate.css") }}" type="text/css" />
Brian Granger
Refactoring templates and top level js/css organization.
r6192 <link rel="stylesheet" href="{{static_url("css/fbm.css") }}" type="text/css" />
<link rel="stylesheet" href="{{static_url("css/page.css") }}" type="text/css"/>
Stefan van der Walt
Use template inheritance.
r5324 {% block stylesheet %}
{% end %}
Stefan van der Walt
Add logout button.
r5325 {% block meta %}
{% end %}
Stefan van der Walt
Use template inheritance.
r5324
</head>
Stefan van der Walt
Add logout button.
r5325 <body {% block params %}{% end %}>
Stefan van der Walt
Use template inheritance.
r5324
<div id="header">
Brian Granger
Refactoring templates and top level js/css organization.
r6192 <span id="ipython_notebook"><h1><a href={{base_project_url}} alt='dashboard'><img src='{{static_url("ipynblogo.png") }}' alt='IPython Notebook'/></a></h1></span>
Stefan van der Walt
Hide top login/logout buttons on login/logout pages.
r5723
{% block login_widget %}
<span id="login_widget">
{% if logged_in %}
<button id="logout">Logout</button>
{% elif login_available and not logged_in %}
<button id="login">Login</button>
{% end %}
</span>
{% end %}
Stefan van der Walt
Use template inheritance.
r5324 {% block header %}
{% end %}
</div>
Brian Granger
Refactoring templates and top level js/css organization.
r6192 <div id="site">
{% block site %}
{% end %}
Stefan van der Walt
Use template inheritance.
r5324 </div>
Andrew Straw
use Tornado's handler.static_url() in templates
r6002 <script src="{{static_url("jquery/js/jquery-1.7.1.min.js") }}" type="text/javascript" charset="utf-8"></script>
<script src="{{static_url("jquery/js/jquery-ui.min.js") }}" type="text/javascript" charset="utf-8"></script>
<script src="{{static_url("js/namespace.js") }}" type="text/javascript" charset="utf-8"></script>
Brian Granger
Refactoring templates and top level js/css organization.
r6192 <script src="{{static_url("js/page.js") }}" type="text/javascript" charset="utf-8"></script>
Andrew Straw
use Tornado's handler.static_url() in templates
r6002 <script src="{{static_url("js/loginwidget.js") }}" type="text/javascript" charset="utf-8"></script>
Brian Granger
Initial work to add Wijmo based menu.
r5856
Stefan van der Walt
Use template inheritance.
r5324 {% block script %}
{% end %}
</body>
</html>