Commit 08620b28 authored by sumpfralle's avatar sumpfralle

fixed program detection for standalone executable

git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@1047 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 58167a14
...@@ -29,6 +29,8 @@ import os ...@@ -29,6 +29,8 @@ import os
log = pycam.Utils.log.get_logger() log = pycam.Utils.log.get_logger()
def convert_svg2eps(svg_filename, eps_filename, location=None): def convert_svg2eps(svg_filename, eps_filename, location=None):
if location is None:
location = pycam.Utils.get_external_program_location("inkscape")
if location is None: if location is None:
location = "inkscape" location = "inkscape"
try: try:
...@@ -50,6 +52,8 @@ def convert_svg2eps(svg_filename, eps_filename, location=None): ...@@ -50,6 +52,8 @@ def convert_svg2eps(svg_filename, eps_filename, location=None):
return False return False
def convert_eps2dxf(eps_filename, dxf_filename, location=None, unit="mm"): def convert_eps2dxf(eps_filename, dxf_filename, location=None, unit="mm"):
if location is None:
location = pycam.Utils.get_external_program_location("pstoedit")
if location is None: if location is None:
location = "pstoedit" location = "pstoedit"
args = [location, "-dt", "-nc", "-f", "dxf:-polyaslines"] args = [location, "-dt", "-nc", "-f", "dxf:-polyaslines"]
......
...@@ -217,14 +217,17 @@ def get_external_program_location(key): ...@@ -217,14 +217,17 @@ def get_external_program_location(key):
if os.path.isfile(location): if os.path.isfile(location):
return location return location
# do a manual scan in the programs directory (only for windows) # do a manual scan in the programs directory (only for windows)
program_dirs = ["C:\\Program Files", "C:\\Programme"]
try: try:
from win32com.shell import shellcon, shell from win32com.shell import shellcon, shell
program_dir = shell.SHGetFolderPath(0, shellcon.CSIDL_PROGRAM_FILES, # The frozen application somehow dows not provide this setting.
0, 0) program_dirs.insert(0, shell.SHGetFolderPath(0,
shellcon.CSIDL_PROGRAM_FILES, 0, 0))
except ImportError: except ImportError:
# no other options for non-windows systems # no other options for non-windows systems
return None pass
# scan the program directory # scan the program directory
for program_dir in program_dirs:
for sub_dir in windows_program_directories[key]: for sub_dir in windows_program_directories[key]:
for basename in potential_names: for basename in potential_names:
location = os.path.join(program_dir, sub_dir, basename) location = os.path.join(program_dir, sub_dir, basename)
......
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