pyobjc-dev Mailing List for PyObjC (Page 64)
Brought to you by:
ronaldoussoren
You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(9) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(1) |
Feb
(2) |
Mar
(3) |
Apr
(30) |
May
(18) |
Jun
|
Jul
(4) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2002 |
Jan
(7) |
Feb
(2) |
Mar
(1) |
Apr
|
May
|
Jun
(3) |
Jul
(13) |
Aug
|
Sep
(23) |
Oct
(180) |
Nov
(291) |
Dec
(95) |
| 2003 |
Jan
(338) |
Feb
(352) |
Mar
(97) |
Apr
(46) |
May
(226) |
Jun
(184) |
Jul
(145) |
Aug
(141) |
Sep
(69) |
Oct
(161) |
Nov
(96) |
Dec
(90) |
| 2004 |
Jan
(66) |
Feb
(87) |
Mar
(98) |
Apr
(132) |
May
(115) |
Jun
(68) |
Jul
(150) |
Aug
(92) |
Sep
(59) |
Oct
(52) |
Nov
(17) |
Dec
(75) |
| 2005 |
Jan
(84) |
Feb
(191) |
Mar
(133) |
Apr
(114) |
May
(158) |
Jun
(185) |
Jul
(62) |
Aug
(28) |
Sep
(36) |
Oct
(88) |
Nov
(65) |
Dec
(43) |
| 2006 |
Jan
(85) |
Feb
(62) |
Mar
(92) |
Apr
(75) |
May
(68) |
Jun
(101) |
Jul
(73) |
Aug
(37) |
Sep
(91) |
Oct
(65) |
Nov
(30) |
Dec
(39) |
| 2007 |
Jan
(24) |
Feb
(28) |
Mar
(10) |
Apr
(2) |
May
(18) |
Jun
(16) |
Jul
(21) |
Aug
(6) |
Sep
(30) |
Oct
(31) |
Nov
(153) |
Dec
(31) |
| 2008 |
Jan
(63) |
Feb
(70) |
Mar
(47) |
Apr
(24) |
May
(59) |
Jun
(22) |
Jul
(12) |
Aug
(7) |
Sep
(14) |
Oct
(26) |
Nov
(5) |
Dec
(5) |
| 2009 |
Jan
(10) |
Feb
(41) |
Mar
(70) |
Apr
(88) |
May
(49) |
Jun
(62) |
Jul
(34) |
Aug
(15) |
Sep
(55) |
Oct
(40) |
Nov
(67) |
Dec
(21) |
| 2010 |
Jan
(60) |
Feb
(17) |
Mar
(26) |
Apr
(26) |
May
(29) |
Jun
(4) |
Jul
(21) |
Aug
(21) |
Sep
(10) |
Oct
(12) |
Nov
(3) |
Dec
(19) |
| 2011 |
Jan
(3) |
Feb
(13) |
Mar
(8) |
Apr
(8) |
May
(17) |
Jun
(20) |
Jul
(21) |
Aug
(7) |
Sep
|
Oct
|
Nov
(9) |
Dec
(11) |
| 2012 |
Jan
(3) |
Feb
|
Mar
|
Apr
(5) |
May
(4) |
Jun
(14) |
Jul
(5) |
Aug
(2) |
Sep
(15) |
Oct
(2) |
Nov
(23) |
Dec
(1) |
| 2013 |
Jan
(8) |
Feb
(1) |
Mar
|
Apr
|
May
(5) |
Jun
(1) |
Jul
(5) |
Aug
(4) |
Sep
|
Oct
(12) |
Nov
(10) |
Dec
(3) |
| 2014 |
Jan
(7) |
Feb
(14) |
Mar
(2) |
Apr
|
May
(2) |
Jun
(11) |
Jul
(10) |
Aug
(4) |
Sep
|
Oct
(8) |
Nov
(1) |
Dec
(2) |
| 2015 |
Jan
(9) |
Feb
(7) |
Mar
(1) |
Apr
|
May
(7) |
Jun
|
Jul
(5) |
Aug
(6) |
Sep
|
Oct
(1) |
Nov
(4) |
Dec
|
| 2016 |
Jan
(1) |
Feb
(1) |
Mar
(4) |
Apr
(2) |
May
(1) |
Jun
|
Jul
(6) |
Aug
(8) |
Sep
(21) |
Oct
(17) |
Nov
|
Dec
(36) |
| 2017 |
Jan
(6) |
Feb
(2) |
Mar
(4) |
Apr
(2) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
(1) |
Dec
(6) |
| 2018 |
Jan
(2) |
Feb
(3) |
Mar
(3) |
Apr
(14) |
May
(2) |
Jun
(2) |
Jul
(4) |
Aug
(3) |
Sep
(6) |
Oct
(16) |
Nov
(1) |
Dec
(6) |
| 2019 |
Jan
(3) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
(6) |
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(2) |
Jun
(1) |
Jul
(7) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
(2) |
Dec
(1) |
| 2021 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
(5) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
| 2023 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
|
From: Jay F. \(saurik\) <sa...@sa...> - 2008-03-08 11:24:45
|
So, a few weeks ago I ported PyObjC to the iPhone, and I'm realizing that I should be doing a better job of telling people how to get it ;P. I don't know if anyone is even interested in this, but I have written a little article about it on my website (http://www.saurik.com/id/5). Most of it is for iPhone developers who want to get started with PyObjC, but it also explains how to get it and provides a link to some example iPhone application code. (The short version of getting it is to add http://apptapp.saurik.com/ as an Installer source, install Cydia Packger, and then install iPhone/Python from the Python category.) I had to bypass the build environment (as I didn't see how to make it do cross compilation in any easy way) and I made a bunch of modifications to the iPhone assembler to support libffi almost entirely out of the box (I also ported Java a few months ago, which needed this for a setup I built that's similar to PyObjC called JocStrap), but otherwise PyObjC pretty much worked. The changes and build scripts can be found at the Telesphoreo project: http://svn.telesphoreo.org/trunk/data/pyobjc/port.diff http://svn.telesphoreo.org/trunk/data/pyobjc/make.sh (Sorry about the massive single-file .diff, when I was working on that I was sufficiently in a rush as to not spend the time to break it into a couple patches for the couple things I changed.) Sincerely, Jay Freeman (saurik) sa...@sa... http://www.saurik.com/ |
|
From: Noah G. <noa...@gm...> - 2008-03-05 01:30:39
|
On Mar 4, 2008, at 5:14 PM, Zac Bir wrote: > On Tue, Mar 4, 2008 at 1:23 PM, Phil Frost > <ph...@ma...> wrote: >> I'll probably be at PyCon, at least for the sprints. I might do an >> impromptu intro to PyObjC if there is interest, and I might do a >> sprint if inspiration finds me, but otherwise I'll just be mingling. > +1 I would love to attend an impromput intro to PyObjC. > I'd love to get together and go briefly over the steps involved in > migrating from a py2app-based build strategy to an Xcode-based build > strategy. > > Zac > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Pyobjc-dev mailing list > Pyobjc-de Noah Gift / http://noahgift.com |
|
From: Zac B. <zb...@ur...> - 2008-03-04 22:14:54
|
On Tue, Mar 4, 2008 at 1:23 PM, Phil Frost <ph...@ma...> wrote: > I'll probably be at PyCon, at least for the sprints. I might do an > impromptu intro to PyObjC if there is interest, and I might do a > sprint if inspiration finds me, but otherwise I'll just be mingling. I'd love to get together and go briefly over the steps involved in migrating from a py2app-based build strategy to an Xcode-based build strategy. Zac |
|
From: Phil F. <ph...@ma...> - 2008-03-04 21:23:21
|
I'll probably be at PyCon, at least for the sprints. I might do an impromptu intro to PyObjC if there is interest, and I might do a sprint if inspiration finds me, but otherwise I'll just be mingling. On Feb 28, 2008, at 13:03 , Robert Vadnais wrote: > Anybody else heading to PyCon in a couple weeks? I assume it's too > late to organize a formal PyObjC sprint, but perhaps we could pull off > an underground version. > > Bob > > > ---------------------------------------------------------------------- > --- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev > |
|
From: Noah G. <noa...@gm...> - 2008-03-04 09:06:32
|
I haven't heard much about PyObjc at PyCon 08. I would be interested in attending an informal talk, etc. Noah Gift |
|
From: James K. <JK...@ne...> - 2008-02-29 14:59:41
|
On 2/28/08 1:03 PM, "Robert Vadnais" <pyo...@bo...> wrote: > Anybody else heading to PyCon in a couple weeks? I assume it's too > late to organize a formal PyObjC sprint, but perhaps we could pull off > an underground version. Hey Bob, I'll be at PyCon, and it appears they have the ability to handle unscheduled talks: http://us.pycon.org/2008/conference/openspace/ I'd certainly be interested in attending. Jim |
|
From: Ronald O. <ron...@ma...> - 2008-02-29 08:43:55
|
On 28 Feb, 2008, at 19:03, Robert Vadnais wrote: > Anybody else heading to PyCon in a couple weeks? I assume it's too > late to organize a formal PyObjC sprint, but perhaps we could pull off > an underground version. I won't be there. Heck, I won't even be on the right continent :-) Ronald |
|
From: Greg E. <gre...@ca...> - 2008-02-28 19:59:13
|
Ronald Oussoren wrote: > Objective-C isn't too bad, the object model is close to that of Python. > For GUI programming you mostly don't have to worry about the pointy > bits in C, which makes it pretty easy to get to know enough of > Objective-C to be able to understand sample code. The main thing you'll need to get used to is remembering to put underscores in the right places in the Python versions of Objective-C method names. It feels quite screwy at first... -- Greg |
|
From: Robert V. <pyo...@bo...> - 2008-02-28 18:03:52
|
Anybody else heading to PyCon in a couple weeks? I assume it's too late to organize a formal PyObjC sprint, but perhaps we could pull off an underground version. Bob |
|
From: Ronald O. <ron...@ma...> - 2008-02-28 17:53:40
|
On 28 Feb, 2008, at 17:16, Anders Olme wrote: > Ok. Guess we all have to learn objective c sometime :). Objective-C isn't too bad, the object model is close to that of Python. For GUI programming you mostly don't have to worry about the pointy bits in C, which makes it pretty easy to get to know enough of Objective-C to be able to understand sample code. Ronald |
|
From: Anders O. <and...@gm...> - 2008-02-28 16:16:13
|
Ok. Guess we all have to learn objective c sometime :). Best Regards Anders Olme |
|
From: Ronald O. <ron...@ma...> - 2008-02-28 11:07:02
|
On 28 Feb, 2008, at 11:54, Anders Olme wrote: > Hello, > > Do you have to have knowledge in objective-c/cocoa to be able to use > pyobjc or can you start learning coca in python directly? You can start learning Cocoa in Python, but it is helpful to have some knowlegde of Objective-C because almost all documentation and code snippets on the web are written in Objective-C. Ronald |
|
From: Anders O. <and...@gm...> - 2008-02-28 10:54:06
|
Hello, Do you have to have knowledge in objective-c/cocoa to be able to use pyobjc or can you start learning coca in python directly? Best Regards Anders Olme |
|
From: Ronald O. <ron...@ma...> - 2008-02-27 09:17:09
|
Tom, Thanks for the fix. I've applied it in revision 1992. Ronald On Wednesday, February 27, 2008, at 08:37AM, "Tom Insam" <to...@je...> wrote: >The function 'fourCharToInt' in PyDocEvents.py > >http://svn.red-bean.com/pyobjc/trunk/pyobjc/pyobjc-framework-WebKit/Examples/PyDocURLProtocol/PyDocEvents.py > >uses struct.unpack without specifying the endianness of the unpack - >it wants to be > > struct.unpack('>l', code)[0] > >or it won't work on intel machines. > >I haven't tested the example otherwise - I was merely cribbing it for >writing my own URL handler. The way it mysteriously fails to work on >intel machines while producing no error messages whatsoever is >especially entertaining. > >Tom Insam >to...@je... > > >------------------------------------------------------------------------- >This SF.net email is sponsored by: Microsoft >Defy all challenges. Microsoft(R) Visual Studio 2008. >http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >_______________________________________________ >Pyobjc-dev mailing list >Pyo...@li... >https://lists.sourceforge.net/lists/listinfo/pyobjc-dev > > |
|
From: Tom I. <to...@je...> - 2008-02-27 07:36:52
|
The function 'fourCharToInt' in PyDocEvents.py http://svn.red-bean.com/pyobjc/trunk/pyobjc/pyobjc-framework-WebKit/Examples/PyDocURLProtocol/PyDocEvents.py uses struct.unpack without specifying the endianness of the unpack - it wants to be struct.unpack('>l', code)[0] or it won't work on intel machines. I haven't tested the example otherwise - I was merely cribbing it for writing my own URL handler. The way it mysteriously fails to work on intel machines while producing no error messages whatsoever is especially entertaining. Tom Insam to...@je... |
|
From: James R E. <ea...@ba...> - 2008-02-26 16:54:01
|
On Feb 26, 2008, at 10:58 , Ronald Oussoren wrote: > That's right, the Python proxy to an Objective-C object retains the > Objective-C object, all references from Python share a single Python > proxy object (and use Python's refcounting to decide when that proxy > object should die). That's what I figured and what I was afraid of. Would that also mean that a Leopard-only approach of using an NSHashTable with NSPointerFunctionsZeroingWeakMemory would also fail, because the Python proxy to the object in the hash table would maintain a strong reference? As for my particular use-case, I can achieve good-enough behaviour by letting windowWillClose: trigger the unregistering (deregistration?) of all the controller's listeners, but it's not ideal. Thanks! James -- It's dead, Jim. |
|
From: Ronald O. <ron...@ma...> - 2008-02-26 15:59:01
|
On 26 Feb, 2008, at 0:26, James R Eagan wrote: > I have a class that implements an observer pattern in python. > Observables maintain weakrefs to listeners that have been registered > with them such that, when a listener goes out of scope, the > observable doesn't keep it alive. Of course, this mechanism fails > as soon as a listener inherits from an ObjC class because weakref > doesn't support ObjC classes. > > At this point, my workaround is to store a strong reference if the > listener can't be weakref'd. I'm not happy about this solution > because it now creates different behaviors depending on whether the > object can be weakref'd. If it can, then the listener is > automatically unregistered from the observable when its lifespan is > up. If it can't, however, then the object must be manually > unregistered before deletion will ever occur. > > This is where the problem arises in PyObjC. Is there any mechanism > through which I can approximate a weak reference to an ObjC object > in Python? Not that I know of. PyObjC explicitly disables weakref support for Objective-C classes because it is AFAIK impossible to get the semantics right. This is due to (lack of) interaction between the Python and Objective-C memory managers, which makes it impossible to keep the weakref valid until the last strong reference to an object goes away, even when that last reference is in Objective-C. There's currently some talk on python-dev about making 'weakref.ref' a generic function (like "len()"), which would allow us to implement a custom weakref type for Objective-C objects. I haven't put much thought into that yet, Cocoa might not have enough hooks to be able to implement such a weakref type. > > > I tried doing some magic by checking the retainCount() of my > objects, but that seems to always be the same, no matter how many > Python objects hold a ref to the ObjC instance. That's right, the Python proxy to an Objective-C object retains the Objective-C object, all references from Python share a single Python proxy object (and use Python's refcounting to decide when that proxy object should die). Ronald |
|
From: James R E. <ea...@ba...> - 2008-02-25 23:27:03
|
I have a class that implements an observer pattern in python. Observables maintain weakrefs to listeners that have been registered with them such that, when a listener goes out of scope, the observable doesn't keep it alive. Of course, this mechanism fails as soon as a listener inherits from an ObjC class because weakref doesn't support ObjC classes. At this point, my workaround is to store a strong reference if the listener can't be weakref'd. I'm not happy about this solution because it now creates different behaviors depending on whether the object can be weakref'd. If it can, then the listener is automatically unregistered from the observable when its lifespan is up. If it can't, however, then the object must be manually unregistered before deletion will ever occur. This is where the problem arises in PyObjC. Is there any mechanism through which I can approximate a weak reference to an ObjC object in Python? I tried doing some magic by checking the retainCount() of my objects, but that seems to always be the same, no matter how many Python objects hold a ref to the ObjC instance. Thanks in advance! James PS: I'd love to be able to use an NSHashTable with NSHashTableZeroingWeakMemory, but I need to maintain 10.4 support on this project. :-( -- Beauty is in the eye of the beer holder... |
|
From: John H. <joh...@gm...> - 2008-02-21 22:09:54
|
On Feb 21, 2008, at 2:41 PM, Ronald Oussoren wrote:
>
> On 21 Feb, 2008, at 18:57, John Harrison wrote:
>
>> I can't get a signature. Attempting to do so I get:
>> AttributeError: 'function' object has no attribute 'signature'
>>
>>
>> calling dir(rawIRData_) gives:
>> ['__call__', '__class__', '__delattr__', '__dict__', '__doc__',
>> '__get__', '__getattribute__', '__hash__', '__init__',
>> '__module__', '__name__', '__new__', '__reduce__',
>> '__reduce_ex__', '__repr__', '__setattr__', '__str__',
>> 'func_closure', 'func_code', 'func_defaults', 'func_dict',
>> 'func_doc', 'func_globals', 'func_name']
>>
>> What connects the objc.informal_protocol definition with the class
>> wii_remote_delegate? I can't see anything that seems to use the
>> same name for the thing in two places. Is that where the problem is?
>
> Is the delegate a subclass of NSObject (either directly or
> indirectly)?
>
> Ronald
Here's the start of the code for the delegate:
class wii_remote_delegate(NSObject):
def irPointMovedX_Y_(self, px, py):
pass
#This works
def rawIRDataHackX1_Y1_S1_X2_Y2_S2_X3_Y3_S3_X4_Y4_S4_(self,
*posargs, **kwdargs):
ircontrol.set_points(posargs[0],posargs[1],posargs[3],posargs
[4])
#This does not work
def rawIRData_(self, irData):
print 'rawIRData: %s' % (irData,)
>
>>
>>
>> thanks,
>> John
>>
>> On Feb 21, 2008, at 3:20 AM, Ronald Oussoren wrote:
>>
>>>
>>> On 20 Feb, 2008, at 1:02, John Harrison wrote:
>>>
>>>> I've been following the discussions concerning the wiimote wrapper
>>>> with interest as I have this insane dream of integrating head
>>>> tracking into my laser/pySight controlled video game in order to
>>>> make
>>>> it even sillier than it currently is. Alas, I have encountered
>>>> problems along the way.
>>>>
>>>> Working with some people that I've found on this list and the
>>>> darwiinremote project I've got something that works somewhat for
>>>> button presses and the irPointMovedX_Y_ method. My problem is
>>>> that I
>>>> want to capture the raw IR data, and this portion of the code
>>>> seem to
>>>> not work.
>>>>
>>>> Here is the relevant information from the most recent
>>>> WiiRemote.h file:
>>>>
>>>>
>>>> typedef struct {
>>>> int x, y, s;
>>>> } IRData;
>>>>
>>>> @interface NSObject (WiiRemoteDelegate)
>>>> - (void) rawIRData: (IRData[4]) irData;
>>>>
>>>>
>>>>
>>>>
>>>> in python I have the following:
>>>>
>>>> WiiRemoteDelegate = objc.informal_protocol(
>>>> "WiiRemoteDelegate",
>>>> [
>>>> objc.selector(None,
>>>> selector="irPointMovedX:Y:",
>>>> signature="v@:ff", isRequired=False),
>>>> objc.selector(None,
>>>> selector="rawIRData:",
>>>> signature="v@:[4{IRData=iii}]", isRequired=False)
>>>> ...
>>>>
>>>> def rawIRData_(self, *posargs, **kwdargs):
>>>> #def rawIRData_(self, irData):
>>>> #print 'rawIRData: %s' % (irData,)
>>>> for x in posargs:
>>>> print '%x' % (x)
>>>>
>>>>
>>>> No matter what I do I get the same data in my delegate,
>>>> formatted as
>>>> hex here:
>>>> 1322f2c
>>>> 13
>>>> bfffe350
>>>> 1313b20
>>>> 1313b00
>>>> bfffe3a0
>>>> 0
>>>> 154c396
>>>> 94aa0ca4
>>>> 142b9c8
>>>> 1322ed0
>>>> 13
>>>>
>>>> This looks to me like I'm not getting the ints that I would expect
>>>> but that I'm getting references to the IRData struct or something.
>>>
>>> That's odd, it looks like the informal protocol isn't actually
>>> used. What's the value of rawIRData_.signature? This should be v@:
>>> [4{IRData=iii}]. Please use the commented-out version of the
>>> method prototype for this, not the one with '*posargs'.
>>>
>>> BTW. I've downloaded the WiiRemote framework a while back and my
>>> parsing script cannot deal with some features in the header files
>>> (I haven't even tried fixing that yet). Furthermore, you won't be
>>> able to use the Mii structure from python because that contains
>>> bitfields and those aren't supported yet.
>>>
>>> Ronald
>>>>
>>>>
>>>> Is there something wrong with selector and/or signature? Do I need
>>>> to add method encodings to the signature? What would a properly
>>>> encoded signature look like? If these are pointers is there a
>>>> way to
>>>> dereference them in python?
>>>>
>>>> I've been banging my head against this for more time than I'd
>>>> like to
>>>> admit and keep getting either bus errors or junk data.
>>>>
>>>> Thanks!
>>>> John
>>>>
>>>> -------------------------------------------------------------------
>>>> ------
>>>> This SF.net email is sponsored by: Microsoft
>>>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>>>> _______________________________________________
>>>> Pyobjc-dev mailing list
>>>> Pyo...@li...
>>>> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev
>>>
>>
>
|
|
From: Ronald O. <ron...@ma...> - 2008-02-21 21:42:10
|
On 21 Feb, 2008, at 18:57, John Harrison wrote:
> I can't get a signature. Attempting to do so I get:
> AttributeError: 'function' object has no attribute 'signature'
>
>
> calling dir(rawIRData_) gives:
> ['__call__', '__class__', '__delattr__', '__dict__', '__doc__',
> '__get__', '__getattribute__', '__hash__', '__init__', '__module__',
> '__name__', '__new__', '__reduce__', '__reduce_ex__', '__repr__',
> '__setattr__', '__str__', 'func_closure', 'func_code',
> 'func_defaults', 'func_dict', 'func_doc', 'func_globals', 'func_name']
>
> What connects the objc.informal_protocol definition with the class
> wii_remote_delegate? I can't see anything that seems to use the
> same name for the thing in two places. Is that where the problem is?
Is the delegate a subclass of NSObject (either directly or indirectly)?
Ronald
>
>
> thanks,
> John
>
> On Feb 21, 2008, at 3:20 AM, Ronald Oussoren wrote:
>
>>
>> On 20 Feb, 2008, at 1:02, John Harrison wrote:
>>
>>> I've been following the discussions concerning the wiimote wrapper
>>> with interest as I have this insane dream of integrating head
>>> tracking into my laser/pySight controlled video game in order to
>>> make
>>> it even sillier than it currently is. Alas, I have encountered
>>> problems along the way.
>>>
>>> Working with some people that I've found on this list and the
>>> darwiinremote project I've got something that works somewhat for
>>> button presses and the irPointMovedX_Y_ method. My problem is
>>> that I
>>> want to capture the raw IR data, and this portion of the code seem
>>> to
>>> not work.
>>>
>>> Here is the relevant information from the most recent WiiRemote.h
>>> file:
>>>
>>>
>>> typedef struct {
>>> int x, y, s;
>>> } IRData;
>>>
>>> @interface NSObject (WiiRemoteDelegate)
>>> - (void) rawIRData: (IRData[4]) irData;
>>>
>>>
>>>
>>>
>>> in python I have the following:
>>>
>>> WiiRemoteDelegate = objc.informal_protocol(
>>> "WiiRemoteDelegate",
>>> [
>>> objc.selector(None,
>>> selector="irPointMovedX:Y:",
>>> signature="v@:ff", isRequired=False),
>>> objc.selector(None,
>>> selector="rawIRData:",
>>> signature="v@:[4{IRData=iii}]", isRequired=False)
>>> ...
>>>
>>> def rawIRData_(self, *posargs, **kwdargs):
>>> #def rawIRData_(self, irData):
>>> #print 'rawIRData: %s' % (irData,)
>>> for x in posargs:
>>> print '%x' % (x)
>>>
>>>
>>> No matter what I do I get the same data in my delegate, formatted as
>>> hex here:
>>> 1322f2c
>>> 13
>>> bfffe350
>>> 1313b20
>>> 1313b00
>>> bfffe3a0
>>> 0
>>> 154c396
>>> 94aa0ca4
>>> 142b9c8
>>> 1322ed0
>>> 13
>>>
>>> This looks to me like I'm not getting the ints that I would expect
>>> but that I'm getting references to the IRData struct or something.
>>
>> That's odd, it looks like the informal protocol isn't actually
>> used. What's the value of rawIRData_.signature? This should be v@:
>> [4{IRData=iii}]. Please use the commented-out version of the method
>> prototype for this, not the one with '*posargs'.
>>
>> BTW. I've downloaded the WiiRemote framework a while back and my
>> parsing script cannot deal with some features in the header files
>> (I haven't even tried fixing that yet). Furthermore, you won't be
>> able to use the Mii structure from python because that contains
>> bitfields and those aren't supported yet.
>>
>> Ronald
>>>
>>>
>>> Is there something wrong with selector and/or signature? Do I need
>>> to add method encodings to the signature? What would a properly
>>> encoded signature look like? If these are pointers is there a way
>>> to
>>> dereference them in python?
>>>
>>> I've been banging my head against this for more time than I'd like
>>> to
>>> admit and keep getting either bus errors or junk data.
>>>
>>> Thanks!
>>> John
>>>
>>> -------------------------------------------------------------------------
>>> This SF.net email is sponsored by: Microsoft
>>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>>> _______________________________________________
>>> Pyobjc-dev mailing list
>>> Pyo...@li...
>>> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev
>>
>
|
|
From: James R E. <ea...@cc...> - 2008-02-21 19:34:05
|
On Feb 21, 2008, at 04:40 , Ronald Oussoren wrote: > The DeprecationWarning is bogus here. What this is trying to > accomplish is warn about mismatches between the Python signature and > Objective-C signature of a method, but this is giving false > positives on some occassions. In your case you get the warning > because the decorated function has a variable number of arguments. Okay, that makes me feel a lot better. :-) Is there a way I can suppress the DeprecationWarning? It's not the end of the world if I can't, but I'd rather not dump those to the console when my app runs. The closest I've found is to use Michele Simionato's decorator module[1], which ensures that the wrapper generated by the decorator actually matches the wrapped function's signature (à la inspect.getargspec). I don't like this approach because it uses eval to generate the wrapper. I also haven't tested it to see if it successfully convinces PyObjC, but I assume it would. [1]: http://www.phyast.pitt.edu/~micheles/python/documentation.html Cheers! James -- "I'm using LaTeX math mode. How much more sexy can I be?" -- Je77 |
|
From: John H. <joh...@gm...> - 2008-02-21 17:58:00
|
I can't get a signature. Attempting to do so I get:
AttributeError: 'function' object has no attribute 'signature'
calling dir(rawIRData_) gives:
['__call__', '__class__', '__delattr__', '__dict__', '__doc__',
'__get__', '__getattribute__', '__hash__', '__init__', '__module__',
'__name__', '__new__', '__reduce__', '__reduce_ex__', '__repr__',
'__setattr__', '__str__', 'func_closure', 'func_code',
'func_defaults', 'func_dict', 'func_doc', 'func_globals', 'func_name']
What connects the objc.informal_protocol definition with the class
wii_remote_delegate? I can't see anything that seems to use the same
name for the thing in two places. Is that where the problem is?
thanks,
John
On Feb 21, 2008, at 3:20 AM, Ronald Oussoren wrote:
>
> On 20 Feb, 2008, at 1:02, John Harrison wrote:
>
>> I've been following the discussions concerning the wiimote wrapper
>> with interest as I have this insane dream of integrating head
>> tracking into my laser/pySight controlled video game in order to make
>> it even sillier than it currently is. Alas, I have encountered
>> problems along the way.
>>
>> Working with some people that I've found on this list and the
>> darwiinremote project I've got something that works somewhat for
>> button presses and the irPointMovedX_Y_ method. My problem is that I
>> want to capture the raw IR data, and this portion of the code seem to
>> not work.
>>
>> Here is the relevant information from the most recent WiiRemote.h
>> file:
>>
>>
>> typedef struct {
>> int x, y, s;
>> } IRData;
>>
>> @interface NSObject (WiiRemoteDelegate)
>> - (void) rawIRData: (IRData[4]) irData;
>>
>>
>>
>>
>> in python I have the following:
>>
>> WiiRemoteDelegate = objc.informal_protocol(
>> "WiiRemoteDelegate",
>> [
>> objc.selector(None,
>> selector="irPointMovedX:Y:",
>> signature="v@:ff", isRequired=False),
>> objc.selector(None,
>> selector="rawIRData:",
>> signature="v@:[4{IRData=iii}]", isRequired=False)
>> ...
>>
>> def rawIRData_(self, *posargs, **kwdargs):
>> #def rawIRData_(self, irData):
>> #print 'rawIRData: %s' % (irData,)
>> for x in posargs:
>> print '%x' % (x)
>>
>>
>> No matter what I do I get the same data in my delegate, formatted as
>> hex here:
>> 1322f2c
>> 13
>> bfffe350
>> 1313b20
>> 1313b00
>> bfffe3a0
>> 0
>> 154c396
>> 94aa0ca4
>> 142b9c8
>> 1322ed0
>> 13
>>
>> This looks to me like I'm not getting the ints that I would expect
>> but that I'm getting references to the IRData struct or something.
>
> That's odd, it looks like the informal protocol isn't actually
> used. What's the value of rawIRData_.signature? This should be v@:[4
> {IRData=iii}]. Please use the commented-out version of the method
> prototype for this, not the one with '*posargs'.
>
> BTW. I've downloaded the WiiRemote framework a while back and my
> parsing script cannot deal with some features in the header files
> (I haven't even tried fixing that yet). Furthermore, you won't be
> able to use the Mii structure from python because that contains
> bitfields and those aren't supported yet.
>
> Ronald
>>
>>
>> Is there something wrong with selector and/or signature? Do I need
>> to add method encodings to the signature? What would a properly
>> encoded signature look like? If these are pointers is there a way to
>> dereference them in python?
>>
>> I've been banging my head against this for more time than I'd like to
>> admit and keep getting either bus errors or junk data.
>>
>> Thanks!
>> John
>>
>> ---------------------------------------------------------------------
>> ----
>> This SF.net email is sponsored by: Microsoft
>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>> _______________________________________________
>> Pyobjc-dev mailing list
>> Pyo...@li...
>> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev
>
|
|
From: Ronald O. <ron...@ma...> - 2008-02-21 10:20:53
|
On 20 Feb, 2008, at 1:02, John Harrison wrote:
> I've been following the discussions concerning the wiimote wrapper
> with interest as I have this insane dream of integrating head
> tracking into my laser/pySight controlled video game in order to make
> it even sillier than it currently is. Alas, I have encountered
> problems along the way.
>
> Working with some people that I've found on this list and the
> darwiinremote project I've got something that works somewhat for
> button presses and the irPointMovedX_Y_ method. My problem is that I
> want to capture the raw IR data, and this portion of the code seem to
> not work.
>
> Here is the relevant information from the most recent WiiRemote.h
> file:
>
>
> typedef struct {
> int x, y, s;
> } IRData;
>
> @interface NSObject (WiiRemoteDelegate)
> - (void) rawIRData: (IRData[4]) irData;
>
>
>
>
> in python I have the following:
>
> WiiRemoteDelegate = objc.informal_protocol(
> "WiiRemoteDelegate",
> [
> objc.selector(None,
> selector="irPointMovedX:Y:",
> signature="v@:ff", isRequired=False),
> objc.selector(None,
> selector="rawIRData:",
> signature="v@:[4{IRData=iii}]", isRequired=False)
> ...
>
> def rawIRData_(self, *posargs, **kwdargs):
> #def rawIRData_(self, irData):
> #print 'rawIRData: %s' % (irData,)
> for x in posargs:
> print '%x' % (x)
>
>
> No matter what I do I get the same data in my delegate, formatted as
> hex here:
> 1322f2c
> 13
> bfffe350
> 1313b20
> 1313b00
> bfffe3a0
> 0
> 154c396
> 94aa0ca4
> 142b9c8
> 1322ed0
> 13
>
> This looks to me like I'm not getting the ints that I would expect
> but that I'm getting references to the IRData struct or something.
That's odd, it looks like the informal protocol isn't actually used.
What's the value of rawIRData_.signature? This should be v@:
[4{IRData=iii}]. Please use the commented-out version of the method
prototype for this, not the one with '*posargs'.
BTW. I've downloaded the WiiRemote framework a while back and my
parsing script cannot deal with some features in the header files (I
haven't even tried fixing that yet). Furthermore, you won't be able to
use the Mii structure from python because that contains bitfields and
those aren't supported yet.
Ronald
>
>
> Is there something wrong with selector and/or signature? Do I need
> to add method encodings to the signature? What would a properly
> encoded signature look like? If these are pointers is there a way to
> dereference them in python?
>
> I've been banging my head against this for more time than I'd like to
> admit and keep getting either bus errors or junk data.
>
> Thanks!
> John
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Pyobjc-dev mailing list
> Pyo...@li...
> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev
|
|
From: Ronald O. <ron...@ma...> - 2008-02-21 09:40:48
|
On 20 Feb, 2008, at 7:00, James R Eagan wrote:
> I've been using the following decorator in PyObjC 1.4 without
> problems, but now PyObjC 2.0 gives me a nice DeprecationWarning. Am
> I doing something naughty and/or dangerous? If so, is there a safer
> way to accomplish the same thing in PyObjC2?
The DeprecationWarning is bogus here. What this is trying to
accomplish is warn about mismatches between the Python signature and
Objective-C signature of a method, but this is giving false positives
on some occassions. In your case you get the warning because the
decorated function has a variable number of arguments.
I guess it is time to start working on a set of unittests for this
feature to find all types of false positives.
Ronald
>
>
> First, the decorator:
>
> def trap_exceptions(func):
> ''' Trap exceptions and prevent them from being passed along to
> the ObjC runtime. '''
> def trapper(self, *args, **kwargs):
> try:
> return func(self, *args, **kwargs)
> except:
> sys.stderr.write('Exception in %s: ' % (func.__name__))
> traceback.print_exception(*sys.exc_info())
> return trapper
>
> Typical usage is on an Objective-C entrypoint. e.g.:
>
> @trap_exceptions
> def performDragOperation_(self, sender):
> if self.delegate is not None \
> and
> self.delegate.respondsToSelector_('performDragOperation:'):
> return self.delegate.performDragOperation_(sender)
> return False
>
> This worked fine pre-Leopard. When an exception was thrown
> somewhere in (e.g.) performDragOperation_, I'd get a stack trace on
> the console and everything would carry along as if nothing
> happened. In PyObjC2, the decorator appears to behave as expected,
> but I also get this warning for every @trap_exceptions'ed method (at
> NIB load time):
>
> /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/
> python/PyObjC/PyObjCTools/NibClassBuilder.py:219:
> DeprecationWarning: Not all Objective-C arguments are present in the
> Python argument-list of <unbound selector
> observeValueForKeyPath:ofObject:change:context: of CBIconView at
> 0x4f1fef0>
> return metaClass(name, bases, methods)
>
> Thanks!
> James
>
> PS: Thanks for all the work you've done on PyObjC 2.0. There are
> lots of wonderful improvements here! I'm very much looking forward
> to the Tiger backport. :-)
>
> --
> Doctors are sadists who like to play God and watch lesser people
> scream
> -- Bren MacGuff in "Juno"
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/_______________________________________________
> Pyobjc-dev mailing list
> Pyo...@li...
> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev
|
|
From: John H. <joh...@gm...> - 2008-02-20 06:33:18
|
For those that are interested in getting the data from rawIRData in
the wiimote framework, I've developed a hack that works, but is
ugly. I've rolled my own framework by added a method to the delegate
in WiiRemote.h:
- (void) rawIRDataHackX1:(int) x1 Y1:(int) y1 S1:(int)s1 X2:(int) x2
Y2:(int) y2 S2:(int)s2 X3:(int) x3 Y3:(int) y3 S3:(int)s3 X4:(int) x4
Y4:(int) y4 S4:(int)s4;
I also added this to the end of the handleIRData method in WiiRemote.m:
if ([_delegate respondsToSelector:@selector
(rawIRDataHackX1:Y1:S1:X2:Y2:S2:X3:Y3:S3:X4:Y4:S4:)])
[_delegate rawIRDataHackX1:irData[0].x Y1:irData[0].y S1:irData
[0].s X2:irData[1].x Y2:irData[1].y S2:irData[1].s X3:irData[2].x
Y3:irData[2].y S3:irData[2].s X4:irData[3].x Y4:irData[3].y S4:irData
[3].s];
and then in my python code:
WiiRemoteDelegate = objc.informal_protocol(
"WiiRemoteDelegate",
[
objc.selector(None,
selector="irPointMovedX:Y:",
signature="v@:ff", isRequired=False),
objc.selector(None,
selector="rawIRData:",
signature="v@:[4{?=iii}]", isRequired=False),
objc.selector(None,
selector="rawIRDataHackX1:Y1:S1:X2:Y2:S2:X3:Y3:S3:X4:Y4:S4:",
signature="v@:iiiiiiiiiiii", isRequired=False),
and
def rawIRDataHackX1_Y1_S1_X2_Y2_S2_X3_Y3_S3_X4_Y4_S4_(self,
*posargs, **kwdargs):
for x in posargs:
print '%8x' % (x)
This works and I get data for the IR points. If anyone can tell me
how to properly wrap the normal rawIRData method I'd appreciate it,
but at least I can continue development with this solution.
|