Messages¶
-
class
djvu.decode.
Message
¶ An abstract base for all messages.
Inheritance diagram:
-
class
djvu.decode.
ErrorMessage
¶ An
ErrorMessage
is generated whenever the decoder or the DDJVU API encounters an error condition. All errors are reported as error messages because they can occur asynchronously.-
message
¶ Returns: the actual error message, as text.
-
location
¶ Returns: a (function, filename, line_no) tuple indicating where the error was detected.
-
-
class
djvu.decode.
InfoMessage
¶ A
InfoMessage
provides informational text indicating the progress of the decoding process. This might be displayed in the browser status bar.-
message
¶ Returns: the actual error message, as text.
-
-
class
djvu.decode.
NewStreamMessage
¶ A
NewStreamMessage
is generated whenever the decoder needs to access raw DjVu data. The caller must then provide the requested data using thestream
file-like object.In the case of indirect documents, a single decoder might simultaneously request several streams of data.
-
name
¶ The first
NewStreamMessage
message always hasname
set toNone
. It indicates that the decoder needs to access the data in the main DjVu file.Further
NewStreamMessage
messages are generated to access the auxiliary files of indirect or indexed DjVu documents.name
then provides the base name of the auxiliary file.
-
uri
¶ Returns: the requested URI. URI is set according to the uri argument provided to function
Context.new_document()
. The firstNewStreamMessage
message always contain the URI passed toContext.new_document()
. SubsequentNewStreamMessage
messages contain the URI of the auxiliary files for indirect or indexed DjVu documents.
-
stream
¶ Returns: a data stream. -
class
djvu.decode.
Stream
¶ -
close
()¶ Indicate that no more data will be provided on the particular stream.
-
abort
()¶ Indicate that no more data will be provided on the particular stream, because the user has interrupted the data transfer (for instance by pressing the stop button of a browser) and that the decoding threads should be stopped as soon as feasible.
-
flush
()¶ Do nothing.
(This method is provided solely to implement Python’s file-like interface.)
-
read
([size])¶ Raises: exceptions.IOError – always. (This method is provided solely to implement Python’s file-like interface.)
-
write
(data)¶ Provide raw data to the DjVu decoder.
This method should be called as soon as the data is available, for instance when receiving DjVu data from a network connection.
-
-
class
-
-
class
djvu.decode.
DocInfoMessage
¶ A
DocInfoMessage
indicates that basic information about the document has been obtained and decoded. Not much can be done before this happens.Check the document’s
decoding_status
to determine whether the operation was successful.
-
class
djvu.decode.
PageInfoMessage
¶ The page decoding process generates a
PageInfoMessage
:- when basic page information is available and before any
RelayoutMessage
orRedisplayMessage
, - when the page decoding thread terminates.
You can distinguish both cases using the page job’s
status
.A
PageInfoMessage
may be also generated as a consequence of readingPage.get_info()
orPage.dump
.- when basic page information is available and before any
-
class
djvu.decode.
ChunkMessage
¶ A
ChunkMessage
indicates that an additional chunk of DjVu data has been decoded.
-
class
djvu.decode.
RelayoutMessage
¶ A
RelayoutMessage
is generated when a DjVu viewer should recompute the layout of the page viewer because the page size and resolution information has been updated.
-
class
djvu.decode.
RedisplayMessage
¶ A
RedisplayMessage
is generated when a DjVu viewer should callPageJob.render()
and redisplay the page. This happens, for instance, when newly decoded DjVu data provides a better image.
-
class
djvu.decode.
ThumbnailMessage
¶ A
ThumbnailMessage
is sent when additional thumbnails are available.
-
class
djvu.decode.
ProgressMessage
¶ A
ProgressMessage
is generated to indicate progress towards the completion of a print or save job.-
percent
¶ Returns: the percent of the job done.
-
status
¶ Returns: a JobException
subclass indicating the current job status.
-