Prompt for installation of missing pieces

This commit is contained in:
Matthias Neeracher 2007-04-23 03:43:39 +00:00
parent 90493ab088
commit 3096164028
5 changed files with 95 additions and 2 deletions

Binary file not shown.

Binary file not shown.

View File

@ -97,6 +97,11 @@
return [self getLineFromCommand:cmd]; return [self getLineFromCommand:cmd];
} }
- (void)adviseLilypondInstallation:(id)sender
{
// [NSApp terminate:self];
}
- (void)awakeFromNib - (void)awakeFromNib
{ {
[lilypondPath setAutoenablesItems:NO]; [lilypondPath setAutoenablesItems:NO];
@ -168,7 +173,87 @@
wantTool = true; wantTool = true;
[defaults setObject:toolPath forKey:@"VLLilypondPath"]; [defaults setObject:toolPath forKey:@"VLLilypondPath"];
} }
[lilypondPath selectItemWithTag:wantTool ? 0 : 1]; [lilypondPath selectItemWithTag:wantTool ? 0 : 1];
}
- (BOOL)promptForSoftwareInstallation:(NSString *)label
withTitle:(NSString *)title
explanation:(NSString *)expl
script:(NSString *)script
url:(NSURL *)url
{
NSString * hasFink = [self getLineFromCommand:@"bash -l which fink"];
NSInteger response =
[[NSAlert alertWithMessageText:title
defaultButton: hasFink
? @"Install through fink"
: label
alternateButton:@"Continue"
otherButton:hasFink
? label
: @""
informativeTextWithFormat: expl, hasFink
? @"\n\nSince you have fink installed already, you may "
"choose to install this package through fink." : @""]
runModal];
if (response == NSAlertAlternateReturn)
return NO;
else if (hasFink && response == NSAlertDefaultReturn) {
NSDictionary * error;
NSURL * scptURL =
[NSURL fileURLWithPath:
[[NSBundle mainBundle] pathForResource:script
ofType:@"scpt"]];
NSAppleScript * scpt =
[[NSAppleScript alloc]
initWithContentsOfURL:scptURL error:&error];
[scpt executeAndReturnError:&error];
} else {
[[NSWorkspace sharedWorkspace] openURL:url];
}
return YES;
}
- (void)applicationWillFinishLaunching:(NSNotification *)aNotification
{
BOOL quit = NO;
if (!toolPath && !appPath)
if ([self promptForSoftwareInstallation:@"Download from lilypond.org"
withTitle: @"Lilypond Not Found!"
explanation:
@"Couldn't find an installation of Lilypond, which "
"is needed to typeset the sheet music. If you continue "
"without installing, you will be unable to preview, "
"print, or save as PDF.%@"
script:@"installLilypond"
url:[NSURL URLWithString:@"http://lilypond.org/web/install"]]
)
quit = YES;
if (![self getLineFromCommand:@"bash -l which python2.5"])
if ([self promptForSoftwareInstallation:@"Download from python.org"
withTitle: @"Python 2.5 Not Found!"
explanation:
@"Python 2.5 is needed to play accompaniments. The "
"version preinstalled on your computer is not recent "
"enough. If you continue without installing, you will be "
"unable to play accompaniments, or save as MIDI.%@"
script:@"installPython"
url:[NSURL URLWithString:@"http://www.python.org/download"]]
)
quit = YES;
if (quit) {
[[NSAlert alertWithMessageText:@"Quit and Restart"
defaultButton: @"OK" alternateButton: @"" otherButton: @""
informativeTextWithFormat:
@"The software you have chosen to install will be "
"available after you restart this application."]
runModal];
[NSApp terminate:self];
}
} }
- (IBAction) playNewPitch:(id)sender - (IBAction) playNewPitch:(id)sender

View File

@ -21,6 +21,8 @@
95009B800B0EDC7B00EB33A4 /* CADebugMacros.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95009B4E0B0ED0BB00EB33A4 /* CADebugMacros.cpp */; }; 95009B800B0EDC7B00EB33A4 /* CADebugMacros.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95009B4E0B0ED0BB00EB33A4 /* CADebugMacros.cpp */; };
95009B810B0EDC7D00EB33A4 /* CAStreamBasicDescription.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95009B260B0ECF9000EB33A4 /* CAStreamBasicDescription.cpp */; }; 95009B810B0EDC7D00EB33A4 /* CAStreamBasicDescription.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95009B260B0ECF9000EB33A4 /* CAStreamBasicDescription.cpp */; };
95009B830B0EDCD800EB33A4 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 95009B820B0EDCD800EB33A4 /* CoreFoundation.framework */; }; 95009B830B0EDCD800EB33A4 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 95009B820B0EDCD800EB33A4 /* CoreFoundation.framework */; };
95049CF30BDC32EB0015EE6E /* installLilypond.scpt in Resources */ = {isa = PBXBuildFile; fileRef = 95049CF20BDC32CD0015EE6E /* installLilypond.scpt */; };
95049D020BDC436A0015EE6E /* installPython.scpt in Resources */ = {isa = PBXBuildFile; fileRef = 95049D010BDC43510015EE6E /* installPython.scpt */; };
950795E10B4A34D9008911A6 /* stop.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 950795E00B4A34D9008911A6 /* stop.tiff */; }; 950795E10B4A34D9008911A6 /* stop.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 950795E00B4A34D9008911A6 /* stop.tiff */; };
952CBB9C095FD1CA00434E43 /* VLSoundOut.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 952CBB9A095FD1CA00434E43 /* VLSoundOut.cpp */; }; 952CBB9C095FD1CA00434E43 /* VLSoundOut.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 952CBB9A095FD1CA00434E43 /* VLSoundOut.cpp */; };
952CBB9D095FD1CA00434E43 /* VLSoundOut.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 952CBB9A095FD1CA00434E43 /* VLSoundOut.cpp */; }; 952CBB9D095FD1CA00434E43 /* VLSoundOut.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 952CBB9A095FD1CA00434E43 /* VLSoundOut.cpp */; };
@ -144,6 +146,8 @@
95009B620B0ED18700EB33A4 /* CAConditionalMacros.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CAConditionalMacros.h; path = Sources/CoreAudioSDK/CAConditionalMacros.h; sourceTree = "<group>"; }; 95009B620B0ED18700EB33A4 /* CAConditionalMacros.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CAConditionalMacros.h; path = Sources/CoreAudioSDK/CAConditionalMacros.h; sourceTree = "<group>"; };
95009B630B0ED18700EB33A4 /* CAMath.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CAMath.h; path = Sources/CoreAudioSDK/CAMath.h; sourceTree = "<group>"; }; 95009B630B0ED18700EB33A4 /* CAMath.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CAMath.h; path = Sources/CoreAudioSDK/CAMath.h; sourceTree = "<group>"; };
95009B820B0EDCD800EB33A4 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; }; 95009B820B0EDCD800EB33A4 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; };
95049CF20BDC32CD0015EE6E /* installLilypond.scpt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.scpt; name = installLilypond.scpt; path = Resources/installLilypond.scpt; sourceTree = "<group>"; };
95049D010BDC43510015EE6E /* installPython.scpt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.scpt; name = installPython.scpt; path = Resources/installPython.scpt; sourceTree = "<group>"; };
950795E00B4A34D9008911A6 /* stop.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = stop.tiff; path = Resources/stop.tiff; sourceTree = "<group>"; }; 950795E00B4A34D9008911A6 /* stop.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = stop.tiff; path = Resources/stop.tiff; sourceTree = "<group>"; };
952CBB98095FD19D00434E43 /* TVLSoundOut */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = TVLSoundOut; sourceTree = BUILT_PRODUCTS_DIR; }; 952CBB98095FD19D00434E43 /* TVLSoundOut */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = TVLSoundOut; sourceTree = BUILT_PRODUCTS_DIR; };
952CBB9A095FD1CA00434E43 /* VLSoundOut.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = VLSoundOut.cpp; path = Sources/VLSoundOut.cpp; sourceTree = "<group>"; }; 952CBB9A095FD1CA00434E43 /* VLSoundOut.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = VLSoundOut.cpp; path = Sources/VLSoundOut.cpp; sourceTree = "<group>"; };
@ -387,6 +391,8 @@
2A37F4B8FDCFA73011CA2CEA /* Resources */ = { 2A37F4B8FDCFA73011CA2CEA /* Resources */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
95049CF20BDC32CD0015EE6E /* installLilypond.scpt */,
95049D010BDC43510015EE6E /* installPython.scpt */,
954DD4DF0B44E61E0056C504 /* VLDocument.nib */, 954DD4DF0B44E61E0056C504 /* VLDocument.nib */,
954DD4DA0B44E6000056C504 /* MainMenu.nib */, 954DD4DA0B44E6000056C504 /* MainMenu.nib */,
95FC66BC0AF0A4D4003D9C11 /* console.icns */, 95FC66BC0AF0A4D4003D9C11 /* console.icns */,
@ -586,6 +592,8 @@
isa = PBXResourcesBuildPhase; isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
95049D020BDC436A0015EE6E /* installPython.scpt in Resources */,
95049CF30BDC32EB0015EE6E /* installLilypond.scpt in Resources */,
8D15AC2C0486D014006FF6A4 /* Credits.rtf in Resources */, 8D15AC2C0486D014006FF6A4 /* Credits.rtf in Resources */,
8D15AC2F0486D014006FF6A4 /* InfoPlist.strings in Resources */, 8D15AC2F0486D014006FF6A4 /* InfoPlist.strings in Resources */,
95B3E1A70960E58B000E9C0D /* Music in Resources */, 95B3E1A70960E58B000E9C0D /* Music in Resources */,

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2.5
""" """
The program "MMA - Musical Midi Accompaniment" and the associated The program "MMA - Musical Midi Accompaniment" and the associated