Skip to content
Permalink
Browse files
Merge pull request #347 from slarosa/pyqgis-console
fix output directory for pyqgis console on installing
  • Loading branch information
mach0 committed Jan 3, 2013
2 parents b48ae8b + 77d48a0 commit d4ef4fd98ed3d771ef6956ec702de7144d982518
Showing with 37 additions and 12 deletions.
  1. +2 −3 python/CMakeLists.txt
  2. +7 −7 python/console/CMakeLists.txt
  3. +26 −0 python/console/__init__.py
  4. 0 python/console/console.py
  5. 0 python/console/console_sci.py
  6. +2 −2 src/app/qgisapp.cpp
@@ -2,6 +2,7 @@ SET (PYTHON_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/python)

ADD_SUBDIRECTORY(plugins)
ADD_SUBDIRECTORY(qsci_apis)
ADD_SUBDIRECTORY(console)

IF (WITH_PYSPATIALITE)
ADD_SUBDIRECTORY(pyspatialite)
@@ -150,7 +151,7 @@ ADD_CUSTOM_TARGET(pyutils ALL)
INSTALL(FILES ${PY_FILES} DESTINATION "${QGIS_PYTHON_DIR}")

# stage to output to make available when QGIS is run from build directory
FOREACH(pyfile ${PY_FILES} ${PYUI_FILES})
FOREACH(pyfile ${PY_FILES})
ADD_CUSTOM_COMMAND(TARGET pyutils
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${pyfile} "${QGIS_PYTHON_OUTPUT_DIRECTORY}"
@@ -159,8 +160,6 @@ FOREACH(pyfile ${PY_FILES} ${PYUI_FILES})
)
ENDFOREACH(pyfile)

ADD_SUBDIRECTORY(console)

# Byte-compile staged PyQGIS utilities
IF(WITH_PY_COMPILE)
ADD_CUSTOM_TARGET(pycompile_pyutils ALL
@@ -1,30 +1,30 @@
ADD_SUBDIRECTORY(console_help)

SET(PYTHON_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/python)
SET(QGIS_PYTHON_DIR ${PYTHON_SITE_PACKAGES_DIR}/qgis)
SET (QGIS_CONSOLE_DIR ${QGIS_DATA_DIR}/python/console)
SET (PYTHON_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/python)

# PyQGIS console files to copy to staging or install
SET(PY_CONSOLE_FILES
console.py
console_sci.py
console_help.py
console_settings.py
console_output.py
__init__.py
)

FILE(GLOB UI_FILES *.ui)
PYQT4_WRAP_UI(PYUI_FILES ${UI_FILES}) # returns absolute paths
PYQT4_WRAP_UI(PYUI_FILES ${UI_FILES})
ADD_CUSTOM_TARGET(pyconsole ALL DEPENDS ${PYUI_FILES})

# stage to output to make available when QGIS is run from build directory
FOREACH(pyfile ${PY_CONSOLE_FILES} ${PYUI_FILES})
ADD_CUSTOM_COMMAND(TARGET pyconsole
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${pyfile} "${QGIS_PYTHON_OUTPUT_DIRECTORY}"
COMMAND ${CMAKE_COMMAND} -E make_directory ${PYTHON_OUTPUT_DIRECTORY}/console
COMMAND ${CMAKE_COMMAND} -E copy ${pyfile} ${PYTHON_OUTPUT_DIRECTORY}/console
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${pyfile}
)
ENDFOREACH(pyfile)

INSTALL(FILES ${PY_CONSOLE_FILES} ${PYUI_FILES} DESTINATION "${QGIS_PYTHON_DIR}")
INSTALL(FILES ${PY_CONSOLE_FILES} ${PYUI_FILES} DESTINATION "${QGIS_CONSOLE_DIR}")

@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
__init__.py
---------------------
Date : September 2012
Copyright : (C) 2012 by Salvatore Larosa
Email : lrssvtml at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""

__author__ = 'Salvatore Larosa'
__date__ = 'September 2012'
__copyright__ = '(C) 2012, Salvatore Larosa'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

from console import show_console
0 python/console/console.py 100755 → 100644
Empty file.
0 python/console/console_sci.py 100755 → 100644
Empty file.
@@ -1093,8 +1093,8 @@ void QgisApp::showPythonDialog()
return;

bool res = mPythonUtils->runStringUnsafe(
"import qgis.console\n"
"qgis.console.show_console()\n", false );
"import console\n"
"console.show_console()\n", false );

if ( !res )
{

0 comments on commit d4ef4fd

Please sign in to comment.