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

[input]Provider matching for input postproc calibration #5870

Merged
merged 4 commits into from Oct 5, 2018

Conversation

LukeBiddle
Copy link

Allows users to match calibration rules to any and all devices of a particular input provider. This is useful when the name of the device is not known in advance. For example, if probesysfs is used to match an mtdev touchscreen:

[input]
mtdev_%(name)s = probesysfs,provider=mtdev

then the touchscreen can be calibrated using:

[postproc:calibration]
(mtdev) = xratio=0.3333,xoffset=0.3333

The new convention is to use parentheses to denote a provider name instead of a device.

I mainly made this change to work with #5659 to apply auto calibration to a resizable app no matter what device it is installed on.

I have only tested this PR with an mtdev touchscreen, but it should work for any input that might need calibrating.

subclasses mapped to their provider name.
"""
provider_map = {}
for input_provider in MotionEventFactory.list():
Copy link
Author

Choose a reason for hiding this comment

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

This is only called once in __init__, and I was unsure if MotionEventFactory.list() might ever change its output after this. Can anyone confirm?

Copy link
Member

Choose a reason for hiding this comment

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

Touch providers are supposed/assumed to be registered before all of this already, while it would be cool to be allow to enable/disable them at runtime, this is currently not really possible anyway, so no worries here.

if issubclass(event, MotionEvent):
provider_map[event] = input_provider

return provider_map
Copy link
Author

Choose a reason for hiding this comment

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

This is what provider_map looks like:

{
<class 'kivy.input.providers.tuio.Tuio2dCurMotionEvent'>: 'tuio',
<class 'kivy.input.providers.tuio.Tuio2dObjMotionEvent'>: 'tuio',
<class 'kivy.input.providers.mtdev.MTDMotionEvent'>: 'mtdev',
<class 'kivy.input.providers.hidinput.HIDMotionEvent'>: 'hidinput',
<class 'kivy.input.providers.linuxwacom.LinuxWacomMotionEvent'>: 'linuxwacom',
<class 'kivy.input.providers.leapfinger.LeapFingerEvent'>: 'leapfinger'
}

@tshirtman tshirtman self-assigned this Jul 23, 2018
Copy link
Member

@tshirtman tshirtman left a comment

Choose a reason for hiding this comment

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

not tested, but LGTM, there might be performance considerations, but they'll only come up if the postproc:calibration module is used (which it's not by default), so i think it's not a big concern.

Sprint pycon-fr 2018 automation moved this from todo to done Oct 5, 2018
subclasses mapped to their provider name.
"""
provider_map = {}
for input_provider in MotionEventFactory.list():
Copy link
Member

Choose a reason for hiding this comment

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

Touch providers are supposed/assumed to be registered before all of this already, while it would be cool to be allow to enable/disable them at runtime, this is currently not really possible anyway, so no worries here.

@tshirtman tshirtman merged commit d12a24d into kivy:master Oct 5, 2018
Sprint pycon-fr 2018 automation moved this from done to merged Oct 5, 2018
@welcome
Copy link

welcome bot commented Oct 5, 2018

Congrats on merging your first pull request! 🎉🎉🎉

@matham matham changed the title Provider matching for input postproc calibration [input]Provider matching for input postproc calibration May 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants