##// 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:

r7106:21b1b8d3
r9834:71196839
Show More
projectdashboard.html
81 lines | 2.5 KiB | text/html | HtmlLexer
Brian Granger
Refactoring templates and top level js/css organization.
r6192 {% extends page.html %}
Stefan van der Walt
Use template inheritance.
r5324
Brian Granger
Refactoring templates and top level js/css organization.
r6192 {% block title %}IPython Dashboard{% end %}
Stefan van der Walt
Use template inheritance.
r5324
{% block stylesheet %}
Andrew Straw
use Tornado's handler.static_url() in templates
r6002 <link rel="stylesheet" href="{{static_url("css/projectdashboard.css") }}" type="text/css" />
Matthias BUSSONNIER
remove underscore in filename
r6853 <link rel="stylesheet" href="{{static_url("css/alternateuploadform.css") }}" type="text/css" />
Stefan van der Walt
Add logout button.
r5325 {% end %}
{% block params %}
Brian Granger
Major refactoring of notebook....
r6193
Stefan van der Walt
Add logout button.
r5325 data-project={{project}}
data-base-project-url={{base_project_url}}
data-base-kernel-url={{base_kernel_url}}
Brian Granger
Refactoring templates and top level js/css organization.
r6192 data-read-only={{read_only}}
Brian Granger
Major refactoring of notebook....
r6193
Stefan van der Walt
Use template inheritance.
r5324 {% end %}
Brian Granger
Major refactoring of notebook....
r6193
Brian Granger
Refactoring templates and top level js/css organization.
r6192 {% block site %}
<div id="main_app">
Brian Granger
Initial try at adding tabs to project dashboard.
r6194 <div id="tabs">
<ul>
<li><a href="#tab1">Notebooks</a></li>
<li><a href="#tab2">Clusters</a></li>
</ul>
<div id="tab1">
{% if logged_in or not read_only %}
Brian Granger
Draft of the cluster list UI....
r6195 <div id="notebook_toolbar">
Matthias BUSSONNIER
clean html, style logon form
r6840 <form id='alternate_upload' class='alternate_upload' >
Matthias BUSSONNIER
change upload sentense
r7106 <span id="drag_info" style="position:absolute" >
To import a notebook, drag the file onto the listing below or <strong>click here</strong>.
</span>
Matthias BUSSONNIER
multifile selection
r6839 <input type="file" name="datafile" class="fileinput" multiple='multiple'>
Matthias BUSSONNIER
alternate notebook upload methods...
r6838 </form>
Brian Granger
Draft of the cluster list UI....
r6195 <span id="notebook_buttons">
<button id="refresh_notebook_list" title="Refresh notebook list">Refresh</button>
<button id="new_notebook" title="Create new notebook">New Notebook</button>
Brian Granger
Initial try at adding tabs to project dashboard.
r6194 </span>
</div>
{% end %}
<div id="notebook_list">
<div id="project_name"><h2>{{project}}</h2></div>
</div>
Brian E. Granger
File upload/import working from notebook browser.
r4491 </div>
Brian Granger
Initial try at adding tabs to project dashboard.
r6194 <div id="tab2">
Brian Granger
Draft of the cluster list UI....
r6195
<div id="cluster_toolbar">
<span id="cluster_list_info">IPython parallel computing clusters</span>
<span id="cluster_buttons">
<button id="refresh_cluster_list" title="Refresh cluster list">Refresh</button>
</span>
</div>
<div id="cluster_list">
Brian Granger
Cluster management is now working....
r6197 <div id="cluster_header">
<span>profile</span>
<span>action</span>
Brian Granger
Chaging # of engines format in cluster list.
r6201 <span title="Enter the number of engines to start or empty for default"># of engines</span>
Brian Granger
Cluster management is now working....
r6197 <span>status</span>
</div>
Brian Granger
Draft of the cluster list UI....
r6195 </div>
Brian E. Granger
Implemented basic notebook browser and fixed numerous bugs.
r4488 </div>
Brian Granger
Initial try at adding tabs to project dashboard.
r6194 </div>
Brian Granger
Refactoring templates and top level js/css organization.
r6192
</div>
Stefan van der Walt
Use template inheritance.
r5324 {% end %}
Brian E. Granger
Implemented basic notebook browser and fixed numerous bugs.
r4488
Stefan van der Walt
Use template inheritance.
r5324 {% block script %}
Andrew Straw
use Tornado's handler.static_url() in templates
r6002 <script src="{{static_url("js/notebooklist.js") }}" type="text/javascript" charset="utf-8"></script>
Brian Granger
Draft of the cluster list UI....
r6195 <script src="{{static_url("js/clusterlist.js") }}" type="text/javascript" charset="utf-8"></script>
Andrew Straw
use Tornado's handler.static_url() in templates
r6002 <script src="{{static_url("js/projectdashboardmain.js") }}" type="text/javascript" charset="utf-8"></script>
Stefan van der Walt
Use template inheritance.
r5324 {% end %}