From a93fde841c809c4174c48336e9d25689f322715a Mon Sep 17 00:00:00 2001 From: daid Date: Thu, 31 May 2012 18:01:57 +0200 Subject: [PATCH] Added setup.py script for cx_Freeze, which I hope will help building a proper MacOS version. However, the frozen executable is not working correctly yet. --- Cura/setup.py | 23 +++++++++++++++++++++++ Cura/util/gcodeInterpreter.py | 9 +++++---- 2 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 Cura/setup.py diff --git a/Cura/setup.py b/Cura/setup.py new file mode 100644 index 00000000..104c1deb --- /dev/null +++ b/Cura/setup.py @@ -0,0 +1,23 @@ +import sys +from cx_Freeze import setup, Executable + +sys.path.append('./cura_sf/') + +# Dependencies are automatically detected, but it might need fine tuning. +build_exe_options = {"packages": [ + 'encodings.utf_8', + "OpenGL", "OpenGL.arrays", "OpenGL.platform", +], "excludes": [], "optimize": 0} + +# GUI applications require a different base on Windows (the default is for a +# console application). +base = None +if sys.platform == "win32": + base = "Win32GUI" + +setup( name = "Cura", + version = "RC5", + description = "Cura", + options = {"build_exe": build_exe_options}, + executables = [Executable("cura.py", base=base)]) + diff --git a/Cura/util/gcodeInterpreter.py b/Cura/util/gcodeInterpreter.py index 9abcacc1..1678640b 100644 --- a/Cura/util/gcodeInterpreter.py +++ b/Cura/util/gcodeInterpreter.py @@ -22,10 +22,11 @@ class gcode(object): self.progressCallback = None def load(self, filename): - self._fileSize = os.stat(filename).st_size - gcodeFile = open(filename, 'r') - self._load(gcodeFile) - gcodeFile.close() + if os.path.isfile(filename): + self._fileSize = os.stat(filename).st_size + gcodeFile = open(filename, 'r') + self._load(gcodeFile) + gcodeFile.close() def loadList(self, l): self._load(l) -- 2.30.2