extract-msg 0.48.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- extract_msg/__init__.py +71 -0
- extract_msg/__main__.py +115 -0
- extract_msg/_rtf/__init__.py +21 -0
- extract_msg/_rtf/create_doc.py +29 -0
- extract_msg/_rtf/inject_rtf.py +174 -0
- extract_msg/_rtf/token.py +35 -0
- extract_msg/_rtf/tokenize_rtf.py +253 -0
- extract_msg/attachments/__init__.py +144 -0
- extract_msg/attachments/attachment.py +188 -0
- extract_msg/attachments/attachment_base.py +730 -0
- extract_msg/attachments/broken_att.py +42 -0
- extract_msg/attachments/custom_att.py +173 -0
- extract_msg/attachments/custom_att_handler/__init__.py +80 -0
- extract_msg/attachments/custom_att_handler/custom_handler.py +134 -0
- extract_msg/attachments/custom_att_handler/lnk_obj_att.py +109 -0
- extract_msg/attachments/custom_att_handler/outlook_image_dib.py +141 -0
- extract_msg/attachments/emb_msg_att.py +134 -0
- extract_msg/attachments/signed_att.py +234 -0
- extract_msg/attachments/unsupported_att.py +40 -0
- extract_msg/attachments/web_att.py +74 -0
- extract_msg/constants/__init__.py +294 -0
- extract_msg/constants/ps.py +46 -0
- extract_msg/constants/re.py +42 -0
- extract_msg/constants/st.py +110 -0
- extract_msg/data/logging-config/logging-nt.json +64 -0
- extract_msg/data/logging-config/logging-posix.json +64 -0
- extract_msg/encoding/__init__.py +277 -0
- extract_msg/encoding/_dt/__init__.py +4 -0
- extract_msg/encoding/_dt/_mac_ce.py +8 -0
- extract_msg/encoding/_dt/_mac_cyrillic.py +8 -0
- extract_msg/encoding/_dt/_mac_greek.py +8 -0
- extract_msg/encoding/_dt/_mac_iceland.py +8 -0
- extract_msg/encoding/_dt/_mac_turkish.py +8 -0
- extract_msg/encoding/_dt/_win874_dec.py +8 -0
- extract_msg/encoding/_dt/_win950_dec.py +6 -0
- extract_msg/encoding/utils.py +329 -0
- extract_msg/enums.py +2067 -0
- extract_msg/exceptions.py +170 -0
- extract_msg/msg_classes/__init__.py +49 -0
- extract_msg/msg_classes/appointment.py +195 -0
- extract_msg/msg_classes/calendar.py +92 -0
- extract_msg/msg_classes/calendar_base.py +496 -0
- extract_msg/msg_classes/contact.py +1335 -0
- extract_msg/msg_classes/journal.py +131 -0
- extract_msg/msg_classes/meeting_cancellation.py +108 -0
- extract_msg/msg_classes/meeting_exception.py +55 -0
- extract_msg/msg_classes/meeting_forward.py +115 -0
- extract_msg/msg_classes/meeting_related.py +65 -0
- extract_msg/msg_classes/meeting_request.py +189 -0
- extract_msg/msg_classes/meeting_response.py +74 -0
- extract_msg/msg_classes/message.py +12 -0
- extract_msg/msg_classes/message_base.py +1382 -0
- extract_msg/msg_classes/message_signed.py +17 -0
- extract_msg/msg_classes/message_signed_base.py +168 -0
- extract_msg/msg_classes/msg.py +1172 -0
- extract_msg/msg_classes/post.py +53 -0
- extract_msg/msg_classes/sticky_note.py +67 -0
- extract_msg/msg_classes/task.py +363 -0
- extract_msg/msg_classes/task_request.py +86 -0
- extract_msg/null_date.py +34 -0
- extract_msg/ole_writer.py +1086 -0
- extract_msg/open_msg.py +204 -0
- extract_msg/properties/__init__.py +23 -0
- extract_msg/properties/named.py +481 -0
- extract_msg/properties/prop.py +506 -0
- extract_msg/properties/properties_store.py +476 -0
- extract_msg/py.typed +0 -0
- extract_msg/recipient.py +362 -0
- extract_msg/structures/__init__.py +34 -0
- extract_msg/structures/_helpers.py +345 -0
- extract_msg/structures/business_card.py +422 -0
- extract_msg/structures/cfoas.py +108 -0
- extract_msg/structures/contact_link_entry.py +51 -0
- extract_msg/structures/dev_mode_a.py +621 -0
- extract_msg/structures/dv_target_device.py +168 -0
- extract_msg/structures/entry_id.py +697 -0
- extract_msg/structures/misc_id.py +222 -0
- extract_msg/structures/mon_stream.py +55 -0
- extract_msg/structures/odt.py +74 -0
- extract_msg/structures/ole_pres.py +302 -0
- extract_msg/structures/ole_stream_struct.py +117 -0
- extract_msg/structures/recurrence_pattern.py +199 -0
- extract_msg/structures/report_tag.py +127 -0
- extract_msg/structures/system_time.py +158 -0
- extract_msg/structures/time_zone_definition.py +111 -0
- extract_msg/structures/time_zone_struct.py +102 -0
- extract_msg/structures/toc_entry.py +137 -0
- extract_msg/structures/tz_rule.py +148 -0
- extract_msg/utils.py +1270 -0
- extract_msg-0.48.2.dist-info/LICENSE.txt +674 -0
- extract_msg-0.48.2.dist-info/METADATA +321 -0
- extract_msg-0.48.2.dist-info/RECORD +95 -0
- extract_msg-0.48.2.dist-info/WHEEL +5 -0
- extract_msg-0.48.2.dist-info/entry_points.txt +2 -0
- extract_msg-0.48.2.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,621 @@
|
|
|
1
|
+
__all__ = [
|
|
2
|
+
'DevModeA',
|
|
3
|
+
]
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
import logging
|
|
7
|
+
import struct
|
|
8
|
+
|
|
9
|
+
from typing import Final, Optional
|
|
10
|
+
|
|
11
|
+
from ._helpers import BytesReader
|
|
12
|
+
from ..enums import DevModeFields
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
logger = logging.getLogger(__name__)
|
|
16
|
+
logger.addHandler(logging.NullHandler())
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class DevModeA:
|
|
20
|
+
"""
|
|
21
|
+
A DEVMODEA structure, as specified in [MS-OLEDS].
|
|
22
|
+
|
|
23
|
+
For the purposes of parsing from bytes, if something goes wrong this will
|
|
24
|
+
evaluate to ``False`` when converting to ``bool``. If no data is prodided,
|
|
25
|
+
the fields are set to default values.
|
|
26
|
+
"""
|
|
27
|
+
PARSE_STRUCT: Final[struct.Struct] = struct.Struct('<32s32s4HI13h14xI4x4I16x')
|
|
28
|
+
|
|
29
|
+
def __init__(self, data: Optional[bytes] = None):
|
|
30
|
+
self.__valid = data is None
|
|
31
|
+
|
|
32
|
+
# Set default values for fields that may not be initialized.
|
|
33
|
+
self.__orientation = 0
|
|
34
|
+
self.__paperSize = 0
|
|
35
|
+
self.__paperLength = 0
|
|
36
|
+
self.__paperWidth = 0
|
|
37
|
+
self.__scale = 0
|
|
38
|
+
self.__copies = 0
|
|
39
|
+
self.__defaultSource = 0
|
|
40
|
+
self.__printQuality = 0
|
|
41
|
+
self.__color = 0
|
|
42
|
+
self.__duplex = 0
|
|
43
|
+
self.__yResolution = 0
|
|
44
|
+
self.__ttOption = 0
|
|
45
|
+
self.__collate = 0
|
|
46
|
+
self.__nup = 0
|
|
47
|
+
self.__icmMethod = 0
|
|
48
|
+
self.__icmIntent = 0
|
|
49
|
+
self.__mediaType = 0
|
|
50
|
+
self.__ditherType = 0
|
|
51
|
+
|
|
52
|
+
if self.__valid:
|
|
53
|
+
self.__deviceName = b'\x00' * 32
|
|
54
|
+
self.__formName = b'\x00' * 32
|
|
55
|
+
self.__specVersion = 0
|
|
56
|
+
self.__driverVersion = 0
|
|
57
|
+
self.__driverExtra = 0
|
|
58
|
+
self.__fields = DevModeFields[0]
|
|
59
|
+
return
|
|
60
|
+
|
|
61
|
+
reader = BytesReader(data)
|
|
62
|
+
|
|
63
|
+
try:
|
|
64
|
+
items = reader.readStruct(self.PARSE_STRUCT)
|
|
65
|
+
self.__deviceName = items[0]
|
|
66
|
+
self.__formName = items[1]
|
|
67
|
+
self.__specVersion = items[2]
|
|
68
|
+
self.__driverVersion = items[3]
|
|
69
|
+
if items[4] != self.PARSE_STRUCT.size:
|
|
70
|
+
logger.warn(f'Unexpected `size` field for DevModeA detected ({items[4]})')
|
|
71
|
+
self.__driverExtra = items[5]
|
|
72
|
+
self.__fields = DevModeFields(items[6])
|
|
73
|
+
# TODO fields specifies if we should read the field or ignore it.
|
|
74
|
+
if DevModeFields.DM_ORIENTATION in self.__fields:
|
|
75
|
+
self.__orientation = items[7]
|
|
76
|
+
if DevModeFields.DM_PAPERSIZE in self.__fields:
|
|
77
|
+
self.__paperSize = items[8]
|
|
78
|
+
if DevModeFields.DM_PAPERLENGTH in self.__fields:
|
|
79
|
+
self.__paperLength = items[9]
|
|
80
|
+
if DevModeFields.DM_PAPERWIDTH in self.__fields:
|
|
81
|
+
self.__paperWidth = items[10]
|
|
82
|
+
if DevModeFields.DM_SCALE in self.__fields:
|
|
83
|
+
self.__scale = items[11]
|
|
84
|
+
if DevModeFields.DM_COPIES in self.__fields:
|
|
85
|
+
self.__copies = items[12]
|
|
86
|
+
if DevModeFields.DM_DEFAULTSOURCE in self.__fields:
|
|
87
|
+
self.__defaultSource = items[13]
|
|
88
|
+
if DevModeFields.DM_PRINTQUALITY in self.__fields:
|
|
89
|
+
self.__printQuality = items[14]
|
|
90
|
+
if DevModeFields.DM_COLOR in self.__fields:
|
|
91
|
+
self.__color = items[15]
|
|
92
|
+
if DevModeFields.DM_DUPLEX in self.__fields:
|
|
93
|
+
self.__duplex = items[16]
|
|
94
|
+
if DevModeFields.DM_YRESOLUTION in self.__fields:
|
|
95
|
+
self.__yResolution = items[17]
|
|
96
|
+
if DevModeFields.DM_TTOPTION in self.__fields:
|
|
97
|
+
self.__ttOption = items[18]
|
|
98
|
+
if DevModeFields.DM_COLLATE in self.__fields:
|
|
99
|
+
self.__collate = items[19]
|
|
100
|
+
if DevModeFields.DM_NUP in self.__fields:
|
|
101
|
+
self.__nup = items[20]
|
|
102
|
+
if DevModeFields.DM_ICMMETHOD in self.__fields:
|
|
103
|
+
self.__icmMethod = items[21]
|
|
104
|
+
if DevModeFields.DM_ICMINTENT in self.__fields:
|
|
105
|
+
self.__icmIntent = items[22]
|
|
106
|
+
if DevModeFields.DM_MEDIATYPE in self.__fields:
|
|
107
|
+
self.__mediaType = items[23]
|
|
108
|
+
if DevModeFields.DM_DITHERTYPE in self.__fields:
|
|
109
|
+
self.__ditherType = items[24]
|
|
110
|
+
except IOError:
|
|
111
|
+
return
|
|
112
|
+
|
|
113
|
+
self.__valid = True
|
|
114
|
+
|
|
115
|
+
def __bool__(self) -> bool:
|
|
116
|
+
return self.__valid
|
|
117
|
+
|
|
118
|
+
def __bytes__(self) -> bytes:
|
|
119
|
+
return self.toBytes()
|
|
120
|
+
|
|
121
|
+
def toBytes(self) -> bytes:
|
|
122
|
+
return self.PARSE_STRUCT.pack(
|
|
123
|
+
self.__deviceName,
|
|
124
|
+
self.__formName,
|
|
125
|
+
self.__specVersion,
|
|
126
|
+
self.__driverVersion,
|
|
127
|
+
self.PARSE_STRUCT.size,
|
|
128
|
+
self.__driverExtra,
|
|
129
|
+
self.__fields,
|
|
130
|
+
self.__orientation,
|
|
131
|
+
self.__paperSize,
|
|
132
|
+
self.__paperLength,
|
|
133
|
+
self.__paperWidth,
|
|
134
|
+
self.__scale,
|
|
135
|
+
self.__copies,
|
|
136
|
+
self.__defaultSource,
|
|
137
|
+
self.__printQuality,
|
|
138
|
+
self.__color,
|
|
139
|
+
self.__duplex,
|
|
140
|
+
self.__yResolution,
|
|
141
|
+
self.__ttOption,
|
|
142
|
+
self.__collate,
|
|
143
|
+
self.__nup,
|
|
144
|
+
self.__icmMethod,
|
|
145
|
+
self.__icmIntent,
|
|
146
|
+
self.__mediaType,
|
|
147
|
+
self.__ditherType,
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
@property
|
|
151
|
+
def collate(self) -> int:
|
|
152
|
+
return self.__collate
|
|
153
|
+
|
|
154
|
+
@collate.setter
|
|
155
|
+
def collate(self, val: Optional[int]) -> None:
|
|
156
|
+
if val is None:
|
|
157
|
+
self.__collate = 0
|
|
158
|
+
if DevModeFields.DM_COLLATE in self.__fields:
|
|
159
|
+
self.__fields ^= DevModeFields.DM_COLLATE
|
|
160
|
+
return
|
|
161
|
+
elif not isinstance(val, int):
|
|
162
|
+
raise TypeError(':property collate: must be an int or None.')
|
|
163
|
+
|
|
164
|
+
if val < -0x8000:
|
|
165
|
+
raise ValueError(':property collate: cannot be less than -0x8000.')
|
|
166
|
+
if val > 0x7FFF:
|
|
167
|
+
raise ValueError(':property collate: cannot be greater than 0x7FFF.')
|
|
168
|
+
|
|
169
|
+
self.__fields |= DevModeFields.DM_COLLATE
|
|
170
|
+
self.__collate = val
|
|
171
|
+
|
|
172
|
+
@property
|
|
173
|
+
def color(self) -> int:
|
|
174
|
+
return self.__color
|
|
175
|
+
|
|
176
|
+
@color.setter
|
|
177
|
+
def color(self, val: Optional[int]) -> None:
|
|
178
|
+
if val is None:
|
|
179
|
+
self.__color = 0
|
|
180
|
+
if DevModeFields.DM_COLOR in self.__fields:
|
|
181
|
+
self.__fields ^= DevModeFields.DM_COLOR
|
|
182
|
+
return
|
|
183
|
+
elif not isinstance(val, int):
|
|
184
|
+
raise TypeError(':property color: must be an int or None.')
|
|
185
|
+
|
|
186
|
+
if val < -0x8000:
|
|
187
|
+
raise ValueError(':property color: cannot be less than -0x8000.')
|
|
188
|
+
if val > 0x7FFF:
|
|
189
|
+
raise ValueError(':property color: cannot be greater than 0x7FFF.')
|
|
190
|
+
|
|
191
|
+
self.__fields |= DevModeFields.DM_COLOR
|
|
192
|
+
self.__color = val
|
|
193
|
+
|
|
194
|
+
@property
|
|
195
|
+
def copies(self) -> int:
|
|
196
|
+
return self.__copies
|
|
197
|
+
|
|
198
|
+
@copies.setter
|
|
199
|
+
def copies(self, val: Optional[int]) -> None:
|
|
200
|
+
if val is None:
|
|
201
|
+
self.__copies = 0
|
|
202
|
+
if DevModeFields.DM_COPIES in self.__fields:
|
|
203
|
+
self.__fields ^= DevModeFields.DM_COPIES
|
|
204
|
+
return
|
|
205
|
+
elif not isinstance(val, int):
|
|
206
|
+
raise TypeError(':property copies: must be an int or None.')
|
|
207
|
+
|
|
208
|
+
if val < -0x8000:
|
|
209
|
+
raise ValueError(':property copies: cannot be less than -0x8000.')
|
|
210
|
+
if val > 0x7FFF:
|
|
211
|
+
raise ValueError(':property copies: cannot be greater than 0x7FFF.')
|
|
212
|
+
|
|
213
|
+
self.__fields |= DevModeFields.DM_COPIES
|
|
214
|
+
self.__copies = val
|
|
215
|
+
|
|
216
|
+
@property
|
|
217
|
+
def defaultSource(self) -> int:
|
|
218
|
+
return self.__defaultSource
|
|
219
|
+
|
|
220
|
+
@defaultSource.setter
|
|
221
|
+
def defaultSource(self, val: Optional[int]) -> None:
|
|
222
|
+
if val is None:
|
|
223
|
+
self.__defaultSource = 0
|
|
224
|
+
if DevModeFields.DM_DEFAULTSOURCE in self.__fields:
|
|
225
|
+
self.__fields ^= DevModeFields.DM_DEFAULTSOURCE
|
|
226
|
+
return
|
|
227
|
+
elif not isinstance(val, int):
|
|
228
|
+
raise TypeError(':property defaultSource: must be an int or None.')
|
|
229
|
+
|
|
230
|
+
if val < -0x8000:
|
|
231
|
+
raise ValueError(':property defaultSource: cannot be less than -0x8000.')
|
|
232
|
+
if val > 0x7FFF:
|
|
233
|
+
raise ValueError(':property defaultSource: cannot be greater than 0x7FFF.')
|
|
234
|
+
|
|
235
|
+
self.__fields |= DevModeFields.DM_DEFAULTSOURCE
|
|
236
|
+
self.__defaultSource = val
|
|
237
|
+
|
|
238
|
+
@property
|
|
239
|
+
def deviceName(self) -> bytes:
|
|
240
|
+
"""
|
|
241
|
+
A 32 byte ANSI string.
|
|
242
|
+
"""
|
|
243
|
+
return self.__deviceName
|
|
244
|
+
|
|
245
|
+
@deviceName.setter
|
|
246
|
+
def deviceName(self, val: bytes) -> None:
|
|
247
|
+
if not isinstance(val, bytes):
|
|
248
|
+
raise TypeError(':property deviceName: must be bytes.')
|
|
249
|
+
if len(val) != 32:
|
|
250
|
+
raise ValueError(':property deviceName: must be exactly 32 bytes.')
|
|
251
|
+
|
|
252
|
+
self.__deviceName = val
|
|
253
|
+
|
|
254
|
+
@property
|
|
255
|
+
def ditherType(self) -> int:
|
|
256
|
+
return self.__ditherType
|
|
257
|
+
|
|
258
|
+
@ditherType.setter
|
|
259
|
+
def ditherType(self, val: Optional[int]) -> None:
|
|
260
|
+
if val is None:
|
|
261
|
+
self.__ditherType = 0
|
|
262
|
+
if DevModeFields.DM_DITHERTYPE in self.__fields:
|
|
263
|
+
self.__fields ^= DevModeFields.DM_DITHERTYPE
|
|
264
|
+
return
|
|
265
|
+
elif not isinstance(val, int):
|
|
266
|
+
raise TypeError(':property ditherType: must be an int or None.')
|
|
267
|
+
|
|
268
|
+
if val < 0:
|
|
269
|
+
raise ValueError(':property ditherType: must be positive.')
|
|
270
|
+
if val > 0xFFFFFFFF:
|
|
271
|
+
raise ValueError(':property ditherType: cannot be greater than 0xFFFFFFFF.')
|
|
272
|
+
|
|
273
|
+
self.__fields |= DevModeFields.DM_DITHERTYPE
|
|
274
|
+
self.__ditherType = val
|
|
275
|
+
|
|
276
|
+
@property
|
|
277
|
+
def driverExtra(self) -> int:
|
|
278
|
+
return self.__driverExtra
|
|
279
|
+
|
|
280
|
+
@driverExtra.setter
|
|
281
|
+
def driverExtra(self, val: int) -> None:
|
|
282
|
+
if not isinstance(val, int):
|
|
283
|
+
raise TypeError(':property driverExtra: must be an int.')
|
|
284
|
+
if val < 0:
|
|
285
|
+
raise ValueError(':property driverExtra: must be positive.')
|
|
286
|
+
if val > 0xFFFF:
|
|
287
|
+
raise ValueError(':property driverExtra: cannot be greater than 0xFFFF.')
|
|
288
|
+
|
|
289
|
+
self.__driverExtra = val
|
|
290
|
+
|
|
291
|
+
@property
|
|
292
|
+
def driverVersion(self) -> int:
|
|
293
|
+
return self.__driverVersion
|
|
294
|
+
|
|
295
|
+
@driverVersion.setter
|
|
296
|
+
def driverVersion(self, val: int) -> None:
|
|
297
|
+
if not isinstance(val, int):
|
|
298
|
+
raise TypeError(':property driverVersion: must be an int or None.')
|
|
299
|
+
if val < 0:
|
|
300
|
+
raise ValueError(':property driverVersion: must be positive.')
|
|
301
|
+
if val > 0xFFFF:
|
|
302
|
+
raise ValueError(':property driverVersion: cannot be greater than 0xFFFF.')
|
|
303
|
+
|
|
304
|
+
self.__driverVersion = val
|
|
305
|
+
|
|
306
|
+
@property
|
|
307
|
+
def duplex(self) -> int:
|
|
308
|
+
return self.__duplex
|
|
309
|
+
|
|
310
|
+
@duplex.setter
|
|
311
|
+
def duplex(self, val: Optional[int]) -> None:
|
|
312
|
+
if val is None:
|
|
313
|
+
self.__duplex = 0
|
|
314
|
+
if DevModeFields.DM_DUPLEX in self.__fields:
|
|
315
|
+
self.__fields ^= DevModeFields.DM_DUPLEX
|
|
316
|
+
return
|
|
317
|
+
elif not isinstance(val, int):
|
|
318
|
+
raise TypeError(':property duplex: must be an int or None.')
|
|
319
|
+
|
|
320
|
+
if val < -0x8000:
|
|
321
|
+
raise ValueError(':property duplex: cannot be less than -0x8000.')
|
|
322
|
+
if val > 0x7FFF:
|
|
323
|
+
raise ValueError(':property duplex: cannot be greater than 0x7FFF.')
|
|
324
|
+
|
|
325
|
+
self.__fields |= DevModeFields.DM_DUPLEX
|
|
326
|
+
self.__duplex = val
|
|
327
|
+
|
|
328
|
+
@property
|
|
329
|
+
def formName(self) -> bytes:
|
|
330
|
+
"""
|
|
331
|
+
A 32 byte ANSI string.
|
|
332
|
+
"""
|
|
333
|
+
return self.__formName
|
|
334
|
+
|
|
335
|
+
@formName.setter
|
|
336
|
+
def formName(self, val: bytes) -> None:
|
|
337
|
+
if not isinstance(val, bytes):
|
|
338
|
+
raise TypeError(':property formName: must be bytes.')
|
|
339
|
+
if len(val) != 32:
|
|
340
|
+
raise ValueError(':property formName: must be exactly 32 bytes.')
|
|
341
|
+
|
|
342
|
+
self.__formName = val
|
|
343
|
+
|
|
344
|
+
@property
|
|
345
|
+
def icmIntent(self) -> int:
|
|
346
|
+
return self.__icmIntent
|
|
347
|
+
|
|
348
|
+
@icmIntent.setter
|
|
349
|
+
def icmIntent(self, val: Optional[int]) -> None:
|
|
350
|
+
if val is None:
|
|
351
|
+
self.__icmIntent = 0
|
|
352
|
+
if DevModeFields.DM_ICMINTENT in self.__fields:
|
|
353
|
+
self.__fields ^= DevModeFields.DM_ICMINTENT
|
|
354
|
+
return
|
|
355
|
+
elif not isinstance(val, int):
|
|
356
|
+
raise TypeError(':property icmIntent: must be an int or None.')
|
|
357
|
+
|
|
358
|
+
if val < 0:
|
|
359
|
+
raise ValueError(':property icmIntent: must be positive.')
|
|
360
|
+
if val > 0xFFFFFFFF:
|
|
361
|
+
raise ValueError(':property icmIntent: cannot be greater than 0xFFFFFFFF.')
|
|
362
|
+
|
|
363
|
+
self.__fields |= DevModeFields.DM_ICMINTENT
|
|
364
|
+
self.__icmIntent = val
|
|
365
|
+
|
|
366
|
+
@property
|
|
367
|
+
def icmMethod(self) -> int:
|
|
368
|
+
return self.__icmMethod
|
|
369
|
+
|
|
370
|
+
@icmMethod.setter
|
|
371
|
+
def icmMethod(self, val: Optional[int]) -> None:
|
|
372
|
+
if val is None:
|
|
373
|
+
self.__icmMethod = 0
|
|
374
|
+
if DevModeFields.DM_ICMMETHOD in self.__fields:
|
|
375
|
+
self.__fields ^= DevModeFields.DM_ICMMETHOD
|
|
376
|
+
return
|
|
377
|
+
elif not isinstance(val, int):
|
|
378
|
+
raise TypeError(':property icmMethod: must be an int or None.')
|
|
379
|
+
|
|
380
|
+
if val < 0:
|
|
381
|
+
raise ValueError(':property icmMethod: must be positive.')
|
|
382
|
+
if val > 0xFFFFFFFF:
|
|
383
|
+
raise ValueError(':property icmMethod: cannot be greater than 0xFFFFFFFF.')
|
|
384
|
+
|
|
385
|
+
self.__fields |= DevModeFields.DM_ICMMETHOD
|
|
386
|
+
self.__icmMethod = val
|
|
387
|
+
|
|
388
|
+
@property
|
|
389
|
+
def mediaType(self) -> int:
|
|
390
|
+
return self.__mediaType
|
|
391
|
+
|
|
392
|
+
@mediaType.setter
|
|
393
|
+
def mediaType(self, val: Optional[int]) -> None:
|
|
394
|
+
if val is None:
|
|
395
|
+
self.__mediaType = 0
|
|
396
|
+
if DevModeFields.DM_MEDIATYPE in self.__fields:
|
|
397
|
+
self.__fields ^= DevModeFields.DM_MEDIATYPE
|
|
398
|
+
return
|
|
399
|
+
elif not isinstance(val, int):
|
|
400
|
+
raise TypeError(':property mediaType: must be an int or None.')
|
|
401
|
+
|
|
402
|
+
if val < 0:
|
|
403
|
+
raise ValueError(':property mediaType: must be positive.')
|
|
404
|
+
if val > 0xFFFFFFFF:
|
|
405
|
+
raise ValueError(':property mediaType: cannot be greater than 0xFFFFFFFF.')
|
|
406
|
+
|
|
407
|
+
self.__fields |= DevModeFields.DM_MEDIATYPE
|
|
408
|
+
self.__mediaType = val
|
|
409
|
+
|
|
410
|
+
@property
|
|
411
|
+
def nup(self) -> int:
|
|
412
|
+
return self.__nup
|
|
413
|
+
|
|
414
|
+
@nup.setter
|
|
415
|
+
def nup(self, val: Optional[int]) -> None:
|
|
416
|
+
if val is None:
|
|
417
|
+
self.__nup = 0
|
|
418
|
+
if DevModeFields.DM_NUP in self.__fields:
|
|
419
|
+
self.__fields ^= DevModeFields.DM_NUP
|
|
420
|
+
return
|
|
421
|
+
elif not isinstance(val, int):
|
|
422
|
+
raise TypeError(':property nup: must be an int or None.')
|
|
423
|
+
|
|
424
|
+
if val < 0:
|
|
425
|
+
raise ValueError(':property nup: must be positive.')
|
|
426
|
+
if val > 0xFFFFFFFF:
|
|
427
|
+
raise ValueError(':property nup: cannot be greater than 0xFFFFFFFF.')
|
|
428
|
+
|
|
429
|
+
self.__fields |= DevModeFields.DM_NUP
|
|
430
|
+
self.__nup = val
|
|
431
|
+
|
|
432
|
+
@property
|
|
433
|
+
def orientation(self) -> int:
|
|
434
|
+
return self.__orientation
|
|
435
|
+
|
|
436
|
+
@orientation.setter
|
|
437
|
+
def orientation(self, val: Optional[int]) -> None:
|
|
438
|
+
if val is None:
|
|
439
|
+
self.__orientation = 0
|
|
440
|
+
if DevModeFields.DM_ORIENTATION in self.__fields:
|
|
441
|
+
self.__fields ^= DevModeFields.DM_ORIENTATION
|
|
442
|
+
return
|
|
443
|
+
elif not isinstance(val, int):
|
|
444
|
+
raise TypeError(':property orientation: must be an int or None.')
|
|
445
|
+
|
|
446
|
+
if val < -0x8000:
|
|
447
|
+
raise ValueError(':property orientation: cannot be less than -0x8000.')
|
|
448
|
+
if val > 0x7FFF:
|
|
449
|
+
raise ValueError(':property orientation: cannot be greater than 0x7FFF.')
|
|
450
|
+
|
|
451
|
+
self.__fields |= DevModeFields.DM_ORIENTATION
|
|
452
|
+
self.__orientation = val
|
|
453
|
+
|
|
454
|
+
@property
|
|
455
|
+
def paperLength(self) -> int:
|
|
456
|
+
return self.__paperLength
|
|
457
|
+
|
|
458
|
+
@paperLength.setter
|
|
459
|
+
def paperLength(self, val: Optional[int]) -> None:
|
|
460
|
+
if val is None:
|
|
461
|
+
self.__paperLength = 0
|
|
462
|
+
if DevModeFields.DM_PAPERLENGTH in self.__fields:
|
|
463
|
+
self.__fields ^= DevModeFields.DM_PAPERLENGTH
|
|
464
|
+
return
|
|
465
|
+
elif not isinstance(val, int):
|
|
466
|
+
raise TypeError(':property paperLength: must be an int or None.')
|
|
467
|
+
|
|
468
|
+
if val < -0x8000:
|
|
469
|
+
raise ValueError(':property paperLength: cannot be less than -0x8000.')
|
|
470
|
+
if val > 0x7FFF:
|
|
471
|
+
raise ValueError(':property paperLength: cannot be greater than 0x7FFF.')
|
|
472
|
+
|
|
473
|
+
self.__fields |= DevModeFields.DM_PAPERLENGTH
|
|
474
|
+
self.__paperLength = val
|
|
475
|
+
|
|
476
|
+
@property
|
|
477
|
+
def paperSize(self) -> int:
|
|
478
|
+
return self.__paperSize
|
|
479
|
+
|
|
480
|
+
@paperSize.setter
|
|
481
|
+
def paperSize(self, val: Optional[int]) -> None:
|
|
482
|
+
if val is None:
|
|
483
|
+
self.__paperSize = 0
|
|
484
|
+
if DevModeFields.DM_PAPERSIZE in self.__fields:
|
|
485
|
+
self.__fields ^= DevModeFields.DM_PAPERSIZE
|
|
486
|
+
return
|
|
487
|
+
elif not isinstance(val, int):
|
|
488
|
+
raise TypeError(':property paperSize: must be an int or None.')
|
|
489
|
+
|
|
490
|
+
if val < -0x8000:
|
|
491
|
+
raise ValueError(':property paperSize: cannot be less than -0x8000.')
|
|
492
|
+
if val > 0x7FFF:
|
|
493
|
+
raise ValueError(':property paperSize: cannot be greater than 0x7FFF.')
|
|
494
|
+
|
|
495
|
+
self.__fields |= DevModeFields.DM_PAPERSIZE
|
|
496
|
+
self.__paperSize = val
|
|
497
|
+
|
|
498
|
+
@property
|
|
499
|
+
def paperWidth(self) -> int:
|
|
500
|
+
return self.__paperWidth
|
|
501
|
+
|
|
502
|
+
@paperWidth.setter
|
|
503
|
+
def paperWidth(self, val: Optional[int]) -> None:
|
|
504
|
+
if val is None:
|
|
505
|
+
self.__paperWidth = 0
|
|
506
|
+
if DevModeFields.DM_PAPERWIDTH in self.__fields:
|
|
507
|
+
self.__fields ^= DevModeFields.DM_PAPERWIDTH
|
|
508
|
+
return
|
|
509
|
+
elif not isinstance(val, int):
|
|
510
|
+
raise TypeError(':property paperWidth: must be an int or None.')
|
|
511
|
+
|
|
512
|
+
if val < -0x8000:
|
|
513
|
+
raise ValueError(':property paperWidth: cannot be less than -0x8000.')
|
|
514
|
+
if val > 0x7FFF:
|
|
515
|
+
raise ValueError(':property paperWidth: cannot be greater than 0x7FFF.')
|
|
516
|
+
|
|
517
|
+
self.__fields |= DevModeFields.DM_PAPERWIDTH
|
|
518
|
+
self.__paperWidth = val
|
|
519
|
+
|
|
520
|
+
@property
|
|
521
|
+
def printQuality(self) -> int:
|
|
522
|
+
return self.__printQuality
|
|
523
|
+
|
|
524
|
+
@printQuality.setter
|
|
525
|
+
def printQuality(self, val: Optional[int]) -> None:
|
|
526
|
+
if val is None:
|
|
527
|
+
self.__printQuality = 0
|
|
528
|
+
if DevModeFields.DM_PRINTQUALITY in self.__fields:
|
|
529
|
+
self.__fields ^= DevModeFields.DM_PRINTQUALITY
|
|
530
|
+
return
|
|
531
|
+
elif not isinstance(val, int):
|
|
532
|
+
raise TypeError(':property printQuality: must be an int or None.')
|
|
533
|
+
|
|
534
|
+
if val < -0x8000:
|
|
535
|
+
raise ValueError(':property printQuality: cannot be less than -0x8000.')
|
|
536
|
+
if val > 0x7FFF:
|
|
537
|
+
raise ValueError(':property printQuality: cannot be greater than 0x7FFF.')
|
|
538
|
+
|
|
539
|
+
self.__fields |= DevModeFields.DM_PRINTQUALITY
|
|
540
|
+
self.__printQuality = val
|
|
541
|
+
|
|
542
|
+
@property
|
|
543
|
+
def scale(self) -> int:
|
|
544
|
+
return self.__scale
|
|
545
|
+
|
|
546
|
+
@scale.setter
|
|
547
|
+
def scale(self, val: Optional[int]) -> None:
|
|
548
|
+
if val is None:
|
|
549
|
+
self.__scale = 0
|
|
550
|
+
if DevModeFields.DM_SCALE in self.__fields:
|
|
551
|
+
self.__fields ^= DevModeFields.DM_SCALE
|
|
552
|
+
return
|
|
553
|
+
elif not isinstance(val, int):
|
|
554
|
+
raise TypeError(':property scale: must be an int or None.')
|
|
555
|
+
|
|
556
|
+
if val < -0x8000:
|
|
557
|
+
raise ValueError(':property scale: cannot be less than -0x8000.')
|
|
558
|
+
if val > 0x7FFF:
|
|
559
|
+
raise ValueError(':property scale: cannot be greater than 0x7FFF.')
|
|
560
|
+
|
|
561
|
+
self.__fields |= DevModeFields.DM_SCALE
|
|
562
|
+
self.__scale = val
|
|
563
|
+
|
|
564
|
+
@property
|
|
565
|
+
def specVersion(self) -> int:
|
|
566
|
+
return self.__specVersion
|
|
567
|
+
|
|
568
|
+
@specVersion.setter
|
|
569
|
+
def specVersion(self, val: int) -> None:
|
|
570
|
+
if not isinstance(val, int):
|
|
571
|
+
raise TypeError(':property specVersion: must be an int.')
|
|
572
|
+
if val < 0:
|
|
573
|
+
raise ValueError(':property specVersion: must be positive.')
|
|
574
|
+
if val > 0xFFFF:
|
|
575
|
+
raise ValueError(':property specVersion: cannot be greater than 0xFFFF.')
|
|
576
|
+
|
|
577
|
+
self.__specVersion = val
|
|
578
|
+
|
|
579
|
+
@property
|
|
580
|
+
def ttOption(self) -> int:
|
|
581
|
+
return self.__ttOption
|
|
582
|
+
|
|
583
|
+
@ttOption.setter
|
|
584
|
+
def ttOption(self, val: Optional[int]) -> None:
|
|
585
|
+
if val is None:
|
|
586
|
+
self.__ttOption = 0
|
|
587
|
+
if DevModeFields.DM_TTOPTION in self.__fields:
|
|
588
|
+
self.__fields ^= DevModeFields.DM_TTOPTION
|
|
589
|
+
return
|
|
590
|
+
elif not isinstance(val, int):
|
|
591
|
+
raise TypeError(':property ttOption: must be an int or None.')
|
|
592
|
+
|
|
593
|
+
if val < -0x8000:
|
|
594
|
+
raise ValueError(':property ttOption: cannot be less than -0x8000.')
|
|
595
|
+
if val > 0x7FFF:
|
|
596
|
+
raise ValueError(':property ttOption: cannot be greater than 0x7FFF.')
|
|
597
|
+
|
|
598
|
+
self.__fields |= DevModeFields.DM_TTOPTION
|
|
599
|
+
self.__ttOption = val
|
|
600
|
+
|
|
601
|
+
@property
|
|
602
|
+
def yResolution(self) -> int:
|
|
603
|
+
return self.__yResolution
|
|
604
|
+
|
|
605
|
+
@yResolution.setter
|
|
606
|
+
def yResolution(self, val: Optional[int]) -> None:
|
|
607
|
+
if val is None:
|
|
608
|
+
self.__yResolution = 0
|
|
609
|
+
if DevModeFields.DM_YRESOLUTION in self.__fields:
|
|
610
|
+
self.__fields ^= DevModeFields.DM_YRESOLUTION
|
|
611
|
+
return
|
|
612
|
+
elif not isinstance(val, int):
|
|
613
|
+
raise TypeError(':property yResolution: must be an int or None.')
|
|
614
|
+
|
|
615
|
+
if val < -0x8000:
|
|
616
|
+
raise ValueError(':property yResolution: cannot be less than -0x8000.')
|
|
617
|
+
if val > 0x7FFF:
|
|
618
|
+
raise ValueError(':property yResolution: cannot be greater than 0x7FFF.')
|
|
619
|
+
|
|
620
|
+
self.__fields |= DevModeFields.DM_YRESOLUTION
|
|
621
|
+
self.__yResolution = val
|