pyobjc-dev Mailing List for PyObjC (Page 53)
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...> - 2009-03-19 09:13:37
|
On 18 Mar, 2009, at 2:09, Ben Artin wrote:
>> I guess /usr/local has some old header files from the age of Tiger.
>
> No version of Mac OS X ever installed anything in /usr/local, so this
> is a 3rd party package you installed at some point, and is presumably
> superseded by a vendor library these days.
Does anyone know a way to exclude /usr/local/include and /usr/local/
lib from the compiler search paths? "-nostdinc" and "-nostdlib" are a
bit blunt, although something like this should work:
CFLAGS=[
"nostdinc",
"-isystem/usr/include",
"-isystem/usr/lib/gcc/i686-apple-darwin9/4.0.1/include",
"-iframework/System/Library/Frameworks",
...
]
(Although the list of included header/framework directories should be
extracted from the output of 'cpp -v' instead of hardcoding them)
Ronald
>
> --
>
> <http://artins.org/ben>
>
> "I have learned two ways to tie my shoes. One way is only good for
> lying down." -- Valentine Michael Smith
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM)
> are
> powering Web 2.0 with engaging, cross-platform capabilities. Quickly
> and
> easily build your RIAs with Flex Builder, the Eclipse(TM)based
> development
> software that enables intelligent coding and step-through debugging.
> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
> _______________________________________________
> Pyobjc-dev mailing list
> Pyo...@li...
> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev
|
|
From: Ben A. <be...@ar...> - 2009-03-18 01:29:02
|
> I guess /usr/local has some old header files from the age of Tiger. No version of Mac OS X ever installed anything in /usr/local, so this is a 3rd party package you installed at some point, and is presumably superseded by a vendor library these days. -- <http://artins.org/ben> "I have learned two ways to tie my shoes. One way is only good for lying down." -- Valentine Michael Smith |
|
From: Rodrigo G. <tio...@gm...> - 2009-03-18 01:05:11
|
Hi again, It turns out the problem was not with PyObjC, but that I had two different versions of dlfcn.h, one in usr/include and another in usr/local/include. Grep "RTLD_DEFAULT" /usr/include/dlfcn.h showed the following line: #define RTLD_DEFAULT ((void *) -2) /* Use default search algorithm. */ Grep "RTLD_DEFAULT" /usr/local/include/dlfcn.h showed nothing. So I mv /usr/local/include/dlfcn.h to /usr/local/include/dlfcn.h.backup and ln -s /usr/include/dlfcn.h /usr/local/include This made it compile fine... But I am still not sure of the consequences, or why this problem happened in the first place. I guess /usr/local has some old header files from the age of Tiger. Cheers, Guerra On Sun, Mar 15, 2009 at 1:56 PM, Rodrigo Guerra <tio...@gm...> wrote: > Hi, > > I am not sure this is the right place for support questions since this > is a "dev" mailing list. If not, then I apologize. > > I am trying the following: > > ~$ sudo easy_install pyobjc==2.2b1 > > I see many deprecated warnings in the compiling of Obj-C files and > then the first actual error lines are the following: > > (snippet) > Modules/objc/parsexml.m: In function 'handle_constant': > Modules/objc/parsexml.m:552: error: 'RTLD_DEFAULT' undeclared (first > use in this function) > Modules/objc/parsexml.m:552: error: (Each undeclared identifier is > reported only once > Modules/objc/parsexml.m:552: error: for each function it appears in.) > Modules/objc/parsexml.m: In function 'handle_cftype': > Modules/objc/parsexml.m:764: error: 'RTLD_DEFAULT' undeclared (first > use in this function) > Modules/objc/parsexml.m: In function 'handle_function': > Modules/objc/parsexml.m:1067: error: 'RTLD_DEFAULT' undeclared (first > use in this function) > Modules/objc/parsexml.m: In function 'handle_constant': > Modules/objc/parsexml.m:552: error: 'RTLD_DEFAULT' undeclared (first > use in this function) > Modules/objc/parsexml.m:552: error: (Each undeclared identifier is > reported only once > Modules/objc/parsexml.m:552: error: for each function it appears in.) > Modules/objc/parsexml.m: In function 'handle_cftype': > Modules/objc/parsexml.m:764: error: 'RTLD_DEFAULT' undeclared (first > use in this function) > Modules/objc/parsexml.m: In function 'handle_function': > Modules/objc/parsexml.m:1067: error: 'RTLD_DEFAULT' undeclared (first > use in this function) > > Some other information about the machine below: > > ~$ python > Python 2.5.1 (r251:54863, Jan 13 2009, 10:26:13) > [GCC 4.0.1 (Apple Inc. build 5465)] on darwin > > ~$ gcc -v > gcc version 4.0.1 (Apple Inc. build 5490) > > ~$ uname -psrv > Darwin 9.6.0 Darwin Kernel Version 9.6.0: Mon Nov 24 17:39:01 PST > 2008; root:xnu-1228.9.59~1/RELEASE_PPC powerpc > > I also downloaded the svn sources, but I am not sure how to proceed to > compile them. What I tried was to cd trunk/pyobjc/pyobjc and from > there run python setup.py install. That gave me the same errors above. > Doing the same thing with python2.6 I get a different error message: > > Processing pyobjc-framework-Quartz-2.2b1.tar.gz > Running pyobjc-framework-Quartz-2.2b1/setup.py -q bdist_egg --dist-dir > /tmp/easy_install-cF5l70/pyobjc-framework-Quartz-2.2b1/egg-dist-tmp-dUj2iE > /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/dist.py:266: > UserWarning: Unknown distribution option: 'options' > warnings.warn(msg) > Modules/_callbacks.m:422: error: syntax error before > 'm_CGDataProviderSequentialCallbacks' > > Any help really appreciated. > > Cheers, > Guerra > |
|
From: Greg E. <gre...@ca...> - 2009-03-17 10:48:46
|
Ronald Oussoren wrote: > > Is there any way from pure python (no main.m, no >> nib) to get something showing on the screen? I know that without a nib >> I won't get a proper dock icon or a menu bar, It's possible to get a proper menu bar without a nib using a trick or two. Let me know if you want details. -- Greg |
|
From: Ronald O. <ron...@ma...> - 2009-03-17 07:34:16
|
On 15 Mar, 2009, at 12:11, Orestis Markou wrote: > Hello, > > For the purposes of testing an application, running it in the same > process as the tests (ie. as part of a unittest run) is essential. > However, for Cocoa applications built with PyObjC built with the XCode > templates I haven't found a way to do this. As far as I can understand > main.m, all it does is using the Python C API to run main.py. However, > when I try to run main.py standalone, things fail because there is no > bundle. > > I've tried to do: > > app = NSApplication.sharedApplication() > app.setDelegate_(delegate) > app.run() > > but things crash soon after. Same if I do AppHelper.runEventLoop(). > > So my question is: Is there any way from pure python (no main.m, no > nib) to get something showing on the screen? I know that without a nib > I won't get a proper dock icon or a menu bar, but this is going to be > a full screen app and thus these things are not needed. I can cope > with bundles, but if there could be no bundles that'd be nice as well. This should be possible, see: http://svn.red-bean.com/pyobjc/trunk/pyobjc/pyobjc-core/Examples/Scripts/HelloWorld.py Most PyObjC examples use py2app to build the application bundle, which includes it's own stub executable into the .app bundle. The Xcode projects use a main.m file because that's needed for Xcode. Ronald > > Thanks, > Orestis > -- > or...@or... > http://orestis.gr/ > > > > > > ------------------------------------------------------------------------------ > Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) > are > powering Web 2.0 with engaging, cross-platform capabilities. Quickly > and > easily build your RIAs with Flex Builder, the Eclipse(TM)based > development > software that enables intelligent coding and step-through debugging. > Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev |
|
From: Orestis M. <or...@or...> - 2009-03-16 14:45:29
|
On 15 Mar 2009, at 22:54, Greg Ewing wrote:
> Orestis Markou wrote:
>
>> I've tried to do:
>> app = NSApplication.sharedApplication()
>> app.setDelegate_(delegate)
>> app.run()
>> but things crash soon after.
>
> That's strange, because I do something very similar in
> PyGUI and it seems to work.
>
> I've only tested it on 10.4, though. It's possible that
> things are different in 10.5.
>
> Have you tried running it with pythonw instead of
> python?
Hm, weird. I did (complete file):
from Foundation import *
from AppKit import *
class Delegate(NSObject):
def applicationDidFinishLaunching_(self, sender):
NSLog('DID FINISH LAUNCHING')
NSLog('launching')
app = NSApplication.sharedApplication()
delegate = Delegate.alloc().init()
app.setDelegate_(delegate)
app.run()
and it seemed to work. I think I may have alloc'ed the delegate and
not bound it to a name, so it got GC'ed and then things crashed.
Thanks! Now, to get a window up...
Orestis
|
|
From: Mani G. <ma...@tu...> - 2009-03-16 14:41:57
|
Hi all, I have a user who is unable to start my pyobjc application. I know that he has installed an alternate version of python, for which the "objc" module (among others) is not available. This is why my app is not starting. Is there any way to work around this, either programmatically from my end, or maybe suggesting a modification on the user's system? Thanks! Mani |
|
From: Greg E. <gre...@ca...> - 2009-03-15 22:53:07
|
Orestis Markou wrote: > I've tried to do: > > app = NSApplication.sharedApplication() > app.setDelegate_(delegate) > app.run() > > but things crash soon after. That's strange, because I do something very similar in PyGUI and it seems to work. I've only tested it on 10.4, though. It's possible that things are different in 10.5. Have you tried running it with pythonw instead of python? -- Greg |
|
From: Orestis M. <or...@or...> - 2009-03-15 11:16:55
|
Hello, For the purposes of testing an application, running it in the same process as the tests (ie. as part of a unittest run) is essential. However, for Cocoa applications built with PyObjC built with the XCode templates I haven't found a way to do this. As far as I can understand main.m, all it does is using the Python C API to run main.py. However, when I try to run main.py standalone, things fail because there is no bundle. I've tried to do: app = NSApplication.sharedApplication() app.setDelegate_(delegate) app.run() but things crash soon after. Same if I do AppHelper.runEventLoop(). So my question is: Is there any way from pure python (no main.m, no nib) to get something showing on the screen? I know that without a nib I won't get a proper dock icon or a menu bar, but this is going to be a full screen app and thus these things are not needed. I can cope with bundles, but if there could be no bundles that'd be nice as well. Thanks, Orestis -- or...@or... http://orestis.gr/ |
|
From: Rodrigo G. <tio...@gm...> - 2009-03-15 04:57:09
|
Hi, I am not sure this is the right place for support questions since this is a "dev" mailing list. If not, then I apologize. I am trying the following: ~$ sudo easy_install pyobjc==2.2b1 I see many deprecated warnings in the compiling of Obj-C files and then the first actual error lines are the following: (snippet) Modules/objc/parsexml.m: In function 'handle_constant': Modules/objc/parsexml.m:552: error: 'RTLD_DEFAULT' undeclared (first use in this function) Modules/objc/parsexml.m:552: error: (Each undeclared identifier is reported only once Modules/objc/parsexml.m:552: error: for each function it appears in.) Modules/objc/parsexml.m: In function 'handle_cftype': Modules/objc/parsexml.m:764: error: 'RTLD_DEFAULT' undeclared (first use in this function) Modules/objc/parsexml.m: In function 'handle_function': Modules/objc/parsexml.m:1067: error: 'RTLD_DEFAULT' undeclared (first use in this function) Modules/objc/parsexml.m: In function 'handle_constant': Modules/objc/parsexml.m:552: error: 'RTLD_DEFAULT' undeclared (first use in this function) Modules/objc/parsexml.m:552: error: (Each undeclared identifier is reported only once Modules/objc/parsexml.m:552: error: for each function it appears in.) Modules/objc/parsexml.m: In function 'handle_cftype': Modules/objc/parsexml.m:764: error: 'RTLD_DEFAULT' undeclared (first use in this function) Modules/objc/parsexml.m: In function 'handle_function': Modules/objc/parsexml.m:1067: error: 'RTLD_DEFAULT' undeclared (first use in this function) Some other information about the machine below: ~$ python Python 2.5.1 (r251:54863, Jan 13 2009, 10:26:13) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin ~$ gcc -v gcc version 4.0.1 (Apple Inc. build 5490) ~$ uname -psrv Darwin 9.6.0 Darwin Kernel Version 9.6.0: Mon Nov 24 17:39:01 PST 2008; root:xnu-1228.9.59~1/RELEASE_PPC powerpc I also downloaded the svn sources, but I am not sure how to proceed to compile them. What I tried was to cd trunk/pyobjc/pyobjc and from there run python setup.py install. That gave me the same errors above. Doing the same thing with python2.6 I get a different error message: Processing pyobjc-framework-Quartz-2.2b1.tar.gz Running pyobjc-framework-Quartz-2.2b1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-cF5l70/pyobjc-framework-Quartz-2.2b1/egg-dist-tmp-dUj2iE /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/dist.py:266: UserWarning: Unknown distribution option: 'options' warnings.warn(msg) Modules/_callbacks.m:422: error: syntax error before 'm_CGDataProviderSequentialCallbacks' Any help really appreciated. Cheers, Guerra |
|
From: Matt A. <man...@gm...> - 2009-02-27 21:50:01
|
I have a python property (created with the builtin type "property") named <key> in a class derived from NSObject. Getting and setting the property seem to work just fine with the normal python syntax. Key-value coding ends up calling the getter and setter (as long as there is not a variable named '_<key>'; if there is, it gets set directly without the setter being called). However, if I call willChangeValueForKey_ on that class, with <key> as argument, the lookup fails and valueForUndefinedKey_ is called. Now, functionality-wise, everything seems to go back to working if I also implement `valueForUndefinedKey_`. In this case, it's an exceedingly simple implementation: def valueForUndefinedKey_(self, key): return getattr(self,key) Can anyone shed light on why the lookup for willChangeValueForKey_ fails? Is there any other way of solving this issue other than implementing valueForUndefinedKey_ as I have above? Thanks! Matt |
|
From: Diez B. R. <de...@we...> - 2009-02-23 22:32:59
|
Hi,
after posting here a few weeks ago & finding that py2app didn't work
with XCode-generated PyObjc-projects anymore, I dug deeper and finally
found a solution. No need to use xcode, no need to use some compiled
code, and the ability to develop using an aliased bundle, which makes
turn-around much faster.
Also, you can use a python of your choice, not only the os x
pre-installed one.
This is what you need to do to develop using py2app:
- create a python-cocoa-project using xcode
- rename the main.py to MyProject.py
- place a setup.py in the project-root that looks like this:
---------
"""
Usage:
python setup.py py2app
Append -A to
"""
from setuptools import setup
import subprocess
import os
plist = dict(
CFBundleDocumentTypes=[ # this you need if you have a
document-based app
{
"CFBundleTypeExtensions" :["????"],
"CFBundleTypeIconFile" : "",
"CFBundleTypeName" : "DocumentType",
"CFBundleTypeOSTypes" : ["????"],
"CFBundleTypeRole" : "Editor",
"NSDocumentClass" : "CameraCalibratorDocument",
}
]
)
for base, dirnames, filenames in os.walk(os.getcwd()):
for filename in filenames:
name, ext = os.path.splitext(filename)
if ext == ".xib":
inf = os.path.join(base, filename)
outf = os.path.join(base, "%s.nib" % name)
cmd = ["ibtool", "--errors", "--warnings", "--notices",
"--output-format", "human-readable-text", "--compile", outf, inf]
if subprocess.call(cmd):
raise Exception("ibtool puked.")
setup(
data_files=['English.lproj'],
app=[
dict(script="MyProject.py", plist=plist),
],
install_requires=["pyobjc"],
setup_requires=["py2app"],
)
---------
That's it.
Please be aware that due to the new XIBs & the need to compile them
using ibtool, the changes to them aren't applied immediatly - you need
to re-run the py2app-command. But that's pretty cheap.
Maybe this helps others,
Diez
|
|
From: Michael V. <m.v...@gm...> - 2009-02-23 08:27:03
|
The newer (Leopard) Xcode templates don't use py2app. You can have the module copied to the Resources folder of the app bundle when you build-- add the Growl module to the Resources group/folder in Groups & Files. If the Growl module is a directory, make sure you check the "Create Folder References for any added folders" radio button on the sheet that comes down when you add the files or folder. Then it should get automatically copied to the app bundle. If not, you can drag it to the Copy Bundle Resources build phase manually. Python will look in the app bundle for modules and the like, so you should be good to go. Hope that helps -- again :-) -mv On Sun, Feb 22, 2009 at 3:02 PM, Yi Qiang <yq...@gm...> wrote: > Hi, > Since I got such a great & useful response to my last question, here is > another one :-) > > I am using the python bindings for Growl in my app. > > What is the preferred method of adding this module to my xcode project so > that it gets baked into the .app? > > Looking through the py2app documentation, it has the '--includes' flag > which looks relevant, but I can't figure out where py2app gets run in the > Xcode build phase. > > I'm using the Cocoa Python Document Based Application template. > > Thanks again, > Yi > > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, > CA > -OSBC tackles the biggest issue in open source: Open Sourcing the > Enterprise > -Strategies to boost innovation and cut costs with open source > participation > -Receive a $600 discount off the registration fee with the source code: > SFAD > http://p.sf.net/sfu/XcvMzF8H > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev > > |
|
From: Yi Q. <yq...@gm...> - 2009-02-22 23:02:13
|
Hi, Since I got such a great & useful response to my last question, here is another one :-) I am using the python bindings for Growl in my app. What is the preferred method of adding this module to my xcode project so that it gets baked into the .app? Looking through the py2app documentation, it has the '--includes' flag which looks relevant, but I can't figure out where py2app gets run in the Xcode build phase. I'm using the Cocoa Python Document Based Application template. Thanks again, Yi |
|
From: Yi Q. <yq...@gm...> - 2009-02-22 07:47:19
|
Amazing, thanks. I had no idea that PyObjC's Foundation module would do that for me. Is this documented somewhere On Sat, Feb 21, 2009 at 11:10 PM, Michael VanLandingham <m.v...@gm... > wrote: > If you're using the PyObjC templates from Xcode, and if your objc code and > python code are in the same program/project, you can get to your ObjC > class(es) simply by importing Foundation in the python module -- your class > and methods will be found at runtime via PyObjC's introspection mechanism. > Easy! > > If you're not already using one of the Xcode PyObjC templates for your > project, you could: > a) move your existing python code into a new project based on those > templates, > b) Compile an app containing your classes that will use the Python API to > load and run your python code-- which is pretty much what the 'main.m' file > does in the Xcode PyObjc templates, or > c) compile your classes into a plugin/bundle and use the > objc.loadBundle() method to load that code. > (there are other solutions, but those are the ones that come to mind right > off) > > HTH, > -mv > > On Sat, Feb 21, 2009 at 3:40 PM, Yi Qiang <yq...@gm...> wrote: > >> Hi, >> How do I wrap a single objective-c class so that I can access it from >> python? I looked at the objc documentation and it has information on how to >> extract & wrap classes for a framework, using objc.loadBundle(). However, I >> just have a single class (.m/.h) that I want to be able to access. >> >> Cheers, >> Yi >> >> >> ------------------------------------------------------------------------------ >> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, >> CA >> -OSBC tackles the biggest issue in open source: Open Sourcing the >> Enterprise >> -Strategies to boost innovation and cut costs with open source >> participation >> -Receive a $600 discount off the registration fee with the source code: >> SFAD >> http://p.sf.net/sfu/XcvMzF8H >> _______________________________________________ >> Pyobjc-dev mailing list >> Pyo...@li... >> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev >> >> > |
|
From: Michael V. <m.v...@gm...> - 2009-02-22 07:10:52
|
If you're using the PyObjC templates from Xcode, and if your objc code and python code are in the same program/project, you can get to your ObjC class(es) simply by importing Foundation in the python module -- your class and methods will be found at runtime via PyObjC's introspection mechanism. Easy! If you're not already using one of the Xcode PyObjC templates for your project, you could: a) move your existing python code into a new project based on those templates, b) Compile an app containing your classes that will use the Python API to load and run your python code-- which is pretty much what the 'main.m' file does in the Xcode PyObjc templates, or c) compile your classes into a plugin/bundle and use the objc.loadBundle() method to load that code. (there are other solutions, but those are the ones that come to mind right off) HTH, -mv On Sat, Feb 21, 2009 at 3:40 PM, Yi Qiang <yq...@gm...> wrote: > Hi, > How do I wrap a single objective-c class so that I can access it from > python? I looked at the objc documentation and it has information on how to > extract & wrap classes for a framework, using objc.loadBundle(). However, I > just have a single class (.m/.h) that I want to be able to access. > > Cheers, > Yi > > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, > CA > -OSBC tackles the biggest issue in open source: Open Sourcing the > Enterprise > -Strategies to boost innovation and cut costs with open source > participation > -Receive a $600 discount off the registration fee with the source code: > SFAD > http://p.sf.net/sfu/XcvMzF8H > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev > > |
|
From: Yi Q. <yq...@gm...> - 2009-02-21 23:40:06
|
Hi, How do I wrap a single objective-c class so that I can access it from python? I looked at the objc documentation and it has information on how to extract & wrap classes for a framework, using objc.loadBundle(). However, I just have a single class (.m/.h) that I want to be able to access. Cheers, Yi |
|
From: Matthew A. <man...@gm...> - 2009-02-21 17:40:01
|
I hadn't yet even noticed how using folder references prevented you from adding and deleting their contents until you said it. XCode drives me insane for actually editing the text of a python program though, so I've been using TextMate as external editor 99% of the time anyway. The biggest (but not only) issue is that I really want to see visible (but close in color to the background, so not to be distracting) glyphs for newline and tab characters when I write python code, and the XCode editor doesn't seem to do that very well. The XCode "read-only" problem isn't one in TextMate. XCode is probably a better editor for Objective-C than it is for Python. Too bad about the lack of dependency magic in the XCode templates, but good to know that's how it is. Thanks! Matt On Sat, Feb 21, 2009 at 10:54 AM, Petr Mifek <pet...@an...> wrote: > Hi Mathew, > > I knew about the folder references, but that is no good for my use, because > a Folder reference is "read only" from within the XCode environment. That > is, I can't easily add or delete files it that folder(s) from within the > XCode. So I still have to go with setting it up one-by-one. It is not that > big issue, though I have a feeling that time will come when it'll be (that > time I'll be forced to leave the XCode and handle that myself ;) ). > > The XCode/Xcode's PyObjc templates won't do this for you. That means, you > must locate all your dependencies by yourself and ensure they are located > under the Resources folder in you app bundle (that is the "standard" way to > handle that, there are others though, like listing prerequisites in a README > ;) ). The py2app goes to some great extent to locate dependencies for your > code and include them in the final bundle - but that is not used during the > standard XCode3.x-templates-based application. > > > Cheers, Petr |
|
From: Petr M. <pet...@an...> - 2009-02-21 16:54:56
|
Hi Mathew, I knew about the folder references, but that is no good for my use, because a Folder reference is "read only" from within the XCode environment. That is, I can't easily add or delete files it that folder(s) from within the XCode. So I still have to go with setting it up one-by-one. It is not that big issue, though I have a feeling that time will come when it'll be (that time I'll be forced to leave the XCode and handle that myself ;) ). The XCode/Xcode's PyObjc templates won't do this for you. That means, you must locate all your dependencies by yourself and ensure they are located under the Resources folder in you app bundle (that is the "standard" way to handle that, there are others though, like listing prerequisites in a README ;) ). The py2app goes to some great extent to locate dependencies for your code and include them in the final bundle - but that is not used during the standard XCode3.x-templates-based application. Cheers, Petr Matthew Anderson wrote: > Thanks Petr, > > I think the folder reference trick will work better for my project > than setting up a "copy files" phase to create the directory > structure. Maybe that's the technique you were looking for too. > > As I still have yet to dive into how XCode builds the project, and how > py2app may or may not be used, I wonder how import dependencies for > locally installed modules are dealt with, if at all. Meaning, if I > say, install docutils and use the ReST parser in my program, do I have > to take extra steps to make sure that docutils is copied into the app > to make the program 'stand alone', or is this taken care of > automagically. I guess testing such things would answer the question. > > Matt > > On Fri, Feb 20, 2009 at 3:38 PM, Petr Mifek <Pet...@an...> wrote: >> >> The new XCode templates to my best understanding do not use the "py2app >> method". You are free to use it on your own though, but thats probably a >> different topic. >> > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA > -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise > -Strategies to boost innovation and cut costs with open source participation > -Receive a $600 discount off the registration fee with the source code: SFAD > http://p.sf.net/sfu/XcvMzF8H > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev |
|
From: Matthew A. <man...@gm...> - 2009-02-21 16:24:23
|
Thanks Petr, I think the folder reference trick will work better for my project than setting up a "copy files" phase to create the directory structure. Maybe that's the technique you were looking for too. As I still have yet to dive into how XCode builds the project, and how py2app may or may not be used, I wonder how import dependencies for locally installed modules are dealt with, if at all. Meaning, if I say, install docutils and use the ReST parser in my program, do I have to take extra steps to make sure that docutils is copied into the app to make the program 'stand alone', or is this taken care of automagically. I guess testing such things would answer the question. Matt On Fri, Feb 20, 2009 at 3:38 PM, Petr Mifek <Pet...@an...> wrote: > > > The new XCode templates to my best understanding do not use the "py2app > method". You are free to use it on your own though, but thats probably a > different topic. > |
|
From: Matthew A. <man...@gm...> - 2009-02-21 16:13:09
|
Thank you! I didn't know there was such a thing as a "folder reference". Once I know that, the solution is easy to understand. I think I need to sit down and read all of the XCode guides, and then figure out what the python project templates do *exactly*. Matt On Sat, Feb 21, 2009 at 12:23 AM, Armando Rivera <air...@gm...> wrote: > Hi, Matthew. > > Here are the steps I tried that seemingly work: > > 1 - In Xcode, Right-Click on "Resources" > 2 - Select Add-->Existing Files and select the folder containing your package > 3 - In the ensuing dialog, place a check in "Copy items into > Destination Group's Folder" > 4 - While still in the dialog, make sure "Create Folder References for > any added folder" is selected. > 5 - Click "Add", and your package folder should be created intact > within Resources ready to be accessed. > > Armando. |
|
From: Armando R. <air...@gm...> - 2009-02-21 06:23:24
|
On Fri, Feb 20, 2009 at 4:07 PM, Matthew Anderson wrote: > Hello all, > > I'm working on a PyObjC app in XCode (leopard). I decided to > encapsulate functionality as a python module in my project, like so: > > sourcefile.py > someModule/ > __init__.py > modfile1.py > modfile2.py > > When I tell XCode to build the project, however, all of the files > inside of the "someModule" directory get flattened in the built > applications "Contents/Resources" folder (meaning, "someModule" is > missing entirely and it's contents are placed in "Contents/Resources". Hi, Matthew. Here are the steps I tried that seemingly work: 1 - In Xcode, Right-Click on "Resources" 2 - Select Add-->Existing Files and select the folder containing your package 3 - In the ensuing dialog, place a check in "Copy items into Destination Group's Folder" 4 - While still in the dialog, make sure "Create Folder References for any added folder" is selected. 5 - Click "Add", and your package folder should be created intact within Resources ready to be accessed. Armando. |
|
From: Petr M. <pet...@an...> - 2009-02-20 23:56:22
|
Hi, I got struck by this a while ago, though I don't have a definite answer (read it as I'm not completely satisfied with the state of things as I have it regarding this issue), I'd leave you a hint: - "Groups" in XCode's "Groups & Files" view are not necessarily folders. Groups are just some logical groupings of files done by XCode. You can however make the Group translate to folder by right clicking on it and in "Get info" you can choose a path. This makes it (the folder) for the source code, not the actual app bundle. - tweak the build process under the appropriate target. In the "Groups & Files" unfold Targets and the target you want, and add there a "Copy files" phase. Again with right click and "Get info", you can set the name of the folder under the "Resources" folder in the actual app bundle. The last step (and the one I'm not satisfied with) is to move the appropriate files from the "Copy Bundle Resources" (they are added there automatically) to your "Copy files" phase, or add them there if they were not added to the former phase. The new XCode templates to my best understanding do not use the "py2app method". You are free to use it on your own though, but thats probably a different topic. Also, you can notice that the XCode template actually compiles only 1 ObjectiveC file by default and everything other is just copying, so theoretically you can make some changes in the python code directly in the Resources folder in the app bundle you once built. I had not such a need so far though. Also don't forget the console for the python output for debugging, "hidden" under menu-run-console. Hope this helps. If someone knows how to make XCode to play nicely with some large folder hierarchies better, please let me know. My primary concern is that I can't specify the "Copy files" phase for some root folder to have all the files copied without having to specify that file-by-file. I'd suspect one can do that using some external script during the build phase. Cheers, Petr Matthew Anderson wrote: > Hello all, > > I'm working on a PyObjC app in XCode (leopard). I decided to > encapsulate functionality as a python module in my project, like so: > > sourcefile.py > someModule/ > __init__.py > modfile1.py > modfile2.py > > When I tell XCode to build the project, however, all of the files > inside of the "someModule" directory get flattened in the built > applications "Contents/Resources" folder (meaning, "someModule" is > missing entirely and it's contents are placed in "Contents/Resources". > > Obviously, calling > > import someModule > > in say, "sourcefile.py" doesn't work in such a situation. > > I don't really understand the build process, or how py2app works > (though I'm assuming that it's doing the heavy lifting?), or how to > specify that I wish this directory structure to remain intact in the > resulting app's resources folder. I'm uncertain of where any > documentation might be to help me understand the underpinnings I need > to make this all behave. > > Help, please? > > Thanks a lot! > Matt > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA > -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise > -Strategies to boost innovation and cut costs with open source participation > -Receive a $600 discount off the registration fee with the source code: SFAD > http://p.sf.net/sfu/XcvMzF8H > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev |
|
From: Matthew A. <man...@gm...> - 2009-02-20 21:07:35
|
Hello all,
I'm working on a PyObjC app in XCode (leopard). I decided to
encapsulate functionality as a python module in my project, like so:
sourcefile.py
someModule/
__init__.py
modfile1.py
modfile2.py
When I tell XCode to build the project, however, all of the files
inside of the "someModule" directory get flattened in the built
applications "Contents/Resources" folder (meaning, "someModule" is
missing entirely and it's contents are placed in "Contents/Resources".
Obviously, calling
import someModule
in say, "sourcefile.py" doesn't work in such a situation.
I don't really understand the build process, or how py2app works
(though I'm assuming that it's doing the heavy lifting?), or how to
specify that I wish this directory structure to remain intact in the
resulting app's resources folder. I'm uncertain of where any
documentation might be to help me understand the underpinnings I need
to make this all behave.
Help, please?
Thanks a lot!
Matt
|
|
From: Mani G. <ma...@tu...> - 2009-02-20 18:07:03
|
Interestingly, while developing my simplified implementation, I hit a snag. There's one protocol function to be implemented, a very simple one: 'preferredSyncModeForEntityName:' (http://developer.apple.com/documentation/Cocoa/Reference/ISyncSessionDriverDataSource_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/ISyncSessionDriverDataSource/preferredSyncModeForEntityName: ). It returns an ISyncSessionDriverMode ( http://developer.apple.com/documentation/Cocoa/Reference/SyncServicesFramework/Miscellaneous/SyncServices_Constants/Reference/reference.html#//apple_ref/doc/c_ref/ISyncSessionDriverMode ) which is just an enum value (int). For some reason, it doesn't like my return value, even though I'm simply returning one of the enum values (ISyncSessionDriverModeRefresh). Here is the error: (ValueError: NSInvalidArgumentException - ISyncSessionDriverDataSource <MySyncSource: 0x1f803a0> responded poorly to preferredSyncModeForEntityName: with entity com.apple.contacts.Contact) Any ideas? It's all very straightforward, yet it fails. Source code is attached. Note: this test app syncs with your Address Book data (only first names/last names) and displays the raw data in the window. I've configured the sync settings (see SyncDriverTest.plist) so that it can only pull data. You can change SyncDriverTest.plist so that it retrieves any other data type recognized by sync services, but if you do make sure the entity is listed under "PullOnlyEntities" to protect your data. Cheers, Mani On Thu, Feb 19, 2009 at 10:28 AM, Mani Ghasemlou <ma...@tu...> wrote: > Ok, I'll put together some simplified code and post my results as soon > as I can (might be a couple days). In the meantime, here is the > protocol in question: ISyncSessionDriverDataSource > (http://developer.apple.com/documentation/Cocoa/Reference/ISyncSessionDriverDataSource_Protocol/Reference/Reference.html#//apple_ref/occ/intf/ISyncSessionDriverDataSource) > > Kind regards, > Mani > > On Thu, Feb 19, 2009 at 2:11 AM, Ronald Oussoren <ron...@ma...> wrote: >> >> On 19 Feb, 2009, at 5:16, Mani Ghasemlou wrote: >> >>> Thanks so much. Then, there must be something wrong with my code, >>> because I keep getting a crash when hitting this code. This however >>> rules out that my overall approach is wrong. >> >> Can you reproduce your crash in a smaller program? That would allow us to >> look at the code and could help pintpoint the issue (either something in >> your code or a bug in PyObjC). >> >> Is the method your writing overriding an existing method, or implementing an >> informal protocol? PyObjC cannot deduce the right signature for methods >> with output arguments without that information. An easy way to check if >> that's your problem is to add some decoration[1] to your code that >> explicitly sets the signature: >> >> def returnIntWithError_(self, outError): >> pass # body goes here >> returnIntWithError_ = objc.selector(returnIntWithError_, >> signature='@@:o^@') >> >> Ronald >> >> [1] the reason for this strange formulation is that I wanted to write "a >> decorator", but noticed that the required decorator isn't actually part of >> PyObjC yet. >> >>> >>> >>> Kind regards, >>> Mani >>> >>> On Wed, Feb 18, 2009 at 4:17 PM, Ronald Oussoren <ron...@ma...> >>> wrote: >>>> >>>> Hi, >>>> >>>> You're approach is correct. >>>> >>>>>> def returnIntWithError_(self, outError): >>>>>> myError = NSError.errorWithDomain_code_userInfo_('myDomain', '1', >>>>>> objc.nil) >>>>>> myReturnVal = 1 >>>>>> return myReturnVal, myError >>>>> >>>> >>>> As an optimization you could check if "outError is objc.NULL", if it is >>>> the >>>> caller isn't interested in the error value and you could return >>>> (myReturnVal, objc.NULL) instead of (myReturnVal, myError). That's not >>>> really an issue here, but could help when it is hard to calculate the >>>> value >>>> of the output argument. >>>> >>>> BTW. Use "None" instead of "objc.nil", both have the same value and >>>> "objc.nil" is basicly only present to make it easier to translate ObjC >>>> code >>>> into Python. The same is true for objc.YES and objc.NO, those are aliases >>>> for True and False. >>>> >>>> Ronald >>>> >>>> >>>> On 17 Feb, 2009, at 20:51, Mani Ghasemlou wrote: >>>> >>>>> Just wanted to raise this question again, as I still haven't found a >>>>> solution. >>>>> >>>>> I've posted the same question on Cocoa-dev, also with no response: >>>>> http://www.cocoabuilder.com/archive/message/cocoa/2009/2/2/229316 >>>>> >>>>> Would greatly appreciate any insights! >>>>> >>>>> Kind regards, >>>>> Mani >>>>> >>>>> On Mon, Feb 2, 2009 at 9:34 AM, Mani Ghasemlou <ma...@tu...> wrote: >>>>>> >>>>>> Hi all, >>>>>> >>>>>> From what I understand of the PyObjc documentation, "out" pointer >>>>>> variables (such as "NSError **outError") are actually appended to the >>>>>> list of return values for a bridge function. >>>>>> >>>>>> For example: >>>>>> >>>>>> int returnIntWithError: NSError **outError >>>>>> >>>>>> from Python would be invoked as: >>>>>> >>>>>> returned_int, returned_error = returnIntWithError_(None) >>>>>> >>>>>> I hope that my understanding of the above is correct. >>>>>> >>>>>> Now, my real question is to extend the above concept to the Python >>>>>> side, when we want to implement an informal protocol. Let's say the >>>>>> protocol says that I have to implement the returnIntWithError: >>>>>> function as described above. How do I implement this function? Is the >>>>>> code below enough? >>>>>> >>>>>> def returnIntWithError_(self, outError): >>>>>> myError = NSError.errorWithDomain_code_userInfo_('myDomain', '1', >>>>>> objc.nil) >>>>>> myReturnVal = 1 >>>>>> return myReturnVal, myError >>>>>> >>>>>> Note that I am completely ignoring the "outError" parameter. Does this >>>>>> look kosher? >>>>>> >>>>>> Thanks in advance for any help! >>>>>> >>>>>> Cheers, >>>>>> Mani >>>>>> >>>>> >>>>> >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> Open Source Business Conference (OSBC), March 24-25, 2009, San >>>>> Francisco, >>>>> CA >>>>> -OSBC tackles the biggest issue in open source: Open Sourcing the >>>>> Enterprise >>>>> -Strategies to boost innovation and cut costs with open source >>>>> participation >>>>> -Receive a $600 discount off the registration fee with the source code: >>>>> SFAD >>>>> http://p.sf.net/sfu/XcvMzF8H >>>>> _______________________________________________ >>>>> Pyobjc-dev mailing list >>>>> Pyo...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev >>>> >>>> >> >> > |