Merge branch 'master' of github.com:tito/kivy

This commit is contained in:
Mathieu Virbel 2011-01-31 03:07:27 +01:00
commit b063d6a2ee
5 changed files with 60 additions and 28 deletions

View File

@ -42,21 +42,20 @@ Code Workflow
~~~~~~~~~~~~~
So here is the initial setup to begin with our workflow (you only need to do
this once to install Kivy):
this once to install Kivy). Basically you follow the installation
instructions from :ref:`dev-install`, but you don't clone our repository,
but the fork you create with the following steps:
#. Log in to GitHub
#. Create a fork of the `Kivy repository <https://github.com/tito/kivy>`_ by
clicking the *fork* button.
#. Clone your fork of our repository to your computer. Your fork will have
the git remote name 'origin' and you will be on branch 'master'.
#. Compile and set up PYTHONPATH or install (see :ref:`dev-install`).
#. Install our pre-commit hook that ensures your code doesn't violate our
styleguide by executing 'make hook' in your clone. This will run our
styleguide check whenever you do a commit, and if there are violations in
the parts that you changed, your commit will be aborted. Fix & retry.
#. Set up the `PYTHONPATH environment variable <http://docs.python.org/tutorial/modules.html#the-module-search-path>`_
to point at your clone.
This way you don't have to install (``setup.py install``) after every tiny
modification. Python will instead import Kivy from your clone.
Now, whenever you want to create a patch, you follow the following steps:

View File

@ -14,6 +14,8 @@ Kivy consists of several building blocks that we will explain in the
following.
.. _providers:
Core Providers and Input Providers
----------------------------------

View File

@ -64,10 +64,36 @@ necessary packages:
python-gst0.10 python-enchant gstreamer0.10-plugins-good cython python-dev \
build-essential libgl1-mesa-dev libgles2-mesa-dev
.. _dev-install:
Installing Kivy
~~~~~~~~~~~~~~~
Installing Kivy for Development
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In order to set up Kivy for development, please set up a development
environment for Kivy on your computer. Follow the steps mentioned in
:ref:`contributing`.
Now that you've installed all the required dependencies, it's time to
download and compile a development version of Kivy::
$ # Download Kivy from GitHub
$ git clone git://github.com/tito/kivy.git
$ cd kivy
$ # Compile:
$ python setup.py build_ext --inplace
If you have the ``make`` command available, you can also use the
following shortcut to compile (does the same as the last two commands)::
$ make build
If you want to modify the Kivy codebase itself,
set up the `PYTHONPATH environment variable <http://docs.python.org/tutorial/modules.html#the-module-search-path>`_
to point at your clone.
This way you don't have to install (``setup.py install``) after every tiny
modification. Python will instead import Kivy from your clone.
Or, if you don't want to make any changes to Kivy itself, you can also run
(as admin, e.g. with sudo)::
$ python setup.py install
If you want to contribute code (patches, new features) to the Kivy
codebase, please read :ref:`contributing`.

View File

@ -4,13 +4,18 @@ Core Abstraction
This module defines the abstraction layers for our core providers and their
implementations. For further information, please refer to
`Architectural Overview` and the `Core Providers and Input Providers` section
of the documentation.
:ref:`architecture` and the :ref:`providers` section of the documentation.
In most cases, you shouldn't directly use a library that's already covered
by the core abstraction. Always try to use our providers first.
In case we are missing a feature or method, please let us know by
opening a new Bug report instead of relying on your library.
**Note:**
These are **not** widgets! These are just abstractions of the respective
functionality. For example, you cannot add a core image to your window.
You have to use the image **widget** class instead. If you're really
looking for widgets, please refer to :mod:`kivy.uix` instead.
'''
import os

View File

@ -21,7 +21,7 @@ if 'KIVY_DOC' not in os.environ:
dll = '/System/Library/PrivateFrameworks/' + \
'MultitouchSupport.framework/MultitouchSupport'
MultitouchSupport = ctypes.CDLL()
MultitouchSupport = ctypes.CDLL(dll)
CFArrayGetCount = MultitouchSupport.CFArrayGetCount
CFArrayGetCount.argtypes = [CFArrayRef]
@ -66,23 +66,23 @@ if 'KIVY_DOC' not in os.environ:
('unknown5_2', ctypes.c_int),
('unknown6', ctypes.c_float), ]
MTDataRef = ctypes.POINTER(MTData)
MTDataRef = ctypes.POINTER(MTData)
MTContactCallbackFunction = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_int,
MTDataRef, ctypes.c_int,
ctypes.c_double, ctypes.c_int)
MTContactCallbackFunction = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_int,
MTDataRef, ctypes.c_int,
ctypes.c_double, ctypes.c_int)
MTDeviceRef = ctypes.c_void_p
MTDeviceRef = ctypes.c_void_p
MTRegisterContactFrameCallback = \
MultitouchSupport.MTRegisterContactFrameCallback
MTRegisterContactFrameCallback.argtypes = \
[MTDeviceRef, MTContactCallbackFunction]
MTRegisterContactFrameCallback.restype = None
MTRegisterContactFrameCallback = \
MultitouchSupport.MTRegisterContactFrameCallback
MTRegisterContactFrameCallback.argtypes = \
[MTDeviceRef, MTContactCallbackFunction]
MTRegisterContactFrameCallback.restype = None
MTDeviceStart = MultitouchSupport.MTDeviceStart
MTDeviceStart.argtypes = [MTDeviceRef, ctypes.c_int]
MTDeviceStart.restype = None
MTDeviceStart = MultitouchSupport.MTDeviceStart
MTDeviceStart.argtypes = [MTDeviceRef, ctypes.c_int]
MTDeviceStart.restype = None
else:
MTContactCallbackFunction = lambda x: None
@ -131,10 +131,10 @@ class MacMotionEventProvider(MotionEventProvider):
# ok, listing devices, and attach !
devices = MultitouchSupport.MTDeviceCreateList()
num_devices = CFArrayGetCount(devices)
print 'num_devices =', num_devices
# print 'num_devices =', num_devices
for i in xrange(num_devices):
device = CFArrayGetValueAtIndex(devices, i)
print 'device #%d: %016x' % (i, device)
# print 'device #%d: %016x' % (i, device)
# create touch dict for this device
data_id = str(device)
self.touches[data_id] = {}