From d7cccdd591346967d3c0c286b2e7e534435abc12 Mon Sep 17 00:00:00 2001 From: Jack Jansen Date: Fri, 20 Jun 2003 22:21:03 +0000 Subject: [PATCH] Added a field that allows the user to set sys.argv-style arguments to the script. Fixes #757544. --- .../English.lproj/MyDocument.nib/classes.nib | 1 + .../English.lproj/MyDocument.nib/info.nib | 6 +++--- .../English.lproj/MyDocument.nib/objects.nib | Bin 4441 -> 4845 bytes Mac/OSX/PythonLauncher/FileSettings.h | 2 ++ Mac/OSX/PythonLauncher/FileSettings.m | 10 +++++++++- Mac/OSX/PythonLauncher/MyDocument.h | 1 + Mac/OSX/PythonLauncher/MyDocument.m | 2 ++ .../PreferencesWindowController.m | 2 ++ .../PythonLauncher.pbproj/project.pbxproj | 2 +- 9 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Mac/OSX/PythonLauncher/English.lproj/MyDocument.nib/classes.nib b/Mac/OSX/PythonLauncher/English.lproj/MyDocument.nib/classes.nib index 7778ff04555..bcdc0cdf088 100644 --- a/Mac/OSX/PythonLauncher/English.lproj/MyDocument.nib/classes.nib +++ b/Mac/OSX/PythonLauncher/English.lproj/MyDocument.nib/classes.nib @@ -14,6 +14,7 @@ nosite = NSButton; optimize = NSButton; others = NSTextField; + scriptargs = NSTextField; tabs = NSButton; verbose = NSButton; "with_terminal" = NSButton; diff --git a/Mac/OSX/PythonLauncher/English.lproj/MyDocument.nib/info.nib b/Mac/OSX/PythonLauncher/English.lproj/MyDocument.nib/info.nib index 0630cb93580..e258c7220a4 100644 --- a/Mac/OSX/PythonLauncher/English.lproj/MyDocument.nib/info.nib +++ b/Mac/OSX/PythonLauncher/English.lproj/MyDocument.nib/info.nib @@ -3,14 +3,14 @@ IBDocumentLocation - 551 90 356 240 0 0 1280 1002 + 398 60 356 240 0 0 1024 746 IBFramework Version - 286.0 + 291.0 IBOpenObjects 5 IBSystem Version - 6I32 + 6L60 diff --git a/Mac/OSX/PythonLauncher/English.lproj/MyDocument.nib/objects.nib b/Mac/OS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(Z~oXLL4ll@xhlIq8uvUTv@W@)~%IGF1_@vKT?9DJ-nIU%)IxX znf?28ru(T2>7PA(j5N>w>Ow28G{}Syi#f%qSA4@p1De2H@+as9-jG|a3!zX5sRIZH z&=Z-ga)v{dPl(Fm!C#{&9FwwItpW5PAWKVG(is*jSwZFf`zDjkX2V}AJt&JGs$21* zN{gp8vnaRk{i9q!dFma3BU>UV#zG{I9R8BMDUa1fub>iBq>nUiUhLzUd@m|3I|F?1tPvCTlHxrinQ;%CXmfK zVqAZ(j;h?FNO9Z2+4(hrWbj>WCnnmSg%rj6%}^EDcYP`%NB#f1rwMTi6kV%Fa636^oY@gm6%wh?FI)RU}l1G&-$~UtP6ucBg}@B}yWc zKeBEs@2Max9vkwvCDPKZYCHd(oAt2Xi_*2mL{frE3HrDyN=ZmVkq~CGI&ZiNR0x6eY!Df6dAmso1n%vgA2N|)JQY9 zy`}T=Tq4QP88j{VI0GGw!DDkfT;;LOB~ntPb(ZIPy#~6bx_F7f?v|cTV`4{=tfHGM z52v!=OvEDnE%v~9^gzYZ4cO9aA(9;7;vyfSU*~@VE8stBL zJ6GY-1u##;{1wQ42)E{7XB2ME!0vfCeG0ZZ!L|sZ0?rRXyd5rl28FXQHV#vtL-8E6 zw!k$Lq&@;eHw+9zsUKn;aOImzFfs-mAHbJiz|16Uwn6Ww&^G|*1|fL@a=lfI*E@Sj&R2HT!>aI@D@HXDUxGk&f8t;A}2>$`}x^Jrh diff --git a/Mac/OSX/PythonLauncher/FileSettings.h b/Mac/OSX/PythonLauncher/FileSettings.h index f70b05f5183..d807bae59cc 100755 --- a/Mac/OSX/PythonLauncher/FileSettings.h +++ b/Mac/OSX/PythonLauncher/FileSettings.h @@ -19,6 +19,7 @@ - (BOOL) tabs; - (NSString *) others; - (BOOL) with_terminal; +- (NSString *) scriptargs; @end @interface FileSettings : NSObject @@ -33,6 +34,7 @@ BOOL nosite; // -S option: don't import site.py BOOL tabs; // -t option: warn about inconsistent tabs NSString *others; // other options + NSString *scriptargs; // script arguments (not for preferences) BOOL with_terminal; // Run in terminal window FileSettings *origsource; diff --git a/Mac/OSX/PythonLauncher/FileSettings.m b/Mac/OSX/PythonLauncher/FileSettings.m index 7b28daae017..fc3937b3dcb 100755 --- a/Mac/OSX/PythonLauncher/FileSettings.m +++ b/Mac/OSX/PythonLauncher/FileSettings.m @@ -77,6 +77,7 @@ nosite = source->nosite; tabs = source->tabs; others = [source->others retain]; + scriptargs = [source->scriptargs retain]; with_terminal = source->with_terminal; prefskey = source->prefskey; if (prefskey) [prefskey retain]; @@ -164,6 +165,7 @@ self = [self initWithFileSettings: fsdefaults]; if (!self) return self; interpreters = [fsdefaults->interpreters retain]; + scriptargs = [@"" retain]; [self applyUserDefaults: filetype]; prefskey = [filetype retain]; return self; @@ -191,6 +193,7 @@ nosite = [source nosite]; tabs = [source tabs]; others = [[source others] retain]; + scriptargs = [[source scriptargs] retain]; with_terminal = [source with_terminal]; // And if this is a user defaults object we also save the // values @@ -206,6 +209,7 @@ [NSNumber numberWithBool: nosite], @"nosite", [NSNumber numberWithBool: nosite], @"nosite", others, @"others", + scriptargs, @"scriptargs", [NSNumber numberWithBool: with_terminal], @"with_terminal", nil]; defaults = [NSUserDefaults standardUserDefaults]; @@ -235,6 +239,8 @@ if (value) tabs = [value boolValue]; value = [dict objectForKey: @"others"]; if (value) others = [value retain]; + value = [dict objectForKey: @"scriptargs"]; + if (value) scriptargs = [value retain]; value = [dict objectForKey: @"with_terminal"]; if (value) with_terminal = [value boolValue]; } @@ -260,7 +266,7 @@ cur_interp = interpreter; return [NSString stringWithFormat: - @"\"%@\"%s%s%s%s%s%s %@ \"%@\" %s", + @"\"%@\"%s%s%s%s%s%s %@ \"%@\" %@ %s", cur_interp, debug?" -d":"", verbose?" -v":"", @@ -270,6 +276,7 @@ tabs?" -t":"", others, script, + scriptargs, with_terminal? "&& echo Exit status: $? && exit 1" : " &"]; } @@ -285,6 +292,7 @@ - (BOOL) nosite { return nosite;}; - (BOOL) tabs { return tabs;}; - (NSString *) others { return others;}; +- (NSString *) scriptargs { return scriptargs;}; - (BOOL) with_terminal { return with_terminal;}; @end diff --git a/Mac/OSX/PythonLauncher/MyDocument.h b/Mac/OSX/PythonLauncher/MyDocument.h index dd2b4fe9bde..00c1bae54e2 100755 --- a/Mac/OSX/PythonLauncher/MyDocument.h +++ b/Mac/OSX/PythonLauncher/MyDocument.h @@ -23,6 +23,7 @@ IBOutlet NSButton *tabs; IBOutlet NSTextField *others; IBOutlet NSButton *with_terminal; + IBOutlet NSTextField *scriptargs; IBOutlet NSTextField *commandline; NSString *script; diff --git a/Mac/OSX/PythonLauncher/MyDocument.m b/Mac/OSX/PythonLauncher/MyDocument.m index 09a0024d5e7..5acc2dcc90c 100755 --- a/Mac/OSX/PythonLauncher/MyDocument.m +++ b/Mac/OSX/PythonLauncher/MyDocument.m @@ -60,6 +60,7 @@ [nosite setState: [settings nosite]]; [tabs setState: [settings tabs]]; [others setStringValue: [settings others]]; + [scriptargs setStringValue: [settings scriptargs]]; [with_terminal setState: [settings with_terminal]]; [commandline setStringValue: [settings commandLineForScript: script]]; @@ -161,6 +162,7 @@ - (BOOL) nosite { return [nosite state];}; - (BOOL) tabs { return [tabs state];}; - (NSString *) others { return [others stringValue];}; +- (NSString *) scriptargs { return [scriptargs stringValue];}; - (BOOL) with_terminal { return [with_terminal state];}; // Delegates diff --git a/Mac/OSX/PythonLauncher/PreferencesWindowController.m b/Mac/OSX/PythonLauncher/PreferencesWindowController.m index fd65194afce..5dd08f36927 100644 --- a/Mac/OSX/PythonLauncher/PreferencesWindowController.m +++ b/Mac/OSX/PythonLauncher/PreferencesWindowController.m @@ -39,6 +39,7 @@ [tabs setState: [settings tabs]]; [others setStringValue: [settings others]]; [with_terminal setState: [settings with_terminal]]; + // Not scriptargs, it isn't for preferences [commandline setStringValue: [settings commandLineForScript: @""]]; } @@ -84,6 +85,7 @@ - (BOOL) tabs { return [tabs state];}; - (NSString *) others { return [others stringValue];}; - (BOOL) with_terminal { return [with_terminal state];}; +- (NSString *) scriptargs { return @"";}; // Delegates - (void)controlTextDidChange:(NSNotification *)aNotification diff --git a/Mac/OSX/PythonLauncher/PythonLauncher.pbproj/project.pbxproj b/Mac/OSX/PythonLauncher/PythonLauncher.pbproj/project.pbxproj index 107ce3dd4f2..badee8785b5 100755 --- a/Mac/OSX/PythonLauncher/PythonLauncher.pbproj/project.pbxproj +++ b/Mac/OSX/PythonLauncher/PythonLauncher.pbproj/project.pbxproj @@ -132,6 +132,7 @@ 4A9504D0FFE6A4CB11CA0CBA, 4A9504D1FFE6A4CB11CA0CBA, ); + hasScannedForEncodings = 1; isa = PBXProject; mainGroup = 2A37F4AAFDCFA73011CA2CEA; projectDirPath = ""; @@ -385,7 +386,6 @@ "; - shouldUseHeadermap = 0; }; 2A37F4C7FDCFA73011CA2CEA = { buildActionMask = 2147483647;