Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f044e09

Browse files
committed
Changed the input field for the interpreter to use (in the preferences
window) to a combobox listing the known interpreters.
1 parent 9431e48 commit f044e09

9 files changed

Lines changed: 52 additions & 10 deletions

File tree

Mac/OSX/PythonLauncher/FileSettings.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
@interface FileSettings : NSObject <FileSettingsSource>
2424
{
2525
NSString *interpreter; // The pathname of the interpreter to use
26+
NSArray *interpreters; // List of known interpreters
2627
BOOL debug; // -d option: debug parser
2728
BOOL verbose; // -v option: verbose import
2829
BOOL inspect; // -i option: interactive mode after script
@@ -54,5 +55,6 @@
5455
//- (void)applyUserDefaults: (NSString *)filetype;
5556
- (void)applyValuesFromDict: (NSDictionary *)dict;
5657
- (void)reset;
58+
- (NSArray *) interpreters;
5759

5860
@end

Mac/OSX/PythonLauncher/FileSettings.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ - (id)initForFSDefaultFileType: (NSString *)filetype
104104
int i;
105105
NSString *filename;
106106
NSDictionary *dict;
107-
NSArray *interpreters;
108107
static NSDictionary *factorySettings;
109108

110109
self = [super init];
@@ -163,6 +162,7 @@ - (id)initForDefaultFileType: (NSString *)filetype
163162
fsdefaults = [FileSettings getFactorySettingsForFileType: filetype];
164163
self = [self initWithFileSettings: fsdefaults];
165164
if (!self) return self;
165+
interpreters = [fsdefaults->interpreters retain];
166166
[self applyUserDefaults: filetype];
167167
prefskey = [filetype retain];
168168
return self;
@@ -247,9 +247,11 @@ - (NSString *)commandLineForScript: (NSString *)script
247247
tabs?" -t":"",
248248
others,
249249
script,
250-
with_terminal? "&& exit" : " &"];
250+
with_terminal? "&& echo Exit status: $? && exit 1" : " &"];
251251
}
252252

253+
- (NSArray *) interpreters { return interpreters;};
254+
253255
// FileSettingsSource protocol
254256
- (NSString *) interpreter { return interpreter;};
255257
- (BOOL) debug { return debug;};

Mac/OSX/PythonLauncher/PreferenceWindow.nib/classes.nib

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Mac/OSX/PythonLauncher/PreferenceWindow.nib/info.nib

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
2.69 KB
Binary file not shown.

Mac/OSX/PythonLauncher/PreferencesWindowController.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,9 @@
2929

3030
- (void)controlTextDidChange:(NSNotification *)aNotification;
3131

32+
- (unsigned int)comboBox:(NSComboBox *)aComboBox indexOfItemWithStringValue:(NSString *)aString;
33+
- (id)comboBox:(NSComboBox *)aComboBox objectValueForItemAtIndex:(int)index;
34+
- (int)numberOfItemsInComboBox:(NSComboBox *)aComboBox;
35+
36+
3237
@end

Mac/OSX/PythonLauncher/PreferencesWindowController.m

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,21 @@ - (void)controlTextDidChange:(NSNotification *)aNotification
9090
[self update_display];
9191
};
9292

93+
// NSComboBoxDataSource protocol
94+
- (unsigned int)comboBox:(NSComboBox *)aComboBox indexOfItemWithStringValue:(NSString *)aString
95+
{
96+
return [[settings interpreters] indexOfObjectIdenticalTo: aString];
97+
}
98+
99+
- (id)comboBox:(NSComboBox *)aComboBox objectValueForItemAtIndex:(int)index
100+
{
101+
return [[settings interpreters] objectAtIndex: index];
102+
}
103+
104+
- (int)numberOfItemsInComboBox:(NSComboBox *)aComboBox
105+
{
106+
return [[settings interpreters] count];
107+
}
108+
93109

94110
@end

Mac/OSX/PythonLauncher/PythonLauncher.pbproj/project.pbxproj

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@
132132
4A9504D0FFE6A4CB11CA0CBA,
133133
4A9504D1FFE6A4CB11CA0CBA,
134134
);
135+
hasScannedForEncodings = 1;
135136
isa = PBXProject;
136137
mainGroup = 2A37F4AAFDCFA73011CA2CEA;
137138
projectDirPath = "";
@@ -169,11 +170,13 @@
169170
refType = 4;
170171
};
171172
2A37F4ACFDCFA73011CA2CEA = {
173+
fileEncoding = 30;
172174
isa = PBXFileReference;
173175
path = MyDocument.m;
174176
refType = 4;
175177
};
176178
2A37F4AEFDCFA73011CA2CEA = {
179+
fileEncoding = 30;
177180
isa = PBXFileReference;
178181
path = MyDocument.h;
179182
refType = 4;
@@ -190,6 +193,7 @@
190193
refType = 4;
191194
};
192195
2A37F4B0FDCFA73011CA2CEA = {
196+
fileEncoding = 30;
193197
isa = PBXFileReference;
194198
path = main.m;
195199
refType = 4;
@@ -400,7 +404,6 @@
400404
</dict>
401405
</plist>
402406
";
403-
shouldUseHeadermap = 1;
404407
};
405408
2A37F4C7FDCFA73011CA2CEA = {
406409
buildActionMask = 2147483647;
@@ -515,11 +518,13 @@
515518
//F53
516519
//F54
517520
F52A90CD02EB5C6A01000102 = {
521+
fileEncoding = 30;
518522
isa = PBXFileReference;
519523
path = FileSettings.m;
520524
refType = 4;
521525
};
522526
F52A90CE02EB5C6A01000102 = {
527+
fileEncoding = 30;
523528
isa = PBXFileReference;
524529
path = FileSettings.h;
525530
refType = 4;
@@ -581,6 +586,7 @@
581586
};
582587
};
583588
F5A42167038BDD8E0110C447 = {
589+
fileEncoding = 30;
584590
isa = PBXFileReference;
585591
path = factorySettings.plist;
586592
refType = 4;
@@ -603,11 +609,13 @@
603609
};
604610
};
605611
F5A4C14002F2055C01000102 = {
612+
fileEncoding = 30;
606613
isa = PBXFileReference;
607614
path = PreferencesWindowController.h;
608615
refType = 4;
609616
};
610617
F5A4C14102F2055C01000102 = {
618+
fileEncoding = 30;
611619
isa = PBXFileReference;
612620
path = PreferencesWindowController.m;
613621
refType = 4;
@@ -625,11 +633,13 @@
625633
};
626634
};
627635
F5A4C14402F2070D01000102 = {
636+
fileEncoding = 30;
628637
isa = PBXFileReference;
629638
path = MyAppDelegate.m;
630639
refType = 4;
631640
};
632641
F5A4C14502F2070D01000102 = {
642+
fileEncoding = 30;
633643
isa = PBXFileReference;
634644
path = MyAppDelegate.h;
635645
refType = 4;
@@ -647,6 +657,7 @@
647657
};
648658
};
649659
F5AA9C6A02F8042D0110C447 = {
660+
fileEncoding = 30;
650661
isa = PBXFileReference;
651662
path = doscript.h;
652663
refType = 4;
@@ -670,6 +681,7 @@
670681
};
671682
};
672683
F5AAA21D02F8115D0110C447 = {
684+
fileEncoding = 30;
673685
isa = PBXFileReference;
674686
path = doscript.m;
675687
refType = 4;

Mac/OSX/PythonLauncher/factorySettings.plist

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@
3939
<string>/sw/bin/python</string>
4040
<string>/Library/Frameworks/Python.framework/Versions/Current/bin/python</string>
4141
<string>/usr/bin/python</string>
42+
<string>/usr/local/bin/pythonw</string>
43+
<string>/sw/bin/pythonw</string>
44+
<string>/Library/Frameworks/Python.framework/Versions/Current/Resources/Python.app/Contents/MacOS/python</string>
45+
<string>/usr/bin/pythonw</string>
46+
<string>/Applications/MacPython-OSX/python-additions/Python.app/Contents/MacOS/python</string>
4247
</array>
4348
<key>nosite</key>
4449
<false/>

0 commit comments

Comments
 (0)