_Event
Bases: abc.ABC
Abstract base class representing an event.
Source code in pyflp/_event.py
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 |
|
id_ = id
instance-attribute
__eq__(o)
Source code in pyflp/_event.py
61 62 63 64 65 66 |
|
__init__(index, id, data)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
EventID
|
An event ID from 0 to 255. |
required |
data |
bytes
|
A |
required |
Source code in pyflp/_event.py
75 76 77 78 79 80 81 82 83 84 |
|
__ne__(o)
Source code in pyflp/_event.py
68 69 70 71 72 73 |
|
__repr__()
Source code in pyflp/_event.py
53 54 55 56 57 58 59 |
|
data()
property
Source code in pyflp/_event.py
41 42 43 |
|
dump(new_data)
abstractmethod
Converts Python types into bytes objects and stores it.
Source code in pyflp/_event.py
45 46 47 |
|
index()
property
Zero based index of instance w.r.t factory.
Source code in pyflp/_event.py
36 37 38 39 |
|
size()
property
abstractmethod
Raw event size in bytes.
Source code in pyflp/_event.py
31 32 33 34 |
|
to_raw()
Used by Project.save(). Overriden by _VariabledSizedEvent
.
Source code in pyflp/_event.py
49 50 51 |
|
ByteEvent
Bases: _Event
Represents a byte-sized event.
Source code in pyflp/_event.py
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 |
|
__init__(index, id, data)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
EventID
|
An event ID from 0 to 63. |
required |
data |
bytes
|
A 1 byte sized |
required |
Raises:
Type | Description |
---|---|
ValueError
|
When |
TypeError
|
When size of |
Source code in pyflp/_event.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
|
__repr__()
Source code in pyflp/_event.py
160 161 162 163 164 165 166 167 |
|
dump(new_data)
Dumps a single byte of data; either a bool, int or a bytes object to event data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
new_data |
Union[bytes, int, bool]
|
The data to be dumped into the event. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If |
OverflowError
|
When an integer is too big to be accumulated in 1 byte. |
TypeError
|
When |
Source code in pyflp/_event.py
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 |
|
size()
property
Source code in pyflp/_event.py
113 114 115 |
|
to_bool()
Source code in pyflp/_event.py
157 158 |
|
to_int8()
Source code in pyflp/_event.py
154 155 |
|
to_uint8()
Source code in pyflp/_event.py
151 152 |
|
_WordEvent
Bases: _Event
Represents a 2 byte event.
Source code in pyflp/_event.py
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 |
|
__init__(index, id, data)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
EventID
|
An event ID from 64 to 127. |
required |
data |
bytes
|
A |
required |
Raises:
Type | Description |
---|---|
ValueError
|
When |
TypeError
|
When size of |
Source code in pyflp/_event.py
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 |
|
__repr__()
Source code in pyflp/_event.py
227 228 229 230 231 232 233 234 |
|
dump(new_data)
Dumps 2 bytes of data; either an int or a bytes object to event data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
new_data |
Union[bytes, int]
|
The data to be dumped into the event. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If |
OverflowError
|
When |
TypeError
|
When |
Source code in pyflp/_event.py
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 |
|
size()
property
Source code in pyflp/_event.py
190 191 192 |
|
to_int16()
Source code in pyflp/_event.py
224 225 |
|
to_uint16()
Source code in pyflp/_event.py
221 222 |
|
_DWordEvent
Bases: _Event
Represents a 4 byte event.
Source code in pyflp/_event.py
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 |
|
DWORD_MAX = 4294967295
class-attribute
INT_MAX = 2147483647
class-attribute
INT_MIN = -2147483648
class-attribute
__init__(index, id, data)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
EventID
|
An event ID from 128 to 191. |
required |
data |
bytes
|
A |
required |
Raises:
Type | Description |
---|---|
ValueError
|
When |
TypeError
|
When size of |
Source code in pyflp/_event.py
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 |
|
__repr__()
Source code in pyflp/_event.py
309 310 311 312 313 314 315 316 |
|
dump(new_data)
Dumps 4 bytes of data; either an int or a bytes object to event data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
new_data |
Union[bytes, int]
|
The data to be dumped into the event. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If |
OverflowError
|
When an integer is too big to be accumulated in 4 bytes. |
TypeError
|
When |
Source code in pyflp/_event.py
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 |
|
size()
property
Source code in pyflp/_event.py
262 263 264 |
|
to_int32()
Deserializes self.data
as a 32-bit signed integer as an int
.
Source code in pyflp/_event.py
305 306 307 |
|
to_uint32()
Deserializes self.data
as a 32-bit unsigned integer as an int
.
Source code in pyflp/_event.py
301 302 303 |
|
_ColorEvent
Bases: _DWordEvent
Represents a 4 byte event which stores a color.
Source code in pyflp/_event.py
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 |
|
dump(new_color)
Dumps a colour.Color
to event data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
new_color |
colour.Color
|
The color to be dumped into the event. |
required |
Raises:
Type | Description |
---|---|
TypeError
|
When |
Source code in pyflp/_event.py
339 340 341 342 343 344 345 346 347 348 349 350 |
|
to_color()
Source code in pyflp/_event.py
352 353 354 |
|
_TextEvent
Bases: _VariableSizedEvent
Represents a variable sized event used for storing strings.
Source code in pyflp/_event.py
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 |
|
__init__(index, id, data, uses_unicode=True)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
EventID
|
An event ID from
192 to 207 or in |
required |
data |
bytes
|
A |
required |
Raises:
Type | Description |
---|---|
ValueError
|
When |
Source code in pyflp/_event.py
397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 |
|
__repr__()
Source code in pyflp/_event.py
394 395 |
|
as_ascii(buf)
staticmethod
Source code in pyflp/_event.py
360 361 362 |
|
as_uf16(buf)
staticmethod
Source code in pyflp/_event.py
364 365 366 |
|
dump(new_data)
Dumps a string to the event data. non UTF-16 data for UTF-16 type projects and non ASCII data for older projects will be removed before dumping.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
new_data |
str
|
The string to be dumped to event data; |
required |
Raises:
Type | Description |
---|---|
TypeError
|
When |
Source code in pyflp/_event.py
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 |
|
to_str()
Source code in pyflp/_event.py
389 390 391 392 |
|
_DataEvent
Bases: _VariableSizedEvent
Represents a variable sized event used for storing a blob of data, consists
of a collection of POD types like int, bool, float, sometimes ASCII strings.
Its size is determined by the event and also FL version sometimes.
The task of parsing is completely handled by one of the FLObject subclasses,
hence no to_*
conversion method is provided.
Source code in pyflp/_event.py
422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 |
|
CHUNK_SIZE = None
class-attribute
Parsing is not done if size of data
argument is not equal to this.
__init__(index, id, data)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
EventID
|
An event ID in from 208 to 255. |
required |
data |
bytes
|
A |
required |
Raises:
Type | Description |
---|---|
ValueError
|
When the event ID is not in the range of 208 ( |
Source code in pyflp/_event.py
450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 |
|
dump(new_bytes)
Dumps a blob of bytes to event data as is; no conversions of any-type. This method is used instead of directly dumping to event data for type-safety.
Raises:
Type | Description |
---|---|
TypeError
|
When |
Source code in pyflp/_event.py
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 |
|