Beef-up the python installer.
This commit is contained in:
parent
19bc466215
commit
9091aebb3f
Binary file not shown.
|
@ -21,9 +21,9 @@
|
|||
</object>
|
||||
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<integer value="506"/>
|
||||
<integer value="372"/>
|
||||
<integer value="81"/>
|
||||
<integer value="506"/>
|
||||
</object>
|
||||
<object class="NSArray" key="IBDocument.PluginDependencies">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
|
@ -630,7 +630,7 @@
|
|||
<object class="NSTextField" id="506962428">
|
||||
<reference key="NSNextResponder" ref="745733591"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{17, 27}, {196, 17}}</string>
|
||||
<string key="NSFrame">{{199, 35}, {196, 17}}</string>
|
||||
<reference key="NSSuperview" ref="745733591"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:4068</string>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
|
@ -665,7 +665,7 @@
|
|||
<object class="NSButton" id="586891897">
|
||||
<reference key="NSNextResponder" ref="745733591"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{226, 17}, {96, 32}}</string>
|
||||
<string key="NSFrame">{{408, 25}, {96, 32}}</string>
|
||||
<reference key="NSSuperview" ref="745733591"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:610</string>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
|
@ -687,7 +687,7 @@
|
|||
<object class="NSButton" id="449224927">
|
||||
<reference key="NSNextResponder" ref="745733591"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{322, 17}, {96, 32}}</string>
|
||||
<string key="NSFrame">{{500, 25}, {96, 32}}</string>
|
||||
<reference key="NSSuperview" ref="745733591"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:610</string>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
|
@ -719,7 +719,7 @@
|
|||
<object class="NSTextView" id="1022893154">
|
||||
<reference key="NSNextResponder" ref="765358965"/>
|
||||
<int key="NSvFlags">2322</int>
|
||||
<string key="NSFrameSize">{375, 66}</string>
|
||||
<string key="NSFrameSize">{553, 0}</string>
|
||||
<reference key="NSSuperview" ref="765358965"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:1498</string>
|
||||
<object class="NSTextContainer" key="NSTextContainer" id="800082627">
|
||||
|
@ -738,7 +738,7 @@
|
|||
<nil key="NSDelegate"/>
|
||||
</object>
|
||||
<reference key="NSTextView" ref="1022893154"/>
|
||||
<double key="NSWidth">375</double>
|
||||
<double key="NSWidth">553</double>
|
||||
<int key="NSTCFlags">1</int>
|
||||
</object>
|
||||
<object class="NSTextViewSharedData" key="NSSharedData">
|
||||
|
@ -799,12 +799,12 @@
|
|||
<int key="NSPreferredTextFinderStyle">0</int>
|
||||
</object>
|
||||
<int key="NSTVFlags">6</int>
|
||||
<string key="NSMaxSize">{463, 10000000}</string>
|
||||
<string key="NSMinize">{223, 66}</string>
|
||||
<string key="NSMaxSize">{623, 10000000}</string>
|
||||
<string key="NSMinize">{223, 0}</string>
|
||||
<nil key="NSDelegate"/>
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSFrame">{{1, 1}, {375, 167}}</string>
|
||||
<string key="NSFrame">{{1, 1}, {553, 267}}</string>
|
||||
<reference key="NSSuperview" ref="393442090"/>
|
||||
<reference key="NSNextKeyView" ref="1022893154"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:1496</string>
|
||||
|
@ -819,7 +819,7 @@
|
|||
<object class="NSScroller" id="42077783">
|
||||
<reference key="NSNextResponder" ref="393442090"/>
|
||||
<int key="NSvFlags">256</int>
|
||||
<string key="NSFrame">{{376, 1}, {15, 167}}</string>
|
||||
<string key="NSFrame">{{554, 1}, {15, 267}}</string>
|
||||
<reference key="NSSuperview" ref="393442090"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:1512</string>
|
||||
<reference key="NSTarget" ref="393442090"/>
|
||||
|
@ -840,7 +840,7 @@
|
|||
<double key="NSPercent">0.94565218687057495</double>
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSFrame">{{20, 60}, {392, 169}}</string>
|
||||
<string key="NSFrame">{{20, 71}, {570, 269}}</string>
|
||||
<reference key="NSSuperview" ref="745733591"/>
|
||||
<reference key="NSNextKeyView" ref="765358965"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:1494</string>
|
||||
|
@ -850,7 +850,7 @@
|
|||
<reference key="NSContentView" ref="765358965"/>
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSFrameSize">{432, 248}</string>
|
||||
<string key="NSFrameSize">{610, 360}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:1109</string>
|
||||
<string key="NSClassName">NSView</string>
|
||||
|
@ -1155,6 +1155,14 @@
|
|||
</object>
|
||||
<int key="connectionID">522</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">messageLabel</string>
|
||||
<reference key="source" ref="610635028"/>
|
||||
<reference key="destination" ref="506962428"/>
|
||||
</object>
|
||||
<int key="connectionID">523</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<object class="NSArray" key="orderedObjects">
|
||||
|
@ -1880,28 +1888,28 @@
|
|||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.QTKitIBPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>{{132, 590}, {432, 248}}</string>
|
||||
<string>{{132, 478}, {610, 360}}</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<object class="NSAffineTransform">
|
||||
<bytes key="NSTransformStruct">P4AAAL+AAABDLAAAw0gAAA</bytes>
|
||||
<bytes key="NSTransformStruct">P4AAAL+AAABBoAAAw8UAAA</bytes>
|
||||
</object>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<object class="NSAffineTransform">
|
||||
<bytes key="NSTransformStruct">P4AAAL+AAABDoQAAwmAAAA</bytes>
|
||||
<bytes key="NSTransformStruct">P4AAAL+AAABD+gAAwpgAAA</bytes>
|
||||
</object>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<object class="NSAffineTransform">
|
||||
<bytes key="NSTransformStruct">P4AAAL+AAABDo4AAwkwAAA</bytes>
|
||||
<bytes key="NSTransformStruct">P4AAAL+AAABDzAAAwpgAAA</bytes>
|
||||
</object>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<object class="NSAffineTransform">
|
||||
<bytes key="NSTransformStruct">P4AAAL+AAABBiAAAwkwAAA</bytes>
|
||||
<bytes key="NSTransformStruct">P4AAAL+AAABDRwAAwo4AAA</bytes>
|
||||
</object>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
|
@ -1931,7 +1939,7 @@
|
|||
</object>
|
||||
</object>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">522</int>
|
||||
<int key="maxID">523</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
|
@ -1979,6 +1987,7 @@
|
|||
<string>cancelButton</string>
|
||||
<string>licenseTextView</string>
|
||||
<string>licenseView</string>
|
||||
<string>messageLabel</string>
|
||||
<string>window</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
|
@ -1988,6 +1997,7 @@
|
|||
<string>id</string>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
|
@ -1998,6 +2008,7 @@
|
|||
<string>cancelButton</string>
|
||||
<string>licenseTextView</string>
|
||||
<string>licenseView</string>
|
||||
<string>messageLabel</string>
|
||||
<string>window</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
|
@ -2018,6 +2029,10 @@
|
|||
<string key="name">licenseView</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">messageLabel</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">window</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string></string>
|
||||
<string>Lettuce</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>tw.com.kkbox.${PRODUCT_NAME:identifier}</string>
|
||||
<string>org.openvanilla.${PRODUCT_NAME:identifier}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
|
@ -19,9 +19,15 @@
|
|||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>KKBX</string>
|
||||
<string>OPVN</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>LSHasLocalizedDisplayName</key>
|
||||
<true/>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.6.0</string>
|
||||
<key>LSUIElement</key>
|
||||
<true/>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
|
||||
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
|
||||
D48D001D143868DA0050BDFF /* McBopomofo.app in Copy Files to Resource Folder */ = {isa = PBXBuildFile; fileRef = D48D0016143868A90050BDFF /* McBopomofo.app */; };
|
||||
D48D00DF1438932E0050BDFF /* Lettuce.icns in Resources */ = {isa = PBXBuildFile; fileRef = D48D00DE1438932E0050BDFF /* Lettuce.icns */; };
|
||||
D4CA5DAD14040B3300B58ED3 /* QTKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D4CA5DAC14040B3300B58ED3 /* QTKit.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
|
@ -71,6 +72,8 @@
|
|||
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
8D1107320486CEB800E47090 /* Installer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Installer.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
D48D000F143868A90050BDFF /* Lettuce.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Lettuce.xcodeproj; path = ../Source/Lettuce.xcodeproj; sourceTree = SOURCE_ROOT; };
|
||||
D48D00DC143892E80050BDFF /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/InfoPlist.strings"; sourceTree = "<group>"; };
|
||||
D48D00DE1438932E0050BDFF /* Lettuce.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = Lettuce.icns; path = ../Source/Images/Lettuce.icns; sourceTree = SOURCE_ROOT; };
|
||||
D4CA5DAC14040B3300B58ED3 /* QTKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QTKit.framework; path = System/Library/Frameworks/QTKit.framework; sourceTree = SDKROOT; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
|
@ -150,6 +153,7 @@
|
|||
29B97317FDCFA39411CA2CEA /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D48D00DE1438932E0050BDFF /* Lettuce.icns */,
|
||||
77C8C1F70C07829500965286 /* MainMenu.xib */,
|
||||
8D1107310486CEB800E47090 /* Info.plist */,
|
||||
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
|
||||
|
@ -212,6 +216,7 @@
|
|||
Japanese,
|
||||
French,
|
||||
German,
|
||||
"zh-Hant",
|
||||
);
|
||||
mainGroup = 29B97314FDCFA39411CA2CEA /* xcPROJECTNAMEASXMLxc */;
|
||||
projectDirPath = "";
|
||||
|
@ -254,6 +259,7 @@
|
|||
77631A3F0C0748CF005415CB /* main.py in Resources */,
|
||||
7790198F0C07548A00326F66 /* InstallerAppDelegate.py in Resources */,
|
||||
77C8C1F90C07829500965286 /* MainMenu.xib in Resources */,
|
||||
D48D00DF1438932E0050BDFF /* Lettuce.icns in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -283,6 +289,7 @@
|
|||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
089C165DFE840E0CC02AAC07 /* English */,
|
||||
D48D00DC143892E80050BDFF /* zh-Hant */,
|
||||
);
|
||||
name = InfoPlist.strings;
|
||||
sourceTree = "<group>";
|
||||
|
|
|
@ -2,22 +2,55 @@ from Foundation import *
|
|||
from AppKit import *
|
||||
import os, shutil, platform
|
||||
|
||||
MIT_LICENSE = """Copyright (C) 2011 by OpenVanilla.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
"""
|
||||
|
||||
class InstallerAppDelegate(NSObject):
|
||||
|
||||
window = objc.IBOutlet()
|
||||
licenseView = objc.IBOutlet()
|
||||
licenseTextView = objc.IBOutlet()
|
||||
messageLabel = objc.IBOutlet()
|
||||
agreeButton = objc.IBOutlet()
|
||||
cancelButton = objc.IBOutlet()
|
||||
|
||||
def awakeFromNib(self):
|
||||
self.window.setDelegate_(self)
|
||||
self.window.setTitle_(NSLocalizedString("OpenVanilla McBopomofo", ""))
|
||||
self.agreeButton.setTitle_(NSLocalizedString("Agree", ""))
|
||||
self.cancelButton.setTitle_(NSLocalizedString("Cancel", ""))
|
||||
self.messageLabel.setStringValue_(NSLocalizedString("Do you agree with the license?", ""))
|
||||
self.licenseTextView.textStorage().mutableString().setString_(MIT_LICENSE)
|
||||
|
||||
def windowWillClose_(self, notification):
|
||||
NSApp.terminate_(self)
|
||||
|
||||
def checkOSVerion(self):
|
||||
mac_version = platform.mac_ver()[0].split(".")
|
||||
if int(mac_version[1]) < 6:
|
||||
NSRunAlertPanel("McBoPoMoFo requires on Mac OS X 10.6 or later verion.", "", "OK", None, None)
|
||||
NSRunAlertPanel(NSLocalizedString("McBopomofo requires on Mac OS X 10.6 or later verion.", ""),
|
||||
NSLocalizedString("Unable to install McBopomofo on your Mac.",""),
|
||||
NSLocalizedString("OK", ""), None, None)
|
||||
NSApp.terminate_(self)
|
||||
|
||||
def showLicenseWindow(self):
|
||||
self.licenseTextView.textStorage().mutableString().setString_("License")
|
||||
windowFrame = self.window.frame()
|
||||
windowFrame.size = self.licenseView.frame().size
|
||||
windowFrame.size.height += 20.0
|
||||
|
@ -43,20 +76,26 @@ class InstallerAppDelegate(NSObject):
|
|||
try:
|
||||
shutil.rmtree(McBopomofoPath)
|
||||
except:
|
||||
NSRunAlertPanel("Failed to remove existing application!", "", "OK", None, None)
|
||||
NSRunAlertPanel(NSLocalizedString("Failed to install McBopomofo!", ""),
|
||||
NSLocalizedString("Failed to remove existing installation.", ""),
|
||||
NSLocalizedString("OK", ""), None, None)
|
||||
try:
|
||||
shutil.copytree(packagePath, McBopomofoPath)
|
||||
except:
|
||||
NSRunAlertPanel("Failed to copy application!", "", "OK", None, None)
|
||||
NSRunAlertPanel(NSLocalizedString("Failed to install McBopomofo!", ""),
|
||||
NSLocalizedString("Failed to copy application.", ""),
|
||||
NSLocalizedString("OK", ""), None, None)
|
||||
NSApp.terminate_(self)
|
||||
|
||||
print McBopomofoPath
|
||||
try:
|
||||
call([os.path.join(McBopomofoPath, "Contents/MacOS/McBopomofo"), "install"])
|
||||
except:
|
||||
NSRunAlertPanel("Failed to install McBopomofo!", "", "OK", None, None)
|
||||
NSRunAlertPanel(NSLocalizedString("Failed to install McBopomofo!", ""), "", NSLocalizedString("OK", ""), None, None)
|
||||
NSApp.terminate_(self)
|
||||
NSRunAlertPanel("Done!", "", "OK", None, None)
|
||||
NSRunAlertPanel(NSLocalizedString("Done!", ""),
|
||||
NSLocalizedString("OpenVanilla McBopomofo has been installed on your Mac.", ""),
|
||||
NSLocalizedString("OK", ""), None, None)
|
||||
NSApp.terminate_(self)
|
||||
|
||||
@objc.IBAction
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue