> if not self.collide_point(*touch.pos):
touch.pos is a tuple of x,y coordinate of the touch, so its like
calling self.collide_point(touch.x, touch.y). self.collide_point(x,y)
will return true if (x,y) is inside the bounding box / rectangle
defined by the widgets pos and height.
> if not super(Carousel, self).on_touch_down(touch):
super(Carousel, self).on_touch_down(touch) will call the base classes
on_touch_down handler (same behavior as if the method wasn't
overwritten in this class). The general widget behavior is to forward
the event to all child widgets, until one of them returns True
(meaning it handled the event)...so in this case:
> if not super(Carousel, self).on_touch_down(touch):
means unless a child widget handled the event, do the following...
> if touch.grab_current is self:
a widget can "grab" a touch on e.g. touch_down, which will cause it to
receive any subsequent events related to that touch, regardless of
whether the parent widget forwards them or not...checking if
touch.grab_current is self is done to check if this event is a normal
one forwarded form the parent...or if its a grabbed touch which the
widget specifically requested to get no matter what. Generally once
you grab a touch...you just want to keep track of it that way
(otherwise, you would e.g. get the same event from the normal parent
forwarding and from the grabbing.
> if self._viewport and 'button' in touch.profile and
> touch.button.startswith('scroll'):
> if self._get_uid('svavoid') in touch.ud:
touch.ud: ud stands for userdata, which is python dictionary attached
to a touch. this way you can store information with the touch itself
in e.g. on_touch_down, and then access it or check it later in a
touch_move or touch_up event handler, or even in another widget that
receives the event. All of these lines look like they are checking
the touch for some contect established earlier that could indicate
whether the touch is to be used for scrolling or not, etc..
> if self._touch is not touch:
checks if 'touch' (which I assume is the touch event passed to the
handler), is the same as is stored in self._touch before at some
point. These are the kind of things that make multi-touch /
multi-pointer programming a bit different than single cursor / mouse
based widgets...there are multiple independent cursor sessions, and
you often want to make sure the context for the interaction is based
on the same touch moving around, instead of a another one.
> I am afraid this will be a showstopper for our company to use Kivy. We have
> created a demo/prototype interface for the application we want to create for
> some customers and one of the biggest points in the feedback was that they
> should be able to swipe through the buttons like they are used to on their
> smartphones.
> So before I confront my boss; is there a way to request a feature to get a
> solution for this in kivy, or any other way to get this done besides
> modifying the underlying framework ourselves?
First, I would file an issue on github if you havent already.
Depending on your deadline, how fast you want it done, how much input
you want to give for having the feature implemented, or integrated /
tested specifically with your code. You can file the issue, and try
to get it done through the volunteer open source process. If you want
it done fast, and integrated with what you have, shoot me an email at
tho...@fresklabs.com; fresk is happy to take on this kind of thing as
a consulting job. I know Meltingrocks (
http://meltingrocks.com/)
would at the very least be just as qualified, but I cant speak for
their availability or interest.
--
Thomas