Commit a19201d1 authored by jcfr's avatar jcfr
Browse files

ENH: Remove deprecated QtDesigner python based launcher

git-svn-id: http://svn.slicer.org/Slicer4/trunk@16805 3bd1e089-480b-0410-8dfb-8563597acbee
parent 1283058c
......@@ -671,11 +671,6 @@ INSTALL(
DESTINATION ${Slicer_INSTALL_LIB_DIR}
)
#-----------------------------------------------------------------------------
# Launcher for QTDesigner
#-----------------------------------------------------------------------------
ADD_SUBDIRECTORY(Utilities/Designer)
#-----------------------------------------------------------------------------
# Documentation
#-----------------------------------------------------------------------------
......
#
# Configure Qt Designer launcher (Designer.py.in) allowing to:
# - update the environment variable QT_PLUGIN_PATH with Slicer QT Plugin path
# - update PATH with Slicer libraries
# - start the designer
#
# --------------------------------------------------------------
SET(designer_launcher_project_name SlicerQT)
SET(designer_launcher_directory ${Slicer_BINARY_DIR})
# --------------------------------------------------------------
GET_TARGET_PROPERTY(output_directory ${designer_launcher_project_name} LIBRARY_OUTPUT_DIRECTORY)
#MESSAGE(STATUS CMAKE_CONFIGURATION_TYPES:${CMAKE_CONFIGURATION_TYPES})
#MESSAGE(STATUS CMAKE_BUILD_TYPE:${CMAKE_BUILD_TYPE})
#MESSAGE(STATUS output_directory:${output_directory})
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})
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
${CMAKE_CURRENT_BINARY_DIR}/Designer.py
)
FILE(COPY ${CMAKE_CURRENT_BINARY_DIR}/Designer.py
DESTINATION ${designer_launcher_directory}
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ WORLD_READ)
MESSAGE(STATUS "Configuring Qt Designer launcher: "${designer_launcher})
ENDFOREACH(config)
ELSE(CMAKE_CONFIGURATION_TYPES)
SET(LIBRARY_OUTPUT_DIRECTORY ${output_directory})
SET(designer_launcher "${designer_launcher_directory}/Designer.py")
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/Designer.py.in
${CMAKE_CURRENT_BINARY_DIR}/Designer.py
)
FILE(COPY ${CMAKE_CURRENT_BINARY_DIR}/Designer.py
DESTINATION ${designer_launcher_directory}
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ WORLD_READ )
MESSAGE(STATUS "Configuring Qt Designer launcher: "${designer_launcher})
ENDIF(CMAKE_CONFIGURATION_TYPES)
#! /usr/bin/env python
"""
After been configured properly using CMAKE,
this module allows to:
- update the environment variable QT_PLUGIN_PATH with Slicer QT Plugin path
- start the designer
"""
import os
import sys
import subprocess
def startDesigner(open_command, argv):
"Start QT Designer"
addEnvVariable('QT_PLUGIN_PATH', toCygwinPath('@CTK_QTDESIGNERPLUGINS_DIR@'))
addEnvVariable('QT_PLUGIN_PATH', toCygwinPath('@CMAKE_LIBRARY_OUTPUT_DIRECTORY@'))
openCmd = open_command+'@QT_BINARY_DIR@'+os.sep+argv[0]
print openCmd
os.system(openCmd + " " + argv[1])
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"
# If platform is cygwin, force pathseparator to be ':'
pathsep = os.pathsep
if (sys.platform == 'cygwin'):
pathsep = ':'
# Update OS environment
if (name in os.environ):
sep = ''
if (os.environ[name] != ""):
sep = pathsep
os.environ[name] += (sep + value)
else:
os.environ[name] = value
# Entry point
if __name__ == "__main__":
if (len(sys.argv) > 2):
print """
designer.py - Start QT Designer with Slicer plugins
Use: python designer.py [UI file]
"""
else:
# Default executable name
executable_name ='designer'
open_command = ''
if (len(sys.argv) < 2):
sys.argv.append("")
# Handle MACOSX case
if sys.platform == 'darwin':
executable_name = 'Designer.app'
open_command = 'open '
# Update first value to match executable name
sys.argv[0] = executable_name
startDesigner(open_command, sys.argv);
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