Commit 83ad94bf authored by sumpfralle's avatar sumpfralle

added the svn:eol-style attribute (native) to all python scripts and xml files


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@629 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 0a2b2fad
# keysyms does not seem to be recognized by pyinstaller # keysyms does not seem to be recognized by pyinstaller
# There will be exceptions after any keypress without this line. # There will be exceptions after any keypress without this line.
hiddenimports = ["gtk.keysyms"] hiddenimports = ["gtk.keysyms"]
\ No newline at end of file
...@@ -6322,7 +6322,7 @@ Any selected group of dimensions will be scaled accordingly.</property> ...@@ -6322,7 +6322,7 @@ Any selected group of dimensions will be scaled accordingly.</property>
<property name="step_increment">1</property> <property name="step_increment">1</property>
</object> </object>
<object class="GtkAdjustment" id="SupportGridLength"> <object class="GtkAdjustment" id="SupportGridLength">
<property name="lower">0.01</property> <property name="lower">-100</property>
<property name="upper">100</property> <property name="upper">100</property>
<property name="step_increment">1</property> <property name="step_increment">1</property>
</object> </object>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
$Id$ $Id$
Copyright 2010 Lars Kruse <devel@sumpfralle.de> Copyright 2010 Lars Kruse <devel@sumpfralle.de>
This file is part of PyCAM. This file is part of PyCAM.
PyCAM is free software: you can redistribute it and/or modify PyCAM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
PyCAM is distributed in the hope that it will be useful, PyCAM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License 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/>.
""" """
import pycam.Utils.log import pycam.Utils.log
# Tkinter is used for "EmergencyDialog" below - but we will try to import it # Tkinter is used for "EmergencyDialog" below - but we will try to import it
# carefully. # carefully.
#import Tkinter #import Tkinter
import sys import sys
import os import os
log = pycam.Utils.log.get_logger() log = pycam.Utils.log.get_logger()
DEPENDENCY_DESCRIPTION = { DEPENDENCY_DESCRIPTION = {
"gtk": ("Python bindings for GTK+", "gtk": ("Python bindings for GTK+",
"Install the package 'python-gtk2'", "Install the package 'python-gtk2'",
"see http://www.bonifazi.eu/appunti/pygtk_windows_installer.exe"), "see http://www.bonifazi.eu/appunti/pygtk_windows_installer.exe"),
"opengl": ("Python bindings for OpenGL", "opengl": ("Python bindings for OpenGL",
"Install the package 'python-opengl'", "Install the package 'python-opengl'",
"see http://www.bonifazi.eu/appunti/pygtk_windows_installer.exe"), "see http://www.bonifazi.eu/appunti/pygtk_windows_installer.exe"),
"gtkgl": ("GTK extension for OpenGL", "gtkgl": ("GTK extension for OpenGL",
"Install the package 'python-gtkglext1'", "Install the package 'python-gtkglext1'",
"see http://www.bonifazi.eu/appunti/pygtk_windows_installer.exe"), "see http://www.bonifazi.eu/appunti/pygtk_windows_installer.exe"),
"gl": ("OpenGL support of graphic driver", "gl": ("OpenGL support of graphic driver",
"Your current graphic driver does not support OpenGL. Please consult " \ "Your current graphic driver does not support OpenGL. Please consult " \
+ "'glxgears' to locate this problem."), + "'glxgears' to locate this problem."),
} }
REQUIREMENTS_LINK = "http://sourceforge.net/apps/mediawiki/pycam/index.php?title=Requirements" REQUIREMENTS_LINK = "http://sourceforge.net/apps/mediawiki/pycam/index.php?title=Requirements"
# Usually the windows registry "HKEY_LOCAL_MACHINE/SOFTWARE/Gtk+/Path" contains # Usually the windows registry "HKEY_LOCAL_MACHINE/SOFTWARE/Gtk+/Path" contains
# something like: C:\Programs\Common files\GTK # something like: C:\Programs\Common files\GTK
# Afterwards we need to append "\bin" to get the library subdirectory. # Afterwards we need to append "\bin" to get the library subdirectory.
WINDOWS_GTK_REGISTRY_PATH = r"SOFTWARE\Gtk+" WINDOWS_GTK_REGISTRY_PATH = r"SOFTWARE\Gtk+"
WINDOWS_GTK_REGISTRY_KEY = "Path" WINDOWS_GTK_REGISTRY_KEY = "Path"
WINDOWS_GTK_LIB_SUBDIR = "bin" WINDOWS_GTK_LIB_SUBDIR = "bin"
def import_gtk_carefully(): def import_gtk_carefully():
""" especially for windows: try to locate required libraries manually, if """ especially for windows: try to locate required libraries manually, if
the import of GTK fails the import of GTK fails
""" """
try: try:
import _winreg import _winreg
in_windows = True in_windows = True
except ImportError: except ImportError:
in_windows = False in_windows = False
if not in_windows: if not in_windows:
# We are not in windows - thus we just try to import gtk without # We are not in windows - thus we just try to import gtk without
# the need for any more manual preparations. # the need for any more manual preparations.
import gtk import gtk
else: else:
# We try to retrive the GTK library directory from the registry before # We try to retrive the GTK library directory from the registry before
# trying any import. Otherwise the user will always see a warning # trying any import. Otherwise the user will always see a warning
# dialog regarding the missing libglib-2.0-0.dll file. This Windows # dialog regarding the missing libglib-2.0-0.dll file. This Windows
# warning dialog can't be suppressed - thus we should try to avoid it. # warning dialog can't be suppressed - thus we should try to avoid it.
try: try:
reg_path = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, reg_path = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,
WINDOWS_GTK_REGISTRY_PATH) WINDOWS_GTK_REGISTRY_PATH)
gtk_dll_path = os.path.join(_winreg.QueryValueEx(reg_path, gtk_dll_path = os.path.join(_winreg.QueryValueEx(reg_path,
WINDOWS_GTK_REGISTRY_KEY)[0], WINDOWS_GTK_LIB_SUBDIR) WINDOWS_GTK_REGISTRY_KEY)[0], WINDOWS_GTK_LIB_SUBDIR)
_winreg.CloseKey(reg_path) _winreg.CloseKey(reg_path)
except NameError: except NameError:
# GTK is probably not installed - the next import will fail # GTK is probably not installed - the next import will fail
pass pass
except WindowsError: except WindowsError:
# this happens with pyinstaller binaries - just ignore it # this happens with pyinstaller binaries - just ignore it
pass pass
else: else:
# add the new path to the PATH environment variable # add the new path to the PATH environment variable
if "PATH" in os.environ: if "PATH" in os.environ:
if not gtk_dll_path in os.environ["PATH"].split(os.pathsep): if not gtk_dll_path in os.environ["PATH"].split(os.pathsep):
# append the guessed path to the library search path # append the guessed path to the library search path
os.environ["PATH"] += "%s%s" % (os.pathsep, gtk_dll_path) os.environ["PATH"] += "%s%s" % (os.pathsep, gtk_dll_path)
# everything should be prepared - now we try to import it again # everything should be prepared - now we try to import it again
import gtk import gtk
def requirements_details_gtk(): def requirements_details_gtk():
result = {} result = {}
try: try:
import_gtk_carefully() import_gtk_carefully()
result["gtk"] = True result["gtk"] = True
except ImportError: except ImportError:
result["gtk"] = False result["gtk"] = False
return result return result
def recommends_details_gtk(): def recommends_details_gtk():
result = {} result = {}
try: try:
import gtk.gtkgl import gtk.gtkgl
result["gtkgl"] = True result["gtkgl"] = True
result["gl"] = True result["gl"] = True
except ImportError: except ImportError:
result["gtkgl"] = False result["gtkgl"] = False
except RuntimeError: except RuntimeError:
result["gl"] = False result["gl"] = False
try: try:
import OpenGL import OpenGL
result["opengl"] = True result["opengl"] = True
except ImportError: except ImportError:
result["opengl"] = False result["opengl"] = False
def check_dependencies(details): def check_dependencies(details):
"""you can feed this function with the output of """you can feed this function with the output of
'(requirements|recommends)_details_*'. '(requirements|recommends)_details_*'.
The result is True if all dependencies are met. The result is True if all dependencies are met.
""" """
failed = [key for (key, state) in details.items() if not state] failed = [key for (key, state) in details.items() if not state]
return len(failed) == 0 return len(failed) == 0
def get_dependency_report(details, prefix=""): def get_dependency_report(details, prefix=""):
result = [] result = []
DESC_COL = 0 DESC_COL = 0
if sys.platform.startswith("win"): if sys.platform.startswith("win"):
ADVICE_COL = 2 ADVICE_COL = 2
else: else:
ADVICE_COL = 1 ADVICE_COL = 1
for key, state in details.items(): for key, state in details.items():
text = "%s%s: " % (prefix, DEPENDENCY_DESCRIPTION[key][DESC_COL]) text = "%s%s: " % (prefix, DEPENDENCY_DESCRIPTION[key][DESC_COL])
if state: if state:
text += "OK" text += "OK"
else: else:
text += "MISSING (%s)" % DEPENDENCY_DESCRIPTION[key][ADVICE_COL] text += "MISSING (%s)" % DEPENDENCY_DESCRIPTION[key][ADVICE_COL]
result.append(text) result.append(text)
return os.linesep.join(result) return os.linesep.join(result)
class EmergencyDialog: class EmergencyDialog:
""" This graphical message window requires no external dependencies. """ This graphical message window requires no external dependencies.
The Tk interface package is part of the main python distribution. The Tk interface package is part of the main python distribution.
Use this class for displaying dependency errors (especially on Windows). Use this class for displaying dependency errors (especially on Windows).
""" """
def __init__(self, title, message): def __init__(self, title, message):
try: try:
import Tkinter import Tkinter
except ImportError: except ImportError:
# tk is not installed # tk is not installed
log.warn("Failed to show error dialog due to a missing Tkinter " \ log.warn("Failed to show error dialog due to a missing Tkinter " \
+ "Python package.") + "Python package.")
return return
try: try:
root = Tkinter.Tk() root = Tkinter.Tk()
except Tkinter.TclError, err_msg: except Tkinter.TclError, err_msg:
log.info(("Failed to create error dialog window (%s). Probably " \ log.info(("Failed to create error dialog window (%s). Probably " \
+ "you are running PyCAM from a terminal.") % err_msg) + "you are running PyCAM from a terminal.") % err_msg)
return return
root.title(title) root.title(title)
root.bind("<Return>", self.finish) root.bind("<Return>", self.finish)
root.bind("<Escape>", self.finish) root.bind("<Escape>", self.finish)
root.minsize(300, 100) root.minsize(300, 100)
self.root = root self.root = root
frame = Tkinter.Frame(root) frame = Tkinter.Frame(root)
frame.pack() frame.pack()
# add text output as label # add text output as label
message = Tkinter.Message(root, text=message) message = Tkinter.Message(root, text=message)
# we need some space for the dependency report # we need some space for the dependency report
message["width"] = 800 message["width"] = 800
message.pack() message.pack()
# add the "close" button # add the "close" button
close = Tkinter.Button(root, text="Close") close = Tkinter.Button(root, text="Close")
close["command"] = self.finish close["command"] = self.finish
close.pack(side=Tkinter.BOTTOM) close.pack(side=Tkinter.BOTTOM)
root.mainloop() root.mainloop()
def finish(self, *args): def finish(self, *args):
self.root.quit() self.root.quit()
...@@ -206,7 +206,10 @@ def get_support_distributed(model, z_plane, average_distance, ...@@ -206,7 +206,10 @@ def get_support_distributed(model, z_plane, average_distance,
else: else:
# position1 is OK # position1 is OK
position = position1 position = position1
# append the original position (ignoring z_plane)
bridge_positions.append(position) bridge_positions.append(position)
# move the point to z_plane
position = Point(position.x, position.y, z_plane)
bridge_dir = lines[line_index].dir.cross( bridge_dir = lines[line_index].dir.cross(
polygon.plane.n).normalized().mul(length) polygon.plane.n).normalized().mul(length)
_add_cuboid_to_model(result, position, bridge_dir, height, thickness) _add_cuboid_to_model(result, position, bridge_dir, height, thickness)
......
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