Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Renderable, Render and Padding APIs #97

Merged
merged 213 commits into from
Sep 28, 2023
Merged

The Renderable, Render and Padding APIs #97

merged 213 commits into from
Sep 28, 2023

Conversation

AnonymouX47
Copy link
Owner

@AnonymouX47 AnonymouX47 commented Jul 18, 2023

  • Adds .renderable subpackage.
    • Renderable
      • _Data_
    • RenderArgs
      • Namespace
    • RenderData
      • Namespace
    • Frame
    • FrameCount
    • FrameDuration
    • Seek
    • RenderableError
    • IndefiniteSeekError
    • RenderError
    • RenderSizeOutOfRangeError
    • RenderArgsDataError
    • RenderArgsError
    • RenderDataError
    • IncompatibleArgsNamespaceError
    • IncompatibleRenderArgsError
    • NoArgsNamespaceError
    • NoDataNamespaceError
    • NonAnimatedFrameDurationError
    • UninitializedDataFieldError
    • UnknownArgsFieldError
    • UnknownDataFieldError
  • Adds .render subpackage.
    • RenderIterator
    • RenderIteratorError
    • FinalizedIteratorError
  • Adds .padding submodule.
    • Padding
    • AlignedPadding
    • ExactPadding
    • HAlign
    • VAlign
    • PaddingError
    • RelativePaddingDimensionsError
  • Updates the documentation glossary.
  • Adds sphinxcontrib-prettyspecialmethods documentation dependency.

- Add: Add new exception classes for the Renderable API.
  - `RenderableError`
  - `RenderArgsError`
  - `RenderDataError`
  - `RenderFormatError`
- Change: `RenderError` is now a subclass of `RenderableError`.
- Change: Generalize the description of `InvalidSizeError`.
- Add: `.renderable._enum` submodule.
- Add: `.renderable._types` submodule.
- Add: `.renderable._renderable` submodule.
- Add: Export public definitions from `.renderable`:
  - `FrameCount`
  - `FrameDuration`
  - `HAlign`
  - `VAlign`
  - `Renderable`
  - `RenderArgs`
  - `RenderData`
  - `RenderFormat`
  - `RenderParam`
  - `Frame`
- Add: `.render._iterator` submodule.
- Add: `.exceptions.RenderIteratorError`.
- Add: Export `RenderIterator` from `.render`.
@AnonymouX47 AnonymouX47 added new New feature implementation renderable Related to the Renderable API iterator Related to the RenderIterator API render Related to the Render API (not just a sub-API of it) labels Jul 18, 2023
@AnonymouX47 AnonymouX47 added this to the 0.8.0 milestone Jul 18, 2023
- Change: Remove use of positional-only parameters.
- Add: `tests.renderable.test_types`.
- Add: Tests for `Frame`.
- Add: `tests.renderable.test_types` to `test-renderable` make target.
- Change: Update NOTE about render data modification in the docstring of
  `RenderIterator._from_render_data_()`.
- Change: `_handle_interrupted_draw_()` is no longer called for
  exceptions other than `KeyboardInterrupt`.
- Change: `_handle_interrupted_draw_()` is now called only when
  `KeyboardInterrupt` is raised while writing a frame to the output
  stream or flushing the stream.
- Change: Update the docstring of `_handle_interrupted_draw_()`.
- Add: Test for `Renderable`'s render arguments.
- Change: Simplify render argument compatibility tests for
  `Renderable._init_render_()`.
- Add: Tests for `RenderFormat`.
- Add: Check `RenderFormat.relative` in tests for
  `Renderable._init_render_()`.
- Change: Remove *animation* parameter of `._init_render_()`.
  - It was really only there for the error message's context.
- Change: Update render size validation in `.draw()`.
- Change: Update the docstrings of modified methods.
- Change: Update render size validation-related tests for
  `Renderable._init_render_()`.
- Change: Rename `.size` -> `.render_size`
- Change: Rename `.render` -> `.render_output`
- Change: Update the field names in the tests and docs.
- Fix: Set frame offset to zero at initialization.

  Ensures iteration starts from the first frame for renderables with
  definite frame count and non-zero current frame number.
- Change: Separate `as_dict()` and `get_fields()` methods for
  `RenderArgs.Namespace` and `RenderData.Namespace`.

  - Move definitions from `RenderArgsData.Namespace` to
    `RenderArgs.Namespace` as-is.
  - Redefine/Re-document for `RenderData.Namespace`.

- Change: Document `RenderData.Namespace.as_dict()` as raising
  `UninitializedDataFieldError`.
- Change: Redefine `RenderData.Namespace.get_fields()` to return a
  tuple of field names instead of a dict, as fields no longer have
  default values.
- Add: `.renderable.NonAnimatedFrameDurationError`.
- Change: Raise `NonAnimatedFrameDurationError`, instead of ignoring,
  when attempting to set `Renderable.frame_duration` on a non-animated
  renderable.
- Change: Update dostring of `Renderable.frame_duration`.
- Change: Update docstrings of interfaces with a frame duration
  parameter and attributes representing frame duration.

  - "fixed" -> "static".
  - Simplify the description of "static" frame duration.
  - Add references to `Renderable.frame_duration` where necessary.
- Add: Call `._clear_frame_()` from `._animate_()`.
- Add: `._clear_frame_()` to the Renderable Extension API docs.
- Change: Fine-tune the definition and documentation of
  `._clear_frame_()`.
- Add: Tests for calls to `._clear_frame_()`.
- Change: Move tests for the *output* parameter to the right place.
- Add: Test rendered frame number for:

  - `__str__()`
  - `render()`
  - `draw()` (with `animate=False`)

- Add: Tests for `__str__()` default render arguments.
- Change: Rewrite tests for `__str__()`.
- Change: Cleanup test for `_clear_frame_()` calls in `_animate_()`.
- Change: Rename some test renderable classes and their respective
  instance variable names:

  - `DrawChar` -> `RenderChar`
  - `draw_char` -> `render_char`
  - `DrawAnimChar` -> `AnimateChar`.
  - `draw_anim_char` -> `animate_char`.
  - ...
- Add: *output* parameter.
- Change: Fine-tune docstring.
- Change: Fine-tune usage in `draw()` and `_animate_()`.
- Add: Tests for calls to `_handle_interrupted_draw_()` in `draw()`
  (for non-animations) and `_animate_()`.
@AnonymouX47
Copy link
Owner Author

Finally! 😩 😮‍💨 😃 🎉

@AnonymouX47 AnonymouX47 merged commit 0b3b4bc into main Sep 28, 2023
20 checks passed
@AnonymouX47 AnonymouX47 deleted the renderable branch September 28, 2023 16:49
@AnonymouX47 AnonymouX47 mentioned this pull request Sep 29, 2023
AnonymouX47 added a commit that referenced this pull request Oct 2, 2023
- Change: Removed `inherit` parameter of namespace metaclass.

  `inherit=False` was flawed because the subclasses would actually
  still inherit the attributes (slot entries) of the base (and could
  even be set on `RenderData` instances).

- Change: Disallow multiple base classes.

  This allowed namespaces to have abitrary attributes if any base
  had a `__dict__` member.

- Change: Unassociated namespace classes cannot be subclassed.

  This allowed for a subclass to be associated with render class
  different from that of its parent. This typing model was not so neat.

Fine-tunes the work done at #97.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
iterator Related to the RenderIterator API new New feature implementation padding Related to the Padding API render Related to the Render API (not just a sub-API of it) renderable Related to the Renderable API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant