def __init__(self): self.preffilepath = os.path.join("Python", "Package Install Manager Prefs") Wapplication.Application.__init__(self, 'Pimp') from Carbon import AE from Carbon import AppleEvents self.defaulturl = "" AE.AEInstallEventHandler(AppleEvents.kCoreEventClass, AppleEvents.kAEOpenApplication, self.ignoreevent) AE.AEInstallEventHandler(AppleEvents.kCoreEventClass, AppleEvents.kAEReopenApplication, self.ignoreevent) AE.AEInstallEventHandler(AppleEvents.kCoreEventClass, AppleEvents.kAEPrintDocuments, self.ignoreevent) AE.AEInstallEventHandler(AppleEvents.kCoreEventClass, AppleEvents.kAEQuitApplication, self.quitevent) if 1: import PyConsole # With -D option (OSX command line only) keep stderr, for debugging the IDE # itself. debug_stderr = None if len(sys.argv) >= 2 and sys.argv[1] == '-D': debug_stderr = sys.stderr del sys.argv[1] PyConsole.installoutput() if debug_stderr: sys.stderr = debug_stderr self.domenu_openstandard() self.mainloop()
def __init__(self): if sys.platform == "darwin": if len(sys.argv) > 1 and sys.argv[1].startswith("-psn"): home = os.getenv("HOME") if home: os.chdir(home) self.preffilepath = os.path.join("Python", "PythonIDE preferences") Wapplication.Application.__init__(self, 'Pide') from Carbon import AE from Carbon import AppleEvents AE.AEInstallEventHandler(AppleEvents.kCoreEventClass, AppleEvents.kAEOpenApplication, self.ignoreevent) AE.AEInstallEventHandler(AppleEvents.kCoreEventClass, AppleEvents.kAEReopenApplication, self.ignoreevent) AE.AEInstallEventHandler(AppleEvents.kCoreEventClass, AppleEvents.kAEPrintDocuments, self.ignoreevent) AE.AEInstallEventHandler(AppleEvents.kCoreEventClass, AppleEvents.kAEOpenDocuments, self.opendocsevent) AE.AEInstallEventHandler(AppleEvents.kCoreEventClass, AppleEvents.kAEQuitApplication, self.quitevent) import PyConsole, PyEdit Splash.wait() # With -D option (OSX command line only) keep stderr, for debugging the IDE # itself. debug_stderr = None if len(sys.argv) >= 2 and sys.argv[1] == '-D': debug_stderr = sys.stderr del sys.argv[1] PyConsole.installoutput() PyConsole.installconsole() if debug_stderr: sys.stderr = debug_stderr for path in sys.argv[1:]: if path.startswith("-p"): # process number added by the OS continue self.opendoc(path) self.mainloop()