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

Allow Scale and Translate to take x, y and z as kwargs. Removes deprecated Scale().scale property. #8270

Merged
merged 8 commits into from Jun 24, 2023

Conversation

GreenJon902
Copy link
Contributor

@GreenJon902 GreenJon902 commented Jun 3, 2023

Added support to create scale and translate instructions with kwargs like this

Translate(x=0, y=1, z=2)
Translate(0, 1)  # Original method still works

Scale(x=2, y=1, z=23)  # Scale also works
Scale(1, 2, 3)  # But the original for this also works.

Unit tests were also added for both methods of creation.

P.S. If your want to know why I can't just use normal args: I have a system where I load designs from a JSON file which stores the type of instruction and kwargs (like pos and size), and it doesn't work with normal args.

Maintainer merge checklist

  • Title is descriptive/clear for inclusion in release notes.
  • Applied a Component: xxx label.
  • Applied the api-deprecation or api-break label.
  • Applied the release-highlight label to be highlighted in release notes.
  • Added to the milestone version it was merged into.
  • Unittests are included in PR.
  • Properly documented, including versionadded, versionchanged as needed.

@misl6 misl6 added this to the 2.3.0 milestone Jun 4, 2023
@misl6 misl6 added the Component: graphics kivy/graphics label Jun 4, 2023
Copy link
Member

@misl6 misl6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @GreenJon902 !

I've left some comments regarding your PR, as there's the chance to do some clean-up 😀

kivy/graphics/context_instructions.pyx Outdated Show resolved Hide resolved
kivy/graphics/context_instructions.pyx Outdated Show resolved Hide resolved
@GreenJon902 GreenJon902 requested a review from misl6 June 4, 2023 09:37
Copy link
Member

@misl6 misl6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you!

@misl6 misl6 changed the title Allow Scale and Translate to take x, y and z as kwargs Allow Scale and Translate to take x, y and z as kwargs. Removes deprecated Scale().scale property. Jun 24, 2023
@misl6 misl6 merged commit ee04092 into kivy:master Jun 24, 2023
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: graphics kivy/graphics
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants