Re: [Pythonmac-SIG] Anyone playing with CoreAnimation yet?
Hi Jack, I'm very interested, but have not had time to dig into CoreAnimation yet. I would definitely like to hear your experiences with it, and will share mine when my current project is wrapped up. --Dethe On 20-Nov-07, at 3:50 AM, Jack Jansen wrote: I've just realised how powerful CoreAnimation is, and I want to start playing with it, especially with the interaction of CoreAnimation CALayer with classic AppKit views and how to treat events, etc. Is anyone else here using it, and/or interested in sharing experience? -- Jack Jansen, [EMAIL PROTECTED], http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Problem with numpy on Leopard
On Nov 5, 2007 10:10 AM, Ronald Oussoren [EMAIL PROTECTED] wrote: That's partially because there's a large set of developers that only test on Linux and then assume code will work everywhere :-/ I'm guilty of that in reverse. I only test on OS X and let Linux users fend for themselves until they get a sane packaging system like frameworks and bundles. ;-) --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Python control/integration of a Cocoa/Quicktime application?
On 11/2/07, Darran Edmundson [EMAIL PROTECTED] wrote: Now that we have a proof-of-concept Objective-C framework, I'm trying to port a simple test application to python. Keep in mind that I didn't write either of these. I'm a complete neophyte in terms of Mac development and ObjectiveC; all I have going for me is a lot of python experience on Windows. Issues I'm having: - In a terminal, 'python' still gives me Apple's native 2.3 rather than MacPython 2.4. Do I uninstall Apple's version or simply ensure that the MacPython version comes earlier in the system path? Just make sure python2.5 comes earlier in your path. Never uninstall Apple's version--your computer uses it for system operations. - The pyObjC online docs discuss XCode templates and a distutils approach. Is the latter deprecated, or still a reasonable approach? I would use the distutils (actually, I think it is setuptools now) approach. The XCode templates have been fixed in Leopard (or so I have heard), but I don't think they were very helpful in Tiger. You can easy_install setuptools and py2app. Below is a bare-bones setup.py that you can customize by replacing variables with the word YOUR in them. Sorry about the over-abundance of ALL CAPS. I have this set up so I can re-use it quickly, so there are a bunch of semi-constants I use in all caps, then I added more for your customization. Let me know if it is confusing. ''' Minimal setup.py example, run with: % python setup.py py2app ''' from distutils.core import setup import py2app NAME = 'YOUR_APP_NAME' SCRIPT = 'YOUR_PYTHON_SCRIPT.py' VERSION = 'YOUR_VERSION' ICON = '' ID = 'A_UNIQUE_STRING COPYRIGHT = 'Copyright 2007 YOUR_NAME' DATA_FILES = ['English.lproj'] # This is needed if you use nib files to define your UI plist = dict( CFBundleIconFile= ICON, CFBundleName= NAME, CFBundleShortVersionString = ' '.join([NAME, VERSION]), CFBundleGetInfoString = NAME, CFBundleExecutable = NAME, CFBundleIdentifier = 'org.YOUR_DOMAIN.examples.%s' % ID, NSHumanReadableCopyright= COPYRIGHT ) app_data = dict(script=SCRIPT, plist=plist) py2app_opt = dict(frameworks=['YOUR_FRAMEWORK_HERE.framework'],) options = dict(py2app=py2app_opt,) setup( data_files = DATA_FILES, app = [app_data], options = options, ) ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Python control/integration of a Cocoa/Quicktime application?
On 11/2/07, Darran Edmundson [EMAIL PROTECTED] wrote: The bare minimum you need is: import objc objc.loadBundle('MyBundle', globals(), bundle_path='/my/bundle/path/MyBundle.framework') One more thing. While the above is a bare minimum from the command line or to work with the framework locally, you'll need a skintch more to get the file paths to work when the framework is packaged into your application bundle. Below is an example I use to package Tim Omernick's CocoaSequenceGrabber framework, and it works both from the command line and in the app bundle. I have this saved as PySight/__init__.py and can then use all the framework objects and methods by simply importing PySight in my project. Again, if any of this is not clear, or you're not sure how to customize this to your project, just let me know. import objc, AppKit, Foundation, os if 'site-packages.zip' in __file__: base_path = os.path.join(os.path.dirname(os.getcwd()), 'Frameworks') else: base_path = '/Library/Frameworks' bundle_path = os.path.abspath(os.path.join(base_path, 'CocoaSequenceGrabber.fram ework')) objc.loadBundle('CocoaSequenceGrabber', globals(), bundle_path=bundle_path) del objc, AppKit, Foundation, os, base_path, bundle_path --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Python control/integration of a Cocoa/Quicktime application?
If you write an Objective-C framework, the python code to wrap it using PyObjC is very short. Here is an example I use to expose Tim Omernick's CocoaSequenceGrabber framework to capture images from the iSight camera: example import objc, AppKit, Foundation, os if 'site-packages.zip' in __file__: base_path = os.path.join(os.path.dirname(os.getcwd()), 'Frameworks') else: base_path = '/Library/Frameworks' bundle_path = os.path.abspath(os.path.join(base_path, 'CocoaSequenceGrabber.fram ework')) objc.loadBundle('CocoaSequenceGrabber', globals(), bundle_path=bundle_path) del objc, AppKit, Foundation, os, base_path, bundle_path /example I have that saved as PySight/__init__.py so I can import * from PySight to get all the objects and methods from the framework. It would be shorter, but I have some path manipulation so that it works from the command line and from within an application bundle built with py2app. The bare minimum you need is: import objc objc.loadBundle('MyBundle', globals(), bundle_path='/my/bundle/path/MyBundle.framework') Writing a bundle in Python that can be imported by an Objective-C application is similarly easy. I have some blog posts on that topic if you ever decide to try that direction. The application just needs to take Objective-C bundles as plugins, it does not have to plan for, or even know about, Python in the bundle implementation. HTH --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] ctypes and OS X CF types?
On 10/22/07, Bill Janssen [EMAIL PROTECTED] wrote: CoreFoundation is C, not C++. That said, it'd probably be easier to use PyObjC with NSMetadataQuery instead. Unfortunately, the Objective-C API is not as functional. Another option is to write the C wrapper in Objective-C (or find a third-party framework that already offers the functionality you want), then write a wrapper to expose it to Python using PyObjC. I've had success with this for using Quicktime features not exposed by Cocoa (I found a third-party library) and the Python wrapper is about three lines of boilerplate code, if I recall correctly. For cross-platform stuff, ctypes is probably the way to go. But if you're targeting OS X anyway, the PyObjC approach has worked well for me. --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] easygui
Hi Rafael, I'm not familiar with EasyGUI, but it uses Tkinter, which I try to avoid on the Mac. If you need an easy way to create GUIs and you're OK with it being Mac-specific, then I'd recommend using Interface Builder (comes with the free OS X developer tools) to create your GUI and PyObjC to write the application in Python. If you need cross-platform GUIs, that won't work, but for the Mac it is the best choice. If you have problems with any of that, I can give more pointers, but for starters: http://developers.apple.com/ for developer tools and Interface Builder docs (requires free account to download latest developer tools) http://pyobjc.sf.net/ for PyObjC, the Python/Objective-C bridge (gives you access to all of Apple's Cocoa libraries from Python) HTH --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] python program in menu bar
Hi Dan, On 10/1/07, Dan Christensen [EMAIL PROTECTED] wrote: Another question: is there a way I can make an LED on my MacBook Pro flash? My program is a mail notifier, and I'd like to know when I have new mail without unblanking my screen, something I'm used to with xbuffy under linux. The LEDs I'm thinking of are the caplocks light, the light to the left of the latch for the lid, and the LED on the power connector, but if there's another I haven't thought of that would be fine too. A google search didn't turn anything up... I agree that would be cool to do, but I don't know how to do it. Does anyone else here know how to blink the LEDs on a MacBook? --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] python program in menu bar
Dan wrote: Thanks so much for that. It was quite easy to adapt it to my needs, even though I don't understand the Cocoa side of the code. A few questions: Glad it helped. I recommend getting familiar with the Cocoa libraries, they are quite rich, and PyObjC makes it very easy to experiment. The AppKiDo application makes it very easy to browse and search the documentation. 1) I noticed that my code runs fine directly from the shell prompt, so I'm curious what the advantage of making a real .app is. I guess this would allow me to add the program as a Startup Item. (Or can one run any command as a Startup Item?) Making it a real application makes it double-clickable from the Finder and may make it behave better with other Cocoa applications. You will see your application's name when you switch to it, rather than Python. And I think Startup Items are expected to be .app applications, although I wouldn't swear to it. It's relatively easy to make it a .app with py2app, and good practice for when you develop a killer app that you want to distribute far and wide. 2) It is easy to change the colour of the title text that appears in the menu bar? It should be. I'm borrowing my wife's computer right now (mine was stolen recently) so I don't actually have the docs handy, but it should be easy to figure out. I think NSAttributedString is the relevant class to start with. 3) Is it easy to generate a beep of some sort? NSBeep is your friend. I plan to look over some of the PyObjC documentation and examples, and I apologize if some of this is answered there. Thanks again for pointing out your code to me, as it is almost exactly what I was looking for! All of it is answerd in the Cocoa docs, but the hard part is knowing where to start. I hope I've been able to give you some good starting points. I'm glad the code example was helpful. One of these days I'm going to get my weblog working again, and I'll post it as a tutorial. --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] python program in menu bar
Hi Dan, On 9/26/07, Dan Christensen [EMAIL PROTECTED] wrote: Can anyone point to a simple example of a python program that runs in the menu bar? I'd like a program that just displays a few characters of text in the menu bar, and updates the display once a minute or so. The first thing to figure out is that Apple calls an app that can live in the menu bar NSStatusItem. Knowing that makes it a LOT easier to find documentation for writing them. I highly recommend getting a copy of AppKiDo to browse the Cocoa docs, if you don't already have it. I posted a very simple example of getting an NSStatusItem using PyObjC on this list awhile back: http://mail.python.org/pipermail/pythonmac-sig/2005-April/013731.html Let me know if it helps, or if you need more help getting going. --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] 64-bit code
On 17-Jun-07, at 9:26 AM, Ronald Oussoren wrote: Speaking of PyObjC: I'm working on a new major release of PyObjC. The code is not yet available in the public repository because I'm targetting Leopard (with a backward compatibility layer for Tiger and Panther) and didn't want to have to think too much about which parts of the code are covered by the Leopard NDA. I'll starting writing more about this in the near future, but let me say I'm really excited about the enhancements in the 2.0 tree. Ronald That's good to hear. I'm very excited about Leopard, which in many ways seems to be for developers more than for end users. I suspected that the quiet on the PyObjC front may have had to do with Leopard development, but it's nice to have confirmation of that. I can hardly wait. --Dethe It goes against the grain of modern education to teach children to program. What fun is there in making plans, acquiring discipline in organizing thoughts, devoting attention to detail and learning to be self-critical? --Alan Perlis ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Accessibility question
Hi Rafael, I am a blind Mac user, in the process of learning python on the Mac. I use VoiceOver, a utility included with Tiger, to read, and to interact with screen elements (e.g., icons, text boxes, etc.). My reason for posting to this list is to ask if there is a native, cocoa GUI toolkit written in python. VoiceOver cannot interact with carbon applications,, so I don't think that I can use WXPython or python card to build GUIs. Yes indeed. The best way to create Mac applications is using the PyObjC toolkit (http://pyobjc.sourceforge.net/) which lets you create the interface using Interface Builder (which comes with the OS X developer tools) and write the application code in Python, but still interact with all of the Cocoa classes. There are tutorials on the PyObjC website. It is what I generally use for GUI applications. You can then build them using py2app to get a standard Mac application and there is no visible sign that your application is written in Python. I hope that helps. If you have further questions about getting these tools installed or set-up, or where to get started using them, don't hesitate to ask. Kind regards, --Dethe http://livingcode.org/ ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] accessing iPhoto star rating through appscript?
On 19-Apr-07, at 2:13 AM, Simon Brunning wrote: Err, that's iTunes. The OP wanted iPhoto. Oops. Sorry 'bout that. My bad. There are a couple of differences besides file names. All the images appear to have a default rating of 0 and images have Captions rather than Names. Also, rating go from 0 to 5 rather than 0 to 100, so you don't have to divide to get stars. library = plistlib.readPlist(os.path.expanduser('~/Pictures/ iPhoto Library/AlbumData.xml')) for photo in library['Master Image List'].values(): if hasattr(photo, 'Rating') and photo.Rating 0: print '%s: %d stars' % (photo.Caption, photo.Rating) How's that? --Dete I can't watch television without praying for nuclear holocaust. -- Bill Hicks ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] accessing iPhoto star rating through appscript?
On 18-Apr-07, at 2:14 PM, Daniel Thorpe wrote: Hi everyone... Does anyone know if it's possible to access the star rating of a photo from iPhoto using appscript? After looking in the iPhoto dictionary and not seeng any reference to it, I have a feeling it is not exposed through AppleScript. If anyone has found a way to get the number of stars, I'd love to know! You don't strictly need AppleScript for this (unless you want data that has been changed since iTunes was last started, while it is running). The ratings are stored in an XML file: ~/Music/iTunes/ iTunes Music Library.xml It's in plist format, so you can use plistlib (part of the standard library on OS X), or you can use the XML tool of your choice to parse the file and extract the ratings. Each track has a dict element containing keys and values. You'll be looking for keyRating/key followed by integer100/integer where the integer corresponds to the star rating. The rating appears to be 20 * # of stars (5 stars = 100, 4 stars = 80, etc.) Tracks which are not rated don't appear to have a Ratings key, so don't make assumptions about every song having that key. HTH --Dethe A miracle, even if it's a lousy miracle, is still a miracle. --Teller ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Macintosh modules/Carbon/documentation
On 30-Mar-07, at 4:49 PM, Jack Jansen wrote: Carbon itself should be fine. It is indeed undocumented within the Python documentation, but the transformation from the official Apple C documentation is pretty clear (I think). Is there anywhere that this mapping is specified? I've always avoided the Mac and Carbon libraries because I had no idea where to begin with them, what was covered, and what I could expect to work. Having any kind of a starting point would be an improvement. --Dethe We must be careful not to build a world we don't want to live in. -- Stu Card ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] How to make 2 scripts in one application
On 5-Mar-07, at 4:45 AM, Chris Van Bael wrote: Hi all, doesn't anybody have an idea on how to solve this issue? Sorry, didn't see your original post. You can address the python instance in the application bundle (which will use the modules in the application bundle), but I think you'll need to know the path the the application. If the application will always be in /Applications/ then you're good to go, otherwise you'll need to have another way to find the Application location (there are several, how you do this depends on several things I don't know about your deployment environment). For instance, I have an application named Drawing Board in my / Applications directory, that was build using py2app. I can invoke the python embedded in it with the path: /Applications/Drawing\ Board.app/Contents/MacOS/python So if my script starts with #!/Applications/Drawing\ Board.app/Contents/MacOS/python then it will run using that version of Python by default and have access to any libraries I've included with my application. Does that answer your question? --Dethe Thanks, Chris On 2/27/07, Chris Van Bael [EMAIL PROTECTED] wrote: Hi all, Maybe a totally noob question, but I'll ask it anyway since I couldn't find an answer on the series of tubes... I'm working on a pygame program that runs on Linux, Windows and Mac. It uses an database which it accesses through SQLAlchemy. So on Linux in setup.py we have a section to install the program and create that database. Now on Windows with py2exe I have a setup.py which has a console and a windows script. The windows script runs the program and the console script sets up the database. Since I use no library.zip file, this can also access the SQLAlchemy modules. Now I want to do something similar to that for OSX. I cannot run the script with the python installed on OSX because it needs SQLAlchemy. But the modules I need are somewhere in the application bundle, can I use them somehow? Greets, Chris ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig Things fall apart. The Centre cannot hold. -- W. B. Yeats ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] pyObjC and Plugins
Hi Steve, My first thought was to make sure that you were getting the python you just build when you type python at the command-line. I've had problems like this before when I had the wrong python in my Path. Then I thought, what if the problem is with the example code? I know I've built that example in the past--I have it running and just used the code yesterday to figure out how to set environmental variables globally in OS X for a friend. So I tried building and installing it, and I got the same problem you did. I haven't had a chance to pore over the log files or svn blame yet, but I would recommend a) trying a different example, and b) looking through the svn history to see what has changed recently in the EnvironmentalPrefs code. The only really recent change was when Ronald added a bundle identifier, but reverting to an version before that has the same problem so the change must be earlier. I have to get the kids (and myself) ready for the day, but I'll check in later if I figure anything else out. --Dethe On 1-Mar-07, at 2:48 AM, Steve Freitas wrote: Hi Dethe, I attempted it again and unfortunately got the same error. I actually decided to do a fresh 10.4.8 install, did Xcode, Python 2.5 and setuptools 0.6c5. I installed PyObjC 1.4 from source (the stable download off the website), and told it to skip installing py2app. I then used easy_setup to install py2app==dev, which this time took care of all the dependencies, though I think it didn't take those from dev. Did python setup.py py2app to the example, copied the result out of dist/ to ~/Library/PreferencePanes, clicked on it and it died with: = Thursday, March 1, 2007 2:45:39 AM US/Pacific = 2007-03-01 02:45:41.627 System Preferences[1880] [NSPrefPaneBundle instantiatePrefPaneObject] (/Users/steve/Library/PreferencePanes/Shell Environment.prefPane): principalClass is nil. If you have any further ideas, I'd love to hear 'em. Thanks, Steve It's like I'm living my own version of the Singularity. I both revel in it and am scared by it. I want to figure out how to crawl into a moment and expand it out so that I can fully experience it, but at the same time know that the rapid flow of events makes it's own experience. ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] pyObjC and Plugins
Hmmm, I think I must have been a few revs behind. When I svn up'd to HEAD and tried again it built and loaded. Here's my setup: macholib-1.1-py2.5.egg modulegraph-0.7-py2.5.egg py2app-0.3.6.dev_r53-py2.5.egg setuptools-0.6c3-py2.5.egg bdist_mpkg-0.4.2-py2.5.egg pyobjc-1.4.1a0 Python 2.5 OS X (10.4.8) Intel example built from latest pyobjc svn. HTH --Dethe On 1-Mar-07, at 2:48 AM, Steve Freitas wrote: Hi Dethe, I attempted it again and unfortunately got the same error. I actually decided to do a fresh 10.4.8 install, did Xcode, Python 2.5 and setuptools 0.6c5. I installed PyObjC 1.4 from source (the stable download off the website), and told it to skip installing py2app. I then used easy_setup to install py2app==dev, which this time took care of all the dependencies, though I think it didn't take those from dev. Did python setup.py py2app to the example, copied the result out of dist/ to ~/Library/PreferencePanes, clicked on it and it died with: = Thursday, March 1, 2007 2:45:39 AM US/Pacific = 2007-03-01 02:45:41.627 System Preferences[1880] [NSPrefPaneBundle instantiatePrefPaneObject] (/Users/steve/Library/PreferencePanes/Shell Environment.prefPane): principalClass is nil. If you have any further ideas, I'd love to hear 'em. Thanks, Steve No lesson seems to be so deeply inculcated by experience of life as that you should never trust experts. If you believe doctors, nothing is wholesome; if you believe theologians, nothing is innocent; if you believe soldiers, nothing is safe. --Lord Salisbury, 19th century British prime minister ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Dock menu
On 1-Mar-07, at 5:36 AM, Amrit Jassal wrote: I have a static dock menu created with Interface Builder (cocoa). Works great. I now have a requirement to add/remove items for this menu at run- time or enable/disable menu items at run-time. I cannot find a way to get a handle to the dock menu at run-time to get at the menu items that I want to enable/disable. Can I somehow get a reference to menu objects (NSMenu) at run-time? Sure, there are several ways. Your menu should already be hooked up to the NSApplication outlet dockMenu in Interface Builder. In theory you should be able to get a reference using NSApp().dockMenu(), but that doesn't appear to work. You could subclass NSApplication to add another outlet that behaves normally and gives you access to the menu. You could probably extract the menu from the Nib file, but that's beyond what I can explain in an email. Or I cannot wire up the menu using IB and need to create the menu at run-time myself? That's certainly an option. I'm not sure why the dockMenu outlet is not exposed in the API. There is an (undocumented) NSApp ().setDockMenu_(my_menu) call in AppKit, but no corresponding .dockMenu() unfortunately. You can either use the setDockMenu, or if your application delegate returns a menu from applicationDockMenu_(application) that menu will be used, over-riding any menu set in Interface Builder. HTH --Dethe You need to lay out the user interface components visually, by hand, with total control over where they go. Automated LayoutManagers don’t cut it. A corollary of this is that you can’t move a UI layout from one platform to another and have the computer make everything fit. Computers don’t lay out interfaces by themselves any better than they can translate French to English by themselves. -- Jens Alfke ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] pyObjC and Plugins
Hi Steve, At some point py2app went from being bundled as part of PyObjC to being a separate install. I think at that time there was a requirement to uninstall the old py2app before installing the new one. I don't guarantee that is the solution to the problem you're having, but it's a possibility (your problem sounds very much like what I was facing, and this fixed it for me). Instructions for uninstalling (and reinstalling) py2app are here: http://svn.pythonmac.org/py2app/py2app/trunk/doc/ index.html#uninstalling-py2app-0-2-x-or-earlier Also, while it may help to remove older versions of and altgraph, bdist_mpkg, macholib, modulegraph, I'm pretty sure you don't have to install them explicitly. They should come along as part of the py2app install, if I recall correctly. The link above is to the py2app docs, so you should be able to find all the info there. Good luck, and let us know how it goes! --Dethe On 28-Feb-07, at 10:11 PM, Steve Freitas wrote: Hi all, I've spent all evening unsuccessfully trying to get the EnvironmentPrefs plugin working on my setup, and I hope you can help. I keep getting this: 2007-02-28 21:56:58.918 System Preferences[522] *** -[NSBundle load]: Error loading code /Users/steve/Library/PreferencePanes/Shell Environment.prefPane/Contents/MacOS/Shell Environment for bundle /Users/steve/Library/PreferencePanes/Shell Environment.prefPane, error code 2 (link edit error code 0, error number 0 ()) 2007-02-28 21:56:58.918 System Preferences[522] [NSPrefPaneBundle instantiatePrefPaneObject] (/Users/steve/Library/PreferencePanes/Shell Environment.prefPane): principalClass is nil. I found this earlier thread... http://mail.python.org/pipermail/pythonmac-sig//2006-October/ 018298.html ...in which apparently upgrading to a later version of py2app fixed by Ronald Oussoren did the trick. However, doing the same hasn't fixed it for me, and I'm guessing in the flurry of reinstallations I left something out. I installed Python 2.5 from Python.org on a fresh install of 10.4.8. I installed, from source, pyObjC 1.4. I did easy_install [module] ==dev for altgraph, bdist_mpkg, macholib, modulegraph and py2app. print altgraph.__version__, bdist_mpkg.__version__, \ macholib.__version__, modulegraph.__version__, py2app.__version__ 0.6.8 0.4.2 1.2 0.7.1 0.3.6 Now, I did a lot of uninstallation and reinstallation of all of these pieces, and it's possible something from an old install is still hanging around, since my uninstallation technique consisted of rm -Rf. However, I'm not yet ready to try a fresh 10.4.8 installation again without someone telling me that's the only way. At various points in my console I also got the ImportError: No module named linecache, but not on every attempt -- I'm not sure why. I've been careful to close and reopen System Preferences between each attempt, and I delete build/ and dist/ in the EnvironmentPrefs dir as well. If anyone could suggest something, I'd sure appreciate it. Thanks! Steve ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig Everyone has gotten so hung up on the legality of this they've forgotten the ethics. --Paul Saffo, on the H-P Scandal ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Multiple python 2.5 framworks
If you build an actual OS X application using py2app, it will embed the Python2.5 framework into the app with no conflict. I have many full python2.5 frameworks installed, from various applications I have built this way, as well as MacPorts and fink (non-framework) versions. I make sure my path points to my standard framework install and that is not picked up by any application I've built with other frameworks, including those which may include special-built frameworks, or older versions of Python. If you are not using py2app to build your applications, then your mileage may vary, but you can still easily have multiple framework installs. Just make sure that each application is referencing the right framework. How you do that depends on how the applications are run. But I strongly recommend that you use py2app for anything you distribute to users: They then have no path dependencies and don't have to build anything, just drag your application to their / Applications folder and they're done. --Dethe On 7-Feb-07, at 10:22 AM, Brian Granger wrote: Hi, We need to deploy a qt4 based python app and I am working on some of the build issues. Because we are using Qt, we need a framework build of Python (we are using 2.5). One of our requirements is that users can build and use the app without doing a system wide install. I am worried that our private python2.5 framework will conflict with the system wide python2.5 framework if it is installed. Can two python2.5 frameworks coexist on the same system. What are the potential issues and pitfalls? I can set the users paths to point to our python. I am mostly worried about building other python packages (using distutils) that we include in our app. How can I be sure that the various build processes won't pick up the system wide python2.5 framework? Thanks Brian ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig Young children play in a way that is strikingly similar to the way scientists work --Busytown News ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Opening an app from another app under different OS X versions
On 25-Jan-07, at 12:08 AM, Ronald Oussoren wrote: On 24 Jan, 2007, at 18:44, Dethe Elza wrote: Also, paths are different on internationalized versions of OS X. The aren't AFAIK. The finder is localized and shows different folder names if you run in another language (that's why there are .localized turds in several directories). Windows is the OS where directory names actually do change depending on the language you install it in. The OSX implementation actually makes it possible to have several accounts with different languages and have them all see their localized version of folder names. Cool, I didn't know that. I'm pretty sure older versions of Mac OS (pre-OS X) *did* work that way--you had to use symbolic constants to refer to known folders and not count on the exact file paths. That said, using fully-qualified paths can still be fragile, since users may move things around when you least expect it. --Dethe There's a little bit of God in every truck driver and a little bit of truck driver in every God. -- Blayne Horner ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Opening an app from another app under different OS X versions
As Kevin said, you may only need the full path to your app. It's remotely possible you would need the full path to open as well (/usr/ bin/open). Full paths are finicky though, and you will need to know where your application is installed, if the help application is in the app bundle, for instance. Also, paths are different on internationalized versions of OS X. The right way is probably to use PyObjC and the NSWorkspace object: from AppKit import NSWorkspace NSWorkspace.sharedWorkspace.launchApplication_('MyApp') For more on Workspace services, there is this article: file:/// Developer/ADC%20Reference%20Library/documentation/Cocoa/Conceptual/ Workspace/index.html Also, when you're launching an app with open, you don't need the -a flag, but without it you do need the path to the application. --Dethe You need to lay out the user interface components visually, by hand, with total control over where they go. Automated LayoutManagers don’t cut it. A corollary of this is that you can’t move a UI layout from one platform to another and have the computer make everything fit. Computers don’t lay out interfaces by themselves any better than they can translate French to English by themselves. -- Jens Alfke ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Opening an app from another app under different OSX versions
On 24-Jan-07, at 10:13 AM, David Woods wrote: Adding the path didn't help. Calling open -a TransanaHelp.app from the command line finds the app, and adding the full path makes is start a bit faster. But when the same call is made from within my bundled Python program (regardless of whether the path is included), I see the following in the console: 'import site' failed; use -v for traceback Traceback (most recent call last): File /Applications/Transana_2/TransanaHelp.app/Contents/MacOS/ TransanaHelp, line 3, in ? import sys, os ImportError: No module named os So it seems, if I'm interpreting this right, like Python's not able to find its own modules under this particular scenario. Line 3 of TransanaHelp.py, by the way, is not the import statement shown here. That line 3 is of some internal Python routine that's not part of my code. I had a problem like this when first moving from distutils-based setup files to setuptools-based setup files. Getting the latest version of py2app may help. --Dethe Copyrights may have been an efficient mechanism to support creative and artistic work in the middle ages, but they don’t work very well in the Internet Age. --Dean Baker ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Question on Python 2.5 and CoreGraphics
CoreGraphics wrapped by Apple using the built-in Python (Python 2.3 in Tiger). The binding itself is binary and proprietary, so it can only be used with the built-in Python. NodeBox, which appears to be a clone of DrawBot (which was inspired by Processing, etc.) has a library for CoreImage. Robert Kern wrote a wrapper for CoreGraphics which is part of Kiva (http://code.enthought.com/kiva/). He split it off as a standalone package, but the URL I have for that no longer works (problems at Starship Python). I have a copy of an early version (version 0.0.0) which I can send you if you like. I believe it uses Pyrex to build the extension. HTH --Dethe On 7-Jan-07, at 10:39 AM, Robert Love wrote: Back in 2005 I had a python script that did some simple image manipulation with CoreGraphics. Since then I have upgraded to python 2.5 and the script no longer works. I think you all tried to explain this to me when I upgraded but didn't follow what was being said. I'm running a PPC machine with 10.4. which python /Library/Frameworks/Python.framework/Versions/Current/bin/python and ls -l /Library/Frameworks/Python.framework/Versions/Current/bin/ python lrwxr-xr-x 1 root admin 9 Sep 22 23:58 /Library/Frameworks/ Python.framework/Versions/Current/bin/python - python2.5 running the script python mine.py arguments Traceback (most recent call last): File mine.py, line 8, in module from CoreGraphics import * ImportError: No module named CoreGraphics If I use python2.3 mine.py arguments it works as expected. which python2.3 /usr/bin/python2.3 Is there a way to use CoreGraphics with python 2.5? Do I need to install more? Link libraries? ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig There's a little bit of God in every truck driver and a little bit of truck driver in every God. -- Blayne Horner ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] controlling iTunes with appscript
On 4-Dec-06, at 8:00 AM, Craig Amundsen wrote: I've tried that. I'm trying to move my library from one external Firewire drive to an external RAID1 setup. Doing the consolidate moved about 10% of the files and then crapped out with an error that said something about being able to read/write a drive. Repeated attempts to consolidate the library now die with the read/write error immediately. I don't think it's a problem with either drive since I can read and write from both of them. It may be that RAID is too slow to keep up with whatever iTunes is trying to do. I was hoping I could do a manual copy and then update all the locations via appscript. This having the advantage of allowing me to preserve metadata. I guess it's time to forget about the metadata since I'm not going to do the one-at-a-time location update from within iTunes. Can you set the metadata from AppScript? I'm assuming you can, but haven't been following this thread that closely. You could try backing up your iTunes/iTunes Music Library.xml file and write a script to parse it and set the metadata on your files once you've moved them. It looks like a standard plist file, so you can use the python plist library to do the parsing. I'm sure the unique Track ID will be different, but you could key off artist + title + size and reset the other information (play counts, rating, etc.). I'm pretty sure iTunes reads this file on startup to set up its internal database, but I don't have time to test this theory right now. If that doesn't work, there still may be value in thinking outside the AppScript box. --Dethe Windows has detected the mouse has moved. Please restart your system for changes to take effect. ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Building plugins with py2app
On 15-Oct-06, at 9:26 AM, Ronald Oussoren wrote: I've done a clean install of python, py2app, PyObjC and related packages and can now reproduce your problem. Thanks so much! I hope I've also fixed the problem in revision 47 of py2app. It turns out the app stub and bundle stub use a slightly different way to setup the python environment, which means the right python path must be set in the Info.plist for plugins but not for applications. That did it, it's working beautifully now. Setting up the right environment for plugins is also very hard, if not impossible to do completely correct: cpython just isn't designed for having several completely seperate interpreters in one application (and no, Py_NewInterpreter/Py_EndInterpreter don't count). Different plugin bundles with py2app will share part of the environment, such as having a shared sys.path. So does that mean that I shouldn't run two Python plugins in the same program, or that I need to be careful that they have the same dependencies, or that the first contains all the dependencies of subsequent plugins, or what? I'm just trying to understand here. Ronald Thanks again for taking the time to fix this. --Dethe Computers are beyond dumb, they're mind-numbingly stupid. They're hostile, rigid, capricious, and unforgiving. They're impossibly demanding and they never learn anything. -- John R. Levine ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Building plugins with py2app
On 15-Oct-06, at 1:07 PM, Ronald Oussoren wrote: Ok, nice to hear that. PyObjC has changed my life for the better, and I'm still just scratching the surface. The hard part is that I've become dependent on it, so when something doesn't work, everything I'm doing comes to a screeching halt. I can't tell you how much I appreciate your quick responses in those cases. If you have two python plugins for the same program they should at the very least use the same version of python, using different versions of python may or may not work. OK, I generally rebuild my plugins with the latest versions of everything anyway, but good to know. I'd have to study the plugin main code to be absolutely sure, but AFAIK if plugins A and B both depend on package C they should depend on the same version of C because at runtime they will both use the version that's included in whichever of the plugins was loaded first. That shouldn't be a problem. If you can arrange for one of the plugins to be loaded first it would be useful to have that plugin include the Python framework and large extensions (like PyObjC). That way other plugins can stay very small and you don't get confusion on what gets loaded. Have you seen SIMBL? It's an input manager that loads plugins, so you can load arbitrary code into an existing application (kind of a gross hack, I know, but terribly useful when code injection wasn't working on Intel). The neat thing about it is how it is configured to only load plugins for certain applications, and only for specified versions of those applications. Having a meta-plugin for Python that did something similar would be cool. I think there is something like that for Quicksilver, but it would be nice to generalize for other plugins. Someday, in all my copious free time, I may even attempt it myself. %-) Ronald Thanks again! --Dethe the city carries such a cargo of pathos and longing that daily life there vaccinates us against revelation -- Pain Not Bread, The Rise and Fall of Human Breath ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Building plugins with py2app
On 12-Oct-06, at 10:44 PM, Ronald Oussoren wrote: Reverting to an older version should work as well, with the caveat that the latest pre-setuptools version of py2app has some problems w.r.t. universal binaries (which is why Bob switched to the current version). OK, well I need universal binaries, so I'll try to move forward rather than backward. I'm going to do a fresh install of Python, PyObjC and py2app to see if that helps to find the problem, but don't have time to do so today. I appreciate the time you've put into this. One thing that you could try: insert 'import sys; print sys.path' at the top of __boot__.py (in the Resources directory of the saver) to see the value of sys.path. That value seems to be wrong. This is a very good clue. Here is the sys.path from a working application built with the same version(s) of all the tools: '/Users/delza/sampleapp/dist/sample.app/Contents/Resources', '/Users/ delza/sampleapp/dist/sample.app/Contents/Resources', '/Users/delza/ sampleapp/dist/sample.app/Contents/Resources/lib/python24.zip', '/ Users/delza/sampleapp/dist/sample.app/Contents/Resources/lib/ python2.4', '/Users/delza/sampleapp/dist/sample.app/Contents/ Resources/lib/python2.4/plat-darwin', '/Users/delza/sampleapp/dist/ sample.app/Contents/Resources/lib/python2.4/plat-mac', '/Users/delza/ sampleapp/dist/sample.app/Contents/Resources/lib/python2.4/plat-mac/ lib-scriptpackages', '/Users/delza/sampleapp/dist/sample.app/Contents/ Resources/lib/python2.4/lib-tk', '/Users/delza/sampleapp/dist/ sample.app/Contents/Resources/lib/python2.4/lib-dynload', '/Users/ delza/sampleapp/dist/sample.app/Contents/Resources/lib/python2.4/site- packages.zip' And here is the sys.path from a plugin: '/Users/delza/Library/Screen Savers/PastelsView.saver/Contents/ Resources', '/Users/delza/Library/Screen Savers/PastelsView.saver/ Contents/Resources', '/Users/delza/Library/Screen Savers/ PastelsView.saver/Contents/Frameworks/Python.framework/Versions/2.4/ lib/python24.zip', '/Users/delza/Library/Screen Savers/ PastelsView.saver/Contents/Frameworks/Python.framework/Versions/2.4/ lib/python2.4/', '/Users/delza/Library/Screen Savers/ PastelsView.saver/Contents/Frameworks/Python.framework/Versions/2.4/ lib/python2.4/plat-darwin', '/Users/delza/Library/Screen Savers/ PastelsView.saver/Contents/Frameworks/Python.framework/Versions/2.4/ lib/python2.4/plat-mac', '/Users/delza/Library/Screen Savers/ PastelsView.saver/Contents/Frameworks/Python.framework/Versions/2.4/ lib/python2.4/plat-mac/lib-scriptpackages', '/Users/delza/Library/ Screen Savers/PastelsView.saver/Contents/Frameworks/Python.framework/ Versions/2.4/lib/python2.4/lib-tk', '/Users/delza/Library/Screen Savers/PastelsView.saver/Contents/Frameworks/Python.framework/ Versions/2.4/lib/python2.4/lib-dynload' Since the ../Contents/Frameworks/Python.framework/Versions/2.4/ directory does not contain a lib directory, these paths are broken. I'm trying to track down where they are set, which appears to be in the bootstrap Objective-C code for setting the RESOURCEPATH environment variable. Does that sound reasonable? --Dethe We have now become a people who believe that wishing for things makes them happen. Unfortunately, the world just doesn't work that way. The truth is that no combination of alternative fuels or so- called renewables will allow us to run the U.S.A. -- or even a substantial fraction of it -- the way that we're running it now. -- James Howard Kunstler ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Building plugins with py2app
On 12-Oct-06, at 9:49 AM, Bob Ippolito wrote: plist thing just doesn't happen? Doesn't appear to. The plugin bootstrap is broken. They won't start. So where do I look? This used to work beautifully. Is the plugin bootstrap the __boot__.py file or is it in C or Objective-C? Do we know how long this has been broken, so I can look at the context- appropriate diffs? The fact that plugins are broken is not documented, but neither is anything else about plugins. They're minimally documented, but that was enough to get me going and I've been building plugins reliably for months, until now. Right now I'm looking at how to return to distutils-based builds and an earlier version of py2app, since that worked. --Dethe You know, Hobbes, some days even my lucky rocketship underpants don't help. --Calvin ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Building plugins with py2app
On 12-Oct-06, at 10:08 AM, Ronald Oussoren wrote: Could you try again with the latest version of py2app, that is subversion revision 46. Using 'easy_install py2app==dev' should do the trick. When I try that (after a long time) get a stack trace as follows: delza$ easy_install py2app==dev Searching for py2app==dev Reading http://www.python.org/pypi/py2app/ Reading http://undefined.org/python/#py2app Reading http://www.python.org/pypi/py2app/0.3.4 Best match: py2app dev Downloading http://svn.pythonmac.org/py2app/py2app/trunk#egg=py2app-dev Doing subversion checkout from http://svn.pythonmac.org/py2app/py2app/ trunk to /tmp/easy_install-q6o67p/trunk Processing trunk Running setup.py -q bdist_egg --dist-dir /tmp/easy_install-q6o67p/ trunk/egg-dist-tmp-vup0ad Traceback (most recent call last): File /usr/local/pybin/easy_install, line 7, in ? sys.exit( File /Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/site-packages/setuptools-0.7a1dev_r51485-py2.4.egg/ setuptools/command/easy_install.py, line 1588, in main with_ei_usage(lambda: File /Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/site-packages/setuptools-0.7a1dev_r51485-py2.4.egg/ setuptools/command/easy_install.py, line 1577, in with_ei_usage return f() File /Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/site-packages/setuptools-0.7a1dev_r51485-py2.4.egg/ setuptools/command/easy_install.py, line 1592, in lambda distclass=DistributionWithoutHelpCommands, **kw File /Library/Frameworks/Python.framework/Versions/2.4//lib/ python2.4/distutils/core.py, line 149, in setup dist.run_commands() File /Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/distutils/dist.py, line 946, in run_commands self.run_command(cmd) File /Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/distutils/dist.py, line 966, in run_command cmd_obj.run() File /Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/site-packages/setuptools-0.7a1dev_r51485-py2.4.egg/ setuptools/command/easy_install.py, line 211, in run self.easy_install(spec, not self.no_deps) File /Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/site-packages/setuptools-0.7a1dev_r51485-py2.4.egg/ setuptools/command/easy_install.py, line 446, in easy_install return self.install_item(spec, dist.location, tmpdir, deps) File /Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/site-packages/setuptools-0.7a1dev_r51485-py2.4.egg/ setuptools/command/easy_install.py, line 471, in install_item dists = self.install_eggs(spec, download, tmpdir) File /Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/site-packages/setuptools-0.7a1dev_r51485-py2.4.egg/ setuptools/command/easy_install.py, line 655, in install_eggs return self.build_and_install(setup_script, setup_base) File /Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/site-packages/setuptools-0.7a1dev_r51485-py2.4.egg/ setuptools/command/easy_install.py, line 930, in build_and_install self.run_setup(setup_script, setup_base, args) File /Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/site-packages/setuptools-0.7a1dev_r51485-py2.4.egg/ setuptools/command/easy_install.py, line 919, in run_setup run_setup(setup_script, args) File /Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/site-packages/setuptools-0.7a1dev_r51485-py2.4.egg/ setuptools/sandbox.py, line 26, in run_setup DirectorySandbox(setup_dir).run( File /Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/site-packages/setuptools-0.7a1dev_r51485-py2.4.egg/ setuptools/sandbox.py, line 63, in run return func() File /Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/site-packages/setuptools-0.7a1dev_r51485-py2.4.egg/ setuptools/sandbox.py, line 29, in lambda {'__file__':setup_script, '__name__':'__main__'} File setup.py, line 92, in ? File /Library/Frameworks/Python.framework/Versions/2.4//lib/ python2.4/distutils/core.py, line 149, in setup dist.run_commands() File /Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/distutils/dist.py, line 946, in run_commands self.run_command(cmd) File /Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/distutils/dist.py, line 965, in run_command cmd_obj.ensure_finalized() File /Library/Frameworks/Python.framework/Versions/2.4//lib/ python2.4/distutils/cmd.py, line 117, in ensure_finalized self.finalize_options() File /Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/site-packages/setuptools-0.7a1dev_r51485-py2.4.egg/ setuptools/command/bdist_egg.py, line 94, in finalize_options ei_cmd = self.ei_cmd = self.get_finalized_command(egg_info) File /Library/Frameworks/Python.framework/Versions/2.4//lib/ python2.4/distutils/cmd.py, line 319, in
Re: [Pythonmac-SIG] Building plugins with py2app
On 12-Oct-06, at 1:33 PM, Ronald Oussoren wrote: Could you try again with the latest version of py2app, that is subversion revision 46. Using 'easy_install py2app==dev' should do the trick. When I try that (after a long time) get a stack trace as follows: Why are you using setuptools 0.7? 0.6 is the stable version of setuptools and works with both python 2.4 and 2.5. I'm using 0.6c3 and that works just fine. Probably from running something like easy_install setuptools=dev, which is the way listed under Install on the setuptools page? I've reverted to 0.6c3 and updated to py2app r46, but both problems remain: 1) py2app isnot picking up plist from a dict, although it does pick up plist filename from a string, and 2) cannot load bundle when building a plugin (screensaver). --Dethe Improved focus can be achieved through activities such as meditations, yoga and turn off Instant Messaging - Ulrich Mayr ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Building plugins with py2app
On 12-Oct-06, at 2:15 PM, Ronald Oussoren wrote: What are you using to test? I've tested with the SillyBalls screensaver in PyObjC's examples directory (Examples/Plugins/ SillyBallsSaver). I've been testing with my screensaver, Pastels, but I just tried with SillyBalls and it also failed to load. I'm also using the SVN HEAD for altgraph, modulegraph and the other related projects, I don't know if that helps. If upgrading doesn't help, or the SillyBallsSaver example doesn't work for you, I'd like to know loads of version information (Python, PyObjC, py2app, altgraph, modulegraph, macholib) and the exact error message you get in Console.app (close SystemPreferences, open Console.app, use the Clear button, then open a freshly build version of your saver or the SillyBals saver). macholib 1.1 modulegraph 0.7 altgraph 0.6.7 bdist_mpkg 0.4.2 Any others? Console output from opening SillyBalls: 'import site' failed; use -v for traceback Traceback (most recent call last): File /Users/delza/Library/Screen Savers/SillyBalls.saver/Contents/ Resources/__boot__.py, line 7, in ? _disable_linecache() File /Users/delza/Library/Screen Savers/SillyBalls.saver/Contents/ Resources/__boot__.py, line 2, in _disable_linecache import linecache ImportError: No module named linecache 2006-10-12 14:37:36.350 System Preferences[839] SillyBalls has encountered a fatal error, and will now terminate. 2006-10-12 14:37:36.350 System Preferences[839] An uncaught exception was raised during execution of the main script: ImportError: No module named linecache This may mean that an unexpected error has occurred, or that you do not have all of the dependencies for this bundle. 2006-10-12 14:37:36.350 System Preferences[839] ScreenSaverModules: can't get principalClass for /Users/delza/Library/Screen Savers/ SillyBalls.saver Also make sure you stop SystemPreferences when you want to test a new build of a screensaver, otherwise SystemPreferences doesn't always pick up the new version (or rather almost never). I've been deleting old versions from ~/Library/Screen Savers/ (which is where I've been installing them), which seems to get my updates picked up OK. Ronald Thanks for the help! --Dethe The real trouble with this world of ours is not that it is an unreasonable world, nor even that it is a reasonable one. The commonest kind of trouble is that it is nearly reasonable, but not quite. Life is not an illogicality; yet it is a trap for logicians. It looks just a little more mathematical and regular than it is; its exactitude is obvious, but its inexactitude is hidden; its wildness lies in wait. --G.K. Chesterton ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Building plugins with py2app
On 12-Oct-06, at 2:56 PM, Ronald Oussoren wrote: I have macholib 1.2, modulegraph 0.7.1, altgraph 0.6.8 and py2app 0.3.5, all fresh checkouts from svn. OK, I now have those versions as well, via easy_install [module]==dev on each one. I had tried building them all from svn the other day, but failed, perhaps because of having the wrong version of setuptools. Could you check the Info.plist and the structure of the screensaver? Info.plist should have a key PyResourcePackages with an empty array as its value yes, have that and an PyRuntimeLocations that points to an embedded python framework. PyRuntimeLocaions contains the value: @executable_path/../Frameworks/ Python.framework/Versions/2.4/Python The patch I just checked in ensures that PyResourcePackages is empty, with an unpatched version the array will contain some strings and that messes up sys.path. There should be a lib/python2.4 in the Resources directory of the screensaver, that should contain site-packages.zip, site.py and a lib-dynload directory. Yes. It also contains a config directory which contains Makefile, Setup, Setup.config, Setup.local. To make absolutely sure you have my patched version you could check py2app/bundletemplate/plist_template.py, there is a definition of PyResourcePackages in there, the value of which should be an empty list. One way to check: . import pprint . import py2app.bundletemplate.plist_template . pprint.pprint(py2app.bundletemplate.plist_template.infoPlistDict ('dummy')) {'CFBundleDevelopmentRegion': u'English', 'CFBundleDisplayName': u'dummy', 'CFBundleExecutable': u'dummy', 'CFBundleIconFile': u'dummy', 'CFBundleIdentifier': u'org.pythonmac.unspecified.dummy', 'CFBundleInfoDictionaryVersion': u'6.0', 'CFBundleName': u'dummy', 'CFBundlePackageType': u'BNDL', 'CFBundleShortVersionString': u'0.0', 'CFBundleSignature': u'', 'CFBundleVersion': u'0.0', 'LSHasLocalizedDisplayName': False, 'NSAppleScriptEnabled': False, 'NSHumanReadableCopyright': u'Copyright not specified', 'NSMainNibFile': u'MainMenu', 'NSPrincipalClass': u'dummy', 'PyMainFileNames': [u'__boot__'], 'PyResourcePackages': [], 'PyRuntimeLocations': [u'@executable_path/../Frameworks/ Python.framework/Versions/2.4/Python', u'~/Library/Frameworks/Python.framework/ Versions/2.4/Python', u'/Library/Frameworks/Python.framework/ Versions/2.4/Python', u'/Network/Library/Frameworks/ Python.framework/Versions/2.4/Python', u'/System/Library/Frameworks/ Python.framework/Versions/2.4/Python'], u'PythonInfoDict': {'PythonExecutable': u'/Library/Frameworks/ Python.framework/Versions/2.4/Resources/Python.app/Contents/MacOS/ Python', 'PythonLongVersion': u'2.4.4c1 (#1, Oct 11 2006, 15:11:04) \n[GCC 4.0.1 (Apple Computer, Inc. build 5341)]', 'PythonShortVersion': u'2.4', u'py2app': {'version': u'0.3.5', 'template': u'bundle'}}} That looks right, I see an empty list as the value of PyResourcePackages. Ronald P.S. Are you sure you installed the latest version of py2app in the right version of Python? If you installed python2.5 after installing python2.4 easy_install might point to the 2.5 version of easy_install (if you have that installed), if it is easy_install-2.4 should pick up the correct version. I'm sure. I've been checking the site-packages directory before and after running easy_install, and I've gone through and removed old .egg directories (and checked the easy_install.pth) so I can be sure I'm getting the right versions. I've checked to make sure I have the current version of the SillyBalls code too. SillyBalls doesn't even use setuptools, so whatever is broken is broken across both distutils and setuptools (I haven't dug underneath yet to see how these work, so it's still magic under the covers to me). So still no idea why it's working for you, but not for me. Anything else you can think of? I followed the instructions in the py2app docs for removing old versions of py2app. If everything is encapsulated in the .egg, perhaps I can revert to the earlier version that worked? --Dethe It was odd: even though I was pretty much being eaten alive, I didn't really mind. I suppose it's the same sort of feeling Jesus had while on the cross, or how Buddha felt when Mechabuddha beat him up in downtown Tokyo. --AJ Packman ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
[Pythonmac-SIG] Building plugins with py2app
Hi folks, I'm switching to to a recent py2app and moving to use setuptools- based builds instead of distutils. I've had several problems, but since I've been coding here and there in spare moments (including on the bus in the mornings), I haven't done a very good job of documenting them, I'm afraid. I do have one persistent problem building both apps and plugins, which is that the settings I add to my plist don't appear in the resulting app/Contents/Info.plist. After much hair-pulling I think that is the source of many of the weird problems I've been seeing. For example, with the following setup: from setuptools import setup setup( plugin=['PastelsView.py'], setup_requires=['py2app'], options=dict( py2app=dict( extension='.saver', plist = dict( NSPrincipalClass='PastelsView', CFBundleShortVersionString = 'Pastels 0.3', CFBBundleDisplayName = 'Pastels', CFBundleIdentifier = 'org.livingcode.applications.pastels', ) ) ) ) I end up with an Info.plist that has the following: CFBundleIdentifier = org.pythonmac.unspecified.PastelsView CFBundleDisplayName = PastelsView CFBundleName = PastelsView NSPrincipalClass = PastelsView So it does end up with the right principal class, but other values are wrong, and the principal class appears to be set correctly more because that is the name of the script file than because I set it explicitly. In another program the app failed to pick up its icon from the plist specifier CFBundleIconFile, but successfully got the icon when I added iconfile in the py2app options. When I try to load the above screensaver I get the console messages: 'import site' failed; use -v for traceback Traceback (most recent call last): File /Users/delza/Library/Screen Savers/PastelsView.saver/ Contents/Resources/__boot__.py, line 7, in ? _disable_linecache() File /Users/delza/Library/Screen Savers/PastelsView.saver/ Contents/Resources/__boot__.py, line 2, in _disable_linecache import linecache ImportError: No module named linecache 2006-10-11 21:19:00.209 System Preferences[382] PastelsView has encountered a fatal error, and will now terminate. 2006-10-11 21:19:00.209 System Preferences[382] An uncaught exception was raised during execution of the main script: ImportError: No module named linecache This may mean that an unexpected error has occurred, or that you do not have all of the dependencies for this bundle. 2006-10-11 21:19:00.210 System Preferences[382] ScreenSaverModules: can't get principalClass for /Users/delza/Library/Screen Savers/ PastelsView.saver Details: Python 2.4.3 PyObjC pyobjc-1.4.1a0 installed with python setup.py bdist_mpkg --open py2app 0.3.4 Setuptools 0.7a1dev_r51485 OS X 10.4.7 (Intel) Code for the screensaver available from Google Code: http:// code.google.com/p/pastels/source Code works from the command-line (not built into a bundle) with my test harness. The linecache module is in place, the message that it is missing is spurious. When I change the Info.plist by hand to reflect the desired bundle name (Pastels) I still see it as PastelsView, and it still fails to load, so I'm obviously missing something important. If anyone has a clue as to what I'm doing wrong, please let me know. If there's any other information that would be helfpul, please let me know. Thanks! --Dethe All space and matter, organic or inorganic, has some degree of life in it [...] All matter/space has some degree of self in it. If either of these claims comes, in future, to be considered true, that would radically change our picture of the universe. --Christopher Alexander ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] porting VPython to OS X
I have tried to work on this in the past and would be willing to help again. My main problem is with the build environment. If I can get it to build consistently, I can write the bits that are needed for OS X. What I need is someone who understands autoconf better than I do. Do you know of *anyone* who has been able to build the latest beta versions of VPython on OS X, even with Fink and X? --Dethe On 4-Oct-06, at 10:44 AM, Joe Heafner wrote: Hello. I'm an astronomy/physics instructor who makes heavy use of VPython (http://www.vpython.org) in teaching introductory calculus-based physics. Currently, the only way to use VPython under OS X is via Fink, which indeed works very well. However, we *REALLY• need a native OS X port that can run without the need for X11. Neither I nor the original VPython developers are Mac programmers and therein lies the purpose of my request. Is there a kind soul out there who would be willing to port VPython so that it runs with the latest Mac native version of Python (currently 2.5 afaik)? I would be most willing to help with testing and anything else not related to writing Mac code, which I currently just can't do. You would be helping the physics teaching community as well as the Mac and Python communities and there would certainly be undying gratitude from all of us! If you're willing to help us out, contact me on list or off list (email in sig). I would really appreciate it! Joe Heafner heafnerj(at)sticksandshadows(dot)com www(dot)SticksAndShadows(dot)com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig Windows has detected the mouse has moved. Please restart your system for changes to take effect. ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] building pyopengl on Tiger?
I'm really glad to hear you're working on the OS X port. I'll try it out as soon as I get a few cycles free. I'm excited about the possibilities for PyOpenGL in the future--the ctypes work opens up some interesting territory. Thanks for working on this. --Dethe On 28-Sep-06, at 8:31 PM, Josh Marshall wrote: As a side note to this discussion on building PyOpenGL 2.0, I'd like to mention that Mike Fletcher is working on OpenGL-ctypes, which is to become PyOpenGL 3.0. I am working on the Mac OS X porting work. Many of the simpler tests now run, but there are still many issues to be worked out. With regards to release times, Mike has said: As far as timelines, I'm hoping to get an alpha out within the next few weeks. I expect it will take 1-2 months to get the alpha into a releasable shape. I consider PyOpenGL 2.0 level functionality to be a basic requirement, I also want to have decent support for the major extensions and OpenGL 2.0 features. So if anyone uses PyOpenGL on the Mac, please check it out from CVS and bang on it a bit. Cheers, Josh On 28/09/2006, at 4:08 PM, [EMAIL PROTECTED] wrote: From: Ronald Oussoren [EMAIL PROTECTED] Date: 28 September 2006 3:58:16 PM To: Bob Ippolito [EMAIL PROTECTED] Cc: Python mac pythonmac-sig@python.org Subject: Re: [Pythonmac-SIG] building pyopengl on Tiger? On Sep 28, 2006, at 7:49 AM, Bob Ippolito wrote: On 9/27/06, Ronald Oussoren [EMAIL PROTECTED] wrote: Does anyone know how to build PyOpenGL on OSX 10.4? I'm getting loads of compiler errors. It should be possible to do this because there's a universal build of pyopengl on the pythonmac.org site. I definitely did that build a few times, but I don't have the source on this machine. I believe I had to make a patch or two... I think they had put in some bad #includes or something. There's definitely need for some patching, the last two releases of PyOpenGL don't build out of the box. I'll see if I can recreate your patches ;-) Ronald -bob ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig There's a little bit of God in every truck driver and a little bit of truck driver in every God. -- Blayne Horner ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] appscript questions
Ronald Oussoren wrote: On Aug 3, 2006, at 7:08 PM, has wrote: p.s. If anyone'd like to help me out a bit, I'd really like to get all the manuals into the standard Python documentation format now. So if you're familiar with the tools and would like to have a go then let me know - it'd be much appreciated. Why do you want to do that? You have to use special tools to convert that to a useable format. And if you're trying to get docs into the standard library, those folks are perfectly willing to take plaintext documentation and dress it up in LaTeX themselves. --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] poll() on OSX 10.3.9 with python2.5b2
Norman Khine wrote: Hello, I need to use the 'select' module in python, but get an error on the: Python 2.5b2 (r25b2:50512, Jul 31 2006, 15:01:51) [GCC 3.3 20030304 (Apple Computer, Inc. build 1640)] on darwin Type help, copyright, credits or license for more information. import select dir(select) ['__doc__', '__file__', '__name__', 'error', 'select'] Hi Norman, Did you build your own python or use a pre-built one? It works for me on both 2.4.3 and 2.5b2, unless I'm missing something in what you're asking: Python 2.4.3 Universal on Intel: $ python -c import select;print dir(select) ['POLLERR', 'POLLHUP', 'POLLIN', 'POLLNVAL', 'POLLOUT', 'POLLPRI', 'POLLRDBAND', 'POLLRDNORM', 'POLLWRBAND', 'POLLWRNORM', '__doc__', '__file__', '__name__', 'error', 'poll', 'select'] Python 2.5b2 Universal on Intel: $ python -c import select; print dir(select) ['POLLERR', 'POLLHUP', 'POLLIN', 'POLLNVAL', 'POLLOUT', 'POLLPRI', 'POLLRDBAND', 'POLLRDNORM', 'POLLWRBAND', 'POLLWRNORM', '__doc__', '__file__', '__name__', 'error', 'poll', 'select'] --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] [ANN] py2app 0.3.2
Kaweh Kazemi wrote: essentially i am trying to package a Panda3D test application using py2app - see http://knuddl.net/moin.cgi/InstallPanda3d for my Panda3D package if interested(compiled/linked for OS X including installation instructions) - though be aware that the installation is still cumbersome and definitely not as user friendly as i would like it to be - this is still very experimental (Panda3D has no official OS X support yet); anyways, i'll re-link the libraries and see how it's going. thanks, kaweh I, for one, am excited to see Panda3D coming to the Mac. I have tried (and failed) to install it before. Before I dive in this time I have a couple of questions. 1) Is your version working on Intel Macs (I have a Macbook Pro). 2) Your instructions include the Nvidia Cg toolkit, but I have an ATI Radeon X1600. Should I skip that step, or does that mean I'm out of luck for the time begin? Thanks for working on this! --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
[Pythonmac-SIG] ctypes for Intel-base Macs?
Hi folks, I'm trying to get ctypes working on my new Macbook Pro under Python 2.4. It works under Python 2.5beta, so I assume the porting work has been done somewhere, but does not work with the downloadable version of ctypes (libffi won't build): configure: error: libffi has not been ported to i686-apple-darwin8.7.1. I've tried getting libffi via darwinports, but it reports the same error: configure: error: libffi has not been ported to i386-apple-darwin8.7.1. I've tried to find the libffi shared library in Python2.5 to see if I could build ctypes around that, but all I could find was _ctypes.so. Maybe I could build around that, but I don't know what pieces I need to copy over. Any ideas for how I can get a working ctypes under 2.4 would be appreciated. Thanks! --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] ctypes for Intel-base Macs?
Bob Ippolito wrote: I'm pretty sure that the version in Python 2.5 still has some i386 stack alignment bugs. Ronald has fixed them for PyObjC, but I don't think that work has migrated to ctypes yet. The version in http://svn.python.org/projects/ctypes/trunk/ctypes/ seems to be in sync with Python 2.5. That appears to have worked. Thanks, Bob! --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Fwd: MacPython icon mockup
On 4/19/06, Jacob Rus [EMAIL PROTECTED] wrote: Ok, what do you all think of these script and compiled script icons: PNG: http://hcs.harvard.edu/~jrus/python/python-icons-a1.png ZIP: http://hcs.harvard.edu/~jrus/python/python-icons-a1.zip The zip file contains icns files, png files, and also folders with the icons applied. I'm glad to provide Photoshop files as well, if someone wants them. -Jacob The icons are great, very Aqua and very Pythonic. Thanks for the time you put into this, and thanks to everyone else on the list for putting in the effort to test and critique other designs. This is going to make Python on the Mac look much more professional than the old falling weight did. Very nice. --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] bin and version
On 4/9/06, Daniel Lord [EMAIL PROTECTED] wrote: On Apr 8, 2006, at 7:59 PM, linda.s wrote: Hi, I installed quite a few python versions in my computer and I want to know where they are located. Should i check them in the bin folder? If so, why I can not find the bin folder in my home directory? Someone answered the portion regarding the commands. As for the location of the 'bin' directory, OS X hides several UNIX directories in the Finder as part of their simplification facade. You can always access them from the shell: [snipped] You can access them from the Finder too, either with the menu Go-Go to Folder... or via the keyboard: Cmd-Shift-G. Either way, you can then type in any directory (such as /bin/) and it will open up a Finder window for it, whether it is normally visible in the Finder or not. If you're already in the Terminal (or other command-line shell), the command open [directory] will open the directory as a folder in the Finder. So, open . will open the current directory, and open /usr/local/bin will open that directory in a Finder window. Of course, the quotes are just for this email, you don't type them in the command. --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] needed: simple gui toolkit with japanese input support
On 4/10/06, Gábor Farkas [EMAIL PROTECTED] wrote: hi, i'd like to write a simple python-mac application, for which i need to choose a gui toolkit. The primary GUI toolkit for Mac-specific work is to use Cocoa via the PyObjC bridge. http://pyobjc.sourceforge.net/ the problem is that i need to be able to enter japanese text, which means i need support for i don't know how that's called in osx (on linux that would be input methods). They're called input methods on OS X too. Take a look at Apple's docs on the subject of international text: http://developer.apple.com/documentation/Carbon/Conceptual/Supporting_Unicode_Input/index.html?http://developer.apple.com/documentation/Carbon/Conceptual/Supporting_Unicode_Input/sui_concepts/chapter_2_section_5.html To see the types of inputs that are available, go to the System Preferences and look at the International panel, especially the Input Menu tab. OS X is international by default, using Unicode for text strings internally, and supports a wide array of input for example with tkinter it is not possible. I imagine that Tkinter works if you use the system input methods, but I haven't tested it. i know that using pyobjc and doing directly cocoa would work, but last time i checked it it seemed quite complicated. What was complicated about it? It's hard to help without further information. so, is there something simpler? maybe a simple gui toolkit built on cocoa? There is a simple GUI toolkit built on Cocoa, it's called PyObjC. There are some efforts at making an even simpler interface, namely PyGUI and Renaissance, but I would recommend you work with PyObjC, build your UI with Interface Builder, and use AppKiDo to supplement Apple's documentation. PyGUI http://www.cosc.canterbury.ac.nz/~greg/python_gui/ Renaissance http://www.gnustep.it/Renaissance/ AppKiDo (handy Cocoa reference) http://homepage.mac.com/aglee/downloads/ thanks, gabor HTH --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] needed: simple gui toolkit with japaneseinput support
On 4/10/06, Kent Quirk [EMAIL PROTECTED] wrote: so, is there something simpler? maybe a simple gui toolkit built on cocoa? There is a simple GUI toolkit built on Cocoa, it's called PyObjC. For particularly large values of simple, I guess. For those who don't already speak Cocoa, PyObjC is annoyingly cumbersome. Using it requires that you understand Cocoa enough to know how to read its documentation, understand its message model, understand the way it handles object allocation, and be able to use Interface Builder. The value of simple being: Exposing all of Cocoa, in a standard way so that existing documentation is usable, from Python. The translation makes using Cocoa from Python simple (as simple as it can be). I get the impression that for those who've used Cocoa and prefer Python, it's a breath of fresh air...but for those who've not been swimming in a vat of Cocoa, it's not quite so appetizing. I have not used Objective-C for anything but a couple of trivial tutorials, I dove straight in with Python. I understand there is a bit of a learning curve, and I've blogged about some of my own learning experiences with PyObjC, Renaissance, and my love/hate relationship with Interface Builder on my blog: http://livingcode.blogspot.com/ I've been quiet there for awhile while I write my own blogging software (in PyObjC) to allow me to interate faster and get more of my PyObjC tutorial stuff posted. A lot of the time, when I've felt that I had to do too much work in PyObjC, it's because I was not doing it the Cocoa Way. And I totally agree that it can be a pain to learn The Cocoa Way in order to build a small, simple program. On the other hand, as you graduate to more complex programs, learning to do it right can ease your development work by orders of magnitude, so the investment can pay off. And some of the more hairy parts of Cocoa aren't necessary when you're working in Python, because you can just use the Python standard library (or 3rd party libraries), so you get the best of both worlds. There are some efforts at making an even simpler interface, namely PyGUI and Renaissance, but I would recommend you work with PyObjC, build your UI with Interface Builder, and use AppKiDo to supplement Apple's documentation. Note this goal from the PyGUI documentation page: Document the API purely in Python terms, so that the programmer does not need to read the documentation for another GUI library, in terms of another language, and translate into Python. That can be a good goal, but on the other hand, there is a *lot* of documentation on Cocoa, far more than PyGUI will ever achieve, and the PyObjC bridge makes it trivial to translate that into Python. And I wouldn't expect PyGUI to expose everything from Cocoa (not it's purpose, it's a cross-platform wrapper), so if there's something beyond what PyGUI offers, don't be afraid to dip back to PyObjC. I do think that PyGUI is a much better approach to cross-platform GUI tools than, say, wxPython. The cross-platform abstractions should be kept as high-level as possible, i.e., in Python, not in a huge C++ library that then gets wrapped in Python. --Dethe - Kent ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] needed: simple gui toolkit with japaneseinput support
On 4/10/06, Kent Quirk [EMAIL PROTECTED] wrote: -Original Message- From: Ronald Oussoren [mailto:[EMAIL PROTECTED] Sent: Monday, April 10, 2006 4:42 PM To: Kent Quirk Cc: Dethe Elza; Gábor Farkas; pythonmac-sig@python.org Subject: Re: [Pythonmac-SIG] needed: simple gui toolkit with japaneseinput support snip I get the impression that for those who've used Cocoa and prefer Python, it's a breath of fresh air...but for those who've not been swimming in a vat of Cocoa, it's not quite so appetizing. And to second Dethe: I'm also a python programmer that likes Cocoa. Heck, I wrote[1] PyObjC because I wanted to use Cocoa from Python. Which is kinda the point -- you already knew Cocoa and wanted to use it in a different context. Can't speak for Ronald (he's already spoken anyhow), but I learned Cocoa from Python. The most contact I've had with Objective-C is to port code from it into Python so that other folks coming to Cocoa from Python will have more examples to draw on. --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] SQLite python
On 3/28/06, Dan Grassi [EMAIL PROTECTED] wrote: Hi, I am totally confused by all the versions and name conflicts of py- sqlite and sqlite not to mention the python version confusion. What I really want to do is use both sqlite version 2 and sqlite version 3 since I have existing sqlite version2 DBs and new CoreData apps that use sqlite version 3. From a version/nomenclature standpoint there is a huge mess eg: py-sqlite works with either sqlite 2 or sqlite 3 and py-sqlite2 works with sqlite version 3. I have been using py-sqlite with sqlite version 2 successfully. First problem I see is that there are two version of Python on my Tiger system: /usr/bin/python version 2.3.5 The above is Apple-supplied Python. Apple uses it for internal scripting stuff, you should pretend it isn't there. Ignore it, don't use it, but whatever you do, don't try to remove or replace it. /usr/local/bin/python version 2.4.1 This is the one you want. If your shell doesn't already point to this by default when you type python on the command line, it should. Try which python to see what your default is. Second problem: The (Apple) installed version of sqlite3 is 3.0.8.6 py-sqlite 2.1 requires sqlite 3.2.2 py-sqlite 2.0 requires sqlite 3.1 py-sqlite 1.1 requires sqlite 3.x So it seems that py-sqlite 1.1 is the one I need. To complicate matters, there is also APSW (Another Python SQLite Wrapper) which can be used with any version of SQLite. http://www.rogerbinns.com/apsw.html If I install it my installed py-sqlite that used the python sqlite version 2 gets overwritten, not nice. It also seems to get instaslled in the python 2.3 library, also not nice. Probably your PATH environment variable points to the Apple-installed python before the current python. You can change this, probably in the .bash-profile file in your home directory. Make sure /usr/local/bin comes before /usr/bin in the PATH. If I go to darwin ports it wants to upgrade my python to 2.4.2 first. Why do you need DarwinPorts? You have both Python and SQLite installed already. Just download the wrapper (pysqlite or apsw) and install it using python setup.py build; sudo python setup.py install after making sure the correct python is in your PATH. Does anyone have a solution? See above. All in all the whole Python database (lack of) mess is ridiculous! I know that Guido does not feel that databases have any place in python but I don't get it, why does the batteries included not include database support, databases like MySQL, PostgreSQL SQLite? Python's batteries do include BerkelyDB out of the box, as well as gdbm and/or dbm, including a built-in portable implementation of dbm for platforms that don't have it already. There are wrappers for PostgreSQL, MySQL, Oracle, SQLite, etc. There are object-relational mappings like SQLObject. The python world has a very rich and lively database environment. At this point I am ready to mostly give up on Python after over 10 years of use and evangelizing. That would be too bad. It's just getting really good. --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
[Pythonmac-SIG] Fwd: py2app question
Forgot to respond to list in my reply: On 3/16/06, Stewart Midwinter [EMAIL PROTECTED] wrote: I have an application I'd like to have located on a USB stick, and be able to run in a self-contained manner on any PC it's connected to, whether running OS X or Windows. Can I use py2app to help create this stand-alone distribution? There's no way to create an entirely self-contained application that runs on either Windows or OS X, there are just too many differences in how they are built and bootstrapped. But py2app will let you build a self-contained application which will run off of a memory stick. You might be able to use filesystem tricks to hide the OS X application on Windows and the Windows application on OS X, to give the illusion that there is only one application (some CD ROMs do this, I believe). Or, could I count on Python always being installed on any OS X - equipped PC, and thus not need to install a separate copy on my USB stick in order to be able to run my app? You cannot count on the version of Python that will be installed, or any external libraries you depend on. The best thing is to bundle it all into your application using py2app. --Dethe thanks S ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Job postings - allow or not?
I'm OK with job postings on the list. Its interesting to watch Python and OS X taking off. --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] getting started with PyObjC
Using XCode isn't really the best way to create PyObjC apps. The recommended way is to use InterfaceBuilder to create your UI, implement it with PyObjC, and use py2app to build the application from there. Check out the tutorial on the PyObjC site, and the docs for py2app. PyObjC tutorial: http://pyobjc.sourceforge.net/doc/tutorial.php Py2app documentation: http://undefined.org/python/py2app.html It sounds like you already have the nib and code, so that should work for you. If you have the nib, but no code yet, there is a script which will generate a python files with stubs built from your nib to get you started. Using the nibclassbuilder script is demonstrated in the tutorial. I hope that helps to get you started. Come back with any further questions you have. --Dethe On 3/6/06, Scott Frankel [EMAIL PROTECTED] wrote: Following the simple example app that Apple provides for PyObjC has lead me to a number of questions ... and a failed build. The example demonstrates using Xcode InterfaceBuilder to build a simple app, PyAverager. My attempts at a build yield Build failed for target Development errors in Xcode and nothing launchable from py2applet. There were no instructions on how to configure a target in the Apple doco. Questions: Does the target need to be more fully specified in Xcode (beyond what the PyObjC template provides), if so how? Does the target need to be specified somehow in the py2app(let) step? Is Xcode really necessary or advantageous for building PyObjC apps? Can Interface Builder NIB files be used with py2app(let)? If so, how are they specified on the cmd-line? (i.e.: declared as the Foo.nib parent directory, or as each of the nib files contained in Foo.nib: classes.nib, info.nib, c.)? Feeling a little at sea; thanks in advance for a point in the right direction. Scott Xcode 2.1 Python 2.4.1 OSX 10.4.5 ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Pythonw and VPython and Fink
On 14-Feb-06, at 1:28 PM, Matthias Milczynski wrote: I assume that the solution of this problem would be to somehow get a fink-based pythonw, but this seems to be not avaiable. Can anybody help me with this? I think the solution is for VPython to be ported to Aqua instead of using X11 (so it can use regular OS X Python, not Fink, among other good things). Unfortunately the times I've tried to take this on, the VPython build system has thwarted me. Periodically I make time to try again, because I'd really like to have VPython, but refuse to install Fink again. --Dethe Every day computers are making people easier to use. --David Tompkin ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] New Page, first proposal
On 8-Feb-06, at 10:35 AM, Chris Porter wrote: How does a build differ from a system? I think build refers to a version of Python, and system refers to a version of OS X. I tried typing in python, and got the same response as typing in pythonw. Then I tried pythonx pythona and pythong, all of which got me something like this: pythonw is a special invocation of python that allows you to talk to the window manager (the w is for windows). Regular python at the command-line isn't allowed to open windows due to some weirdness with how Apple created the window manager. -bash: pythona: command not found Be nice to know why only some letters after 'python' are allowed. Adding random letters to the end of commands doesn't work. 4) To do this in a window, enter the following lines at the prompt: What? What window? Any window? Is window some particular application? This refers to putting Hello World in a window (actually a blank window with Hello World in the title bar. The window is the one you create with the following lines. import wx app = wx.PySimpleApp() frame = wx.Frame(None, -1, Hello World).Show(1) app.MainLoop() Tried this in a Terminal (window), this is what I got: import wx app = wx.PySimpleApp() frame = wx.Frame(None, -1,Hello World).Show(1) app.MainLoop() The newlines or semicolons must have gotten obliterated. Either of these work for me: import wx app = wx.PySimpleApp() frame = wx.Frame(None, -1, Hello World).Show(1) app.MainLoop() # or import wx; app=wx.PySimpleApp(); frame = wx.Frame(None, -1, Hello World).Show(1); app.MainLoop() For users of this page, we are going to assume you know: That python is a programming language. That window means... That you are generally familiar with the Terminal app That you know how to construct a program and save it to disk, and run it. That Hmmm. If they don't know that Python is a programming language, why are they here? Familiarity with the terminal app and knowing how to save python as a text file are certainly prerequisites at this point though. --Dethe Say what you like about C++, but it's uninitialized variables will always hold a special place in my heart. In a world where we define *everything* concretely it is the last refuge of the undefined. It's the programmer's Wild West, the untamed frontier. --Bjorn Stroustrap ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
[Pythonmac-SIG] Crashing screensaver engine
Hi folks, I'm trying to write an example screensaver in PyObjC which is a bit more complex than the existing example. One of the things I've added is a sheet to configure the screensaver. I'm doing something wrong there (was doing more things wrong, but I found some of them) and the screensaver engine is crashing. There don't appear to be any harmful side effects from this--my configuration changes are persisted, and the screensaver runs fine, but I want to fix this before I post the code. The code itself is all in one file (including setup script) here: http://livingcode.org/temp/pastels.txt (rename to pastels.py and run python pastels.py py2app to build) and the latest crash log is here: http://livingcode.org/temp/screensaver_crash.log Any hints as to what I'm doing wrong would be very appreciated. Thanks! --Dethe PowerPoint can make almost anything appear good and look professional. Quite frankly, I find that a little bit frightening. --David Byrne ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
[Pythonmac-SIG] PyMedia for Mac?
Does anyone know of a working port of PyMedia for OS X? I've seen, via Google, that several people have attempted the job, but no sign of anyone who has completed it. --Dethe Young children play in a way that is strikingly similar to the way scientists work --Busytown News ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Converting to AppleEvents
On Wed 2005-12-07, at Wed 2005-12-07T07:52 AM, Brian Ray wrote: [snipped] This seems to work well for now. However, is there a way to have os.system() wait till it's finished? In other words how to I get the osascript tool to not return until the script has actually finished. You probably want to use subprocess, not os.system(). It's a more advanced module and should allow you to wait for your script to complete (or to interact with it while it's running if you like). http://docs.python.org/lib/module-subprocess.html --Dethe Computers are beyond dumb, they're mind-numbingly stupid. They're hostile, rigid, capricious, and unforgiving. They're impossibly demanding and they never learn anything. -- John R. Levine ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Speed up Python on the Mac?
On Tue 2005-12-06, at Tue 2005-12-06T10:08 AM, Christopher Barker wrote: [Great list snipped] Have I got them all? I hope this helps. Ctypes allows you to call C code from Python without an extension, but is fairly hairy to write. One Mac-specific way is to expose the C code via Objective-C as a framework. Importing Objective-C frameworks is trivial using the PyObjC library. It would be great to have a real-world example to see what could be done purely from python (plus libraries) using some fo the speedup guidance mentioned (both Eby's and SciPy's). Maybe we should capture this on the wiki? --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] book recommendation
Hi David, While no one book covers all of Cocoa, going through a book can help give you a feel for how Cocoa programs come together. I've often caught myself making things *way* more difficult than they need to be before I discovered the Coccoa Way To Do It. I'm still learning the Cocoa Way, but it is worth the effort. I've found that both the Hillegass[1] and Garfinkel[2] books were worth reading, as have quite different approaches and cover different parts of Cocoa to some degree. I've heard good things about the Anguish[3] book, and while I haven't read it, I have read his earlier book and have high expectations of this one. Finally, keeping something like AppKiDo[4] around can help you navigate the Apple documentation more readily. I hope that helps. --Dethe [1] Aaron Hillegass, Cocoa Programming for OS X, ISBN: 0321213149 [2] Garfinkel and Mahoney, Building Cocoa Applications: A Step by Step Guide, ISBN: 0596002351 [3] Scott Anguish, et al., Cocoa Programming, ISBN: 0672322307 [4] http://homepage.mac.com/aglee/downloads/appkido.html ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] inputing multi-digit numbers
Question: how do I get rid of the \n attached to each member in my list? Choose: map(int(map(string.strip, yourlist)) (Python 2.2) [ int(x.strip()) for x in yourlist ] (Python 2.3) ( int(x.strip()) for x in yourlist ) (Python 2.4) You don't need strip(), int() ignores white space. So the generator- expression version could be (others could be shortened similarly): (int(x) for x in yourlist) --Dethe A miracle, even if it's a lousy miracle, is still a miracle. --Teller ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] inputing multi-digit numbers
On 10-Nov-05, at 5:01 AM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: -Original Message- From: [EMAIL PROTECTED] [mailto:pythonmac-sig- [EMAIL PROTECTED] On Behalf Of Kirk Durston Sent: Thursday, November 10, 2005 2:00 AM To: pythonmac-sig@python.org Subject: [Pythonmac-SIG] inputing multi-digit numbers I’m having a hard time figuring out how to input a list of numbers, each one of which can be 1, 2, or 3 digits in length. First, I select a column in an Excel file, and copy and past it into a Word file. I then save it as a text file. Wouldn't it be simpler to use Excel to export as CSV and use python's csv module to read them in? http://python.org/doc/current/lib/module-csv.html I don't understand why Word is involved in getting numbers from Excel to Python. Another alternative would be to use the excellent pywin32 tools to extract Excel data directly from within Python, using Excel's COM interface. http://sourceforge.net/projects/pywin32/ Excel has other interfaces it exposes besides COM. Here is a recipe from the Python Cookbook to extract tabular data from an Excel file using pywin32 and the ADODB interface. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440661 I hope this is helpful. --Dethe the city carries such a cargo of pathos and longing that daily life there vaccinates us against revelation -- Pain Not Bread, The Rise and Fall of Human Breath ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] inputing multi-digit numbers
On 10-Nov-05, at 10:18 AM, Bob Ippolito wrote: I use this to convert excel to xml, and parse that from Python. http://www.andykhan.com/jexcelapi/ -bob Oops. Obviously I failed to note which list this question was posed on, I assumed it was edu-sig for some reason. Sorry, didn't mean to give you Windows tips on a Mac list, just forgot that Mac folks use Excel too. I don't actually have Office on any of my Macs. Does anyone know if it is AppleScript-able? Can you drive Excel directly from Python on OS X like you can on Windows? --Dethe Windows has detected the mouse has moved. Please restart your system for changes to take effect. ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] inputing multi-digit numbers
Excel on Mac is AppleScriptable through a weird path: Excel exposes the VBA object model to AppleScript. So, it's not AppleScriptable in the standard sense and I am not sure how you would access it from Python. Thanks for the info, Kevin. It sounds like downloading OpenOffice and using PyUNO would be fun in comparison. --Dethe ...if there's not much you can do with HTML, it does have the advantage of being easy to learn. -- Paul Graham ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
[Pythonmac-SIG] Best way to grab screenshot?
Hi folks, I'm trying to put together a screencast program using PyObjC. The first step is to be able to take a screenshot, and I've figured out one way to do that, based on The Irate Scotsman's Screen Sharing code [1]. Since OS X is using OpenGL to compose the window, and since even Series 60 cellphones expose and API for taking screenshots from Python, I'm thinking there must be a better way than this. But y'know, I've been wrong before. Here is the function I'm using: def screenShot(self): rect = NSScreen.mainScreen().frame() image = NSImage.alloc().initWithSize_((rect.size.width, rect.size.height)) window = NSWindow.alloc ().initWithContentRect_styleMask_backing_defer_( rect, NSBorderlessWindowMask, NSBackingStoreNonretained, False) view = NSView.alloc().initWithFrame_(rect) window.setLevel_(NSScreenSaverWindowLevel + 100) window.setHasShadow_(False) window.setAlphaValue_(0.0) window.setContentView_(view) window.orderFront_(self) view.lockFocus() screenRep= NSBitmapImageRep.alloc().initWithFocusedViewRect_ (rect) image.addRepresentation_(screenRep) view.unlockFocus() window.orderOut_(self) window.close() return image Suggestions for improvement are welcome! Next step: Figure out how to create a Quicktime movie and insert the images. I had assumed that the QTKit would allow me to do this, ha ha ha. Fool me once, shame on you Apple, but fool me again and again and again --Dethe [1] http://iratescotsman.com/products/source/ There are two ways of constructing a software design. One way is to make it so simple there are obviously no deficiencies and the other way is to make it so complicated that there are no obvious deficiencies. --C.A.R. Hoare ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Still hitting ImportError when trying to open app made with py2app
Hi Terry, The lack of a response is probably due to the general unfamiliarity with QT on this list. Mostly Cocoa gets advocated for Mac use, although some folks are using wx, Tkinter, or PyGame. Beyond that things start to get into less travelled territory pretty quick, although there are certainly many more options. So I suspect silence is simply a whole bunch of people refraining from posting I dunno to the list. Best wishes. --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Problems with Notifications in PyObjC
What was the real problem? --Dethe On 29-Jul-05, at 2:07 PM, Jon Rosebaugh wrote: Um, ignore this. Boy, do I feel stupid now. On 7/29/05, Jon Rosebaugh [EMAIL PROTECTED] wrote: I hope this is an acceptable place for PyObjC problems... Anyhow, I have a small project I'm working on (zip available at http://li5-50.members.linode.com/~jon/NoteDB/NoteDB.zip), and notifications aren't working out for me. I think. I have a delegate for a NSTableView, and my tableViewSelectionDidChange_ method isn't being called, while other delegate methods are. I also have tried to subclass NSTableView, in accordance with the directions here (http://borkware.com/quickies/one?topic=NSTableView), but that subclass isn't receiving the textDidEndEditing_ notification either. Since the only things these have in common is that they are notifications, the only idea I have is that I'm neglecting something crucial for notifications, but the PyObjC docs don't indicate that I need to do anything special. Thanks in advance for any help. -- Bloggity: http://blog.inklesspen.com/ -- Bloggity: http://blog.inklesspen.com/ ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig We are, after all, the junk tribe and we like to make junk. If we don't make more junk each year we call it a recession. --Rich Gold smime.p7s Description: S/MIME cryptographic signature ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Solid GUI toolkits for Mac?
On 26-Jul-05, at 11:12 PM, Jon Rosebaugh wrote: I know of PyObjC (which scares me, because Interface Builder and Cocoa scare me; I also had an initial fear (or perhaps dislike) of Interface Builder to begin with. Once you learn to use it, and PyObjC, you can be incredibly productive. Cocoa is a *big* framework, and has a pretty high learning curve, so one thing I've often found when things weren't working the way I expected is that I was trying too hard, doing too much coding, and needed to just *do it the Cocoa way* and things worked smoothly. This list is quite helpful when you're trying to figure out the Cocoa way, as are some of the (Objective-C) Cocoa-specific mailing lists. --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
[Pythonmac-SIG] PySight
Hi folks, I'm looking for advice about packaging a library. Jonathan Wight of Toxic Software has built a simple framework around SequenceGrabber to expose it to Cocoa. I've made a trivial PyObjC wrapper and tested it sucessfully with Python. I'd like to build a disk image that contains a) an installer for the framework + wrapper, b) sample apps (Cocoa and Python versions of the same program), and c) the source code to all of these. Does this sound like a good idea, or should I separate it out into multiple .dmg files? Finally, I haven't really used the bdist_mpkg command to build an installer (except for running it on the PyObjC trunk periodically). All I'm installing is a framework and an __init__.py file. Is bdist_mpkg the way to go? TIA --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] [Pyobjc-dev] another tableview question
On 7-Jul-05, at 7:29 PM, Phil Christensen wrote: # # class defined in MainMenu.nib class ContentsTreeViewDelegate(NibClassBuilder.AutoBaseClass): # the actual base class is NSObject # The following outlets are added to the class: # controller # tableView def init(self): self.contents = [] return self You should call your superclass init() here. Bob Ippolito wrote about proper use of super on this list a few days ago, so I'm paraphrasing from him: def init(self): self = super(ontentsTreeViewDelegate, self).init() self.contents = [] return self def awakeFromNib(self): self.tableView.documentView().setDataSource_(self) You can (and perhaps should) set the data source in your nib using InterfaceBuilder. def numberOfRowsInTableView_(self, sender): return (len(self.contents)) numberOfRowsInTableView_ = objc.selector(numberOfRowsInTableView_, argumentTypes='O', returnType='i') I have never needed to use objc.selector. I think this method should be OK without it. def tableView_objectValueForTableColumn_row_(self, sender, tableColumn, row): if (len(self.contents) row): self.contents[row] tableView_objectValueForTableColumn_row_ = objc.selector (tableView_objectValueForTableColumn_row_, argumentTypes='OOi', returnType='O') I think this may be the problem, you're not returning a value from this method. Also, the value you return should inherit from NSObject, and you should keep a reference to it, because the tableView doesn't, IIRC. # but when I run the application I get: 2005-07-07 22:19:30.911 controller[7740] *** Illegal NSTableView data source (ContentsTreeViewDelegate: 0x11ac760). Must implement numberOfRowsInTableView: and tableView:objectValueForTableColumn:row: I think this is due to you not returning a value from the method above. Try it and see. Which I thought I had! Incidentally, I've also tried defining the selector with and without the 'selector' argument, and I've also tried using the 'signature' argument instead of the argumentTypes/ returnType keywords. You shouldn't need these, the PyObjC does a great job of hiding these details. Any help would be greatly appreciated. Thanks in advance, -phil christensen [EMAIL PROTECTED] --Dethe Windows has detected the mouse has moved. Please restart your system for changes to take effect. ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] [Pyobjc-dev] another tableview question
One thing I'm not sure about is making the class a dataSource in InterfaceBuilder. I made the connection (and obviously defined the methods in the source), but I couldn't define the appropriate actions on the class I created in IB. When I tried to create an action for 'tableView:objectValueForTableColumn:row:', IB told me it was not a valid action name. I guess that would make sense anyways, since these aren't actions at all. You don't have to tell IB about actions unless you want to bind them. In this case, all you need to do is tell it you have this custom class, and an instance of your class is the dataSource for your table. The rest should happen at runtime. --Dethe Thought is an infection. In certain cases it becomes an epidemic. -- Wallace Stevens ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] More on init
This works for me: snippet from Foundation import * from AppKit import * from PyObjCTools import NibClassBuilder, AppHelper jabberwocky = '''Twas brillig and the slithy toves did gyre and gimble in the wabe all mimsy were the borogroves and the mome raths outgrabe''' class SpeechDelegate(NSObject): def applicationDidFinishLaunching_(self, notification): synth = NSSpeechSynthesizer.alloc() synth = synth.initWithVoice_ ('com.apple.speech.synthesis.voice.Victoria') synth.startSpeakingString_(jabberwocky) app = NSApplication.sharedApplication() delegate = SpeechDelegate.alloc().init() app.setDelegate_(delegate) AppHelper.runEventLoop() /snippet ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Discussion of Python IDE's: strengths and weaknesses (long)
Hi Kevin, Thanks for that summary. Testing out all of these various IDEs has been on my to-do list for a long time, but I never seem to get around to it (I rely on vim and TextWrangler for most of my coding needs). It's very helpful to have a good summary of the features and status of the IDEs handy. --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] PyObjC FAQ
There is a FAQ on the macpython wiki: http://www.pythonmac.org/wiki/FAQ It seems to have been rather drastically refactored, I remember there being many more questions before. --Dethe On 4-Jul-05, at 1:43 PM, Bob Ippolito wrote: On Jul 4, 2005, at 9:48 AM, Jacob Kaplan-Moss wrote: On Jul 4, 2005, at 2:31 PM, Jacob Kaplan-Moss wrote: Perhaps this one should be added to the FAQ? ... which, I now see, doesn't seem to exist (http:// pyobjc.sourceforge.net/faq/ is a 404). Should we write one? I'm happy to coordinate putting one together if people want to send me questions and/or answers that should be in it... Yes, please :) I just wrote an additional section at the beginning of the intro that specifically covers the Three Big Things right up front and quickly (First Steps). http://svn.red-bean.com/pyobjc/trunk/pyobjc/Doc/intro.txt -bob ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig Excel is the Awk of Windows --Joel Spolsky ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] NSMovieView question
You can't really do that using NSMovieView without dropping down to the C-level Quicktime routines (maybe there is a python wrapper for these, but if so it is not documented). If you are running on Tiger (10.4) you can use the Quicktime (QTKit) framework, which has much more control over the movie. QTKit Reference: http://developer.apple.com/documentation/QuickTime/ Reference/QTCocoaObjCKit/index.html Quicktime for Cocoa documentation: http://developer.apple.com/ documentation/Cocoa/QuickTime-date.html Specifically, you could use the QTMovie.currentTime() and QTMovie.setCurrentTime_(time) methods to do what you're asking. --Dethe On 30-Jun-05, at 11:49 AM, Jared Barden wrote: Hello all, If I'm using an NSMovieView to play a given movie that is let's say 5:00 long, how do I tell the NSMovieView to go to 4:45? I've been looking around and haven't found a good answer yet. All help appreciated, Jared Barden Wilcox Development Solutions http://www.wilcoxd.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig Young children play in a way that is strikingly similar to the way scientists work --Busytown News ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] [Durus-users] Problem compiling Durus on Tiger
On 24-Jun-05, at 7:25 AM, Mario Ruggier wrote: Another annoying thing is the path change for site-packages -- tiger now expects now that site-packages be appended to the panther version of the same location... ;-( I use a script to tell me where site-packages is. Save this as pyext for example and you can do things like ls `pyext` and tab-completion works fine with that in Bash. If you need to find the site-packages for a specific python, then just run it as /usr/local/bin/python pyext.py assuming you call it pyext.py in that case... = pyext script #!/usr/bin/env python import sys for p in sys.path: if p.endswith('site-packages'): print p sys.exit() end script = It's not particularly elegant, but I find it useful (and not just on OS X). --Dethe Life is extinct on other planets. Their scientists were more advanced than ours. --Mark Russell ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] [Visualpython-users] Re: avoid dueling pythons on tiger
On 7-Jun-05, at 7:16 PM, Jon Schull wrote: Thanks I have done that (by adding set path = (/usr/local/bin $path) to .tcshrc) and all is well. Now, as momentary liaison between the pythonmac and vpython lists I'll mention that VPython (a truly beautiful thing) could be made independent of X11 if someone from this group knew how to liberate it... I took a stab at it once, before VPython was refactored into C++, but I was still pretty new to OS X programming at the time, and it defeated me. I haven't yet taken a look at the C++ version, it's on my todo list, but not a high priority right now. I'd love to see VPython on OS X properly, but my hobby coding time is pretty limited right now. --Dethe Well I've wrestled with reality for thirty-five years now, doctor, and I'm happy to state I've finally won out over it. -- Elwood P. Dowd, Harvey ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
[Pythonmac-SIG] Correct way to send info to running program
I want to be able to periodically send data to a running program, from the command-line. I was looking at the various NSPort classes, but just discovered that NSSocketPort is not a raw socket, but only intended to talk to other NSPort instances. Surely I'm not the only one who wants to be able to do this. Is there a one right way? Any guidance here would be appreciated. --Dethe There are only two industries that call their customers users ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Correct way to send info to running program
Bob wrote: NSDistributedNotificationCenter? You didn't really specify what your requirements are... I'm trying to set up a simplest thing that could possibly work for getting events from another application which doesn't really play well with others. I have hacked it enough that it logs the events I want to the console, so I can, for example, put a tail -f console.log | grep [events I'm interested in] | sendMessageToMyApp. I was intending to make sendMessageToMyApp be based on datagrams using something along the lines of: import socket host, port = 'localhost', 8081 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.sendto('some data from the command-line', (host, port)) But I was thinking that I could use NSPort to receive these messages, which was totally off base. I can apparently use CFSocket, but realized that I should do a reality check and see if there's a better way than the somewhat convoluted and roundabout path I'd set up. It looks like NSDistributedNotificationCenter might work. I'll try it out. Thanks! --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] SetSystemUIMode in python?
While Pyrex is a pretty reasonable way to write extensions, PyObjC or ctypes is generally less painful when wrapping a small number of functions. This is very interesting. I thought the basic choices for wrapping C functions were: * Pyrex * ctypes * Write Obj-C and import with PyObjC I hadn't realized that you could import functions with PyObjC and no (additional) intervening Obj-C code. Very very cool. --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
[Pythonmac-SIG] Building Twisted
Hi folks, Has anyone installed twisted 2.0 on Tiger? I don't think I've ever had trouble building Twisted before, but now they've made it dependent on Zope Interfaces, which won't build for me. I'm running OS 10.4, Bob's Python 2.4, latest svn of PyObjC and py2app. Here's the traceback I'm getting when I try to build Zope Interfaces 3.0.1: $ python setup.py build running build running build_py running build_ext building 'zope.interface._zope_interface_coptimizations' extension gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused- madd -fno-common -dynamic -DNDEBUG -g -O3 -Wall -Wstrict-prototypes - IDependencies/zope.interface-ZopeInterface-3.0.1/zope.interface -I/ Library/Frameworks/Python.framework/Versions/2.4/include/python2.4 -c Dependencies/zope.interface-ZopeInterface-3.0.1/zope.interface/ _zope_interface_coptimizations.c -o build/temp.darwin-8.1.0- Power_Macintosh-2.4/Dependencies/zope.interface-ZopeInterface-3.0.1/ zope.interface/_zope_interface_coptimizations.o Dependencies/zope.interface-ZopeInterface-3.0.1/zope.interface/ _zope_interface_coptimizations.c:339: error: static declaration of 'SpecType' follows non-static declaration Dependencies/zope.interface-ZopeInterface-3.0.1/zope.interface/ _zope_interface_coptimizations.c:73: error: previous declaration of 'SpecType' was here error: command 'gcc' failed with exit status 1 Since when do either Zope or Twisted require binary components anyway? --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Building Twisted
Just install the zope.interfaces from http://pythonmac.org/ packages/ -- unless you don't trust me, in which case, I don't care :) Bob, your packages were the first place I checked, but I checked for twisted and completely missed the fact that you had a package for Zope Interfaces. Thank you! It's a dumb bug in the z.i sources that gcc4 doesn't like. It probably compiles if you gcc_switch to 3.3. I recall that someone sent the z.i guys a patch, I don't know why they haven't made a 3.0.2 release yet. Lazy, I guess :) Since when do either Zope or Twisted require binary components anyway? Since Zope 3 and Twisted 2. Progress. There's no stopping it, more's the pity. Thanks again. --Dethe Windows has detected the mouse has moved. Please restart your system for changes to take effect. ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] On posting long urls
Using tinyurl isn't very search engine friendly and if tinyurl ever goes down then the links are gone... I only really use tinyurl for pathologically long transient URLs, like a mapquest map or something :) -bob It's not an either-or proposition. You can include the original URL for searching, or in case tinyurl goes away, but include a tinyurl to the same resource for convenience (and not linebreaking). --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
[Pythonmac-SIG] Frameworks which won't import
Let me try to rephrase my question. I have a framework which I can't import into PyObjC in the usual way. Since then I've tried various other frameworks I've found on my system, mostly embedded in application bundles, and some import but others do not. I'm not getting any information on *why* they can't be imported, even when I turn on debugging with the following lines before any attempt to load bundles. from PyObjCTools import Debugging Debugging.installVerboseExceptionHandler() Here are the questions: * What can I do to find out why a bundle wouldn't load? * Are there common, expected reasons for a framework bundle to not load? * Is there anything I can do about it? Now, as far as the Skype framework itself is concerned, I realized I'm using a Beta and downloaded the earlier, stable release, which does not have embedded frameworks. Thanks! --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Frameworks which won't import
It's more or less a case of getting what you deserve, trying to load embedded frameworks from applications that were never meant for external use. They probably depend on symbols defined in the executable or something. OK, thanks. At least I know to give up that route and try another way. --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] AddressBook wrapper
You rock. Thanks! --Dethe On 5-May-05, at 4:26 AM, Ronald Oussoren wrote: On 4-mei-2005, at 22:03, Dethe Elza wrote: The AddressBook wrapper doesn't appear to expose the constants kABShowAsPerson (0), kABShowAsCompany (1), or kABShowAsMask (7). It does now (PyObjC repository, revision 1609) Ronald values of will give rise to dom --Unix prehistory ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] MacOS 10.4: getxattr() etc. for Python?
The trick is that on Solaris and SELinux they're purely an ACL issue as far as I know. I believe Tiger is the first OS to fully deploy an abstract meta-data infrastructure in the FS. While ReiserFS has it, from what I'm told, it's not widely deployed. Not entirely true, BeOS pioneered file metadata infrastructure, as well as multi-fork files, but OS X may well be the first mainstream OS to do so. --Dethe Why is Virtual Reality always posited in terms of space, when time is the only real commodity left? --Rich Gold ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
[Pythonmac-SIG] AddressBook wrapper
The AddressBook wrapper doesn't appear to expose the constants kABShowAsPerson (0), kABShowAsCompany (1), or kABShowAsMask (7). --Dethe Life is extinct on other planets. Thier scientists were more advanced than ours. --Mark Russell ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
[Pythonmac-SIG] Simple Statusitem example
Here is a very simple example of a statusbar item, requiring no further resources. A real statusitem would probably have a Nib to load a menu and maybe a configuration panel from, icons, etc. begin statusitem.py == import objc from Foundation import * from AppKit import * from PyObjCTools import NibClassBuilder, AppHelper start_time = NSDate.date() class Timer(NSObject): ''' Application delegate ''' statusbar = None def applicationDidFinishLaunching_(self, notification): print 'timer launched' # Make the statusbar item statusbar = NSStatusBar.systemStatusBar() # if you use an icon, the length can be NSSquareStatusItemLength statusitem = statusbar.statusItemWithLength_(NSVariableStatusItemLength) self.statusitem = statusitem # Need to retain this for later # statusitem.setImage_(some_image) #statusitem.setMenu_(some_menu) statusitem.setToolTip_('Seconds since startup') statusitem.setAction_('terminate:') # must have some way to exit self.timer = NSTimer.alloc().initWithFireDate_interval_target_selector_userInfo_repea ts_( start_time, 1.0, self, 'display:', None, True ) NSRunLoop.currentRunLoop().addTimer_forMode_(self.timer, NSDefaultRunLoopMode) self.timer.fire() def display_(self, notification): print 'display:' self.statusitem.setTitle_(elapsed()) def elapsed(): return str(int(NSDate.date().timeIntervalSinceDate_(start_time))) if __name__ == __main__: app = NSApplication.sharedApplication() delegate = Timer.alloc().init() app.setDelegate_(delegate) AppHelper.runEventLoop() == end statusitem.py The main thing about the setup file is to pass LSUIElement = '1' in the plist to suppress the dock icon. The program should perhaps hide itself as well. == begin setup.py == ''' Minimal setup.py example, run with: % python setup.py py2app ''' from distutils.core import setup import py2app NAME = 'Uptime' SCRIPT = 'statusitem.py' VERSION = '0.1' ID = 'uptime' plist = dict( CFBundleName= NAME, CFBundleShortVersionString = ' '.join([NAME, VERSION]), CFBundleGetInfoString = NAME, CFBundleExecutable = NAME, CFBundleIdentifier = 'org.livingcode.examples.%s' % ID, LSUIElement = '1' ) app_data = dict(script=SCRIPT, plist=plist) setup( app = [app_data], ) == end setup.py --Dethe Windows has detected the mouse has moved. Please restart your system for changes to take effect. smime.p7s Description: S/MIME cryptographic signature ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Simple Statusitem example
Replying to myself... In another thread, Bob suggests waiting until the 29th to release PyObjC 1.3.1, so I guess I have a little more time to work on this example. Perhaps I'll keep this as a dirt simple example, and work up a more realistic one with an icon, menu, and dialog. I had about an hour last night to knock this together, which stretched out a little longer because I'd never used NSTimer before. Are there any examples people would like to see? What would actually be *useful* to show in the status bar? ITunes and clocks have been done to death, but I'm sure there's something that would be nice to have which would make a good example. --Dethe On 12-Apr-05, at 11:17 PM, Dethe Elza wrote: Here is a very simple example of a statusbar item, requiring no further resources. A real statusitem would probably have a Nib to load a menu and maybe a configuration panel from, icons, etc. begin statusitem.py == import objc from Foundation import * from AppKit import * from PyObjCTools import NibClassBuilder, AppHelper start_time = NSDate.date() class Timer(NSObject): ''' Application delegate ''' statusbar = None def applicationDidFinishLaunching_(self, notification): print 'timer launched' # Make the statusbar item statusbar = NSStatusBar.systemStatusBar() # if you use an icon, the length can be NSSquareStatusItemLength statusitem = statusbar.statusItemWithLength_(NSVariableStatusItemLength) self.statusitem = statusitem # Need to retain this for later # statusitem.setImage_(some_image) #statusitem.setMenu_(some_menu) statusitem.setToolTip_('Seconds since startup') statusitem.setAction_('terminate:') # must have some way to exit self.timer = NSTimer.alloc().initWithFireDate_interval_target_selector_userInfo_repe ats_( start_time, 1.0, self, 'display:', None, True ) NSRunLoop.currentRunLoop().addTimer_forMode_(self.timer, NSDefaultRunLoopMode) self.timer.fire() def display_(self, notification): print 'display:' self.statusitem.setTitle_(elapsed()) def elapsed(): return str(int(NSDate.date().timeIntervalSinceDate_(start_time))) if __name__ == __main__: app = NSApplication.sharedApplication() delegate = Timer.alloc().init() app.setDelegate_(delegate) AppHelper.runEventLoop() == end statusitem.py The main thing about the setup file is to pass LSUIElement = '1' in the plist to suppress the dock icon. The program should perhaps hide itself as well. == begin setup.py == ''' Minimal setup.py example, run with: % python setup.py py2app ''' from distutils.core import setup import py2app NAME = 'Uptime' SCRIPT = 'statusitem.py' VERSION = '0.1' ID = 'uptime' plist = dict( CFBundleName= NAME, CFBundleShortVersionString = ' '.join([NAME, VERSION]), CFBundleGetInfoString = NAME, CFBundleExecutable = NAME, CFBundleIdentifier = 'org.livingcode.examples.%s' % ID, LSUIElement = '1' ) app_data = dict(script=SCRIPT, plist=plist) setup( app = [app_data], ) == end setup.py --Dethe Windows has detected the mouse has moved. Please restart your system for changes to take effect.___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig Isn't 'A guy tried to smuggle plutonium from Tajikistan into Afganistan or Pakistan' just a fancy way of saying 'Live for the moment?' --Get Your War On smime.p7s Description: S/MIME cryptographic signature ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Simple Statusitem example
Hi Tom, Thanks, that sounds like a good example. I'll take a look at it. Any others out there? --Dethe On 13-Apr-05, at 9:36 AM, Tom Pollard wrote: Hi Dethe, You asked: Are there any examples people would like to see? What would actually be *useful* to show in the status bar? ITunes and clocks have been done to death, but I'm sure there's something that would be nice to have which would make a good example. How about a network activity icon, something like what's in the Windows tray? Currently, you have to open the Network preferences panel to see whether you've got a network connection. It sometimes takes a few minutes to get a DHCP address from my office network when I connect first the laptop in the morning, and I've wished there was a way to see easily when the network comes up (besides seeing whether I can load a web page.) Tom Ambiguity, calculated or generative, as a means of discontinuous organization, at first seems familiar to us -- Pain Not Bread, An introduction to Du Fu smime.p7s Description: S/MIME cryptographic signature ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
[Pythonmac-SIG] Hide application icon
HI folks, I'm writing a statusbar app and don't want an icon to show up in the Dock. What is the correct way to hide/remove the icon? --Dethe What dark passions and ancient evils have been held in check by the grim totalitarianism of the profit motive? --Bruce Sterling smime.p7s Description: S/MIME cryptographic signature ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Hide application icon
Thanks! I thought I'd tried that, but my Info.plist wasn't getting picked up. I blew away dist/ and build/ and rebuilt with -P Info.plist and it worked. I'll work up a simple statusbar example for the PyObjC examples if there's any interest. --Dethe On 12-Apr-05, at 12:59 PM, Martina Oefelein wrote: Hi Dethe Elza: I'm writing a statusbar app and don't want an icon to show up in the Dock. What is the correct way to hide/remove the icon? set LSUIElement to 1 in your info.plist http://developer.apple.com/documentation/MacOSX/Conceptual/ BPRuntimeConfig/Concepts/PListKeys.html#//apple_ref/doc/uid/20001431/ TPXREF136 ciao Martina Email is where knowledge goes to die. --Bill French smime.p7s Description: S/MIME cryptographic signature ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Categories for class methods
That's a good tip, I haven't gotten the hang of Cocoa's verbosity yet. The choice of read: was to balance write:. The whole thing started because I found it odd that writing an image to a file was such a convoluted process. In a lot of ways, Cocoa makes things really easy, but when it isn't easy, sometimes it becomes really, really hard (at least hard to figure out, if not to implement). Some of that is just getting to know the libraries, of course, and a lack of howtos for the things I'm trying to do. --Dethe On 27-Jan-05, at 12:57 PM, Bob Ippolito wrote: On Jan 27, 2005, at 15:24, Dethe Elza wrote: FYI, once I updated PyObjC from svn, my example code worked, thanks again Ronald. ... class NSImage(Category(NSImage)): def rect(self): return (0,0),self.size() @classmethod # for Python2.3 replace with read_ = classmethod(read_) def read_(cls, filepath): return NSImage.alloc().initWithContentsOfFile_(filepath) Just a nit here, you should probably call this imageWithFilePath_ to follow convention. read: is a really confusing name for an initializer. -bob ...coding isn't the poor handmaiden of design or analysis. Coding is where your fuzzy, comfortable ideas awaken in the harsh dawn of reality. It is where you learn what your computer can do. If you stop coding, you stop learning. Kent Beck, Smalltalk Best Practice Patterns smime.p7s Description: S/MIME cryptographic signature ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] coding preference
That being said, I am hopeful about PyGUI, but it's a going to be at least another few years before it's as useful as wxPython (there isn't even a real Windows version yet!). After all, it took quite a few years for wxPython to become really usable. My mistake. I was under the impression that PyGUI had been abandoned. I will take another look. Maybe I was thinking of PIDDLE/Sping, which does appear to be abandoned. If PyGUI is still viable, I'll look into it and see if I can help out. In the meantime, wxPython (and probably PyQT, if the license works for you) is a pretty good option for cross platform code, and it's slowly becoming more Pythonic. I keep trying to like wxPython, I really do. It's just that its freaking huge, many of its widgets look like they were designed by children, and I find it really cumbersome to work with. The wx demo looks moderately OK on Windows, but pretty bad on OS X. I don't have any experience with PyQT, but prefer open systems to closed, given a choice. There are also a couple of pythonic wrappers for wxPython: WAX and PythonCard. I'm not fond of the wrappers around wrappers around wrappers approach, but if they work for you, who cares how many layers there are? I've looked at PythonCard, but you can't next objects, which rules it out for me (plus it's built on wx). I've been meaning to take a look at Wax to see if the API is worth porting to live on top of Cocoa, but I'll take another look at PyGUI first. --Dethe Choosing software is not a neutral act. It must be done consciously; the debate over free and proprietary software cant be limited to the differences in the applications features and ergonomics. To choose an operating system, or software, or network architecture is to choose a kind of society. --Lemaire and Decroocq (trans. by Tim Bray) smime.p7s Description: S/MIME cryptographic signature ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
[Pythonmac-SIG] Re: [Pyobjc-dev] missing method?
You need to replace colons in the Cocoa method with underscores in Python, so [dictionaryWithContentsOfFile: @/path] // My ObjC may be off a bit, but something like this becomes dictionaryWithContentsOfFile_(u/path) # note underscore --Dethe As for intelligent machines taking over, a machine does not have to be intelligent to conquer the world; it merely has to be desireable. We've already lost a war to a synthetic species--the automobile--that has killed more than 15 million people; occupied all of our cities except Venice, Italy; and continues to exact crushing taxes in resources, wealth, and time from over half the planet--and everybody wants one. --Grant Thompson smime.p7s Description: S/MIME cryptographic signature ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] ANN: pyobjc-1.2
As it is largely undocumented, has no official release, is quite evil, and I have no spare time to support it.. I'm not going to encourage its use. If you have a use for it, it's there, but that's about as far as I'm willing to go right now. With an intro like that, how can I *not* try it out? %-) --Dethe A miracle, even if it's a lousy miracle, is still a miracle. --Teller smime.p7s Description: S/MIME cryptographic signature ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig