Commits

Ronald Oussoren committed 695147e

Use runEventLoop in examples

Comments (0)

Files changed (4)

pyobjc/Examples/TableModel/TableModel.py

 from Foundation import NSObject
 from AppKit import NSApplicationMain, NSTableDataSource, NSTableViewDelegate
-from PyObjCTools import NibClassBuilder
+from PyObjCTools import NibClassBuilder, AppHelper
 from objc import selector
 import sys
 
         print "shouldSelectRow_", rowIndex
         return (rowIndex % 2)
 
-sys.exit(NSApplicationMain(sys.argv))
+AppHelper.runEventLoop()

pyobjc/Examples/TableModel2/TableModel.py

 import sys
 import os.path
 import AppKit
-from PyObjCTools import NibClassBuilder
+from PyObjCTools import NibClassBuilder, AppHelper
 
 sys.path.insert(0, os.path.join(sys.path[0], "pyobjc"))
 
         print "tableView:shouldSelectRow:", aRow
         return 1
 
-sys.exit(AppKit.NSApplicationMain(sys.argv))
+AppHelper.runEventLoop()

pyobjc/Examples/Todo/main.py

 import objc
 from AppKit import *
 from PyObjCTools.NibClassBuilder import extractClasses
+from PyObjCTools import AppHelper
 
 extractClasses('MainMenu')
 extractClasses('ToDoDocument')
 import ToDoItem
 import TodoAppDelegate
 
-NSApplicationMain(sys.argv)
+AppHelper.runEventLoop()

pyobjc/Examples/iClass/main.py

 """
 import time
 from AppKit import NSApplicationMain
-from PyObjCTools import NibClassBuilder
+from PyObjCTools import NibClassBuilder, AppHelper
 from Foundation import NSBundle
 import sys
 import os
 
 import datasource
 
-NSApplicationMain(sys.argv)
+AppHelper.runEventLoop()