New MacOS script, will be the base for a .app
parent
009b856310
commit
4e19d7abfa
|
@ -1,7 +1,7 @@
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
import __init__
|
import __init__
|
||||||
|
|
||||||
import wx, threading, re, subprocess, sys, os, time
|
import wx, threading, re, subprocess, sys, os, time, platform
|
||||||
from wx.lib import buttons
|
from wx.lib import buttons
|
||||||
|
|
||||||
from gui import icon
|
from gui import icon
|
||||||
|
@ -39,7 +39,13 @@ class printProcessMonitor():
|
||||||
|
|
||||||
def loadFile(self, filename):
|
def loadFile(self, filename):
|
||||||
if self.handle == None:
|
if self.handle == None:
|
||||||
self.handle = subprocess.Popen([sys.executable, sys.argv[0], '-r', filename], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
cmdList = [sys.executable, sys.argv[0], '-r', filename]
|
||||||
|
if platform.system() == "Darwin":
|
||||||
|
if platform.machine() == 'i386':
|
||||||
|
cmdList.insert(0, 'arch')
|
||||||
|
cmdList.insert(1, '-i386')
|
||||||
|
print cmdList
|
||||||
|
self.handle = subprocess.Popen(cmdList, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
self.thread = threading.Thread(target=self.Monitor)
|
self.thread = threading.Thread(target=self.Monitor)
|
||||||
self.thread.start()
|
self.thread.start()
|
||||||
else:
|
else:
|
||||||
|
@ -51,7 +57,7 @@ class printProcessMonitor():
|
||||||
while(len(line) > 0):
|
while(len(line) > 0):
|
||||||
#print line.rstrip()
|
#print line.rstrip()
|
||||||
line = p.stdout.readline()
|
line = p.stdout.readline()
|
||||||
p.wait()
|
p.communicate()
|
||||||
self.handle = None
|
self.handle = None
|
||||||
self.thread = None
|
self.thread = None
|
||||||
|
|
||||||
|
|
|
@ -1,33 +1,97 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
python2.7 -c ''
|
SCRIPTDIR=`dirname "$0"`
|
||||||
if [ $? != 0 ]; then
|
RESDIR=${SCRIPTDIR}/../Resources/
|
||||||
echo "Requires python2.7"
|
|
||||||
echo " Install python2.7"
|
#run the path_helper to set the $PATH for accessing python
|
||||||
exit 1
|
if [ -x /usr/libexec/path_helper ]; then
|
||||||
|
eval `/usr/libexec/path_helper -s`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
python2.7 -c 'import OpenGL'
|
displayMessage()
|
||||||
|
{
|
||||||
|
/usr/bin/osascript > /dev/null <<-EOF
|
||||||
|
tell application "System Events"
|
||||||
|
activate
|
||||||
|
display dialog "$@" buttons {"Ok"}
|
||||||
|
end tell
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
#Testing for python2.7, which we need and is not always installed on MacOS 1.6
|
||||||
|
PY="python2.7"
|
||||||
|
$PY -c ''
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
echo "Requires PyOpenGL"
|
displayMessage "Python 2.7 is missing from your system. Cura requires Python2.7.\nStarting the installer" $PATH
|
||||||
echo " sudo easy_install PyOpenGL"
|
#TODO: Install python2.7
|
||||||
exit 1
|
$PY -c ''
|
||||||
|
if [ $? != 0 ]; then
|
||||||
|
displayMessage "Failed to install python2.7"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
python2.7 -c 'import wx'
|
#Next check for numpy, numpy does not always run under 64bit, so we need to check if we need to use "arch -i386"
|
||||||
|
$PY -c 'import numpy' 2> /dev/null
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
echo "Requires wx. Download and install (the Cocoa/64-bit variant) from:"
|
PY="arch -i386 python2.7"
|
||||||
echo " http://www.wxpython.org/download.php"
|
$PY -c 'import numpy'
|
||||||
exit 1
|
if [ $? != 0 ]; then
|
||||||
|
displayMessage "Numpy is missing from your system, this is required.\nStarting the installer"
|
||||||
|
#TODO: Install numpy
|
||||||
|
|
||||||
|
#After installing numpy, we need to check if we need to use arch -386 again
|
||||||
|
PY="python2.7"
|
||||||
|
$PY -c 'import numpy'
|
||||||
|
if [ $? != 0 ]; then
|
||||||
|
PY="arch -i386 python2.7"
|
||||||
|
$PY -c 'import numpy'
|
||||||
|
if [ $? != 0 ]; then
|
||||||
|
displayMessage "Failed to install numpy."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
python2.7 -c 'import serial'
|
#Check for wxPython
|
||||||
|
$PY -c 'import wx'
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
echo "Requires pyserial."
|
displayMessage "wxPython is missing from your system. Cura requires wxPython.\nStarting the installer"
|
||||||
echo " sudo easy_install pyserial"
|
#TODO: Start wxPython installer
|
||||||
exit 1
|
$PY -c 'import wx'
|
||||||
|
if [ $? != 0 ]; then
|
||||||
|
displayMessage "Failed to properly install wxPython."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SCRIPT_DIR=`dirname $0`
|
#Check for PyOpenGL
|
||||||
python ${SCRIPT_DIR}/Cura/cura.py $@
|
$PY -c 'import OpenGL'
|
||||||
|
if [ $? != 0 ]; then
|
||||||
|
displayMessage "PyOpenGL is missing from your system. Cura requires PyOpenGL.\nStarting installation"
|
||||||
|
#TODO: Install PyOpenGL
|
||||||
|
$PY -c 'import OpenGL'
|
||||||
|
if [ $? != 0 ]; then
|
||||||
|
displayMessage "Failed to properly install PyOpenGL."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
#Check for pyserial
|
||||||
|
$PY -c 'import serial'
|
||||||
|
if [ $? != 0 ]; then
|
||||||
|
displayMessage "PySerial is missing from your system. Cura requires PySerial.\nStarting installation"
|
||||||
|
#TODO: Install PySerial
|
||||||
|
$PY -c 'import serial'
|
||||||
|
if [ $? != 0 ]; then
|
||||||
|
displayMessage "Failed to properly install PySerial."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
#All checks passed, start Cura
|
||||||
|
$PY "${RESDIR}Cura/cura.py" &
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue