"""
A number of function that enhance IDLE on MacOSX when it used as a normal
GUI application (as opposed to an X11 application).
"""
import sys

def runningAsOSXApp():
    """ Returns True iff running from the IDLE.app bundle on OSX """
    return (sys.platform == 'darwin' and 'IDLE.app' in sys.argv[0])

def addOpenEventSupport(root, flist):
    """
    This ensures that the application will respont to open AppleEvents, which
    makes is feaseable to use IDLE as the default application for python files.
    """
    def doOpenFile(*args):
        for fn in args:
            flist.open(fn)

    # The command below is a hook in aquatk that is called whenever the app
    # receives a file open event. The callback can have multiple arguments,
    # one for every file that should be opened.
    root.createcommand("::tk::mac::OpenDocument", doOpenFile)

def hideTkConsole(root):
    root.tk.call('console', 'hide')


def setupApp(root, flist):
    """
    Perform setup for the OSX application bundle.
    """
    if not runningAsOSXApp(): return

    hideTkConsole(root)
    addOpenEventSupport(root, flist)

@@ -1,12 +1,11 @@
 %22%22%22
-%0D
 %0AA numbe
@@ -70,17 +70,16 @@
 a normal
-%0D
 %0AGUI app
@@ -126,14 +126,12 @@
 on).
-%0D
 %0A%22%22%22
-%0D
 %0Aimp
@@ -137,19 +137,17 @@
 port sys
-%0D%0A%0D
+%0A
 %0Adef run
@@ -161,17 +161,16 @@
 SXApp():
-%0D
 %0A    %22%22%22
@@ -226,25 +226,24 @@
 e on OSX %22%22%22
-%0D
 %0A    return 
@@ -298,19 +298,17 @@
 argv%5B0%5D)
-%0D%0A%0D
+%0A
 %0Adef add
@@ -333,33 +333,32 @@
 oot, flist):
-%0D
 %0A    %22%22%22
 %0D%0A    This e
@@ -341,25 +341,24 @@
 st):%0A    %22%22%22
-%0D
 %0A    This en
@@ -423,17 +423,16 @@
 s, which
-%0D
 %0A    mak
@@ -503,25 +503,24 @@
 n files.
-%0D
 %0A    %22%22%22
 %0D%0A    de
@@ -507,25 +507,24 @@
 les.%0A    %22%22%22
-%0D
 %0A    def doO
@@ -538,17 +538,16 @@
 (*args):
-%0D
 %0A       
@@ -562,17 +562,16 @@
 in args:
-%0D
 %0A       
@@ -589,19 +589,17 @@
 open(fn)
-%0D%0A%0D
+%0A
 %0A    # T
@@ -666,17 +666,16 @@
  the app
-%0D
 %0A    # r
@@ -742,17 +742,16 @@
 guments,
-%0D
 %0A    # o
@@ -790,17 +790,16 @@
  opened.
-%0D
 %0A    roo
@@ -852,19 +852,17 @@
 penFile)
-%0D%0A%0D
+%0A
 %0Adef hid
@@ -878,17 +878,16 @@
 e(root):
-%0D
 %0A    roo
@@ -918,13 +918,10 @@
 de')
-%0D%0A%0D%0A%0D
+%0A%0A
 %0Adef
@@ -943,25 +943,24 @@
  flist):
-%0D
 %0A    %22%22%22
 %0D%0A    Pe
@@ -947,25 +947,24 @@
 st):%0A    %22%22%22
-%0D
 %0A    Perform
@@ -1005,17 +1005,16 @@
 dle.
-%0D
 %0A    %22%22%22
 %0D%0A  
@@ -1009,17 +1009,16 @@
 %0A    %22%22%22
-%0D
 %0A    if 
@@ -1050,11 +1050,9 @@
 turn
-%0D%0A%0D
+%0A
 %0A   
@@ -1071,17 +1071,16 @@
 le(root)
-%0D
 %0A    add
@@ -1112,6 +1112,5 @@
 ist)
-%0D
 %0A

Add missing svn:eol-style property to text files.