pyobjc-dev Mailing List for PyObjC (Page 66)
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: Ronald O. <ron...@ma...> - 2008-02-10 17:10:43
|
On 8 Feb, 2008, at 20:06, Arnar Birgisson wrote: > Hello there, > > Forgive me if I'm in the wrong place asking this. > > I have an OS-X Framework (with source code) and I need to use the > functionality of it from Python. The framework in question is > WiiRemote.framework that provides events from a Wii remote through > delegates (unfortunately I'm not familiar with Objective-C). > > After digging around for a while, I'm having trouble finding answers > to the following: > > What are my options here? You're on the right list of this, PyObjC is specificly designed for this task. > > Is it possible to use the compiled framework directly with ctypes? Possibly, but using PyObjC would be better. > > Can I use it from a custom extension module (written in C)? > Can I write a Python extension module in Objective-C? Yes to both, but that's not really necessary. Both PyObjC 1.x and PyObjC 2.x (shipping with Leopard) have tools to automaticly create a python wrapper from header files. Those are a bit tuned to the way Apple writes headers, but with some luck work with the WiiRemote headers as well. Ronald > > > thanks, > Arnar > > ------------------------------------------------------------------------- > 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 S. <joh...@gm...> - 2008-02-10 05:34:56
|
in WiiRemoteDiscovery.h;
@interface NSObject( WiiRemoteDiscoveryDelegate )
- (void) WiiRemoteDiscovered:(WiiRemote*)wiimote;
- (void) WiiRemoteDiscoveryError:(int)code;
@end;
in python:
WiiRemoteDiscoveryDelegate = objc.informal_protocol(
"WiiRemoteDiscoveryDelegate",
[
# (void) WiiRemoteDiscovered:(WiiRemote*)wiimote;
objc.selector(
None,
selector='WiiRemoteDiscovered:',
signature='v@:@',
isRequired=0,
),
# (void) WiiRemoteDiscoveryError:(int)code;
objc.selector(
None,
selector='WiiRemoteDiscoveryError:',
signature='v@:i',
isRequired=0,
),
]
)
class wii_remote_discovery_delegate(NSObject):
def WiiRemoteDiscovered_(self, wiiRemote):
self.wiiRemote=wiiRemote
print "discovered"
def WiiRemoteDiscoveryError_(self, returnCode):
print "not discovered"
wd = WiiRemoteDiscovery.new()
x=wii_remote_discovery_delegate.new()
wd.setDelegate_(x)
wd.start()
result:
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
from wii import *
File "/Users/jstoner/Documents/projects/boogiepants/wii.py", line 47, in
<module>
class wii_remote_discovery_delegate(NSObject):
error: wii_remote_discovery_delegate is overriding existing Objective-C
class
so I corrected my stupid case error, and now I'm getting this... Any ideas?
--
blog:
http://www.generosity.org/stoner/
'In knowledge is power, in wisdom, humility.'
|
|
From: Koen B. <ko...@ma...> - 2008-02-09 22:45:36
|
Hey Ronald, I am playing around with this and it seems to work. But how can I make all my NSObjects to add this method? I tried importing this in AppName.py but the methods do not get added to underlying modules. Do I need to import this wherever I use it after importing any other classes based on NSObject? If anyone runs into the same get the script here: http://pastie.caboo.se/149814 Koen On 28 jan 2008, at 14:23, Ronald Oussoren wrote: > > On Monday, January 28, 2008, at 01:04PM, "Koen Bok" <ko...@ma... > > wrote: >> I guess I have to do it that way. Could you supply me with some >> hints/ >> directions how to start this? >> >> Thanks a lot, > > Something like this should do the trick: > > class NSObject (objc.Category(NSObject)): > def _pyobjc_performOnThread_(self, callinfo): > try: > sel, arg = callinfo > m = self.methodForSelector_(sel) > m(arg) > except: import traceback > traceback.print_exc() > _pyobjc_performOnThread = _objc.selector(_pyobjc_performOnThread, > sel="_pyobjc_performOnThread:") > > def pyobjc_performSelector_onThread_withObject_waitUntilDone_( > self, aSelector, thread, arg, wait): > """ > A version of > performSelector:onThread:withObject:waitUntilDone: that > will log exceptions in the called method (instead of aborting > the > NSRunLoop on the other thread). > """ > self.performSelector_onThread_withObject_waitUntilDone_( > 'pyobjc_performOnThread:', thread, (aSelector, arg), > wait) > > > This is completely untested, but should do the trick, you can then > use pyobjc_performSelector_onThread_withObject_waitUntilDone_ > instead of the version without pyobjc_ prefix. > > This would be a good addition for PyObjC 2.1 (at least when the > other variants of performSelector are added as well). > > Ronald >> >> Koen >> >> >> On 27 jan 2008, at 18:21, Ronald Oussoren wrote: >> >>> There's not much you can do about this, the cleanest way to avoid >>> stopping your application is to add you're own method for executing >>> code on the main loop and have that catch all exceptions. This can >>> easily be build on top of the NSObject version. >> >> >> ------------------------------------------------------------------------- >> 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: Arnar B. <ar...@gm...> - 2008-02-08 19:06:45
|
Hello there, Forgive me if I'm in the wrong place asking this. I have an OS-X Framework (with source code) and I need to use the functionality of it from Python. The framework in question is WiiRemote.framework that provides events from a Wii remote through delegates (unfortunately I'm not familiar with Objective-C). After digging around for a while, I'm having trouble finding answers to the following: What are my options here? Is it possible to use the compiled framework directly with ctypes? Can I use it from a custom extension module (written in C)? Can I write a Python extension module in Objective-C? thanks, Arnar |
|
From: Bruce L. <lic...@gm...> - 2008-02-08 16:31:36
|
Hello, So instead of trying to get PyObjC to install correctly on my PowerBook running Leopard, I have decided to back out to the version installed in the system. This, of course, breaks *something*, every time I run a newly compiled program (or build it in xcode) I get this error: 2/7/08 11:29:34 PM [0x0-0x51051].com.BruceLichtenstein.CloneMuts[5296] SystemError: NULL result without error in PyObject_Call I have googled this error and it seems common to many many different packages, but there doesn't appear to be a fix handy. Any ideas? Thanks, bruce |
|
From: Bruce L. <lic...@gm...> - 2008-02-08 04:39:45
|
Hello, So instead of trying to get PyObjC to install correctly on my PowerBook running Leopard, I have decided to back out to the version installed in the system. This, of course, breaks *something*, every time I run a newly compiled program (or build it in xcode) I get this error: 2/7/08 11:29:34 PM [0x0-0x51051].com.BruceLichtenstein.CloneMuts[5296] SystemError: NULL result without error in PyObject_Call I have googled this error and it seems common to many many different packages, but there doesn't appear to be a fix handy. Any ideas? Thanks, bruce |
|
From: Bruce L. <lic...@gm...> - 2008-02-08 04:36:52
|
Hello, So instead of trying to get PyObjC to install correctly on my PowerBook running Leopard, I have decided to back out to the version installed in the system. This, of course, breaks *something*, every time I run a newly compiled program (or build it in xcode) I get this error: 2/7/08 11:29:34 PM [0x0-0x51051].com.BruceLichtenstein.CloneMuts[5296] SystemError: NULL result without error in PyObject_Call I have googled this error and it seems common to many many different packages, but there doesn't appear to be a fix handy. Any ideas? Thanks, bruce |
|
From: Michael M. <mic...@gm...> - 2008-02-07 18:03:22
|
That's funny, I'm surprised I didn't see the old examples when I was looking.
Your version looks much more useful than what I put together, thanks
for sharing it!
-mike
On Feb 7, 2008 12:39 AM, Kevin A. Mitchell <ka...@ka...> wrote:
> On 2/1/08, Michael McCracken <mic...@gm...> wrote:
>
> > Hi, I got the urge to embed a python console in my app so I could poke
> > around in it while it was running.
> > I didn't find an example of doing just that when I looked, so I
> > thought I'd put one together and share it.
> >
> > I used it like this, tying it to a menu item:
> >
> > @IBAction
> > def showPyConsole_(self, sender):
> > if self.pyconsole is None:
> > locals = {'m': self}
> > welcome = "Welcome to the Console.\nThe main window
> > controller is called 'm'."
> > self.pyconsole =
> > PyConsole.PyConsole.alloc().initWithLocals_welcomeMsg_(locals,
> > welcome)
> > self.pyconsole.showWindow_(self)
> >
> > It pops up a window running a REPL that's pretty close to the python
> > interactive interpreter.
> >
> > The code and xib are here: http://michael-mccracken.net/software/PyConsole.zip
> > I've licensed it as BSD.
> >
> > I'd be curious to hear if anyone else finds it useful.
> > (Patches, suggestions, etc are nice too.)
> >
> > Cheers,
> > -mike
> >
> > --
> > Michael McCracken
> > misc: http://michael-mccracken.net/wp/
> >
>
> For the past few weeks I've been tinkering with the
> EmbeddedInterpreter example that comes with the PyObjC 1.4 sources,
> with pretty much the same idea of using it in a program under
> development. I've only just now gotten it packed up for public use.
>
> One trap to fall into is doing something in the embedded interpreter
> that hangs it up. The only choice then is to force quit the app.
>
> I wrote some code that uses Quartz Event Services to trap Control-C
> and cause it to interrupt the Python interpreter. There are some hooks
> to turn it on and off so that it only interrupts interactive commands,
> and not the entire program. Feel free to pick it up and use it; I put
> it under the MIT license.
>
> I've been playing with some debugging tools, including an idea for
> swizzling existing Objective-C calls and wrapping them with tracing
> code. That hasn't really worked out yet, but I'll put something in my
> blog if I get something cool put together.
>
> Blog entry:
> http://www.kamit.com/blog-entry/2008/02/07/quartz-event-services-interrupting-embedded-python
>
> Code (MIT license):
> http://www.kamit.com/hg/InterpreterKeyController
>
> --
> Kevin A. Mitchell
> http://www.kamit.com/
>
> -------------------------------------------------------------------------
> 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
>
--
Michael McCracken
UCSD CSE PhD Candidate
research: http://www.cse.ucsd.edu/~mmccrack/
misc: http://michael-mccracken.net/wp/
|
|
From: Kevin A. M. <ka...@ka...> - 2008-02-07 08:47:18
|
On 2/1/08, Michael McCracken <mic...@gm...> wrote:
> Hi, I got the urge to embed a python console in my app so I could poke
> around in it while it was running.
> I didn't find an example of doing just that when I looked, so I
> thought I'd put one together and share it.
>
> I used it like this, tying it to a menu item:
>
> @IBAction
> def showPyConsole_(self, sender):
> if self.pyconsole is None:
> locals = {'m': self}
> welcome = "Welcome to the Console.\nThe main window
> controller is called 'm'."
> self.pyconsole =
> PyConsole.PyConsole.alloc().initWithLocals_welcomeMsg_(locals,
> welcome)
> self.pyconsole.showWindow_(self)
>
> It pops up a window running a REPL that's pretty close to the python
> interactive interpreter.
>
> The code and xib are here: http://michael-mccracken.net/software/PyConsole.zip
> I've licensed it as BSD.
>
> I'd be curious to hear if anyone else finds it useful.
> (Patches, suggestions, etc are nice too.)
>
> Cheers,
> -mike
>
> --
> Michael McCracken
> misc: http://michael-mccracken.net/wp/
>
For the past few weeks I've been tinkering with the
EmbeddedInterpreter example that comes with the PyObjC 1.4 sources,
with pretty much the same idea of using it in a program under
development. I've only just now gotten it packed up for public use.
One trap to fall into is doing something in the embedded interpreter
that hangs it up. The only choice then is to force quit the app.
I wrote some code that uses Quartz Event Services to trap Control-C
and cause it to interrupt the Python interpreter. There are some hooks
to turn it on and off so that it only interrupts interactive commands,
and not the entire program. Feel free to pick it up and use it; I put
it under the MIT license.
I've been playing with some debugging tools, including an idea for
swizzling existing Objective-C calls and wrapping them with tracing
code. That hasn't really worked out yet, but I'll put something in my
blog if I get something cool put together.
Blog entry:
http://www.kamit.com/blog-entry/2008/02/07/quartz-event-services-interrupting-embedded-python
Code (MIT license):
http://www.kamit.com/hg/InterpreterKeyController
--
Kevin A. Mitchell
http://www.kamit.com/
|
|
From: Michael M. <mic...@gm...> - 2008-02-06 18:04:53
|
I'm not sure if this qualifies as best practices, but I've been happy using the PDB command line interface from within XCode. I do use XCode, mainly to keep things separate from real work. What I do most often is just add pdb.set_trace() where I want a breakpoint, and re-run. When it hits the breakpoint, I get PDB in the XCode "Debugger console" window, and that's fine. Like Ronald, I also use print statements often, and I've also had some luck chasing bugs with my embedded console that I wrote to the list about earlier. Sometimes it's nicer to just poke around in a console that isn't the debugger. Note that PDB doesn't currently work from inside that console. Cheers, -mike On Feb 6, 2008 8:54 AM, Noah Gift <noa...@gm...> wrote: > >> sure I can figure out how to add the scripting to XCode as a shell > >> script at some point. > > > > I don't use Xcode for Python development at all, Xcode is a nice IDE > > for Objective-C but offers limited support for Python. When I need > > to debug python code I tend to use print statements. That said, you > > should be able to use your favorite Python debuggers with PyObjC > > just like you can use them to debug wxPython programs. > > I would like to point out that IPython is also a very good > alternative. The readline stuff has been fixed, so it is quite nice > to get tabbed completion of these huge method names. > > > > > >> > >> > >> I might try Eclipse are well, but I have become used to Komodo > >> after a year or so of using it and so reluctant to tackle the > >> Eclipse learning curve unless it offers more than Komodo. Komodo > >> works great for wxPython debugging and I may just use wxPython > >> instead of PyObjC for UI components. I am concerned that PyObjC is > >> second-class on OS X just like the Java-Cocoa bridge was--and we > >> all know how that turned out in the end. Anyone know of any > >> commitments to do so, or is PyObjC reached its zenith given Apple > >> is dropping other non-Cocoa things such as public Carbon-64 to > >> focus on Cocoa? > > > > There are two major differences between PyObjC and the Java-Cocoa > > bridge: > > > > 1) PyObjC is a straight 1-1 bridge which seriously reduces the > > amount of work needed to add support for new APIs to PyObjC. The > > Java-Cocoa bridge tried to map the ObjC API's to something closer to > > Java's conventions and that required a lot of manual labor. That's > > one reason I've been negative about adding something simular to > > PyObjC in the past. > > > > 2) PyObjC is developed outside of Apple, Java-Cocoa was a pure Apple > > project. This has advantages and disadvantages of course, there is > > no risk that PyObjC will completely disappear but on the other hand > > the development team is rather tiny (basicly just me). > > > > It would definitely be nice to be able to use the Xcode tools like > > the debugger and profiler GUI's on Python scripts and I have filed > > feature requests that asked for this. If more people do this we > > might even get somewhere. > > > > It would be great if Apple hired Ronald and made him charge of a team > of thousands :) > > > > ------------------------------------------------------------------------- > 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 > -- Michael McCracken UCSD CSE PhD Candidate research: http://www.cse.ucsd.edu/~mmccrack/ misc: http://michael-mccracken.net/wp/ |
|
From: Noah G. <noa...@gm...> - 2008-02-06 16:55:00
|
>> sure I can figure out how to add the scripting to XCode as a shell >> script at some point. > > I don't use Xcode for Python development at all, Xcode is a nice IDE > for Objective-C but offers limited support for Python. When I need > to debug python code I tend to use print statements. That said, you > should be able to use your favorite Python debuggers with PyObjC > just like you can use them to debug wxPython programs. I would like to point out that IPython is also a very good alternative. The readline stuff has been fixed, so it is quite nice to get tabbed completion of these huge method names. > >> >> >> I might try Eclipse are well, but I have become used to Komodo >> after a year or so of using it and so reluctant to tackle the >> Eclipse learning curve unless it offers more than Komodo. Komodo >> works great for wxPython debugging and I may just use wxPython >> instead of PyObjC for UI components. I am concerned that PyObjC is >> second-class on OS X just like the Java-Cocoa bridge was--and we >> all know how that turned out in the end. Anyone know of any >> commitments to do so, or is PyObjC reached its zenith given Apple >> is dropping other non-Cocoa things such as public Carbon-64 to >> focus on Cocoa? > > There are two major differences between PyObjC and the Java-Cocoa > bridge: > > 1) PyObjC is a straight 1-1 bridge which seriously reduces the > amount of work needed to add support for new APIs to PyObjC. The > Java-Cocoa bridge tried to map the ObjC API's to something closer to > Java's conventions and that required a lot of manual labor. That's > one reason I've been negative about adding something simular to > PyObjC in the past. > > 2) PyObjC is developed outside of Apple, Java-Cocoa was a pure Apple > project. This has advantages and disadvantages of course, there is > no risk that PyObjC will completely disappear but on the other hand > the development team is rather tiny (basicly just me). > > It would definitely be nice to be able to use the Xcode tools like > the debugger and profiler GUI's on Python scripts and I have filed > feature requests that asked for this. If more people do this we > might even get somewhere. > It would be great if Apple hired Ronald and made him charge of a team of thousands :) > |
|
From: Ronald O. <ron...@ma...> - 2008-02-06 16:35:26
|
On 6 Feb, 2008, at 4:20, Daniel Lord wrote: > Well, seeing as no one answered at all (except one other soul > looking for information), I am assuming that there isn't anything > substantial. > > So for my apps, to maximize the size of my tool set, I have decided > to minimize the PyObj portions as much as possible (just the View > and small UI Controllers and Models where handy like tables, etc. ) > and implement the rest of the code in standalone straight Python > classes which I can source-level debug easily in Komodo using unit > tests. I can debug the UI in Xcode and then when I combine > everything in Xcode, I only have small bits of code that are opaque > to source-level debugging if I even need it. Now that I think about > it, that makes the most sense anyway. Assuming py2app does the right > things with XCode builds to bring in third-party modules like > appscript which I like to use a lot--I've been "chickening out" so > far and writing a setup and using py2app from the command line. > I am sure I can figure out how to add the scripting to XCode as a > shell script at some point. I don't use Xcode for Python development at all, Xcode is a nice IDE for Objective-C but offers limited support for Python. When I need to debug python code I tend to use print statements. That said, you should be able to use your favorite Python debuggers with PyObjC just like you can use them to debug wxPython programs. > > > I might try Eclipse are well, but I have become used to Komodo after > a year or so of using it and so reluctant to tackle the Eclipse > learning curve unless it offers more than Komodo. Komodo works great > for wxPython debugging and I may just use wxPython instead of PyObjC > for UI components. I am concerned that PyObjC is second-class on OS > X just like the Java-Cocoa bridge was--and we all know how that > turned out in the end. Anyone know of any commitments to do so, or > is PyObjC reached its zenith given Apple is dropping other non-Cocoa > things such as public Carbon-64 to focus on Cocoa? There are two major differences between PyObjC and the Java-Cocoa bridge: 1) PyObjC is a straight 1-1 bridge which seriously reduces the amount of work needed to add support for new APIs to PyObjC. The Java-Cocoa bridge tried to map the ObjC API's to something closer to Java's conventions and that required a lot of manual labor. That's one reason I've been negative about adding something simular to PyObjC in the past. 2) PyObjC is developed outside of Apple, Java-Cocoa was a pure Apple project. This has advantages and disadvantages of course, there is no risk that PyObjC will completely disappear but on the other hand the development team is rather tiny (basicly just me). It would definitely be nice to be able to use the Xcode tools like the debugger and profiler GUI's on Python scripts and I have filed feature requests that asked for this. If more people do this we might even get somewhere. Ronald P.S. In case you don't know: you can file bugs and feature requests at bugreport.apple.com, all you need for that is a (free) ADC account. |
|
From: Bruce L. <lic...@gm...> - 2008-02-06 15:31:14
|
Hello, This relates to my previous thread. I am not convinced that PyObjC is installing properly on my system, and while I can run programs built upon the PyObjC I have installed, they are neither portable nor are they consistently compiled. What is the best method of installing PyObjC to ensure that the required files get to their intended targets? Should it matter where the source code is placed when building? (I have found that the installation is stable but produces non-portable applications when I place the source code in the site-packages directory)... Thanks, Bruce |
|
From: Daniel L. <da...@br...> - 2008-02-06 03:20:21
|
Well, seeing as no one answered at all (except one other soul looking for information), I am assuming that there isn't anything substantial. So for my apps, to maximize the size of my tool set, I have decided to minimize the PyObj portions as much as possible (just the View and small UI Controllers and Models where handy like tables, etc. ) and implement the rest of the code in standalone straight Python classes which I can source-level debug easily in Komodo using unit tests. I can debug the UI in Xcode and then when I combine everything in Xcode, I only have small bits of code that are opaque to source-level debugging if I even need it. Now that I think about it, that makes the most sense anyway. Assuming py2app does the right things with XCode builds to bring in third-party modules like appscript which I like to use a lot--I've been "chickening out" so far and writing a setup and using py2app from the command line. I am sure I can figure out how to add the scripting to XCode as a shell script at some point. I might try Eclipse are well, but I have become used to Komodo after a year or so of using it and so reluctant to tackle the Eclipse learning curve unless it offers more than Komodo. Komodo works great for wxPython debugging and I may just use wxPython instead of PyObjC for UI components. I am concerned that PyObjC is second-class on OS X just like the Java-Cocoa bridge was--and we all know how that turned out in the end. Anyone know of any commitments to do so, or is PyObjC reached its zenith given Apple is dropping other non-Cocoa things such as public Carbon-64 to focus on Cocoa? Don't get me wrong, I appreciate Apple supporting Python so well in the first place, and they've improved integration in Xcode 3.0. I just wish they'd gone farther with it. |
|
From: Orestis M. <or...@or...> - 2008-02-03 13:05:58
|
Thanks, I've made some progress. Here is my code:
bundle =3D NSBundle.bundleWithPath_('/System/Library/Frameworks/=20
IOBluetooth.framework')
objc.loadBundleFunctions(bundle, globals(),(
('IOBluetoothNSStringToDeviceAddress', "i:@^@","blah test" ),
))
print IOBluetoothNSStringToDeviceAddress
This yields: <objc.function object at 0xdc97a0> which I suppose means =20=
that the function was loaded.
However, if I follow with:
address =3D "00-1d-28-e1-bd-90"
out =3D None
print IOBluetoothNSStringToDeviceAddress(address, out)
I get:
TypeError: Need 3 arguments, got 2
I tried changing the signature to i:@o^@ , to account for the output =20
parameter but I get a segmentation fault.
The Objective-C function signature is:
extern IOReturn IOBluetoothNSStringToDeviceAddress( NSString =20
*inNameString, BluetoothDeviceAddress *outDeviceAddress );
I've tried to divine the method signature from =
http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Artic=
les/chapter_13_section_9.html#/=20
/apple_ref/doc/uid/TP30001163-CH9-TPXREF165
but I don't think I've succeeded...
--
Orestis Markou
or...@or...
http://orestis.gr/
On 03 =CE=A6=CE=B5=CE=B2 2008, at 3:15 =CE=A0=CE=9C, Michael McCracken =
wrote:
> Hi, I just found this in an email from Bob Ippolito a while back. (at
> http://www.mail-archive.com/pyt...@py.../msg02013.html )
> Try using objc.loadBundleFunctions.
> if IOBluetoothNSStringToDeviceAddress is pretty simple, that might =20
> work.
>
> Here's the example from the email:
>
> bundle =3D NSBundle.bundleWithPath_('/System/Library/Frameworks/=20
> Carbon.framework')
> objc.loadBundleFunctions(bundle, globals(), (
> ('SetSystemUIMode', 'III', " Sets the presentation mode for
> system-provided user interface elements."),
> ))
>
>
>
> On Feb 2, 2008 3:14 PM, Orestis Markou <or...@or...> wrote:
>> Hello,
>>
>> I'm trying to use IOBluetooth and IOBluetoothUI. I've figured out
>> using the Obj-C part (using objc.loadBundle) but IOBluetooth uses =20
>> some
>> external functions, like IOBluetoothNSStringToDeviceAddress in
>> IOBluetoothUtilities. I can't find a way to use this.
>>
>> I've tried using gen_bridge_metadata but I get a compiler error.
>> Checking, I've seen that there is a IOBluetooth.bridgesupport file
>> inside the framework resources but it doesn't contain the above
>> function. After looking around, I've tried using a constant it *does*
>> contain, ie kBluetoothFeatureEncryption, but Python still can't =20
>> find it.
>>
>> I'm using:
>>
>> import objc as _objc
>>
>> _objc.loadBundle('IOBluetooth', globals(),
>> bundle_path=3Du'/System/Library/Frameworks/IOBluetooth.framework')
>>
>> in IOBluetooth.py and
>>
>> from IOBluetooth import *
>>
>> in my main class.
>>
>> The documentation on wrapping global functions/constants is =20
>> *severely*
>> lacking, so any help appreciated :)
>> --
>> Orestis Markou
>> or...@or...
>> http://orestis.gr/
>>
>>
>>
>>
>>
>> =
-------------------------------------------------------------------------
>> 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
>>
>
>
>
> --=20
> Michael McCracken
> UCSD CSE PhD Candidate
> research: http://www.cse.ucsd.edu/~mmccrack/
> misc: http://michael-mccracken.net/wp/
|
|
From: Ronald O. <ron...@ma...> - 2008-02-03 13:05:19
|
On 3 Feb, 2008, at 8:07, Bruce Lichtenstein wrote: > Ronald, > > Thanks again for the info again. > > I still cannot find a way to get my program compile on Leopard to run > on Tiger. The program either crashes or gives the same error about > being unable to find class_addIvar referenced in the _objc.so file. As > far as I know I have made no specific calls to the class_addIvar > method, unless objc.ivar() calls it. Is there a way for me to make a > program that uses objc.ivar() backwards compatible? class_addIvar shouldn't be used on Leopard, appearently the objc-core module isn't Tiger safe yet. There should be a backward compatibility layer for the objective-C 2.0 runtime API in Modules/objc/objc-runtime- compat.[hm], but for some reason that isn't used in your program. Ronald |
|
From: Bruce L. <lic...@gm...> - 2008-02-03 07:07:15
|
Ronald, Thanks again for the info again. I still cannot find a way to get my program compile on Leopard to run on Tiger. The program either crashes or gives the same error about being unable to find class_addIvar referenced in the _objc.so file. As far as I know I have made no specific calls to the class_addIvar method, unless objc.ivar() calls it. Is there a way for me to make a program that uses objc.ivar() backwards compatible? Thanks, Bruce |
|
From: John S. <joh...@gm...> - 2008-02-03 03:51:28
|
On Jan 31, 2008 3:43 AM, Ronald Oussoren <ron...@ma...> wrote:
>
> On 31 Jan, 2008, at 7:19, John Stoner wrote:
>
> in WiiRemoteDiscovery.h;
>
> @interface NSObject( WiiRemoteDiscoveryDelegate )
>
> - (void) WiiRemoteDiscovered:(WiiRemote*)wiimote;
> - (void) WiiRemoteDiscoveryError:(int)code;
>
> @end;
> in python;
>
> wd = WiiRemoteDiscovery.new()
> class wii_remote_discovery_delegate(WiiRemoteDiscoveryDelegate):
> def wiiRemoteDiscovered_(self, wiiRemote):
> self.wiiRemote=wiiRemote
> print "discovered"
> def WiiRemoteDiscoveryError_(self, returnCode):
> print "not discovered"
> x=wii_remote_discovery_delegate()
> wd.setDelegate_(x)
> wd.start()
>
> Traceback (most recent call last):
> File "/Users/jstoner/Documents/projects/boogiepants/wii.py", line 29, in
> <module>
> class wii_remote_discovery_delegate(WiiRemoteDiscoveryDelegate):
> NameError: name 'WiiRemoteDiscoveryDelegate' is not defined
> >>>
>
> Do I need to do a stub implementation of WiiRemoteDiscoveryDelegate or
> does PyObjC have a way to handle this?
>
>
> WiiRemoteDiscoveryDelegate is not a class, but a category (which is the
> ObjC way of adding new methods to an existingclass). You have to define an
> objc.informal_protocol that defines which methods are present in the
> WiiRemoteDiscoveryDelegate informal protocol (the category in the header
> file). You can then define your delegate as a subclass of NSObject, PyObjC
> will automaticly detect that you're implementing an informal protocol and
> use the right type information for your methods.
>
> This is a sample protocol definition from the Foundation wrappers in
> PyObjC 1.4:
>
> NSArchiverCallback = _objc.informal_protocol(
> "NSArchiverCallback",
> [
> # (Class)classForArchiver
> _objc.selector(
> None,
> selector='classForArchiver',
> signature='#@:',
> isRequired=0,
> ),
> # (id)replacementObjectForArchiver:(NSArchiver *)archiver
> _objc.selector(
> None,
> selector='replacementObjectForArchiver:',
> signature='@@:@',
> isRequired=0,
> ),
> ]
> )
>
>
> The hardest part is defining the 'signature' strings, Apple's ADC website
> contains an Objective-C runtime manual that explains how to construct these
> strings.
>
> Ronald
>
>
>
>
Closer and closer:
wd = WiiRemoteDiscovery.new()
WiiRemoteDiscoveryDelegate = objc.informal_protocol(
"WiiRemoteDiscoveryDelegate",
[
# (void) WiiRemoteDiscovered:(WiiRemote*)wiimote;
objc.selector(
None,
selector='WiiRemoteDiscovered:',
signature='v@:@',
isRequired=0,
),
# (void) WiiRemoteDiscoveryError:(int)code;
objc.selector(
None,
selector='WiiRemoteDiscoveryError:',
signature='v@:i',
isRequired=0,
),
]
)
class wii_remote_discovery_delegate(NSObject):
def wiiRemoteDiscovered_(self, wiiRemote):
self.wiiRemote=wiiRemote
print "discovered"
def WiiRemoteDiscoveryError_(self, returnCode):
print "not discovered"
x=wii_remote_discovery_delegate.new()
wd.setDelegate_(x)
wd.start()
It still fails, but silently this time. Is it the 'self' reference?
I tried to find that doc you mentioned... I think it has been relocated if
not deleted. There are a few pages that I found that refer to it, but have
links to the wrong page.
--
blog:
http://www.generosity.org/stoner/
'In knowledge is power, in wisdom, humility.'
|
|
From: Michael M. <mic...@gm...> - 2008-02-03 01:17:40
|
Hi, I just found this in an email from Bob Ippolito a while back. (at http://www.mail-archive.com/pyt...@py.../msg02013.html ) Try using objc.loadBundleFunctions. if IOBluetoothNSStringToDeviceAddress is pretty simple, that might work. Here's the example from the email: bundle = NSBundle.bundleWithPath_('/System/Library/Frameworks/Carbon.framework') objc.loadBundleFunctions(bundle, globals(), ( ('SetSystemUIMode', 'III', " Sets the presentation mode for system-provided user interface elements."), )) On Feb 2, 2008 3:14 PM, Orestis Markou <or...@or...> wrote: > Hello, > > I'm trying to use IOBluetooth and IOBluetoothUI. I've figured out > using the Obj-C part (using objc.loadBundle) but IOBluetooth uses some > external functions, like IOBluetoothNSStringToDeviceAddress in > IOBluetoothUtilities. I can't find a way to use this. > > I've tried using gen_bridge_metadata but I get a compiler error. > Checking, I've seen that there is a IOBluetooth.bridgesupport file > inside the framework resources but it doesn't contain the above > function. After looking around, I've tried using a constant it *does* > contain, ie kBluetoothFeatureEncryption, but Python still can't find it. > > I'm using: > > import objc as _objc > > _objc.loadBundle('IOBluetooth', globals(), > bundle_path=u'/System/Library/Frameworks/IOBluetooth.framework') > > in IOBluetooth.py and > > from IOBluetooth import * > > in my main class. > > The documentation on wrapping global functions/constants is *severely* > lacking, so any help appreciated :) > -- > Orestis Markou > or...@or... > http://orestis.gr/ > > > > > > ------------------------------------------------------------------------- > 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 > -- Michael McCracken UCSD CSE PhD Candidate research: http://www.cse.ucsd.edu/~mmccrack/ misc: http://michael-mccracken.net/wp/ |
|
From: Orestis M. <or...@or...> - 2008-02-02 23:14:32
|
Hello,
I'm trying to use IOBluetooth and IOBluetoothUI. I've figured out
using the Obj-C part (using objc.loadBundle) but IOBluetooth uses some
external functions, like IOBluetoothNSStringToDeviceAddress in
IOBluetoothUtilities. I can't find a way to use this.
I've tried using gen_bridge_metadata but I get a compiler error.
Checking, I've seen that there is a IOBluetooth.bridgesupport file
inside the framework resources but it doesn't contain the above
function. After looking around, I've tried using a constant it *does*
contain, ie kBluetoothFeatureEncryption, but Python still can't find it.
I'm using:
import objc as _objc
_objc.loadBundle('IOBluetooth', globals(),
bundle_path=u'/System/Library/Frameworks/IOBluetooth.framework')
in IOBluetooth.py and
from IOBluetooth import *
in my main class.
The documentation on wrapping global functions/constants is *severely*
lacking, so any help appreciated :)
--
Orestis Markou
or...@or...
http://orestis.gr/
|
|
From: James R E. <ea...@ba...> - 2008-02-02 01:00:19
|
Hi Daniel, I, too, would love to hear what people are doing to debug PyObjC (or just Python in general) in Xcode. I personally haven't found Xcode's Python support to be terribly strong. I actually prefer to do my PyObjC development in Eclipse using PyDev. It can be a little bit tricky to set up, but I've found the payoff to be well worth it. Using the Eclipse debugger to step through code is an invaluable debugging tool. Cheers! James On Feb 1, 2008, at 16:16 , Daniel Lord wrote: > I would appreciate any sources of information anyone can point me to > that offer some good best practices for PyObjC debugging using Xcode > and gdb. > > While NSLog(), print(), and repr() suffice most of the time, it > would be really nice to be able to get closer to source-level > debugging with PyObjC like I can in plain-vanilla Python and > wxPython with Komodo. I realize I cannot achieve that ideal, but I'd > appreciate getting closer. > > For instance, I am using Apple Python 2.5.1 on Leopard right now: > 1. would it help to build an unstripped MacPython framework build? I > know PyObjC is unstripped if I build with py2app -A, but I'll have > to dig down into Xcode to see how to arrange that for a debug target > in Xcode 3. > > 2. Anyone know any good macros for gdb that help cut through and > clear away all the stack detritus when gdb hits a break? Python is a > great tool, but it leaves a fugly stack bt. > > 3. Right now, I break in main.m, set a bps on NSLog, having put > NSLog calls in Python where I want to take a look at things--surely > there are more clever folks out there than me. What do you do? > > > 4. Any other useful tips, strategies, etc. > > I'll assemble things, write something up with examples, and put them > in a Wiki once I work through whatever I can find. Google has > returned a paucity of info on this which is why I am pinging the list. > > Daniel > > > > ------------------------------------------------------------------------- > 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 -- God never showed you lessons I could teach. -- Gosling, "Mr. Skeleton Wings" |
|
From: Daniel L. <da...@br...> - 2008-02-01 21:18:20
|
I would appreciate any sources of information anyone can point me to that offer some good best practices for PyObjC debugging using Xcode and gdb. While NSLog(), print(), and repr() suffice most of the time, it would be really nice to be able to get closer to source-level debugging with PyObjC like I can in plain-vanilla Python and wxPython with Komodo. I realize I cannot achieve that ideal, but I'd appreciate getting closer. For instance, I am using Apple Python 2.5.1 on Leopard right now: 1. would it help to build an unstripped MacPython framework build? I know PyObjC is unstripped if I build with py2app -A, but I'll have to dig down into Xcode to see how to arrange that for a debug target in Xcode 3. 2. Anyone know any good macros for gdb that help cut through and clear away all the stack detritus when gdb hits a break? Python is a great tool, but it leaves a fugly stack bt. 3. Right now, I break in main.m, set a bps on NSLog, having put NSLog calls in Python where I want to take a look at things--surely there are more clever folks out there than me. What do you do? 4. Any other useful tips, strategies, etc. I'll assemble things, write something up with examples, and put them in a Wiki once I work through whatever I can find. Google has returned a paucity of info on this which is why I am pinging the list. Daniel |
|
From: Ronald O. <ron...@ma...> - 2008-02-01 07:10:32
|
On 31 Jan, 2008, at 17:55, scott herzinger wrote:
> I'm working with PyObjC version 2.0 per the Leopard distribution.
> QTTrack.quickTimeMovie and QTMedia.quickTimeMovie both return
> PyObjCPointers. For example, suppose movie is a QTMovie:
>
> >>> track = movie.tracks()[0]
> track = movie.tracks()[0]
> >>> media = track.media()
> media = track.media()
> >>> pprint((movie, track, media))
> pprint((movie, track, media))
> (<QTMovie: 0x1a6bc30 time scale = 600, duration = 52049, rate =
> 0.000000, tracks = { 0x1bf0c30 0x1bf0ec0 }>,
> <QTTrack: 0x1bf0c30 Size = { 240, 320 }, QTMedia = 0x1f97a00>,
> <QTMedia: 0x1f97a00 type = 'vide', time scale = 1500, duration =
> 130000>)
> >>> qtm = media.quickTimeMedia()
> qtm = media.quickTimeMedia()
> 2008-01-31 11:19:37.248 Python[7943:613] PyObjCPointer created: at
> 0xcbef4 of type ^{MediaType}
> >>> qtm
> qtm
> <PyObjCPointer object at 0x27601c0>
> >>>
That's rather annoying. I've added this to my todo list for pyobjc 2.1.
>
>
> FWIW there are other indications that QTKit is not completely
> wrapped. For example, none of the QTMovie.movieWith... class methods
> appear to be available in PyObjC (e.g. movieWithFile, movieWithURL).
> Instance methods like initWithFile are available, so the absence of
> class methods is not a showstopper.
The class methods are available, even if introspection doesn't show
them:
:>>>QTKit.QTMovie.movieWithFile_(None)
2008-02-01 08:03:20.907 Python[2971:613] *** WARNING: Method
movieWithFile: in class QTMovie is obsolete ***
>
The introspection issue is caused by the way class methods are
implemented: they are methods on the metaclass (just like in Objective-
C) and Python's standard introspection tools (and PyObjC's
classbrowser samples) don't know how to deal with that.
This implementation method is needed to be able to use class and
instance methods that have the same name, the trivial example of that:
>>> from Foundation import NSObject
>>> NSObject.description()
u'NSObject'
>>> NSObject.new().description()
u'<NSObject: 0x1a6aed0>'
>>>
There are more interesting methods like this though, including some
where the instance method is undocumented and PyObjC 1.x would
unexpectly call the instance method when a user wanted to use the
documented class method.
>
> I'm targeting 10.5 and beyond. QTKit doesn't yet let me get at the
> media bits in ways that I need in my application. AudioUnits may be
> applicable, but I haven't had a chance to come up to speed with them.
Have you filed a bug at Apple for that? As I said, Carbon Quicktime
isn't available in 64-bit mode and I'm sure Apple would be interested
to hear about usecases that cannot fully use QTKit.
Ronald
>
>
> Thanks,
> Scott
>
>
>
> On Jan 31, 2008, at 4:33 AM, Ronald Oussoren wrote:
>
>>
>> On 30 Jan, 2008, at 23:33, Scott Herzinger wrote:
>>
>>> I'm looking for an idiom by which I can use a given PyObjCPointer,
>>> that I get back from some Cocoa API, as a Carbon object (or
>>> pointer thereto). My specific requirement currently is to take a
>>> PyObjCPointer that I get back from a QTKit API, and use its
>>> referent as a Carbon.Qt.Media object.
>>
>> PyObjCPointer objects are an indication of an incomplete wrapping
>> of a framework. Which method returns a PyObjCPointer and in which
>> version of PyObjC?
>>
>> In PyObjC2 a PyObjCPointer has an "pointerAsInteger" atrribute that
>> returns the numeric value of the pointer, I don't remember if
>> PyObjC1 has the same attribute. With that value and ctypes you can
>> contruct a Carbon.QT object.
>>
>> BTW. What OS release are you targetting? Apple is clearly stearing
>> away from the Carbon QuickTime API's in favour of QTKit (no 64-bit
>> support in the Carbon API, no new development as well).
>>
>> Ronald
>
|
|
From: Michael M. <mic...@gm...> - 2008-02-01 06:46:15
|
Hi, I got the urge to embed a python console in my app so I could poke
around in it while it was running.
I didn't find an example of doing just that when I looked, so I
thought I'd put one together and share it.
I used it like this, tying it to a menu item:
@IBAction
def showPyConsole_(self, sender):
if self.pyconsole is None:
locals = {'m': self}
welcome = "Welcome to the Console.\nThe main window
controller is called 'm'."
self.pyconsole =
PyConsole.PyConsole.alloc().initWithLocals_welcomeMsg_(locals,
welcome)
self.pyconsole.showWindow_(self)
It pops up a window running a REPL that's pretty close to the python
interactive interpreter.
The code and xib are here: http://michael-mccracken.net/software/PyConsole.zip
I've licensed it as BSD.
I'd be curious to hear if anyone else finds it useful.
(Patches, suggestions, etc are nice too.)
Cheers,
-mike
--
Michael McCracken
misc: http://michael-mccracken.net/wp/
|
|
From: Michael M. <mic...@gm...> - 2008-02-01 01:21:52
|
This seemed like a good excuse to learn a bit more about the
bridgesupport metadata, so I looked at AppKit's
PyObjCOverrides.bridgesupport file and found this entry for
NSGradient:
<class name='NSGradient'>
<method selector='initWithColors:atLocations:colorSpace:'>
<arg c_array_length_in_arg='0' index='1' type_modifier='n' />
</method>
<method selector='initWithColorsAndLocations:' suggestion='Use
initWithColors:atLocation:colorspace:' variadic='true' />
</class>
Contrast the entry for arrayWithObjects:
<method c_array_delimited_by_null='true' class_method='true'
selector='arrayWithObjects:' variadic='true' />
This seems to explain why I got the error, but I couldn't quite figure
out how that suggestion was being ignored and replaced with the less
helpful one I got.
I found the suggestion I got ("Variadic functions/methods are not
supported") being set in method-signature.m:499, but it seems like it
shouldn't get there for this method, because a suggestion already
exists.
Anyway, I was trying to do some spelunking without actually having
time to check out and build things, so that's as far as I got. I'd be
curious to hear more about what's going on here.
Thanks,
-mike
On Jan 30, 2008 11:57 AM, Barry Wark <bar...@gm...> wrote:
>
> On Jan 30, 2008 11:45 AM, Ronald Oussoren <ron...@ma...> wrote:
> >
> > On 29 Jan, 2008, at 20:17, Michael McCracken wrote:
> >
> > > I was trying to init an NSGradient with the system PyObjC 2.0 in 10.5,
> > > like this:
> > >
> > > aGradient =
> > > NSGradient.alloc().initWithColorsAndLocations_(NSColor.blackColor(),
> > > 0.0, NSColor.whiteColor(), 1.0, None)
> > >
> > > just a straight translation from ObjC. It didn't work:
> > >
> > > File "/Users/mmccrack/Products/Debug/Incoming.app/Contents/
> > > Resources/INAnimActionView.py",
> > > line 199, in drawRect_
> > > aGradient.initWithColorsAndLocations_(NSColor.blackColor(), 0.0,
> > > NSColor.whiteColor(), 1.0, None)
> > > TypeError: Variadic functions/methods are not supported
> >
> > That's annoying, this is supposed to work. I'll have to look more
> > closely to see what's going on, but my first guess is broken metadata.
> >
>
> Broken metadata for the initWithColorsAndLocations: seems likely to me
> too. This does work:
> In [2]: NSArray.arrayWithObjects_('abc',2,None)
> Out[2]:
> (
> abc,
> 2
> )
>
> barry
>
--
Michael McCracken
UCSD CSE PhD Candidate
research: http://www.cse.ucsd.edu/~mmccrack/
misc: http://michael-mccracken.net/wp/
|