Overview¶
Path | PyPoE/poe/file/idl.py |
Version | 1.0.0a0 |
Revision | $Id: c07c9b1426992f0f5c158159010c42aa5de3afa5 $ |
Author | Omega_K2 |
Description¶
File Format handler for Grinding Gear Games’ .idl format.
.idl files are used to link multiple virtual texture out of single image file.
Agreement¶
See PyPoE/LICENSE
Documentation¶
Public API¶
-
class
PyPoE.poe.file.idl.
IDLFile
[source]¶ Bases:
PyPoE.poe.file.shared.AbstractFile
,PyPoE.shared.containers.TypedList
Encapsulated in-memory representation of .idl files.
Since .idl files basically act as list of
IDLRecord
instances IDLFile also acts as a list, i.e. it supports the regular list interface. However, added items may only be aIDLRecord
-
append
(object) → None -- append object to end¶
-
as_dict
()[source]¶ Returns: Lookup dictionary mapping the destinations to the records Return type: dict[str, IDLRecord]
-
clear
() → None -- remove all items from L¶
-
copy
() → list -- a shallow copy of L¶
-
count
(value) → integer -- return number of occurrences of value¶
-
extend
(iterable) → None -- extend list by appending elements from the iterable¶
-
get_read_buffer
(file_path_or_raw, function, *args, **kwargs)¶ Will attempt to open the given file_path_or_raw in read mode and pass the buffer to the specified function. The function must accept at least one keyword argument called ‘buffer’.
Parameters: - file_path_or_raw (BytesIO | bytes | str) – file path, bytes or buffer to read from
- args – Additional positional arguments to pass to the specified function
- kwargs – Additional keyword arguments to pass to the specified function
Returns: Result of the function
Return type: Raises: TypeError
– if file_path_or_raw has an invalid type
-
get_write_buffer
(file_path_or_raw, function, *args, **kwargs)¶ Will attempt to open the given file_path_or_raw in write mode and pass the buffer to the specified function. The function must accept at least one keyword argument called ‘buffer’.
Parameters: - file_path_or_raw (BytesIO | bytes | str) – file path, bytes or buffer to write to
- args – Additional positional arguments to pass to the specified function
- kwargs – Additional keyword arguments to pass to the specified function
Returns: Result of the function
Return type: Raises: TypeError
– if file_path_or_raw has an invalid type
-
index
(value[, start[, stop]]) → integer -- return first index of value.¶ Raises ValueError if the value is not present.
-
insert
(index, p_object)¶ L.insert(index, object) – insert object before index
-
pop
([index]) → item -- remove and return item at index (default last).¶ Raises IndexError if list is empty or index is out of range.
-
read
(file_path_or_raw, *args, **kwargs)¶ Reads the file contents into the specified path or buffer. This will also reset any existing contents of the file.
If a buffer or bytes was given, the data will be read from the buffer or bytes object.
If a file path was given, the resulting data will be read from the specified file.
Parameters: - file_path_or_raw (BytesIO | bytes | str) – file path, bytes or buffer to read from
- args – Additional positional arguments
- kwargs – Additional keyword arguments
Returns: result of the read operation, if any
Return type: Raises: TypeError
– if file_path_or_raw has an invalid type
-
remove
(value) → None -- remove first occurrence of value.¶ Raises ValueError if the value is not present.
-
reverse
()¶ L.reverse() – reverse IN PLACE
-
sort
(key=None, reverse=False) → None -- stable sort *IN PLACE*¶
-
write
(file_path_or_raw, *args, **kwargs)¶ Write the contents of file to the specified path or buffer.
If a buffer or bytes was given, a buffer object with the new data should be returned.
If a file path was given, the resulting data should be written to the specified file.
Parameters: - file_path_or_raw (BytesIO | bytes | str) – file path, bytes or buffer to write to
- args – Additional positional arguments
- kwargs – Additional keyword arguments
Returns: result of the write operation, if any
Return type: Raises: TypeError
– if file_path_or_raw has an invalid type
-
-
class
PyPoE.poe.file.idl.
IDLRecord
(destination, source, x1, y1, x2, y2)[source]¶ Bases:
PyPoE.shared.containers.Record
Variables: -
__init__
(destination, source, x1, y1, x2, y2)[source]¶ Creates a new IDLRecord instance.
The coordinates (x1, y1) and (x2, y2) can be understood as the upper left and lower right corner of a bounding rectangle respectively.
Parameters:
-
h
¶ returns: height :rtype: int
-
w
¶ returns: width :rtype: int
-