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

made newPage functions to work without arguments too #14

Merged
merged 4 commits into from
Mar 19, 2021
Merged

made newPage functions to work without arguments too #14

merged 4 commits into from
Mar 19, 2021

Conversation

jansindl3r
Copy link
Contributor

@jansindl3r jansindl3r commented Mar 18, 2021

I made the newPage function to work without arguments too.

    Initial newPage() without arguments: 1000 x 1000
    Second newPage() without arguments: same as previous page

I found an issue that the function throws an error if you don't draw before. Probably because RecordingDocument's self.pageWidth = self.pageHeight = None Drawing makes it somehow become not None. It got a temporary fix

Fixes #13.

@jansindl3r
Copy link
Contributor Author

btw, all test that test Image failed even with fresh copy

@justvanrossum
Copy link
Owner

The test failure is because of a reather agggressive linter setting. Please check with

$ flake8 --max-line-length=127 path/to/file.py

...for both files you're edting. If that passes, run pytest locally. Doing

$ pytest

should be enough. If that passes, there's a good chance the CI will pass, too.

src/drawbot_skia/drawing.py Outdated Show resolved Hide resolved
tests/test_api.py Outdated Show resolved Hide resolved
src/drawbot_skia/drawing.py Outdated Show resolved Hide resolved
src/drawbot_skia/drawing.py Outdated Show resolved Hide resolved
tests/test_api.py Outdated Show resolved Hide resolved
tests/test_api.py Show resolved Hide resolved
src/drawbot_skia/drawing.py Outdated Show resolved Hide resolved
…ppercased as DEFAULT_FRAMEDURATION in document.py
src/drawbot_skia/drawing.py Outdated Show resolved Hide resolved
def newPage(self, width=None, height=None):
if width and not height or height and not width:
raise TypeError("newPage() takes either no argument or two - width and height")
if not width and not height:
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
if not width and not height:
if width is None and height is None:

src/drawbot_skia/drawing.py Outdated Show resolved Hide resolved
@justvanrossum justvanrossum merged commit 0bc14c3 into justvanrossum:master Mar 19, 2021
@justvanrossum
Copy link
Owner

Thanks Jan!

@jansindl3r
Copy link
Contributor Author

I learnt something again :) I thank you!

I am making a small python workshop soon and it's great to welcome a few Windows users too. VS code setup with split editor where one half shows the exported image works pretty well as a substitution for DrawBot app.

Though sharing install instructions with 13 steps is not that good for beginners, but they managed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

newPage() requires arguments
2 participants