summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvarmaa <varmaa@8b7adc99-b347-0410-ae0a-d9e86c8d69b5>2008-05-08 19:42:57 +0000
committervarmaa <varmaa@8b7adc99-b347-0410-ae0a-d9e86c8d69b5>2008-05-08 19:42:57 +0000
commit250d07b1cdf4dd9012d2c4768815120a65b00fee (patch)
treec490e765c2fdf73ce5d8966a983c9afc01f3b0f4
parent115856f5b5b66b76307b9f63507a0dfbd672f58c (diff)
downloadenso-250d07b1cdf4dd9012d2c4768815120a65b00fee.tar.gz
enso-250d07b1cdf4dd9012d2c4768815120a65b00fee.tar.bz2
Modified the OS X backend so that it doesn't attach an app delegate or call app.run() if a delegate is already installed and the app is already running. This allows Enso to be embedded in other applications, though it's still the case that only one instance of Enso should be running at a time.HEADmaster
git-svn-id: https://enso.googlecode.com/svn/trunk@147 8b7adc99-b347-0410-ae0a-d9e86c8d69b5
-rw-r--r--enso/platform/osx/input.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/enso/platform/osx/input.py b/enso/platform/osx/input.py
index 89a3f83..5d5d098 100644
--- a/enso/platform/osx/input.py
+++ b/enso/platform/osx/input.py
@@ -228,9 +228,13 @@ class InputManager( object ):
app = AppKit.NSApplication.sharedApplication()
- delegate = _AppDelegate.alloc().init()
-
- app.setDelegate_( delegate )
+ if not app.delegate():
+ logging.info( "Attaching app delegate." )
+ delegate = _AppDelegate.alloc().init()
+ app.setDelegate_( delegate )
+ else:
+ logging.info( "An app delegate is already attached; "
+ "skipping installation." )
timer = sendMsg(
_Timer.alloc(),
@@ -267,7 +271,13 @@ class InputManager( object ):
atexit.register( keyListener.unregister )
self.onInit()
- app.run()
+
+ if not app.isRunning():
+ logging.info( "Calling app.run()." )
+ app.run()
+ else:
+ logging.info( "Application appears to be running already; "
+ "skipping app.run()." )
def stop( self ):
app = AppKit.NSApplication.sharedApplication()