from twisted.internet._threadedselect import install
reactor = install()

import objc, Foundation, AppKit, os, MGScopeBar
from PyObjCTools import AppHelper

def loadFramework(frameworkName):
    base_path = os.path.join(os.path.dirname(os.getcwd()), 'Frameworks')
    bundle_path = os.path.abspath(
        os.path.join(base_path, '%s.framework' % frameworkName)
        )
    objc.loadBundle(frameworkName, globals(), bundle_path=bundle_path) 

#base_path = os.path.join(os.path.dirname(os.getcwd()), 'Frameworks')
#bundle_path = os.path.abspath(
#    os.path.join(base_path, 'BWToolkitFramework.framework')
#    )
#objc.loadBundle('BWToolkitFramework', globals(), bundle_path=bundle_path) 
loadFramework('BWToolkitFramework')

objc.loadBundle("Automator", globals(),
                bundle_path="/System/Library/Frameworks/Automator.framework")

# import modules containing classes required to start application and
# load MainMenu.nib:
from friendly import app, master, account, contacts

# pass control to AppKit
reactor.interleave(AppHelper.callAfter)
reactor.addSystemEventTrigger('after', 'shutdown', AppHelper.stopEventLoop)
AppHelper.runEventLoop()

@@ -1,850 +1,1375 @@
-from twisted.internet._threadedselect import install%0Areactor = install()%0A%0Aimport objc, Foundation, AppKit, os, MGScopeBar%0Afrom PyObjCTools import AppHelper%0A%0Adef loadFramework(frameworkName):%0A    base_path = os.path.join(os.path.dirname(os.getcwd()), 'Frameworks')%0A    bundle_path = os.path.abspath(%0A        os.path.join(base_path, '%25s.framework' %25 frameworkName)%0A        )%0A    objc.loadBundle(frameworkName, globals(), bundle_path=bundle_path) %0A%0A#base_path = os.path.join(os.path.dirname(os.getcwd()), 'Frameworks')%0A#bundle_path = os.path.abspath(%0A#    os.path.join(base_path, 'BWToolkitFramework.framework')%0A#    )%0A#objc.loadBundle('BWToolkitFramework', globals(), bundle_path=bundle_path) %0AloadFramework('BWToolkitFramework')%0A%0Aobjc.loadBundle(%22Automator%22, globals(),%0A                bundle_path=%22/System/Library/Frameworks/Automator.framework%22)
+# This file is part of Friendly.%0A# Copyright (c) 2009 Johan Rydberg %3Cjohan.rydberg@gmail.com%3E%0A#%0A# Permission is hereby granted, free of charge, to any person%0A# obtaining a copy of this software and associated documentation%0A# files (the %22Software%22), to deal in the Software without%0A# restriction, including without limitation the rights to use,%0A# copy, modify, merge, publish, distribute, sublicense, and/or sell%0A# copies of the Software, and to permit persons to whom the%0A# Software is furnished to do so, subject to the following%0A# conditions:%0A#%0A# The above copyright notice and this permission notice shall be%0A# included in all copies or substantial portions of the Software.%0A#%0A# THE SOFTWARE IS PROVIDED %22AS IS%22, WITHOUT WARRANTY OF ANY KIND,%0A# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES%0A# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND%0A# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT%0A# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,%0A# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING%0A# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR%0A# OTHER DEALINGS IN THE SOFTWARE.%0A%0Afrom twisted.internet._threadedselect import install%0Areactor = install()%0A%0Afrom PyObjCTools import AppHelper%0A%0Aimport Automator%0Aimport BWToolkitFramework%0Aimport Foundation%0Aimport AppKit%0Aimport MGScopeBar%0Aimport objc
 %0A%0A# 

Clean up main.py.