Commit b06eba20 authored by sumpfralle's avatar sumpfralle

fixed an exception in case of a missing Tkinter module


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@313 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent b0a5e647
...@@ -33,6 +33,9 @@ DEPENDENCY_DESCRIPTION = { ...@@ -33,6 +33,9 @@ DEPENDENCY_DESCRIPTION = {
"togl": ("Tk for OpenGL", "togl": ("Tk for OpenGL",
"see http://downloads.sourceforge.net/togl/", "see http://downloads.sourceforge.net/togl/",
"see http://downloads.sourceforge.net/togl/"), "see http://downloads.sourceforge.net/togl/"),
"tkinter": ("Tk interface for Python",
"Install the package 'python-tk'",
"see http://tkinter.unpythonic.net/wiki/"),
} }
REQUIREMENTS_LINK = "https://sourceforge.net/apps/mediawiki/pycam/index.php?title=Requirements" REQUIREMENTS_LINK = "https://sourceforge.net/apps/mediawiki/pycam/index.php?title=Requirements"
...@@ -79,6 +82,15 @@ def dependency_details_tk(): ...@@ -79,6 +82,15 @@ def dependency_details_tk():
result["opengl"] = True result["opengl"] = True
except ImportError: except ImportError:
result["opengl"] = False result["opengl"] = False
try:
import Tkinter
result["tkinter"] = True
except ImportError:
result["tkinter"] = False
# Don't try to import OpenGL.Tk if Tkinter itself is missing.
# Otherwise the "except" statement below fails due to the unknown
# Tkinter.TclError exception.
if result["tkinter"]:
try: try:
import logging import logging
try: try:
...@@ -94,6 +106,8 @@ def dependency_details_tk(): ...@@ -94,6 +106,8 @@ def dependency_details_tk():
result["togl"] = True result["togl"] = True
except (ImportError, Tkinter.TclError): except (ImportError, Tkinter.TclError):
result["togl"] = False result["togl"] = False
else:
result["togl"] = False
return result return result
def check_dependencies(details): def check_dependencies(details):
...@@ -170,7 +184,7 @@ class ToolPathList(list): ...@@ -170,7 +184,7 @@ class ToolPathList(list):
class ToolPathInfo: class ToolPathInfo:
def __init__(self, toolpath, name, cutter, drill_id, speed, feedrate, def __init__(self, toolpath, name, cutter, drill_id, speed, feedrate,
material_allowance, safety_height, unit, start_x, start_y, start_z): material_allowance, safety_height, unit, start_x, start_y, start_z, bounding_box):
self.toolpath = toolpath self.toolpath = toolpath
self.name = name self.name = name
self.visible = True self.visible = True
...@@ -185,6 +199,7 @@ class ToolPathInfo: ...@@ -185,6 +199,7 @@ class ToolPathInfo:
self.start_x = start_x self.start_x = start_x
self.start_y = start_y self.start_y = start_y
self.start_z = start_z self.start_z = start_z
self.bounding_box = bounding_box
self.color = None self.color = None
# generate random color # generate random color
self.set_color() self.set_color()
......
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