0
0
mirror of https://github.com/python/cpython.git synced 2024-11-28 08:20:55 +01:00
cpython/Mac/OSX/PythonLauncher/MyAppDelegate.m
Jack Jansen 0a3d6060d5 Only show the UI for selecting options if the ALT key was depressed while
dragging or double-clicking the script.
2002-08-01 15:07:00 +00:00

54 lines
1.1 KiB
Objective-C

#import "MyAppDelegate.h"
#import "PreferencesWindowController.h"
#import <Carbon/Carbon.h>
@implementation MyAppDelegate
- (id)init
{
self = [super init];
initial_action_done = NO;
should_terminate = NO;
return self;
}
- (IBAction)showPreferences:(id)sender
{
[PreferencesWindowController getPreferencesWindow];
}
- (void)applicationDidFinishLaunching:(NSNotification *)notification
{
// If we were opened because of a file drag or doubleclick
// we've set initial_action_done in shouldShowUI
// Otherwise we open a preferences dialog.
if (!initial_action_done) {
initial_action_done = YES;
[self showPreferences: self];
}
}
- (BOOL)shouldShowUI
{
// if this call comes before applicationDidFinishLaunching: we
// should terminate immedeately after starting the script.
if (!initial_action_done)
should_terminate = YES;
initial_action_done = YES;
if( GetCurrentKeyModifiers() & optionKey )
return YES;
return NO;
}
- (BOOL)shouldTerminate
{
return should_terminate;
}
- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender
{
return NO;
}
@end