Commit 25c54b67 authored by jcfr's avatar jcfr
Browse files

BUG: SlicerQT - Added method toCygwinPath to Slicer3/Utilities/Designer/Designer.py

If required, path are converted according to cygwin specs.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@11561 3bd1e089-480b-0410-8dfb-8563597acbee
parent ed61792a
......@@ -15,16 +15,12 @@ GET_TARGET_PROPERTY(output_directory ${designer_launcher_project_name} LIBRARY_O
#MESSAGE(STATUS CMAKE_BUILD_TYPE:${CMAKE_BUILD_TYPE})
#MESSAGE(STATUS output_directory:${output_directory})
# Convert path
FILE(TO_NATIVE_PATH ${QT_BINARY_DIR} NATIVE_QT_BINARY_DIR)
IF(CMAKE_CONFIGURATION_TYPES)
# Loop through all Configuration types
# For further details, see http://www.cmake.org/cmake/help/cmake-2-8-docs.html#variable:CMAKE_CONFIGURATION_TYPES
FOREACH(config ${CMAKE_CONFIGURATION_TYPES})
FILE(TO_NATIVE_PATH ${output_directory}/${config} NATIVE_LIBRARY_OUTPUT_DIRECTORY)
SET(LIBRARY_OUTPUT_DIRECTORY ${output_directory}/${config})
SET(designer_launcher "${designer_launcher_directory}/Designer-${config}.py")
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/Designer.py.in
${designer_launcher}
......@@ -35,7 +31,7 @@ IF(CMAKE_CONFIGURATION_TYPES)
ELSE(CMAKE_CONFIGURATION_TYPES)
FILE(TO_NATIVE_PATH ${output_directory} NATIVE_LIBRARY_OUTPUT_DIRECTORY)
SET(LIBRARY_OUTPUT_DIRECTORY ${output_directory})
SET(designer_launcher "${designer_launcher_directory}/Designer.py")
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/Designer.py.in
......
......@@ -9,13 +9,23 @@ this module allows to:
import os
import sys
import subprocess
def startDesigner(open_command, argv):
"Start QT Designer"
addEnvVariable('QT_PLUGIN_PATH', '@NATIVE_LIBRARY_OUTPUT_DIRECTORY@')
addEnvVariable('PATH', '@NATIVE_LIBRARY_OUTPUT_DIRECTORY@')
os.execv(open_command+'@NATIVE_QT_BINARY_DIR@'+os.sep+argv[0], argv)
addEnvVariable('QT_PLUGIN_PATH', toCygwinPath('@LIBRARY_OUTPUT_DIRECTORY@'))
addEnvVariable('PATH', toCygwinPath('@LIBRARY_OUTPUT_DIRECTORY@'))
os.execv(open_command+'@QT_BINARY_DIR@'+os.sep+argv[0], argv)
def toCygwinPath(path):
"Attempt to convert to a cygwin path"
if (sys.platform == 'cygwin'):
os.system('cygpath -u '+path);
new_path=subprocess.Popen(["cygpath", "-u",path], stdout=subprocess.PIPE).communicate()[0]
else:
new_path=path
return new_path.strip()
def addEnvVariable(name, value):
"Add variable to environment"
......
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