File: IPython1SandboxAppDelegate.py

package info (click to toggle)
ipython 0.13.1-2%2Bdeb7u1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 15,752 kB
  • sloc: python: 69,537; makefile: 355; lisp: 272; sh: 80; objc: 37
file content (39 lines) | stat: -rw-r--r-- 931 bytes parent folder | download
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
32
33
34
35
36
37
38
39
#
#  IPython1SandboxAppDelegate.py
#  IPython1Sandbox
#
#  Created by Barry Wark on 3/4/08.
#  Copyright __MyCompanyName__ 2008. All rights reserved.
#

from Foundation import NSObject, NSPredicate
import objc
import threading

from PyObjCTools import AppHelper

from twisted.internet import reactor

class IPython1SandboxAppDelegate(NSObject):
    ipythonController = objc.IBOutlet()
    
    def applicationShouldTerminate_(self, sender):
        if reactor.running:
            reactor.addSystemEventTrigger(
                'after', 'shutdown', AppHelper.stopEventLoop)
            reactor.stop()
            return False
        return True
    
    
    def applicationDidFinishLaunching_(self, sender):
        reactor.interleave(AppHelper.callAfter)
        assert(reactor.running)
    
    
    def workspaceFilterPredicate(self):
        return NSPredicate.predicateWithFormat_("NOT (self.value BEGINSWITH '<')")