pyobjc-dev Mailing List for PyObjC (Page 69)
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: <dzi...@al...> - 2008-01-12 18:35:57
|
Hi!
Could somebody help me to solve this problem or explain why it's =20
impossible in Cocoa/pyObjC?
Please....
Here is a pure python:
class SimpleValue:
def __init__(self):
self.type =3D 0
self.value =3D 0
self.source =3D None
=09
def __call__(self):
if self.type =3D=3D 0:
return self.value
elif self.type =3D=3D 1:
return self.source() #here is a trick: if =
type of my variable =20
is 1, __call__ will return source method result :-)
else: print "Type %s is not supported, ERROR"
=09
a =3D SimpleValue()
a.value =3D 777
b =3D SimpleValue()
b.type =3D 1
b.source =3D a
tab =3D [a, b]
print "a.type =3D %s, b.type =3D %s" % (tab[0].type, tab[1].type)
print "a.value =3D %s, b.value =3D %s" % (tab[0].value, tab[1].value)
print "a.source =3D %s, b.source =3D %s"% (tab[0].source, tab[1].source)
print "a() =3D %s, b() =3D %s" % (tab[0](), tab[1]())
The result is nice:
a.type =3D 0, b.type =3D 1
a.value =3D 777, b.value =3D 0
a.source =3D None, b.source =3D <__main__.Value instance at 0x16ed9af8>
a() =3D 777, b() =3D 777
I'm trying to do the same thing in XCode Cocoa application. So I made =20=
two classes:
First one is almost same as above:
class SimpleValue (NSObject):
type =3D ivar(u'type')
value =3D ivar(u'value')
source =3D ivar(u'source')
def __call__(self):
if self.type =3D=3D 0:
return self.value
elif self.type =3D=3D 1:
return self.source()
else: print "Type %s is not supported, ERROR"
Second just class to preview results in window...
class TestView(NibClassBuilder.AutoBaseClass):
elements =3D ivar(u'elements')
def awakeFromNib(self):
a =3D SimpleValue.alloc().init()
a.value =3D 777
a.type =3D 0
b =3D SimpleValue.alloc().init()
b.type =3D 1
b.source =3D a
# !!!!!! here application exploding....Why!!! !!!!!!!!!!!!#
self.elements =3D [a, b]
#elementsController is defined in NIB
self.elementsController.setContent_(self.elements)
# if b.source is changed to "tralala" or 6, nice tab shows a =
and b
Python 2.4 MacOSX 10.4..
best 4 all
=C5=81ukasz
=09
|
|
From: Ronald O. <ron...@ma...> - 2008-01-08 17:03:35
|
Folks, The website at http://pyobjc.sf.net/ is slightly refreshed and now reflects pyobjc 2.0 instead of 1.4. The site still looks the same, but there are slight differences, the most significant of which is the example pages (at http://pyobjc.sf.net/examples/), which now include downloadable archives and syntax-colored source code. Another significant change: the site no longer uses php, which was a nonsensical for what amounted to a static website. The side is now generated on the client side by some python scripts and genshi templates. Ronlad |
|
From: Ronald O. <ron...@ma...> - 2008-01-08 06:45:45
|
On 8 Jan, 2008, at 0:09, Michael McCracken wrote: > On Jan 6, 2008 11:10 PM, Ronald Oussoren <ron...@ma...> > wrote: >> >> On 6 Jan, 2008, at 21:21, Jon Christopher wrote: >> >>> Many apologies if this is the wrong place to ask this question, >>> but I >>> couldn't find anywhere else. >>> >>> I'd like to call the instrumentObjcMessageSends(YES) function which >>> is part of the objc runtime so that I can log all objc-messages, >>> but I >>> can't figure out how to access it from python. >>> This function has the same effect as >>> NSObjCMessageLoggingEnabled=TRUE >>> (see http://developer.apple.com/technotes/tn2004/tn2124.html) >>> >>> I can create and call objc classes, but instrumentObjcMessageSends >>> is >>> a free function. I'd appreciate any pointers as to how to call this >>> function, or runtime free functions in general, for that matter. >> >> You cannot easily call runtime functions. Because >> instrumentObjcMessageSends isn't a public API I won't add it to >> PyObjC. >> >> It should be possible to call it using objc.loadBundleFunctions, >> but I >> don't have time to look into that right now. >> > > Wouldn't it be possible to just wrap that function with a C > extension module? > > Or if you really want every message send, just add it to your main.m? That's also possible. This should do the trick for calling it in pure python: import objc import Foundation objc.loadBundleFunctions(Foundation.__bundle__, globals(), [ ('instrumentObjcMessageSends', objc._C_VOID + objc._C_NSBOOL), ]) Then use 'instrumentObjcMessageSends(1)' to enable logging. This assumes the prototype for the function is 'void instrumentObjcMessageSends(BOOL)'. I've tried this without getting a possitive result though. According to <http://lists.apple.com/archives/darwin-dev/2005/Jul/msg00027.html> you have to call another function as well, which has a callback function to perform the actual logging. I guess it would be easier to just implement this is a small C extension after all. Ronald |
|
From: Michael M. <mic...@gm...> - 2008-01-07 23:09:15
|
On Jan 6, 2008 11:10 PM, Ronald Oussoren <ron...@ma...> wrote: > > On 6 Jan, 2008, at 21:21, Jon Christopher wrote: > > > Many apologies if this is the wrong place to ask this question, but I > > couldn't find anywhere else. > > > > I'd like to call the instrumentObjcMessageSends(YES) function which > > is part of the objc runtime so that I can log all objc-messages, but I > > can't figure out how to access it from python. > > This function has the same effect as NSObjCMessageLoggingEnabled=TRUE > > (see http://developer.apple.com/technotes/tn2004/tn2124.html) > > > > I can create and call objc classes, but instrumentObjcMessageSends is > > a free function. I'd appreciate any pointers as to how to call this > > function, or runtime free functions in general, for that matter. > > You cannot easily call runtime functions. Because > instrumentObjcMessageSends isn't a public API I won't add it to PyObjC. > > It should be possible to call it using objc.loadBundleFunctions, but I > don't have time to look into that right now. > Wouldn't it be possible to just wrap that function with a C extension module? Or if you really want every message send, just add it to your main.m? -mike (PS, sorry Ronald for the accidental double-reply.) -- 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-01-07 07:10:51
|
On 6 Jan, 2008, at 21:21, Jon Christopher wrote: > Many apologies if this is the wrong place to ask this question, but I > couldn't find anywhere else. > > I'd like to call the instrumentObjcMessageSends(YES) function which > is part of the objc runtime so that I can log all objc-messages, but I > can't figure out how to access it from python. > This function has the same effect as NSObjCMessageLoggingEnabled=TRUE > (see http://developer.apple.com/technotes/tn2004/tn2124.html) > > I can create and call objc classes, but instrumentObjcMessageSends is > a free function. I'd appreciate any pointers as to how to call this > function, or runtime free functions in general, for that matter. You cannot easily call runtime functions. Because instrumentObjcMessageSends isn't a public API I won't add it to PyObjC. It should be possible to call it using objc.loadBundleFunctions, but I don't have time to look into that right now. Ronald > > > Thanks, > Jon > > BTW, the all the links from the sourceforge examples page > http://pyobjc.sourceforge.net/examples/index.php are broken. > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev |
|
From: Jon C. <jon...@gm...> - 2008-01-06 20:21:15
|
Many apologies if this is the wrong place to ask this question, but I couldn't find anywhere else. I'd like to call the instrumentObjcMessageSends(YES) function which is part of the objc runtime so that I can log all objc-messages, but I can't figure out how to access it from python. This function has the same effect as NSObjCMessageLoggingEnabled=TRUE (see http://developer.apple.com/technotes/tn2004/tn2124.html) I can create and call objc classes, but instrumentObjcMessageSends is a free function. I'd appreciate any pointers as to how to call this function, or runtime free functions in general, for that matter. Thanks, Jon BTW, the all the links from the sourceforge examples page http://pyobjc.sourceforge.net/examples/index.php are broken. |
|
From: Ronald O. <ron...@ma...> - 2008-01-06 10:35:16
|
On 5 Jan, 2008, at 12:15, Matt Webb wrote: > Hi there, > > I'm using the default PyObjC on Leopard. > > I've used PyObjC before--very happy with it, thanks! To learn more, > I've been attempting to port SonOfGrab to Python. It uses some new- > to-10.5 window server methods that I want to get familiar with: > > http://developer.apple.com/samplecode/SonOfGrab/index.html > > What I'm being stumped by is making an array that consists of > CGWindowID types (CGWindowID is a uint32_t), rather than NSNumber. > > It's probably really simple, I know, but I can't see it in the docs > (and my Google-fu is poor today): > > how do I force a number - in Python - to get cast as uint32_t when > it's given to Obj C, instead of an NSNumber? An array of integers should do the trick. If that doesn't work: could you please post your (partial) port of SonOfGrab, that would make debugging the issue easier. Ronald |
|
From: Matt W. <ma...@in...> - 2008-01-05 11:15:30
|
Hi there, I'm using the default PyObjC on Leopard. I've used PyObjC before--very happy with it, thanks! To learn more, I've been attempting to port SonOfGrab to Python. It uses some new- to-10.5 window server methods that I want to get familiar with: http://developer.apple.com/samplecode/SonOfGrab/index.html What I'm being stumped by is making an array that consists of CGWindowID types (CGWindowID is a uint32_t), rather than NSNumber. It's probably really simple, I know, but I can't see it in the docs (and my Google-fu is poor today): how do I force a number - in Python - to get cast as uint32_t when it's given to Obj C, instead of an NSNumber? (I've put a little more info below.) thanks, Matt # My Python code is: windowIds = [w[kWindowIDKey].unsignedIntValue() for w in sortedSelection] The equivalent Obj C code is: // Now we Collect the CGWindowIDs from the sorted selection CGWindowID *windowIDs = calloc([sortedSelection count], sizeof(CGWindowID)); int i = 0; for(NSMutableDictionary *entry in sortedSelection) { windowIDs[i++] = [[entry objectForKey:kWindowIDKey] unsignedIntValue]; } // CGWindowListCreateImageFromArray expect a CFArray of *CGWindowID*, not CGWindowID wrapped in a CF/NSNumber // Hence we typecast our array above (to avoid the compiler warning) and use NULL CFArray callbacks // (because CGWindowID isn't a CF type) to avoid retain/release. CFArrayRef windowIDsArray = CFArrayCreate(kCFAllocatorDefault, (const void**)windowIDs, [sortedSelection count], NULL); free(windowIDs); -- from http://developer.apple.com/samplecode/SonOfGrab/listing2.html |
|
From: Barry W. <bar...@gm...> - 2008-01-03 00:33:08
|
+1 for both set/frozenset and datetime.datetime! barry On Jan 1, 2008 4:12 AM, Ronald Oussoren <ron...@ma...> wrote: > Hi, > > I'm currently search for more Python classes that could use custom > PyObjC proxies, just like python's "dict" is proxied as > "OC_PythonDictionary". > > The ones I know of right now are: > > - set, frozenset: proxy using subclass of NS(Mutable)Set > - datetime.datetime, ...: proxy using subclass of NSDate > > There's bound to be more of those, but I haven't looked very carefully > yet. The advantage of custom proxies is > cleaner integration of pure python types in Cocoa code, and hence less > need to "contaminate" code with unnecessary Cocoa dependencies. As an > example, the datetime.datetime proxy would allow you to dump the > output of an SQL query in an NSTable column with a date-formatter > without manual conversions. > > Ronald > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > 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-01-01 12:12:50
|
Hi, I'm currently search for more Python classes that could use custom PyObjC proxies, just like python's "dict" is proxied as "OC_PythonDictionary". The ones I know of right now are: - set, frozenset: proxy using subclass of NS(Mutable)Set - datetime.datetime, ...: proxy using subclass of NSDate There's bound to be more of those, but I haven't looked very carefully yet. The advantage of custom proxies is cleaner integration of pure python types in Cocoa code, and hence less need to "contaminate" code with unnecessary Cocoa dependencies. As an example, the datetime.datetime proxy would allow you to dump the output of an SQL query in an NSTable column with a date-formatter without manual conversions. Ronald |
|
From: Ian B. <ib...@gm...> - 2008-01-01 12:01:32
|
Cool! Thanks for all your work on PyObjC 2.0 - my clients and I are loving it! Happy New Year! Ian On Jan 1, 2008, at 4:57 AM, Ronald Oussoren wrote: > I've just changed the repository to better reflect reality: > > What was until now the trunk is pyobjc-1.4-branch. If you have this > checked out you can update your workspace by executing the following > command in a checkout: > > $ svn switch https://svn.red-bean.com/pyobjc/branches/pyobjc-1.4-branch > > The pyobjc2 branch is now the trunk, the command for updating a > workspace: > > $ svn switch https://svn.red-bean.com/pyobjc/trunk/pyobjc > > BTW. the trunk contains support for 64-bit code on Intel. There are > some issues on G5 systems that should be easy enough to fix once I > have access to the G5 box at the office again. > > Ronald > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > 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-01-01 11:57:23
|
I've just changed the repository to better reflect reality:
What was until now the trunk is pyobjc-1.4-branch. If you have this
checked out you can update your workspace by executing the following
command in a checkout:
$ svn switch https://svn.red-bean.com/pyobjc/branches/pyobjc-1.4-branch
The pyobjc2 branch is now the trunk, the command for updating a
workspace:
$ svn switch https://svn.red-bean.com/pyobjc/trunk/pyobjc
BTW. the trunk contains support for 64-bit code on Intel. There are
some issues on G5 systems that should be easy enough to fix once I
have access to the G5 box at the office again.
Ronald
|
|
From: <dzi...@al...> - 2008-01-01 11:05:40
|
Hi All!
Happy new year!
Could somebody explain me what I'm doing wrong? How to solve?
I try to build some control: depends what was chosen in menu, =20
different input boxes appears below.
Because i need to change this view (add, remove from superview) i =20
cant use IB.
class SFValueBox(NibClassBuilder.AutoBaseClass): #NSView
def initWithFrame_(self, rect):
self =3D super(SFValueBox, self).initWithFrame_(rect)
if self =3D=3D None: return None
size =3D NSMakeRect(0, 0, rect.size.width, rect.size.height)
#? Never works, but detail:
self.setAutoresizesSubviews_(False)
self.setTitle_(u"SFValue:")
#here is my small menu:
self.typePopUp =3D NSPopUpButton.alloc=20
().initWithFrame_pullsDown_(NSMakeRect(self.frame=20
().size.width-30,self.frame().size.height -44,18,20),True)
self.typePopUp.cell().setControlSize_(NSMiniControlSize)
self.typePopUp.setFont_(NSFont .systemFontOfSize_=20
(NSFont.systemFontSizeForControlSize_(NSMiniControlSize)))
self.typePopUp.addItemsWithTitles_([u"choose", u"value", =20
u"from...", u"library..."])
# Till now i'ts OK
# but here I try to add observer to change view if menu changed.
self.typePopUp.addObserver_forKeyPath_options_context_(
self,
u'selecedItem', #???
NSKeyValueObservingOptionNew | =20
NSKeyValueObservingOptionOld,
0)
self.addSubview_(self.typePopUp)
def observeValueForKeyPath_ofObject_change_context_(self, path, =20
object, changeDescription, context):
#Nothing happens here:
print "path - %s\n, object - %s\n, changeDescription - %s\n, =20=
context - %s\n" % (path, object, changeDescription, context)
#here I can change my view and set self.needsRedraw_(True)
Where is a trick?
=C5=81=
|
|
From: Bill B. <bb...@ma...> - 2007-12-31 17:52:06
|
More likely than not, you have some other version of Python installed
on your system and parts of it are being picked up instead of the
System python.
On Nov 29, 2007, at 6:04 AM, George Armah wrote:
> Hello,
>
> This is my first attempt at using pyobjc and I run into some problems.
>
> I created a new project using XCode 3.0 with the Cocoa-Python
> Application template.
> I then proceeded to do a build on the application (n.b. I haven't
> added any of my own code yet) and the build succeeded.
> When I do a build and run however, I get the following error message
> in console:
>
> //--------------------------------------------------------------------------------------------------------------------------------
> The Debugger Debugger is attaching to process
> [Session started at 2007-11-29 08:32:29 -0500.]
> Traceback (most recent call last):
> File "/Users/Armahg/Builds/Release/again.app/Contents/Resources/
> main.py", line 10, in <module>
> import objc
> ImportError: No module named objc
> 2007-11-29 08:32:29.349 again[2542:10b] *** Terminating app due to
> uncaught exception 'NSInternalInconsistencyException', reason: '/
> Users/Armahg/again/main.m:46 main() PyRun_SimpleFile failed with
> file '/Users/Armahg/Builds/Release/again.app/Contents/Resources/
> main.py'. See console for errors.'
> 2007-11-29 08:32:29.352 again[2542:10b] Stack: (
> 2488480363,
> 2511437979,
> 2488479819,
> 2488479882
> )
> //--------------------------------------------------------------------------------------------------------------------------------
> >From what I have read, i thought pyobjC2 should work right out of
> the box with Leopard. Is there anything configuration I have to do
> to get the app working?
>
>
> I also tried to run some of the PyObjc examples and received the
> following error message
>
> //--------------------------------------------------------------------------------------------------------------------------------
> Armahg:CurrencyConverter Armahg$ python setup.py py2app
> Traceback (most recent call last):
> File "setup.py", line 8, in <module>
> import py2app
> ImportError: No module named py2app
> //--------------------------------------------------------------------------------------------------------------------------------
>
> TroubleShooting done so far:
>
> My current path for Python is:
> Armahg$ which python
> /Library/Frameworks/Python.framework/Versions/Current/bin/python
>
> I modified the main.m file in my test PyObjc app to read
> /*Py_SetProgramName("/usr/bin/python");*/
> Py_SetProgramName("/Library/Frameworks/Python.framework/Versions/
> Current/bin/python");
>
> and this has not helped either.
>
>
> Any help given would be much appreciated. Also, in return, I'll
> document what I do and post it somewhere online so that
> other newcomers won't have to email this dev list with the same
> problem again :)
>
> Thanks in advance ,
>
> George.
>
>
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/_______________________________________________
> Pyobjc-dev mailing list
> Pyo...@li...
> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev
|
|
From: Koen B. <ko...@ma...> - 2007-12-31 11:25:43
|
Dear George,
Could you try to load objc in the interactive console:
Doerak:~ koen$ python
Python 2.5.1 (r251:54869, Apr 18 2007, 22:08:04)
[GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import objc
>>>
If that indeed does work, I suspect your files have a path to the
wrong python on top. That would be the first line in a file like this:
#!/bin/python.
Koen
On 29 nov 2007, at 15:04, George Armah wrote:
> Hello,
>
> This is my first attempt at using pyobjc and I run into some problems.
>
> I created a new project using XCode 3.0 with the Cocoa-Python
> Application template.
> I then proceeded to do a build on the application (n.b. I haven't
> added any of my own code yet) and the build succeeded.
> When I do a build and run however, I get the following error message
> in console:
>
> //--------------------------------------------------------------------------------------------------------------------------------
> The Debugger Debugger is attaching to process
> [Session started at 2007-11-29 08:32:29 -0500.]
> Traceback (most recent call last):
> File "/Users/Armahg/Builds/Release/again.app/Contents/Resources/
> main.py", line 10, in <module>
> import objc
> ImportError: No module named objc
> 2007-11-29 08:32:29.349 again[2542:10b] *** Terminating app due to
> uncaught exception 'NSInternalInconsistencyException', reason: '/
> Users/Armahg/again/main.m:46 main() PyRun_SimpleFile failed with
> file '/Users/Armahg/Builds/Release/again.app/Contents/Resources/
> main.py'. See console for errors.'
> 2007-11-29 08:32:29.352 again[2542:10b] Stack: (
> 2488480363,
> 2511437979,
> 2488479819,
> 2488479882
> )
> //--------------------------------------------------------------------------------------------------------------------------------
> >From what I have read, i thought pyobjC2 should work right out of
> the box with Leopard. Is there anything configuration I have to do
> to get the app working?
>
>
> I also tried to run some of the PyObjc examples and received the
> following error message
>
> //--------------------------------------------------------------------------------------------------------------------------------
> Armahg:CurrencyConverter Armahg$ python setup.py py2app
> Traceback (most recent call last):
> File "setup.py", line 8, in <module>
> import py2app
> ImportError: No module named py2app
> //--------------------------------------------------------------------------------------------------------------------------------
>
> TroubleShooting done so far:
>
> My current path for Python is:
> Armahg$ which python
> /Library/Frameworks/Python.framework/Versions/Current/bin/python
>
> I modified the main.m file in my test PyObjc app to read
> /*Py_SetProgramName("/usr/bin/python");*/
> Py_SetProgramName("/Library/Frameworks/Python.framework/Versions/
> Current/bin/python");
>
> and this has not helped either.
>
>
> Any help given would be much appreciated. Also, in return, I'll
> document what I do and post it somewhere online so that
> other newcomers won't have to email this dev list with the same
> problem again :)
>
> Thanks in advance ,
>
> George.
|
|
From: Duane R. <bai...@gm...> - 2007-12-28 21:28:11
|
I wrote a quick wrapper to get an TIFFRepresentation from a 1d list, a
width, and a height. Sadly, I ran into two problems:
1. it is returned in a tuple.
2. when I extract it from the tuple, I can't call methods (I tried length)
because of the missing variable 'self'.
here's the code:
#import <Python.h>
#import "pyobjc-api.h"
#import <Cocoa/Cocoa.h>
// example usage
// getbitmap([1 2 3 4], 2, 2, 1, colorspace) # creates a grascale, 2x2
NSBitMapImageRep
static PyObject *get_bitmap(PyObject *self, PyObject *args) // def
getbitmap(data, width, height, ipp, colorspace):
{
unsigned char *data;
PyObject *dataList, *newwidth, *newheight, *newipp, *intObject,
*colorspace;
long listSize = -1, i = 0, width = 0, height = 0, ipp = 3;
BOOL alpha;
NSBitmapImageRep *rep;
NSData *tiff;
NSString *colorString;
if (!PyArg_ParseTuple(args, "O!ii", &PyList_Type, &dataList, &width,
&height)) return NULL;
listSize = PyList_Size(dataList);
if(width * height * ipp != listSize)
{
PyErr_Format(PyExc_ValueError, "The list size does not agree with the
other arguments!");
PyErr_Print();
return Py_None;
}
if (listSize < 0)
{
PyErr_Format(PyExc_TypeError, "First argument must be a list with
entries!");
PyErr_Print();
return Py_None;
}
data = malloc(sizeof(unsigned char) * listSize);
for (i = 0; i < listSize; i++)
{
intObject = PyList_GetItem(dataList, i);
if(!PyInt_Check(intObject))
{
PyErr_Format(PyExc_TypeError, "Entry %d of list is not an integer!",
i);
PyErr_Print();
return Py_None;
}
data[i] = (unsigned char)PyInt_AsUnsignedLongMask(intObject);
}
// So, now we have our DATA! :D
alpha = (ipp == 4) ? YES : NO;
rep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes: &data
pixelsWide: width
pixelsHigh: height
bitsPerSample: 8
samplesPerPixel:ipp
hasAlpha: alpha
isPlanar: NO
colorSpaceName: NSDeviceRGBColorSpace
bytesPerRow: width * ipp
bitsPerPixel: ipp * 8];
tiff = [rep TIFFRepresentation];
return PyObjC_ObjCToPython(@encode(NSData), tiff);
}
static PyMethodDef methods[] = {
{"getbitmap", get_bitmap, METH_VARARGS,
"Get an NSBitmapImageRep"},
{NULL, NULL, 0, NULL}
};
PyObject *mod;
PyMODINIT_FUNC initbitmap()
{
mod = Py_InitModule("bitmap", methods);
PyObjC_ImportAPI(mod);
}
|
|
From: Bill B. <bb...@ma...> - 2007-12-28 19:26:07
|
It turns out that the rather powerful iPython is easy to install on
Leopard:
sudo easy_install ipython
However, it has the odd behavior of showing the same method many times
upon hitting <tab>:
In [7]: x.objectAtIndex_
x.objectAtIndex_ x.objectAtIndex_ x.objectAtIndex_ x.objectAtIndex_
In [7]: type(x)
Out[7]: <objective-c class NSCFArray at 0x37adc0>
In [8]: x
Out[8]:
(
1,
2,
3,
4
)
Has anyone futzed with this?
b.bum
|
|
From: Ronald O. <ron...@ma...> - 2007-12-26 19:34:04
|
On 26 Dec, 2007, at 18:49, Barry Wark wrote: > Ronald, > > Thanks for the clarification! In the long run, it would definitely be > worth the effort to get pyobjc2 working on the 10.4u.sdk. On a side > note, would you be willing to share what features are present in the > system python that aren't available in the MacPython build (for 10.5)? I know of two differences: 1) dtrace support in the python interpreter. I've asked if these patches can be shared, but haven't received a response yet. This support is probably based on, or equal to, patches for this floating around on the net. For completeness sake: dtrace is a system tracing tool that was invented by Sun and allows very deep inspecting (system call tracing on steroids). The patches in the interpreter emit events when the python stacklevel changes, making it easier to tie events to python code instead of code in the interpreter. 2) "import CoreGraphics". These are Apple's limited bindings to CoreGraphics, which are also present on 10.4. PyObjC2 also includes CoreGraphics bindings as part of "import Quartz", and those are way more complete. Ronald > > > barry > > On Dec 26, 2007 3:18 AM, Ronald Oussoren <ron...@ma...> > wrote: >> >> On 24 Dec, 2007, at 20:44, Barry Wark wrote: >> >>> Mikeal, >>> >>> pyobjc2 requires the 10.5 SDK. Unfortunately the MacPython DMG >>> distribution is built against the 10.4u SDK. >> >> Both are technically true ;-). The MacPython DMG, and will continue >> to >> be, build agains the 10.4 SDK because 10.5 wasn't out when the latest >> release of Python was done. >> >> PyObjC2 is slightly more complicated: it currently requires the 10.5 >> SDK to build, but the architecture allows building on 10.4 as well. >> That support incomplete at the moment, patches would be more than >> welcome. What AFAIK needs to be done is implementing a number of C >> functions that emulate the Objective-C 2.0 runtime API. Most of that >> work is already done, and no rocket science is involved. >> >> >>> In order to use pyobjc2 >>> with the MacPython distribution, you have to compile the Python >>> framework from source. I've done this. You're welcome to give my >>> build >>> a try (http://rieke-server.physiol.washington.edu/~barry/python/python-2.5.1-macosx2007-11-26.dmg >>> ). >>> It will install in the same location as the 10.4u SDK (I can't >>> figure >>> out a way around this), so you might want to move the current >>> Python.framework to somewhere safe before you install the new one. >> >> To be honest I believe this is a waste of time, what you'll end up >> with is a home-build version of python that is the same version as >> the >> system-installed one and misses a number of features. The resulting >> framework might run on 10.4 as well, but you don't know that without >> testing (AFAIK a number of unix API's that are used by the >> posixmodule >> have changed to be more in line with the current revision of the UNIX >> specificiation). >> >> Ronald |
|
From: Barry W. <bar...@gm...> - 2007-12-26 17:49:29
|
Ronald, Thanks for the clarification! In the long run, it would definitely be worth the effort to get pyobjc2 working on the 10.4u.sdk. On a side note, would you be willing to share what features are present in the system python that aren't available in the MacPython build (for 10.5)? barry On Dec 26, 2007 3:18 AM, Ronald Oussoren <ron...@ma...> wrote: > > On 24 Dec, 2007, at 20:44, Barry Wark wrote: > > > Mikeal, > > > > pyobjc2 requires the 10.5 SDK. Unfortunately the MacPython DMG > > distribution is built against the 10.4u SDK. > > Both are technically true ;-). The MacPython DMG, and will continue to > be, build agains the 10.4 SDK because 10.5 wasn't out when the latest > release of Python was done. > > PyObjC2 is slightly more complicated: it currently requires the 10.5 > SDK to build, but the architecture allows building on 10.4 as well. > That support incomplete at the moment, patches would be more than > welcome. What AFAIK needs to be done is implementing a number of C > functions that emulate the Objective-C 2.0 runtime API. Most of that > work is already done, and no rocket science is involved. > > > > In order to use pyobjc2 > > with the MacPython distribution, you have to compile the Python > > framework from source. I've done this. You're welcome to give my build > > a try (http://rieke-server.physiol.washington.edu/~barry/python/python-2.5.1-macosx2007-11-26.dmg > > ). > > It will install in the same location as the 10.4u SDK (I can't figure > > out a way around this), so you might want to move the current > > Python.framework to somewhere safe before you install the new one. > > To be honest I believe this is a waste of time, what you'll end up > with is a home-build version of python that is the same version as the > system-installed one and misses a number of features. The resulting > framework might run on 10.4 as well, but you don't know that without > testing (AFAIK a number of unix API's that are used by the posixmodule > have changed to be more in line with the current revision of the UNIX > specificiation). > > Ronald |
|
From: Ronald O. <ron...@ma...> - 2007-12-26 11:23:25
|
On 24 Dec, 2007, at 20:44, Barry Wark wrote: > Mikeal, > > pyobjc2 requires the 10.5 SDK. Unfortunately the MacPython DMG > distribution is built against the 10.4u SDK. Both are technically true ;-). The MacPython DMG, and will continue to be, build agains the 10.4 SDK because 10.5 wasn't out when the latest release of Python was done. PyObjC2 is slightly more complicated: it currently requires the 10.5 SDK to build, but the architecture allows building on 10.4 as well. That support incomplete at the moment, patches would be more than welcome. What AFAIK needs to be done is implementing a number of C functions that emulate the Objective-C 2.0 runtime API. Most of that work is already done, and no rocket science is involved. > In order to use pyobjc2 > with the MacPython distribution, you have to compile the Python > framework from source. I've done this. You're welcome to give my build > a try (http://rieke-server.physiol.washington.edu/~barry/python/python-2.5.1-macosx2007-11-26.dmg > ). > It will install in the same location as the 10.4u SDK (I can't figure > out a way around this), so you might want to move the current > Python.framework to somewhere safe before you install the new one. To be honest I believe this is a waste of time, what you'll end up with is a home-build version of python that is the same version as the system-installed one and misses a number of features. The resulting framework might run on 10.4 as well, but you don't know that without testing (AFAIK a number of unix API's that are used by the posixmodule have changed to be more in line with the current revision of the UNIX specificiation). Ronald |
|
From: Barry W. <bar...@gm...> - 2007-12-24 19:44:31
|
Mikeal, pyobjc2 requires the 10.5 SDK. Unfortunately the MacPython DMG distribution is built against the 10.4u SDK. In order to use pyobjc2 with the MacPython distribution, you have to compile the Python framework from source. I've done this. You're welcome to give my build a try (http://rieke-server.physiol.washington.edu/~barry/python/python-2.5.1-macosx2007-11-26.dmg). It will install in the same location as the 10.4u SDK (I can't figure out a way around this), so you might want to move the current Python.framework to somewhere safe before you install the new one. Once installed, you'll have to rebuild any extensions, since they generally have to be built with the same SDK as the interpreter. pyobjc2 should now build and run fine (checkout the pyobjc2 source from svn). The only hickup I've noticed is that the Xcode debugger sometimes chokes when loading pyobjc2 applications that use the MacPython framework since it appears that it doesn't contain some of the expected debugging symbols. Let me know how things go. Barry On Dec 24, 2007 12:01 AM, Mikeal Rogers <mi...@os...> wrote: > I can't seem to find any documentation for building/installing > pyobjc2.0 on Leopard for MacPython. > > For a variety of reasons I don't use the Python that is installed on > Leopard by default and need to get pyobjc running in 2.5.1 MacPython. > > It would be really nice is pyobjc2 was in the cheeseshop like the old > 1.x is. > > -Mikeal > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev > |
|
From: Mikeal R. <mi...@os...> - 2007-12-24 08:01:08
|
I can't seem to find any documentation for building/installing pyobjc2.0 on Leopard for MacPython. For a variety of reasons I don't use the Python that is installed on Leopard by default and need to get pyobjc running in 2.5.1 MacPython. It would be really nice is pyobjc2 was in the cheeseshop like the old 1.x is. -Mikeal |
|
From: Ronald O. <ron...@ma...> - 2007-12-23 08:25:01
|
On 20 Dec, 2007, at 19:48, Bill Bumgarner wrote: > On Dec 20, 2007, at 8:15 AM, Jon Rosebaugh wrote: >> I did figure out where to get IBOutlet and IBAction, but my >> ConverterController (I'm following the Currency Converter tutorial) >> doesn't seem to be working. When the app starts up, it puts this in >> the console: >> 12/20/07 10:09:29 AM Python Converter Converter[9448] Unknown class >> `ConverterController' in nib file, using `NSObject' instead. >> 12/20/07 10:09:29 AM Python Converter Converter[9448] Could not >> connect the action convert: to target of class NSObject >> and then obviously clicking the convert button doesn't do anything >> at all. >> >> Here is my ConverterController class: >> >> class ConverterController(NSObject): >> amountField = objc.IBOutlet() >> dollarField = objc.IBOutlet() >> rateField = objc.IBOutlet() >> >> @objc.IBAction >> def convert_(self, sender): >> print "Hello World" >> self.amountField.setFloatValue_(self.dollarField.floatValue() >> * self.rateField.floatValue()) >> self.rateField.selectText_(self) > > Make sure you import the file containing the ConverterController class > in your main.py. Is that something that can/should be automated? Either by running a macro when Xcode adds a new file (which afaik isn't possible, but you never know), or by having main.py do an os.listdir of the Resources directory and try to import everything that resembles a python module. Ronald > > > b.bum > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev |
|
From: Bill B. <bb...@ma...> - 2007-12-20 18:48:22
|
On Dec 20, 2007, at 8:15 AM, Jon Rosebaugh wrote: > I did figure out where to get IBOutlet and IBAction, but my > ConverterController (I'm following the Currency Converter tutorial) > doesn't seem to be working. When the app starts up, it puts this in > the console: > 12/20/07 10:09:29 AM Python Converter Converter[9448] Unknown class > `ConverterController' in nib file, using `NSObject' instead. > 12/20/07 10:09:29 AM Python Converter Converter[9448] Could not > connect the action convert: to target of class NSObject > and then obviously clicking the convert button doesn't do anything > at all. > > Here is my ConverterController class: > > class ConverterController(NSObject): > amountField = objc.IBOutlet() > dollarField = objc.IBOutlet() > rateField = objc.IBOutlet() > > @objc.IBAction > def convert_(self, sender): > print "Hello World" > self.amountField.setFloatValue_(self.dollarField.floatValue() > * self.rateField.floatValue()) > self.rateField.selectText_(self) Make sure you import the file containing the ConverterController class in your main.py. b.bum |
|
From: Jon R. <ch...@gm...> - 2007-12-20 16:15:38
|
On Dec 20, 2007 1:56 AM, Michael McCracken <mic...@gm...> wrote:
> The main changes that tripped me up are that to benefit from the IB
> integration (I think) you need to use the XIB format, and you want to
> declare your class ivars as IBOutlet, and methods as IBAction when
> appropriate, like you do in ObjC:
>
> from objc import IBOutlet, IBAction
>
> class SomeWindowController(NSWindowController):
> myProgressMeter = IBOutlet()
>
> @IBAction
> def haveAHollyJollyChristmas_(self, sender):
> # etc...
>
> Then IB will see these just like it does with ObjC IBAction/Outlets,
> and you'll hook up your UI like you would for ObjC.
I did figure out where to get IBOutlet and IBAction, but my
ConverterController (I'm following the Currency Converter tutorial)
doesn't seem to be working. When the app starts up, it puts this in
the console:
12/20/07 10:09:29 AM Python Converter Converter[9448] Unknown class
`ConverterController' in nib file, using `NSObject' instead.
12/20/07 10:09:29 AM Python Converter Converter[9448] Could not
connect the action convert: to target of class NSObject
and then obviously clicking the convert button doesn't do anything at all.
Here is my ConverterController class:
class ConverterController(NSObject):
amountField = objc.IBOutlet()
dollarField = objc.IBOutlet()
rateField = objc.IBOutlet()
@objc.IBAction
def convert_(self, sender):
print "Hello World"
self.amountField.setFloatValue_(self.dollarField.floatValue()
* self.rateField.floatValue())
self.rateField.selectText_(self)
|