Building Cocoa GUIs in Python with PyObjC, Part Four

Creating an Open Dialog

Our controller doesn't really do anything at this point. We'll begin by adding an open dialog for the user. This will require us to really delve into the Objective C bridge provided by PyObjC. We'll start by reading some documentation that ships with Xcode.

Let's launch the local documentation browser in Xcode. Under "Help" click "Documentation". In the newly opened documentation browser select the "Mac OS X 10.5" documentation set and search for NSOpenPanel. This is the class we'll be working with to create our open dialog. Have a look through the documentation, then let's code.

First we do some basic stuff, creating the object and setting some permissions. A modified open method on our controller.py looks like this:

filetypes = ('mp3', 'ogg', 'mp4', 'flac', 'm4a', 'm4p')

@IBAction
def open_(self, sender):
    panel = NSOpenPanel.openPanel()
    panel.setCanChooseDirectories_(NO)
    panel ...

Continue Reading

Permalink | Posted: Jul 04, 2008 | Tags: python osx programming pyobjc cocoa

My iPhone 3G Buying Experience

I've been reading various responses to the iPhone 3G activation issues. These range from "my phone is a brick," "the store won't sell any that aren't activated," to "the line barely moves." I had a different experience yesterday morning out here in California.

I went to the smaller local Apple store in the Stanford Shopping Center. The line started at 5 AM (mall rules) and my friend and I got there at 7 AM. We were around the 100th in line. Around 9 AM the Apple employees started to alert people that if they had a business discount on their phone they needed to call AT&T and get it removed. So I called and in 5 minutes I got the PLU number removed from my account. I got into the store at 9:45 AM, and quickly bought my 8 GB. The employee helping me told ...

Continue Reading

Permalink | Posted: Jul 12, 2008 | Tags: 42 iphone

Entries for June, 2008

Entries for August, 2008

Tags

42 | django | python | oggify | OSCON | OSCON07 | osx | utosc | mythtv | security | reading | music | gaming | programming | tips | shell | vim | pyobjc | cocoa | iphone | blog | git

Calendar

<< Jul >>
Mo Tu We Th Fr Sa Su
30 1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31 1 2 3

Search

This space reserved for a search box

A Django site. Hosted on a Slicehost Slice