blob: 6d32e81cb5be691513e12a20cfe44fca9e923ca7 [file] [log] [blame]
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>UserALE API &mdash; UserAle 1.0.0 documentation</title>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="top" title="UserAle 1.0.0 documentation" href="index.html"/>
<link rel="up" title="API" href="userale.html"/>
<link rel="next" title="UserALE Logger" href="userale.logger.html"/>
<link rel="prev" title="API" href="userale.html"/>
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="index.html" class="icon icon-home"> UserAle
</a>
<div class="version">
1.0.0
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul>
<li class="toctree-l1"><a class="reference internal" href="installation.html">Installation Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="quickstart.html">Quickstart Guide</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="userale.html">API</a><ul class="current">
<li class="toctree-l2 current"><a class="current reference internal" href="#">UserALE API</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="userale.html#logger">Logger</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="authors.html">Authors</a></li>
<li class="toctree-l1"><a class="reference internal" href="changelog.html">UserAle Changelog</a></li>
<li class="toctree-l1"><a class="reference internal" href="license.html">License</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">UserAle</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> &raquo;</li>
<li><a href="userale.html">API</a> &raquo;</li>
<li>UserALE API</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="module-userale.ale">
<span id="userale-api"></span><h1>UserALE API<a class="headerlink" href="#module-userale.ale" title="Permalink to this headline"></a></h1>
<dl class="class">
<dt id="userale.ale.Ale">
<em class="property">class </em><code class="descclassname">userale.ale.</code><code class="descname">Ale</code><span class="sig-paren">(</span><em>output='userale.log'</em>, <em>autostart=True</em>, <em>interval=5000</em>, <em>user=None</em>, <em>version=None</em>, <em>details=False</em>, <em>resolution=500</em>, <em>shutoff=[]</em><span class="sig-paren">)</span><a class="headerlink" href="#userale.ale.Ale" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">PyQt5.QtCore.QObject</span></code></p>
<p>UserALE intercepts all application events by letting the developer install an event filter in their PyQT5 application to
generate detailed user logs. UserAle does not capture system level logs or events generated by a non-user
(a.k.a. system and signals sent between QObjects).</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>output</strong> &#8211; [str] The file or url path to which logs will be sent</li>
<li><strong>autostart</strong> &#8211; [bool] Should UserAle start auotmatically on app rendering</li>
<li><strong>interval</strong> &#8211; [int] The minimum time interval in ms betweeen batch transmission of logs</li>
<li><strong>user</strong> &#8211; [str] Identifier for the user of the application</li>
<li><strong>version</strong> &#8211; [str] The application version</li>
<li><strong>details</strong> &#8211; [bool] Should detailed logs (key strokes, input/change values) be recorded</li>
<li><strong>resolution</strong> &#8211; [int] Delay in ms between instances of high frequency logs like mouseovers, scrolls, etc</li>
<li><strong>shutoff</strong> &#8211; [list] Turn off logging for specific events. For example, to ignore mousedown events, [&#8216;mousedown&#8217;]</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>An example log will appear like this:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="p">{</span>
<span class="s1">&#39;target&#39;</span><span class="p">:</span> <span class="p">,</span>
<span class="s1">&#39;path&#39;</span><span class="p">:</span> <span class="p">[</span><span class="s1">&#39;Example&#39;</span><span class="p">,</span> <span class="s1">&#39;testLineEdit&#39;</span><span class="p">],</span>
<span class="s1">&#39;clientTime&#39;</span><span class="p">:</span> <span class="p">,</span>
<span class="s1">&#39;location&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;x&#39;</span><span class="p">:</span> <span class="mi">82</span><span class="p">,</span> <span class="s1">&#39;y&#39;</span><span class="p">:</span> <span class="mi">0</span><span class="p">},</span>
<span class="s1">&#39;type&#39;</span><span class="p">:</span> <span class="s1">&#39;dragstart&#39;</span><span class="p">,</span>
<span class="s1">&#39;userAction&#39;</span><span class="p">:</span> <span class="s1">&#39;true&#39;</span><span class="p">,</span>
<span class="s1">&#39;details&#39;</span> <span class="p">:</span> <span class="p">[</span> <span class="p">],</span>
<span class="s1">&#39;userId&#39;</span><span class="p">:</span> <span class="s1">&#39;userABC1234&#39;</span><span class="p">,</span>
<span class="s1">&#39;toolVersion&#39;</span><span class="p">:</span> <span class="s1">&#39;myApplication&#39;</span><span class="p">,</span>
<span class="s1">&#39;useraleVersion&#39;</span><span class="p">:</span> <span class="s1">&#39;1.0.0 alpha&#39;</span>
<span class="p">}</span>
</pre></div>
</div>
<dl class="method">
<dt id="userale.ale.Ale.eventFilter">
<code class="descname">eventFilter</code><span class="sig-paren">(</span><em>object</em>, <em>event</em><span class="sig-paren">)</span><a class="headerlink" href="#userale.ale.Ale.eventFilter" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>object</strong> &#8211; [QObject] The object being watched.</li>
<li><strong>event</strong> &#8211; [QEvent]</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">[bool] Return true in order to filter the event out (stop it from being handled further). Otherwise return false.</p>
</td>
</tr>
</tbody>
</table>
<p>Filters events for the watched object (in this case, QApplication)</p>
</dd></dl>
<dl class="method">
<dt id="userale.ale.Ale.getClientTime">
<code class="descname">getClientTime</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#userale.ale.Ale.getClientTime" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">[str] String representation of the time the event was triggered.</td>
</tr>
</tbody>
</table>
<p>Capture the time the event was captured.</p>
</dd></dl>
<dl class="method">
<dt id="userale.ale.Ale.getLocation">
<code class="descname">getLocation</code><span class="sig-paren">(</span><em>event</em><span class="sig-paren">)</span><a class="headerlink" href="#userale.ale.Ale.getLocation" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>event</strong> &#8211; [QEvent] The base class for all event classes.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">[dict] A dictionary representation of the x and y positions of the mouse cursor.</td>
</tr>
</tbody>
</table>
<p>Grab the x and y position of the mouse cursor, relative to the widget that received the event.</p>
</dd></dl>
<dl class="method">
<dt id="userale.ale.Ale.getPath">
<code class="descname">getPath</code><span class="sig-paren">(</span><em>object</em><span class="sig-paren">)</span><a class="headerlink" href="#userale.ale.Ale.getPath" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>object</strong> &#8211; [QObject] The base class for all Qt objects.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">[list] List of QObjects up to the child object.</td>
</tr>
</tbody>
</table>
<p>Fetch the entire path up the root of the tree for a leaf node object.
Recursive operation.</p>
</dd></dl>
<dl class="method">
<dt id="userale.ale.Ale.getSelector">
<code class="descname">getSelector</code><span class="sig-paren">(</span><em>object</em><span class="sig-paren">)</span><a class="headerlink" href="#userale.ale.Ale.getSelector" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>object</strong> &#8211; [QObject] The base class for all Qt objects.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">[str] The Qt object&#8217;s name</td>
</tr>
</tbody>
</table>
<p>Get target object&#8217;s name (object defined by user or object&#8217;s meta class name)</p>
</dd></dl>
<dl class="method">
<dt id="userale.ale.Ale.handleDragEvents">
<code class="descname">handleDragEvents</code><span class="sig-paren">(</span><em>event_type</em>, <em>event</em>, <em>object</em><span class="sig-paren">)</span><a class="headerlink" href="#userale.ale.Ale.handleDragEvents" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>event_type</strong> &#8211; [str] The string representation of the type of event being triggered by the user.</li>
<li><strong>event</strong> &#8211; [QEvent] The base class for all event classes.</li>
<li><strong>object</strong> &#8211; [QObject] The base class for all Qt objects.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">[dict] A userale log describing a drag event.</p>
</td>
</tr>
</tbody>
</table>
<p>Returns the userale log representing all drag events.</p>
</dd></dl>
<dl class="method">
<dt id="userale.ale.Ale.handleKeyEvents">
<code class="descname">handleKeyEvents</code><span class="sig-paren">(</span><em>event_type</em>, <em>event</em>, <em>object</em><span class="sig-paren">)</span><a class="headerlink" href="#userale.ale.Ale.handleKeyEvents" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>event_type</strong> &#8211; [str] The string representation of the type of event being triggered by the user.</li>
<li><strong>event</strong> &#8211; [QEvent] The base class for all event classes.</li>
<li><strong>object</strong> &#8211; [QObject] The base class for all Qt objects.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">[dict] A userale log describing a key event.</p>
</td>
</tr>
</tbody>
</table>
<p>Returns the userale log representing all key events, including key name and key code.</p>
</dd></dl>
<dl class="method">
<dt id="userale.ale.Ale.handleLeaveEvents">
<code class="descname">handleLeaveEvents</code><span class="sig-paren">(</span><em>event_type</em>, <em>event</em>, <em>object</em><span class="sig-paren">)</span><a class="headerlink" href="#userale.ale.Ale.handleLeaveEvents" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>event_type</strong> &#8211; [str] The string representation of the type of event being triggered by the user.</li>
<li><strong>event</strong> &#8211; [QEvent] The base class for all event classes.</li>
<li><strong>object</strong> &#8211; [QObject] The base class for all Qt objects.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">[dict] A userale log describing a leave event.</p>
</td>
</tr>
</tbody>
</table>
<p>Returns the userale log representing all leave events.</p>
</dd></dl>
<dl class="method">
<dt id="userale.ale.Ale.handleMouseEvents">
<code class="descname">handleMouseEvents</code><span class="sig-paren">(</span><em>event_type</em>, <em>event</em>, <em>object</em><span class="sig-paren">)</span><a class="headerlink" href="#userale.ale.Ale.handleMouseEvents" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>event_type</strong> &#8211; [str] The string representation of the type of event being triggered by the user.</li>
<li><strong>event</strong> &#8211; [QEvent] The base class for all event classes.</li>
<li><strong>object</strong> &#8211; [QObject] The base class for all Qt objects.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">[dict] A userale log describing a mouse event.</p>
</td>
</tr>
</tbody>
</table>
<p>Returns the userale log representing all mouse event data.</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="userale.ale.Ale.handleMoveEvents">
<code class="descname">handleMoveEvents</code><span class="sig-paren">(</span><em>event_type</em>, <em>event</em>, <em>object</em><span class="sig-paren">)</span><a class="headerlink" href="#userale.ale.Ale.handleMoveEvents" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>event_type</strong> &#8211; [str] The string representation of the type of event being triggered by the user.</li>
<li><strong>event</strong> &#8211; [QEvent] The base class for all event classes.</li>
<li><strong>object</strong> &#8211; [QObject] The base class for all Qt objects.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">[dict] A userale log describing a drag event.</p>
</td>
</tr>
</tbody>
</table>
<p>Returns the userale log representing all move events.</p>
</dd></dl>
<dl class="method">
<dt id="userale.ale.Ale.handleResizeEvents">
<code class="descname">handleResizeEvents</code><span class="sig-paren">(</span><em>event_type</em>, <em>event</em>, <em>object</em><span class="sig-paren">)</span><a class="headerlink" href="#userale.ale.Ale.handleResizeEvents" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>event_type</strong> &#8211; [str] The string representation of the type of event being triggered by the user.</li>
<li><strong>event</strong> &#8211; [QEvent] The base class for all event classes.</li>
<li><strong>object</strong> &#8211; [QObject] The base class for all Qt objects.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">[dict] A userale log describing a resize event.</p>
</td>
</tr>
</tbody>
</table>
<p>Returns the userale log representing all resize events.</p>
</dd></dl>
<dl class="method">
<dt id="userale.ale.Ale.handleScrollEvents">
<code class="descname">handleScrollEvents</code><span class="sig-paren">(</span><em>event_type</em>, <em>event</em>, <em>object</em><span class="sig-paren">)</span><a class="headerlink" href="#userale.ale.Ale.handleScrollEvents" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>event_type</strong> &#8211; [str] The string representation of the type of event being triggered by the user.</li>
<li><strong>event</strong> &#8211; [QEvent] The base class for all event classes.</li>
<li><strong>object</strong> &#8211; [QObject] The base class for all Qt objects.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">[dict] A userale log describing a scroll event.</p>
</td>
</tr>
</tbody>
</table>
<p>Returns the userale log representing all scroll events.</p>
</dd></dl>
</dd></dl>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="userale.logger.html" class="btn btn-neutral float-right" title="UserALE Logger" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="userale.html" class="btn btn-neutral" title="API" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright 2016, The Charles Stark Draper Laboratory..
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'1.0.0',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
});
</script>
</body>
</html>