Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 d4ef4fd
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 12 deletions.
5 changes: 2 additions & 3 deletions python/CMakeLists.txt
Expand Up @@ -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)
Expand Down Expand Up @@ -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}"
Expand All @@ -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
Expand Down
14 changes: 7 additions & 7 deletions python/console/CMakeLists.txt
@@ -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}")

26 changes: 26 additions & 0 deletions python/console/__init__.py
@@ -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
Empty file modified python/console/console.py 100755 → 100644
Empty file.
Empty file modified python/console/console_sci.py 100755 → 100644
Empty file.
4 changes: 2 additions & 2 deletions src/app/qgisapp.cpp
Expand Up @@ -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 )
{
Expand Down

0 comments on commit d4ef4fd

Please sign in to comment.