/usr/share/doc/python-djvu-doc/html/event-model.html is in python-djvu-doc 0.8-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Event model — python-djvulibre 0.8 documentation</title>
<link rel="stylesheet" href="_static/haiku.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/docutils-math.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.8',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</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>
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="DjVu documents" href="documents.html" />
<link rel="prev" title="LISP S-expressions" href="expressions.html" />
</head>
<body>
<div class="header" role="banner"><h1 class="heading"><a href="index.html">
<span>python-djvulibre 0.8 documentation</span></a></h1>
<h2 class="heading"><span>Event model</span></h2>
</div>
<div class="topnav" role="navigation" aria-label="top navigation">
<p>
«  <a href="expressions.html">LISP S-expressions</a>
  ::  
<a class="uplink" href="index.html">Contents</a>
  ::  
<a href="documents.html">DjVu documents</a>  »
</p>
</div>
<div class="content">
<div class="section" id="event-model">
<h1>Event model<a class="headerlink" href="#event-model" title="Permalink to this headline">¶</a></h1>
<p>The DDJVU API provides for efficiently decoding and displaying DjVu documents.
It provides for displaying images without waiting for the complete DjVu data.
Images can be displayed as soon as sufficient data is available. A higher
quality image might later be displayed when further data is available. The DjVu
library achieves this using a complicated scheme involving multiple threads.
The DDJVU API hides this complexity with a familiar event model.</p>
<dl class="data">
<dt id="djvu.decode.DDJVU_VERSION">
<code class="descclassname">djvu.decode.</code><code class="descname">DDJVU_VERSION</code><a class="headerlink" href="#djvu.decode.DDJVU_VERSION" title="Permalink to this definition">¶</a></dt>
<dd><p>Version of the DDJVU API.</p>
</dd></dl>
<dl class="class">
<dt id="djvu.decode.Context">
<em class="property">class </em><code class="descclassname">djvu.decode.</code><code class="descname">Context</code><span class="sig-paren">(</span><em>argv0</em><span class="sig-paren">)</span><a class="headerlink" href="#djvu.decode.Context" title="Permalink to this definition">¶</a></dt>
<dd><dl class="method">
<dt id="djvu.decode.Context.handle_message">
<code class="descname">handle_message</code><span class="sig-paren">(</span><em>message</em><span class="sig-paren">)</span><a class="headerlink" href="#djvu.decode.Context.handle_message" title="Permalink to this definition">¶</a></dt>
<dd><p>This method is called, in a separate thread, for every received
message, <em>before</em> any blocking method finishes.</p>
<p>By default do something roughly equivalent to:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="k">if</span> <span class="n">message</span><span class="o">.</span><span class="n">job</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">message</span><span class="o">.</span><span class="n">job</span><span class="o">.</span><span class="n">message_queue</span><span class="o">.</span><span class="n">put</span><span class="p">(</span><span class="n">message</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">message</span><span class="o">.</span><span class="n">document</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">message</span><span class="o">.</span><span class="n">document</span><span class="o">.</span><span class="n">message_queue</span><span class="o">.</span><span class="n">put</span><span class="p">(</span><span class="n">message</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">message</span><span class="o">.</span><span class="n">context</span><span class="o">.</span><span class="n">message_queue</span><span class="o">.</span><span class="n">put</span><span class="p">(</span><span class="n">message</span><span class="p">)</span>
</pre></div>
</div>
<p>You may want to override this method to change this behaviour.</p>
<p>All exceptions raised by this method will be ignored.</p>
</dd></dl>
<dl class="attribute">
<dt id="djvu.decode.Context.message_queue">
<code class="descname">message_queue</code><a class="headerlink" href="#djvu.decode.Context.message_queue" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the internal message queue.</p>
</dd></dl>
<dl class="method">
<dt id="djvu.decode.Context.get_message">
<code class="descname">get_message</code><span class="sig-paren">(</span><span class="optional">[</span><em>wait=True</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#djvu.decode.Context.get_message" title="Permalink to this definition">¶</a></dt>
<dd><p>Get message from the internal context queue.</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">Returns:</th><td class="field-body">a <a class="reference internal" href="messages.html#djvu.decode.Message" title="djvu.decode.Message"><code class="xref py py-class docutils literal"><span class="pre">Message</span></code></a> instance</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><code class="docutils literal"><span class="pre">None</span></code> if <cite>wait</cite> is false and no message is available.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="djvu.decode.Context.new_document">
<code class="descname">new_document</code><span class="sig-paren">(</span><em>uri</em><span class="optional">[</span>, <em>cache=True</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#djvu.decode.Context.new_document" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates a decoder for a DjVu document and starts decoding. This
method returns immediately. The decoding job then generates messages to
request the raw data and to indicate the state of the decoding process.</p>
<p><cite>uri</cite> specifies an optional URI for the document. The URI follows the
usual syntax (<code class="docutils literal"><span class="pre">protocol://machine/path</span></code>). It should not end with
a slash. It only serves two purposes:</p>
<ul class="simple">
<li>The URI is used as a key for the cache of decoded pages.</li>
<li>The URI is used to document <a class="reference internal" href="messages.html#djvu.decode.NewStreamMessage" title="djvu.decode.NewStreamMessage"><code class="xref py py-class docutils literal"><span class="pre">NewStreamMessage</span></code></a> messages.</li>
</ul>
<p>Setting argument <cite>cache</cite> to a true value indicates that decoded pages
should be cached when possible.</p>
<p>It is important to understand that the URI is not used to access the
data. The document generates <a class="reference internal" href="messages.html#djvu.decode.NewStreamMessage" title="djvu.decode.NewStreamMessage"><code class="xref py py-class docutils literal"><span class="pre">NewStreamMessage</span></code></a> messages to indicate
which data is needed. The caller must then provide the raw data using
a <a class="reference internal" href="messages.html#djvu.decode.NewStreamMessage.stream" title="djvu.decode.NewStreamMessage.stream"><code class="xref py py-attr docutils literal"><span class="pre">NewStreamMessage.stream</span></code></a> object.</p>
<dl class="class">
<dt id="djvu.decode.Context.djvu.decode.FileUri">
<em class="property">class </em><code class="descclassname">djvu.decode.</code><code class="descname">FileUri</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#djvu.decode.Context.djvu.decode.FileUri" title="Permalink to this definition">¶</a></dt>
<dd><p>To open a local file, provide a <code class="xref py py-class docutils literal"><span class="pre">FileUri</span></code> instance as an <cite>uri</cite>.</p>
</dd></dl>
<p>Localized characters in <cite>uri</cite> should be in URI-encoded.</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">Return type:</th><td class="field-body"><a class="reference internal" href="documents.html#djvu.decode.Document" title="djvu.decode.Document"><code class="xref py py-class docutils literal"><span class="pre">Document</span></code></a></td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="exceptions.html#djvu.decode.JobFailed" title="djvu.decode.JobFailed"><strong>JobFailed</strong></a> – on failure.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="djvu.decode.Context.cache_size">
<code class="descname">cache_size</code><a class="headerlink" href="#djvu.decode.Context.cache_size" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="djvu.decode.Context.clear_cache">
<code class="descname">clear_cache</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#djvu.decode.Context.clear_cache" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="djvu.decode.Job">
<em class="property">class </em><code class="descclassname">djvu.decode.</code><code class="descname">Job</code><a class="headerlink" href="#djvu.decode.Job" title="Permalink to this definition">¶</a></dt>
<dd><p>A job.</p>
<dl class="method">
<dt id="djvu.decode.Job.get_message">
<code class="descname">get_message</code><span class="sig-paren">(</span><span class="optional">[</span><em>wait=True</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#djvu.decode.Job.get_message" title="Permalink to this definition">¶</a></dt>
<dd><p>Get message from the internal job queue.</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">Returns:</th><td class="field-body">a <a class="reference internal" href="messages.html#djvu.decode.Message" title="djvu.decode.Message"><code class="xref py py-class docutils literal"><span class="pre">Message</span></code></a> instance.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><code class="docutils literal"><span class="pre">None</span></code> if <cite>wait</cite> is false and no message is available.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="djvu.decode.Job.is_done">
<code class="descname">is_done</code><a class="headerlink" href="#djvu.decode.Job.is_done" title="Permalink to this definition">¶</a></dt>
<dd><p>Indicate whether the decoding job is done.</p>
</dd></dl>
<dl class="attribute">
<dt id="djvu.decode.Job.is_error">
<code class="descname">is_error</code><a class="headerlink" href="#djvu.decode.Job.is_error" title="Permalink to this definition">¶</a></dt>
<dd><p>Indicate whether the decoding job is done.</p>
</dd></dl>
<dl class="attribute">
<dt id="djvu.decode.Job.message_queue">
<code class="descname">message_queue</code><a class="headerlink" href="#djvu.decode.Job.message_queue" 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">the internal message queue.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="djvu.decode.Job.status">
<code class="descname">status</code><a class="headerlink" href="#djvu.decode.Job.status" 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">a <a class="reference internal" href="exceptions.html#djvu.decode.JobException" title="djvu.decode.JobException"><code class="xref py py-exc docutils literal"><span class="pre">JobException</span></code></a> subclass indicating the job status.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="djvu.decode.Job.stop">
<code class="descname">stop</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#djvu.decode.Job.stop" title="Permalink to this definition">¶</a></dt>
<dd><p>Attempt to cancel the job.</p>
<p>This is a best effort method. There no guarantee that the job will
actually stop.</p>
</dd></dl>
<dl class="method">
<dt id="djvu.decode.Job.wait">
<code class="descname">wait</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#djvu.decode.Job.wait" title="Permalink to this definition">¶</a></dt>
<dd><p>Wait until the job is done.</p>
</dd></dl>
</dd></dl>
</div>
</div>
<div class="bottomnav" role="navigation" aria-label="bottom navigation">
<p>
«  <a href="expressions.html">LISP S-expressions</a>
  ::  
<a class="uplink" href="index.html">Contents</a>
  ::  
<a href="documents.html">DjVu documents</a>  »
</p>
</div>
<div class="footer" role="contentinfo">
© Copyright 2007-2018 Jakub Wilk <jwilk@jwilk.net>.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.6.7.
</div>
</body>
</html>
|