/usr/lib/python3/dist-packages/djvu/const.py is in python3-djvu 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 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | # encoding=UTF-8
# Copyright © 2008-2015 Jakub Wilk <jwilk@jwilk.net>
#
# This file is part of python-djvulibre.
#
# python-djvulibre is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
# python-djvulibre is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
'''DjVuLibre bindings: various constants.'''
import djvu.sexpr
EMPTY_LIST = djvu.sexpr.Expression([])
EMPTY_OUTLINE = djvu.sexpr.Expression([djvu.sexpr.Symbol('bookmarks')])
METADATA_BIBTEX_KEYS = frozenset(djvu.sexpr.Symbol(x) for x in '''
address
annote
author
booktitle
chapter
crossref
edition
editor
howpublished
institution
journal
key
month
note
number
organization
pages
publisher
school
series
title
type
volume
year'''.split())
# Retrieved from <https://www.ctan.org/pkg/bibtex>
METADATA_PDFINFO_KEYS = frozenset(djvu.sexpr.Symbol(x) for x in '''
Author
CreationDate
Creator
Keywords
ModDate
Producer
Subject
Title
Trapped'''.split())
# Retrieved from the PDF specification
METADATA_KEYS = METADATA_BIBTEX_KEYS | METADATA_PDFINFO_KEYS
class TextZoneType(djvu.sexpr.Symbol):
'''
A type of a text zone. You can compare text zone types with the < operator.
To create objects of this class, use the get_text_zone_type() function.
'''
__cache = {}
@classmethod
def from_symbol(cls, symbol):
return cls.__cache[symbol]
def __new__(cls, value, rank):
self = djvu.sexpr.Symbol.__new__(cls, value)
TextZoneType.__cache[self] = self
return self
def __init__(self, value, rank):
self.__rank = rank
def __lt__(self, other):
if not isinstance(other, TextZoneType):
raise TypeError('cannot compare text zone type with other object')
return self.__rank < other.__rank
def __le__(self, other):
if not isinstance(other, TextZoneType):
raise TypeError('cannot compare text zone type with other object')
return self.__rank <= other.__rank
def __gt__(self, other):
if not isinstance(other, TextZoneType):
raise TypeError('cannot compare text zone type with other object')
return self.__rank > other.__rank
def __ge__(self, other):
if not isinstance(other, TextZoneType):
raise TypeError('cannot compare text zone type with other object')
return self.__rank >= other.__rank
def __repr__(self):
return '<{mod}.{cls}: {name}>'.format(
mod=self.__module__,
cls=type(self).__name__,
name=self
)
TEXT_ZONE_PAGE = TextZoneType('page', 7)
TEXT_ZONE_COLUMN = TextZoneType('column', 6)
TEXT_ZONE_REGION = TextZoneType('region', 5)
TEXT_ZONE_PARAGRAPH = TextZoneType('para', 4)
TEXT_ZONE_LINE = TextZoneType('line', 3)
TEXT_ZONE_WORD = TextZoneType('word', 2)
TEXT_ZONE_CHARACTER = TextZoneType('char', 1)
def get_text_zone_type(symbol):
return TextZoneType.from_symbol(symbol)
TEXT_ZONE_SEPARATORS = {
TEXT_ZONE_PAGE: '\f', # Form Feed (FF)
TEXT_ZONE_COLUMN: '\v', # Vertical tab (VT, LINE TABULATION)
TEXT_ZONE_REGION: '\035', # Group Separator (GS, INFORMATION SEPARATOR THREE)
TEXT_ZONE_PARAGRAPH: '\037', # Unit Separator (US, INFORMATION SEPARATOR ONE)
TEXT_ZONE_LINE: '\n', # Line Feed (LF)
TEXT_ZONE_WORD: ' ', # space
TEXT_ZONE_CHARACTER: ''
}
# 8.3.4.2 Maparea (overprinted annotations)
ANNOTATION_MAPAREA = djvu.sexpr.Symbol('maparea')
# 8.3.4.2 Maparea (overprinted annotations):
MAPAREA_SHAPE_RECTANGLE = djvu.sexpr.Symbol('rect')
MAPAREA_SHAPE_OVAL = djvu.sexpr.Symbol('oval')
MAPAREA_SHAPE_POLYGON = djvu.sexpr.Symbol('poly')
MAPAREA_SHAPE_LINE = djvu.sexpr.Symbol('line')
MAPAREA_SHAPE_TEXT = djvu.sexpr.Symbol('text')
MAPAREA_URI = MAPAREA_URL = djvu.sexpr.Symbol('url')
# 8.3.4.2.3.1.1 Border type:
MAPAREA_BORDER_NONE = djvu.sexpr.Symbol('none')
MAPAREA_BORDER_XOR = djvu.sexpr.Symbol('xor')
MAPAREA_BORDER_SOLID_COLOR = djvu.sexpr.Symbol('border')
# 8.3.4.2.3.1.1 Border type:
MAPAREA_BORDER_SHADOW_IN = djvu.sexpr.Symbol('shadow_in')
MAPAREA_BORDER_SHADOW_OUT = djvu.sexpr.Symbol('shadow_out')
MAPAREA_BORDER_ETCHED_IN = djvu.sexpr.Symbol('shadow_ein')
MAPAREA_BORDER_ETCHED_OUT = djvu.sexpr.Symbol('shadow_eout')
MAPAREA_SHADOW_BORDERS = (MAPAREA_BORDER_SHADOW_IN, MAPAREA_BORDER_SHADOW_OUT, MAPAREA_BORDER_ETCHED_IN, MAPAREA_BORDER_ETCHED_OUT)
MAPAREA_SHADOW_BORDER_MIN_WIDTH = 1
MAPAREA_SHADOW_BORDER_MAX_WIDTH = 32
# 8.3.4.2.3.1.2 Border always visible
MAPAREA_BORDER_ALWAYS_VISIBLE = djvu.sexpr.Symbol('border_avis')
# 8.3.4.2.3.1.3 Highlight color and opacity:
MAPAREA_HIGHLIGHT_COLOR = djvu.sexpr.Symbol('hilite')
MAPAREA_OPACITY = djvu.sexpr.Symbol('opacity')
MAPAREA_OPACITY_MIN = 0
MAPAREA_OPACITY_DEFAULT = 50
MAPAREA_OPACITY_MAX = 100
# 8.3.4.2.3.1.4 Line and Text parameters:
MAPAREA_ARROW = djvu.sexpr.Symbol('arrow')
MAPAREA_LINE_WIDTH = djvu.sexpr.Symbol('width')
MAPAREA_LINE_COLOR = djvu.sexpr.Symbol('lineclr')
MAPAREA_LINE_MIN_WIDTH = 1
MAPAREA_LINE_COLOR_DEFAULT = '#000000'
# 8.3.4.2.3.1.4 Line and Text parameters:
MAPAREA_BACKGROUND_COLOR = djvu.sexpr.Symbol('backclr')
MAPAREA_TEXT_COLOR = djvu.sexpr.Symbol('textclr')
MAPAREA_PUSHPIN = djvu.sexpr.Symbol('pushpin')
MAPAREA_TEXT_COLOR_DEFAULT = '#000000'
# 8.3.4.1 Initial Document View :
ANNOTATION_BACKGROUND = djvu.sexpr.Symbol('background') # 8.3.4.1.1 Background Color
ANNOTATION_ZOOM = djvu.sexpr.Symbol('zoom') # 8.3.4.1.2 Initial Zoom
ANNOTATION_MODE = djvu.sexpr.Symbol('mode') # 8.3.4.1.3 Initial Display level
ANNOTATION_ALIGN = djvu.sexpr.Symbol('align') # 8.3.4.1.4 Alignment
# djvuchanges.txt, sections "Metadata Annotations" and "Document Annotations and Metadata":
ANNOTATION_METADATA = djvu.sexpr.Symbol('metadata')
# 8.3.4.3 Printed headers and footers:
ANNOTATION_PRINTED_HEADER = djvu.sexpr.Symbol('phead')
ANNOTATION_PRINTED_FOOTER = djvu.sexpr.Symbol('pfoot')
PRINTER_HEADER_ALIGN_LEFT = PRINTED_FOOTER_ALIGN_LEFT = djvu.sexpr.Symbol('left')
PRINTER_HEADER_ALIGN_CENTER = PRINTED_FOOTER_ALIGN_CENTER = djvu.sexpr.Symbol('center')
PRINTER_HEADER_ALIGN_RIGHT = PRINTED_FOOTER_ALIGN_RIGHT = djvu.sexpr.Symbol('right')
__all__ = [
'ANNOTATION_ALIGN',
'ANNOTATION_BACKGROUND',
'ANNOTATION_MAPAREA',
'ANNOTATION_METADATA',
'ANNOTATION_MODE',
'ANNOTATION_PRINTED_FOOTER',
'ANNOTATION_PRINTED_HEADER',
'ANNOTATION_ZOOM',
'EMPTY_LIST',
'EMPTY_OUTLINE',
'MAPAREA_ARROW',
'MAPAREA_BACKGROUND_COLOR',
'MAPAREA_BORDER_ALWAYS_VISIBLE',
'MAPAREA_BORDER_ETCHED_IN',
'MAPAREA_BORDER_ETCHED_OUT',
'MAPAREA_BORDER_NONE',
'MAPAREA_BORDER_SHADOW_IN',
'MAPAREA_BORDER_SHADOW_OUT',
'MAPAREA_BORDER_SOLID_COLOR',
'MAPAREA_BORDER_XOR',
'MAPAREA_HIGHLIGHT_COLOR',
'MAPAREA_LINE_COLOR',
'MAPAREA_LINE_COLOR_DEFAULT',
'MAPAREA_LINE_MIN_WIDTH',
'MAPAREA_LINE_WIDTH',
'MAPAREA_OPACITY',
'MAPAREA_OPACITY_DEFAULT',
'MAPAREA_OPACITY_MAX',
'MAPAREA_OPACITY_MIN',
'MAPAREA_PUSHPIN',
'MAPAREA_SHADOW_BORDERS',
'MAPAREA_SHADOW_BORDER_MAX_WIDTH',
'MAPAREA_SHADOW_BORDER_MIN_WIDTH',
'MAPAREA_SHAPE_LINE',
'MAPAREA_SHAPE_OVAL',
'MAPAREA_SHAPE_POLYGON',
'MAPAREA_SHAPE_RECTANGLE',
'MAPAREA_SHAPE_TEXT',
'MAPAREA_TEXT_COLOR',
'MAPAREA_TEXT_COLOR_DEFAULT',
'MAPAREA_URI',
'MAPAREA_URL',
'METADATA_BIBTEX_KEYS',
'METADATA_KEYS',
'METADATA_PDFINFO_KEYS',
'PRINTED_FOOTER_ALIGN_CENTER',
'PRINTED_FOOTER_ALIGN_LEFT',
'PRINTED_FOOTER_ALIGN_RIGHT',
'PRINTER_HEADER_ALIGN_CENTER',
'PRINTER_HEADER_ALIGN_LEFT',
'PRINTER_HEADER_ALIGN_RIGHT',
'TEXT_ZONE_CHARACTER',
'TEXT_ZONE_COLUMN',
'TEXT_ZONE_LINE',
'TEXT_ZONE_PAGE',
'TEXT_ZONE_PARAGRAPH',
'TEXT_ZONE_REGION',
'TEXT_ZONE_SEPARATORS',
'TEXT_ZONE_WORD',
'TextZoneType',
'get_text_zone_type'
]
# vim:ts=4 sts=4 sw=4 et
|