Ecosyste.ms: OpenCollective

An open API service for software projects hosted on Open Collective.

github.com/kivy/pyobjus

Access Objective-C classes from Python
https://github.com/kivy/pyobjus

Completly rewtited solution for getting/setting objective c properties. I found much more simpler solution which works in all cases (for now)

5469731d09934c1fe38ff8fded6bb84f6da172ce authored over 11 years ago
It seems that we can't use setValue:forKey if we have pointer to some primitive type, for examples int*. Look at this -> http://lists.apple.com/archives/cocoa-dev/2006/May/msg00343.html. But luckily we can find out actual name of getter/setter function if some property is using those functions -> @property (nonatomic, assign, getter = get_prop_int_gtr_ptr, setter = set_prop_int_ptr:) int *prop_int_cst_ptr;

5cb18f863c8b7f9d7141e6187b6aaa1252308b8d authored over 11 years ago
Working on @dynamic properties. It seems that if we use @dynamic with property, objc_setIvar/objc_getIvar functions don't work with those properties. Instead of that, we can use setValue:forKey and valueForKey: methods of NSObject class. For now, I tested this feature with @dynamic property of type NSString*, and it is working OK.

f3aab544a3560ddfabf638ab545e0a936c6d7d67 authored over 11 years ago
Added support for parsing some of properties options, such as copy, retain, readonly, etc.. Others I'll add also. Tested existing property support, fixed some small bugs. Code clean.

fdab39a1fc4e2d5b2d78fb8b6cc961950b06c91a authored over 11 years ago
Fixed properties of type pointer to struct, and pointer to int. I had some problems with this, but for know we have working NSRange* and int* properties. I'll tests others.

09e849181829aacff903613744ac2e3f56c5feef authored over 11 years ago
Added basic getting/setting for properties. Made some tests, and fow now, everything is working OK. Need to made some more complex tests with some options on properties.

b94734fcefcdd90ccf93bc2c63bc14b4b83fdc08 authored over 11 years ago
Added prototype of ObjcIvar type. Also added some methods to runtime.pxi which will be needed for ivars pyobjus implementation.

6942c8a7503fca940374d4caced1dbfd59a72f24 authored over 11 years ago
Started implementation of ivars/propertied in pyobjus

a060bb08dbb2a535815d44cf8bdae4157e063126 authored over 11 years ago
Merge pull request #4 from ivpusic/unknown_type_signature

Unknown type signature

60ecc545490368b81744de6d03c61592649ae0d1 authored over 11 years ago
Added files which contains tests and examples of new features

4e0b6ac39bab8b604d39ad16414b8607920d62be authored over 11 years ago
Added support for returning IMP and passing IMP types as arguments. Also fixed two small bugs in existing implementation of unknown type signature. I also added some unit tests, and example of using new features in examples/unknown_type.py

36a990242dfcc0c2f35657694151a57fb981faf7 authored over 11 years ago
If user doesn't have defined struct type in objc_py_types/objc_cy_types, and he use pyobjus feature to generate struct type from method signature, he can pass generated type to function which accepts void*, and in that function user can cast that type to appropriate objective c type, so in that case he will get correct value from revieved arguments. I will make some examples of using this feature.

419c7374d392bc568765e15225f0ab3011410d2f authored over 11 years ago
Finished algorithm for generating unknown struct types. User can provide names for fields, or otherwise pyobjus will generate field names for user. User can review generated field names with getMembers function. I tired to use function which accepts generated unknown type, but it work only for pritive types of struct, struct types in struct currently doesn't work, because we aren't made qeuvivalent cython struct, and cast type to that cython type when we are converting python arg to C/Cython arg, so that is causing problems. I don't know how much will be usefull this feature, but in any case is better then nothing, when we return struct of uknown type, and user don't want, or don't know to define required cython struct.

47b771725856020aecc80f21bc00f249c733ad57 authored over 11 years ago
Working on (?) signature. Some struct can have ? type, so I'm trying to 'generate' structs for user in that cases. Also I'm trying to allow user to he can define field names of struct, otherwise pyobjus will generate names for fields internaly. Work in progress...

552b2794ba13e53b95227b6b710a8a808887be98 authored over 11 years ago
Looking for chances to add bit field support in pyobjus, but unfortunetly libffi doesn't support structures with bitfields. Source -> http://www.manpagez.com/info/libffi/libffi-3.0.13/libffi_12.php#Missing-Features. Later we can see if there is some hack, which we can do for adding some support for this, but currently I think that this isn't priority for pyobjus

f216fd1049e3f0f1537c8a9e995d375b601677de authored over 11 years ago
Merge pull request #3 from ivpusic/union_signature

Union signature

6c7fba5705f7844001223cb5ce1d1de4f323ffda authored over 11 years ago
Small code clean

c6e130f9acce55fbc9ae0e31db6d928b99d39e6d authored over 11 years ago
Removed unused function in pyobjus.pyx

25a8f0ab673557a5976f3c7aa9ae43e14f0f99a7 authored over 11 years ago
Small bug fix in type_encoding_to_ffi_type function

5eade030f2e9a455db302270d6a6e9c38096e520 authored over 11 years ago
Added exapmles and unit test related to using objective c unions. I tried to make work passing unions as arguments by value, but without success, and I mentioned that in examples/unions.py, so users can see what they currently can, and what they can work with unions in objective c. Mostly they can everything except passing unions by value to functions. Note that returning unions by value work correct.

c3711807a417e46d4f6dec38872a74211e5f7af2 authored over 11 years ago
Implemented passing union pointers as arguments. Also made to work dereference function with Unions, but I think we have problem with passing unions by value to some function. It seems that libffi doesn't support passing unions by value, so it might me a problem. I tried on many different ways to make work this, but without success

53052eae843bcee99e325335cc1d531cd5f9db7b authored over 11 years ago
Working on union signature. It seems that libffi doesn't have any special support for unions, but with some customisations of existing support for struct signatures, unions also works for function which makes and returns some union type. This need to be more tested. Alse fixed bug related to signature_types_to_list, and function still need some improvements, but I'll work on that. Next will be to try make union signature when we need to pass union as function argument.

0f27207c3b3b3126c415e308945c272089f03061 authored over 11 years ago
Merge pull request #2 from ivpusic/ptr_to_type_signature

Ptr to type signature

d3a3a5865fc6e56cb270b20fc4886d1766294db6 authored over 11 years ago
removed useless lines from .gitignore

f59aa89f54828b977ac23f2ff96cb063e04fa2bf authored over 11 years ago
Added examples/pointer_to_type.py file

87db77d916cd9a48a60dcc9213ad8b6b9e0a9a4d authored over 11 years ago
Maked unit test for ^type signature. Also added example of using new feature in examples/pointer_to_type.py file. I fixed some bugs related to BOOL type. It was't work at all, but it is working now OK.

931166a359bc37c08b8f7f419b56bcfb2cc52c51 authored over 11 years ago
Working on dereference function. Function convert_cy_ret_to_py is reused in dereference function, so I also modify some parts of that function, so it now can be used for dereferencing. In pyobjus_type.pxi added ObjcInt and ObjcFloat types, which are needed for dereference function, because user need to say pyobjus in which type to convert void pointer. Other types also will be added (ObjcLong, ObjcUnsignedInt, etc.)

bb92fde8ccff8cf40c0e63ceb27ec33eadab6911 authored over 11 years ago
Fixed bug related to isKindOfClass: method

e32748af7f615e2a88f415036fbb125c207ed575 authored over 11 years ago
Added more support for ^type signature. Also I refactored some code, and added pyobjus_types.pxi file, which will hold cython classes which represents objective c types, for example Class -> ObjcClass, selector -> ObjcSelector, etc.

bf16d4aad6ab6f61724e7b7929043c6780553648 authored over 11 years ago
little improvement (added strcpy) in pyobjus_conversations.pxi

66e609df32045a177d25f3979d4879153e07ed62 authored over 11 years ago
Added support for most of types (int, long, float, etc.) for (^type) pointer to type signature. Also added objective c methods in usrlib.m file, for testing purposes of (^type) sig

456a7e8e1225a1704e1f5f044da9bb843f10030c authored over 11 years ago
Some code refactoring, and making code infrastructure for implementing of ^type signature. Also added some (short, unsigned long, etc.) missing argument types. This need to be tested! Code with purpose of casting or converting is moved to pyobjus_conversions.pxi file.

6530e8ace865efb2086c65c597ba9eb548641594 authored over 11 years ago
started implementation of (^type) pointer to type method signature. Also added new folder with name objc_usr_classes with user defined objective class for testing purposes of this signature.

033ad43b87c3f51c13b441c0482fd60b1061a61b authored over 11 years ago
started implementation of (^) signature. Added method for casting python object to py_objc object type (NSRange, ObjcClassInstance, etc.) Needed to implement casting for rest of types, also needed testing. Tested only with NSValue class.

97d3f401e90f0bbf2cd3285014a680dc9070d96c authored over 11 years ago
I made more unit tests on NSString class. Also added some enum types to objc_py_types.py, and tests for added enum types. All tests are passed! --> /test/test_nsstring.py

b7a85aabe1d87c03b948a6f40ae7fe3062cd0ea5 authored over 11 years ago
Fixed passing struct as argument. We are using solution with both ctypes and cython structs. There will not be a lot additional work when defining cython structs, because we need only say what't the name of struct type, and put elif statement (objc_cy_types.pxi). Details about struct fields is donne via ctypes structure. If I somehow make structure arguments to work withouth cython struct, it will not be a problem to remove added helper objc_cy_types.pxi file, but I'm not shure it they will work without cast to some C (cython) type.

f01fd7123147c807cd2a7dfd98c809c3d963341f authored over 11 years ago
We have working struct signature for few nsvalue methods. I will do a more tests on other classes. It seems that case when we need to call objc_msgSeng or objc_msgSend_stret when we need to return structure depends on architecture, so I write case for x86_64 architecture, and I put some docs on that line, and some resources about x86_64. It will be needed to implements other cases (PowerPC and IA-32 which are supported by apple)

35f838fbf46115ed8155239bb7e2b37e8e518ed9 authored over 11 years ago
small code cleanup after commit

ce73e72ee1765ca807d55ff1c5f2c1b964ed4ec8 authored over 11 years ago
Added algorithm to parse function signature and construct ffi_type structure. Also get working NSValue valueWithRect and rectValue methods. Next step is to handle exceptions potentialy generated by objc_msgSend or objc_msgSend_stret functions

5084ffca218deed88e8c778f6bf0b74d1554a389 authored over 11 years ago
Small code clean after commit

782c22cfe913ae7d7f9dfbb9d579762618fb58ac authored over 11 years ago
currently hardcoded but working support for rangeOfString: method. It returns NSRange, which is struct. The problem is with casting to types...c to c types, and c to python types. Also problem is with objc_msgSend and objc_msgSend_stret methods when we are returning some struct type. If struct is small, it need to be called with objc_msgSend, but if struct is big, it need to be called with objc_msgSend_stret. Which size is 'small', and which size is 'big' depends on architecture, and that's problem. As I already said, currently implementation is hardcoded, and it isn't for some real use, but work is in progress :)

e7f2e8453e8fb45d9eb5fc0f824e4ebd22832470 authored over 11 years ago
Added unit test for NSMutableArray

7c41201a5e72f231969c29355de1f1e22e111644 authored over 11 years ago
Added support for varargs methods! I have tested this with arrayWithObjects method, and it works OK. Last argument must be nil in objective c, and in python we need to pass None insted of nil. Later internally in pyobjus, None is convered to NULL, otherwise we are getting segmentation fault

5f58c2b1ac03ab6aac810bfa2e14ad188f94f16e authored over 11 years ago
Update ClassesAndSelectors.py

ce5e0ce77203594a27fe372c46972e3cdee7ff6c authored over 11 years ago
Added examples of operations with classes and selectors in /examples dir

f7d0af359be28baef5431a7dc2ae1b46c40c70c1 authored over 11 years ago
added NSAlert examples to /examples dir

3d37f1156e9e9e7034bba49cc09c72cba0ac3575 authored over 11 years ago
Improved caching system in pyobjus. Also separated class and class instance methods. Now objects are more lightweight, because they have only instances of ObjcMethod which they can call. Tested with existing unit tests, and all tests are passing. Also uncomented code in existing unit tests which was commented, beacause some functions could not work before, but for now we have working all test cases which are defined in /tests dir

211d5c0e1aa99da08ef55163b81bb95b6c6fe20b authored over 11 years ago
added return to ':' return signature (I forgot to add this on last commit)

c39119e9eccb511e6718aa685f3576294111a79f authored over 11 years ago
Implemented selector signature (:). Tested with respondsToSelector_, instancesRespondsToSelector_ method, and with NSString and NSArray types, it works for now. Working tests can be found at the end of pyobjus/test.py file. Also fixed little bug with static methods resolution

e245c007026809d5fd5ad809d88dd8f8cb180ff1 authored over 11 years ago
removed one unused method in pyobjus.pyx

b0cef278b29cdb0cdfccdf828c4ea67c2699ae29 authored over 11 years ago
Added method signature (# -> Class) implementation. Tested in pyobjus/test.py with methods object.oclass() and object.isKindOfClass_(someCls), and it seems to work OK, but need to be tested more. Also fixed little bug with collecting methods of super class

8e863aed8acaa3011714cb41913e98af2faaa5f8 authored over 11 years ago
Fixed super_class method resolution. Make some tests with NSMutableDictionary, and now it works for methods in examples/NSMutableDictionary.py. Other method needs to be tested

5ce8f650ae34b21cfa82fa0c204a2600b4e96e46 authored over 11 years ago
added example of calling method with multiple arguments in examples/NSMutableArray.py file

f2073eabcda50ddfa2762001ce81a759f5cf5c7f authored over 11 years ago
small code delete

5e0dac903336e51931731babed12ff06a80f3e5c authored over 11 years ago
deleted some unused code from pyobjus.pyx

8298a077f6312d6b0e232b146d7c6fddf1c2cf76 authored over 11 years ago
added dprint function

db26a1c032f4d4be1c09934b0666ba5e94a558dc authored over 11 years ago
added some examples

c838249de7358fa09993271d756c2f8bddae17b1 authored over 11 years ago
Merge pull request #1 from kivy/ivpusic_gsoc

Ivpusic gsoc

7a8eb8eb1915a7fe59dee561a65d24a1d7ace2a6 authored over 11 years ago
added missing return if object already exists (autoclass function)

b5322ec58487cd72b031fef5e569e78d7ae57c57 authored over 11 years ago
small bug fix for NSArray and NSMutableArray

1a6aa3472401dfac3e10c737605e5f518e0c16b5 authored over 11 years ago
fixed warnings, fixed NSMutableArray, fixed bug related to super_class methods

2f53f9ecdb7b63e1ea7560ca9a0aef0da2609513 authored over 11 years ago
fix @ assignation for method parameters

In addition, lot of debug is added, and few weird things removed.

df6de273cd7bc7b07d50cdbdfd6aa066059f85b0 authored over 11 years ago
added test.py file

77857b5cddaf7fd79f55e06c6d31ce8b30ca4b65 authored over 11 years ago
small progress on NSArray object

71edef8076ff280d66854c41a221a4fc15a8a1ca authored over 11 years ago
added some code snippets for NSArray class

24a2608d8738cd6a0e54c09499398cff7915191e authored over 11 years ago
ivpusic commit test

42a96e831add5645454a1b83521525c11b2c69f8 authored over 11 years ago
Merge branch 'master' of github.com:kivy/pyobjus

# Please enter a commit message to explain why this merge is necessary,
# especially if it merge...

aafef1e363148726e0e20dddc97c04d584187d95 authored almost 12 years ago
add static method support to ObjcClass

9cc386cf7ca123a0434936734599a2cf79c33fe7 authored almost 12 years ago
update readme and fix doc

b7562f2df827bbf0220b15827c17ab8058e2b4f3 authored almost 12 years ago
start documentation

977e380373f03ab70e0257fb4b760b48a33d2497 authored almost 12 years ago
add more tests

1620693457a19ac1bc5a086db3538c6478c19200 authored almost 12 years ago
add nsobject tests

e1b0cfedcbb73b5b001c4a14b2a0a156c02ec361 authored almost 12 years ago
fix "c" return type

af0378c934dfc915250ed5b5e7927bf9d468b8f7 authored almost 12 years ago
add gitignore

27294072f8c17ea9e2de6de9badbc16b37dbbd1f authored almost 12 years ago
avoid broken test atm

2c0838916c32d25f0d83496e3868517c7a5d13a7 authored almost 12 years ago
core: when we return a id, ensure we autoclass the right class name from the instance.

fe20ad8f9791b9f61827b2a4f2586434e2881945 authored almost 12 years ago
erge branch master

e12371995ce6b4b0e68426c8a62abf541f2135ec authored almost 12 years ago
additional tests

start classmethod support

c0903210422300de54fa35a5f4583f622d5d8d21 authored almost 12 years ago
add ability to pass objclass instance in parameters

497efbe282bbd214a3bd42d9b58a0d35c3945996 authored almost 12 years ago
type: add void return type handle

d65897bd4e26dfbdb4b60a42ff5f089e460a665f authored almost 12 years ago
clean up tests, and create first correctly working unittest

ab386cb1e31336642bd86143062230fe10cb1cd5 authored almost 12 years ago
fix call method, doesnt need per argument selector

f06d95c7fb665887d0b99ae96dff6014e4c3023a authored almost 12 years ago
fix autoclass method binding (replace : with _ in selector name for python functions)

e3b8a36bdbbc752419f44d3967ba161480021837 authored almost 12 years ago
got ffi_call() works, but lot of segfault around it.

0d240ffe428dcef15fcd1f33600f14546f619c63 authored almost 12 years ago
wip

892fd4a68d12accae6e8b701b49bd0656ead8994 authored almost 12 years ago
Merge branch 'master' of ssh://github.com/kivy/pyobjus

df0063eaa6b62635033873737e1befd2f3200d45 authored over 12 years ago
wip autoclass()

9cdedbad258effe6810ba06662404c94d05ccdc8 authored over 12 years ago
fix "_" -> ":" swap for method name

35d3b89a73392c51bfa99c197b0fa6e11925f35a authored over 12 years ago
Merge branch 'master' of github.com:kivy/pyobjus

Conflicts:
pyobjus/pyobjus.pyx

c04072bc06753b6ac2d45315313669c8fc829e43 authored over 12 years ago
wip

5d01d3a917b285998fd4e9818386c5700b1b2342 authored over 12 years ago
move method init part from __call__ to ensure_method()

ed63ceece1d5e6da6869da129c21b3c3b87507a0 authored over 12 years ago
wip. clean up and split into seperate files. still segfaults on ffi_call :/

56fd0af68844acc77e16bf0f1d8b75cda123f9fe authored over 12 years ago
un-stuck hansent work ^^

988dd8ae7d0b4cba009968e221121179c91e531e authored over 12 years ago
WIP, ffi_call complains about assigning to 'PyObject *' (aka 'struct _object *') from incompatible type 'void' although no python object used...?!

79f717fe1e88dcdbffb56980a247a41ec62df5ab authored over 12 years ago
wip3

42e4ca61b23b2aecfafde1840bf3a0cc375ec09f authored over 12 years ago
add tests

d62eb4f75df9b903d692cbc8661ef101f40a572a authored over 12 years ago
wip2

798e8829feb18ca1acb2f708bb541b399ebda111 authored over 12 years ago
wip

5eb319796b75ae5870d69366c92318a213212bce authored over 12 years ago
fix crash (load the framework Foundation manually, remove -lobjc, and add autorelease pool (seem not necessary.))

57bacbe84298a4a6b2453c26a4121cce2fe813d1 authored over 12 years ago
some test code...obj-c class registry does not seem to be initialized...not sure what Xcode does to make it work yet :/

e119c2cdd09a25e7afc00aeacf69dd2bdbfd4f59 authored over 12 years ago