Commit 5439e0f1 authored by sumpfralle's avatar sumpfralle

avoid GTKGL import errors (breaking the complete PyCAM GUI)


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@755 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 7a2aff57
...@@ -20,13 +20,20 @@ You should have received a copy of the GNU General Public License ...@@ -20,13 +20,20 @@ You should have received a copy of the GNU General Public License
along with PyCAM. If not, see <http://www.gnu.org/licenses/>. along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
""" """
# careful import - otherwise pycam.Gui.Project will throw an exception
try:
import gtk.gtkgl
import OpenGL.GL as GL
import OpenGL.GLU as GLU
import OpenGL.GLUT as GLUT
GL_ENABLED = True
except (ImportError, RuntimeError):
GL_ENABLED = False
from pycam.Geometry.Point import Point from pycam.Geometry.Point import Point
import pycam.Geometry.Matrix as Matrix import pycam.Geometry.Matrix as Matrix
from pycam.Geometry.utils import sqrt, number from pycam.Geometry.utils import sqrt, number
import pycam.Utils.log import pycam.Utils.log
import OpenGL.GL as GL
import OpenGL.GLU as GLU
import OpenGL.GLUT as GLUT
import gtk import gtk
import pango import pango
import math import math
...@@ -251,10 +258,9 @@ class ModelViewWindowGL: ...@@ -251,10 +258,9 @@ class ModelViewWindowGL:
self.settings = settings self.settings = settings
self.is_visible = False self.is_visible = False
# check if the 3D view is available # check if the 3D view is available
try: if GL_ENABLED:
import gtk.gtkgl
self.enabled = True self.enabled = True
except (ImportError, RuntimeError): else:
log.error("Failed to initialize the interactive 3D model view." log.error("Failed to initialize the interactive 3D model view."
+ "\nPlease install 'python-gtkglext1' to enable it.") + "\nPlease install 'python-gtkglext1' to enable it.")
self.enabled = False self.enabled = False
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment