Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix some bugs in camera.py#2961

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Starbuck5 merged 1 commit intomainfromankith26-camera-init-fix
Jan 16, 2022
Merged

Conversation

@ankith26
Copy link
Contributor

@ankith26ankith26 commentedDec 28, 2021
edited
Loading

Initially set out tofix#2936 then noticed a few more issues, got sidetracked as usual and now I make this PR with a few more fixes

Now all functions are defined at all times regardless init state, and error correctly. After a quit, they are reset back to error. Make config envvar accept bothvidcapture andvideocapture (case insensitive) and fixget_backends returningVidCapture when it should beVideoCapture, and some more code cleanups around that. Also errors with a more helpful message if a particular backend is unavailable

@Starbuck5
Copy link
Contributor

Starbuck5 commentedDec 28, 2021
edited
Loading

Thanks Ankith, but yeesh, this diff is something else. This changes 110 lines of a <200 line file.

I don't want to expand environment variables for vidcapture, because that thing is 100% deprecated. In fact, in my last camera PR, illume told me I could remove it, but I kept it, in a role reversal for the ages. Actually, vidcapture could use a deprecation warning (ay, it actually has one already). The biggest problem for me is that I'venever been able to get it working, even though there are third party python 3 wheels (vidcapture is py2) that supposedly work.

@Starbuck5
Copy link
Contributor

Starbuck5 commentedDec 28, 2021
edited
Loading

Ok, I've read through everything, it looks good.

I'm curious why you refactored all of my individual setup functions into one, though.

Maybe colorspace should have a different error message if it isn't able to be imported. Which it could be, if pygame was built without the _camera module. I don't think it's built on Windows 7.

@ankith26
Copy link
ContributorAuthor

ankith26 commentedDec 28, 2021
edited
Loading

I'm curious why you refactored all of my individual setup functions into one, though.

Those functions had some unnecessary repetition, and this one function conditional approach seems more elegant to me than having functions kept in a dict and each of those functions having repetition ofglobal statement and_camera import 😄

Maybe colorspace should have a different error message if it isn't able to be imported. Which it could be, if pygame was built without the _camera module. I don't think it's built on Windows 7.

ANotImplementedError is the most pythonic error to be using in a case like this, it was made for a case like this.
Actually, now that you pointed it out and I rechecked with thedocs, this is indeed not the kind of error to be using here. IMHO, we should make it so that the colorspace function is available on all platforms, because it is independent of the camera backend used. Perhaps that bit of_camera should always compile and this function should always be exported, and the other bits could have conditional compilation

I don't want to expand environment variables for vidcapture, because that thing is 100% deprecated. In fact, in my last camera PR, illume told me I could remove it, but I kept it, in a role reversal for the ages.

Ah, ok. Should I revert my change then? Well it does not matter either way IG, this vidcapture changes should remain undocumented anyways

Another thing I wanted to ask, does windows_camera work on win8? Because the code doesint(platform.win32_ver()[0]) > 8 check, should it be>=?

@Starbuck5
Copy link
Contributor

It should work on Windows 8, since every function I used has been around since then, but I’m still not sure. It claims to support it in the docs, so we should try to use it in the code. If it doesn’t work, somebody will open an issue. (Or nobody will care, since not many people use pygame.camera and not many people use Windows 8)

@ankith26
Copy link
ContributorAuthor

Alrighty :)
I also updated thecolorspace function to emit better errors when not available, although yeah, it should not get triggered in most cases

Copy link
Contributor

@Starbuck5Starbuck5 left a comment

Choose a reason for hiding this comment

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

Thanks, Ankith!

This looks good to me. You could fix that tiny remaining thing (the default size is wrong on the class), and the it'll be good.

ankith26 reacted with thumbs up emoji
Copy link
Member

@illumeillume left a comment

Choose a reason for hiding this comment

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

👍 🎉 thanks

@illumeillume added the bug labelOct 29, 2022
@illumeillume changed the titlefix some bugs in camera.pyFix some bugs in camera.pyOct 29, 2022
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@illumeillumeillume approved these changes

+1 more reviewer

@Starbuck5Starbuck5Starbuck5 approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

bugcamerapygame.camera

Projects

None yet

Milestone

2.1.3

Development

Successfully merging this pull request may close these issues.

pygame.camera members not defined before init?

4 participants

@ankith26@Starbuck5@illume

[8]ページ先頭

©2009-2025 Movatter.jp