Add version info

This commit is contained in:
daid 2012-04-11 16:34:15 +02:00
parent a79a7c066d
commit 497eb6f03d
4 changed files with 31 additions and 4 deletions

View File

@ -16,6 +16,7 @@ from gui import printWindow
from gui import simpleMode from gui import simpleMode
from gui import icon from gui import icon
from util import profile from util import profile
from util import version
def main(): def main():
app = wx.App(False) app = wx.App(False)
@ -33,7 +34,7 @@ def main():
class mainWindow(configBase.configWindowBase): class mainWindow(configBase.configWindowBase):
"Main user interface window" "Main user interface window"
def __init__(self): def __init__(self):
super(mainWindow, self).__init__(title='Cura') super(mainWindow, self).__init__(title='Cura - ' + version.getVersion())
wx.EVT_CLOSE(self, self.OnClose) wx.EVT_CLOSE(self, self.OnClose)
#self.SetIcon(icon.getMainIcon()) #self.SetIcon(icon.getMainIcon())

View File

@ -13,11 +13,12 @@ from gui import machineCom
from gui import printWindow from gui import printWindow
from gui import icon from gui import icon
from util import profile from util import profile
from util import version
class simpleModeWindow(configBase.configWindowBase): class simpleModeWindow(configBase.configWindowBase):
"Main user interface window for simple mode" "Main user interface window for simple mode"
def __init__(self): def __init__(self):
super(simpleModeWindow, self).__init__(title='Cura - Simple mode') super(simpleModeWindow, self).__init__(title='Cura - Simple mode - ' + version.getVersion())
wx.EVT_CLOSE(self, self.OnClose) wx.EVT_CLOSE(self, self.OnClose)
#self.SetIcon(icon.getMainIcon()) #self.SetIcon(icon.getMainIcon())

23
Cura/util/version.py Normal file
View File

@ -0,0 +1,23 @@
from __future__ import absolute_import
import __init__
import os
def getVersion():
gitPath = os.path.abspath(os.path.join(os.path.split(os.path.abspath(__file__))[0], "../../.git"))
versionFile = os.path.abspath(os.path.join(os.path.split(os.path.abspath(__file__))[0], "../version"))
if os.path.exists(gitPath):
f = open(gitPath + "/refs/heads/master", "r")
version = f.readline()
f.close()
return version.strip()
if os.path.exists(versionFile):
f = open(versionFile, "r")
version = f.readline()
f.close()
return version.strip()
return "?"
if __name__ == '__main__':
print getVersion()

View File

@ -16,7 +16,7 @@ BUILD_TARGET=${1:-win32}
##Do we need to create the final archive ##Do we need to create the final archive
ARCHIVE_FOR_DISTRIBUTION=1 ARCHIVE_FOR_DISTRIBUTION=1
##Which version name are we appending to the final archive ##Which version name are we appending to the final archive
BUILD_NAME=RC1 BUILD_NAME=RC2
TARGET_DIR=${BUILD_TARGET}-Cura-${BUILD_NAME} TARGET_DIR=${BUILD_TARGET}-Cura-${BUILD_NAME}
##Which versions of external programs to use ##Which versions of external programs to use
@ -140,8 +140,10 @@ mv ${TARGET_DIR}/pypy-*-${BUILD_TARGET} ${TARGET_DIR}/pypy
#Cleanup pypy #Cleanup pypy
rm -rf ${TARGET_DIR}/pypy/lib-python/2.7/test rm -rf ${TARGET_DIR}/pypy/lib-python/2.7/test
#add Skeinforge #add Cura
cp -a Cura ${TARGET_DIR}/Cura cp -a Cura ${TARGET_DIR}/Cura
#Add cura version file
echo $BUILD_NAME > ${TARGET_DIR}/Cura/version
#add printrun #add printrun
cp -a Printrun ${TARGET_DIR}/Printrun cp -a Printrun ${TARGET_DIR}/Printrun