Skip to content

Commit d4ef4fd

Browse files
committed
Merge pull request #347 from slarosa/pyqgis-console
fix output directory for pyqgis console on installing
2 parents b48ae8b + 77d48a0 commit d4ef4fd

File tree

6 files changed

+37
-12
lines changed

6 files changed

+37
-12
lines changed

python/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ SET (PYTHON_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/python)
22

33
ADD_SUBDIRECTORY(plugins)
44
ADD_SUBDIRECTORY(qsci_apis)
5+
ADD_SUBDIRECTORY(console)
56

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

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

162-
ADD_SUBDIRECTORY(console)
163-
164163
# Byte-compile staged PyQGIS utilities
165164
IF(WITH_PY_COMPILE)
166165
ADD_CUSTOM_TARGET(pycompile_pyutils ALL

python/console/CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
ADD_SUBDIRECTORY(console_help)
22

3-
SET(PYTHON_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/python)
4-
SET(QGIS_PYTHON_DIR ${PYTHON_SITE_PACKAGES_DIR}/qgis)
3+
SET (QGIS_CONSOLE_DIR ${QGIS_DATA_DIR}/python/console)
4+
SET (PYTHON_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/python)
55

6-
# PyQGIS console files to copy to staging or install
76
SET(PY_CONSOLE_FILES
87
console.py
98
console_sci.py
109
console_help.py
1110
console_settings.py
1211
console_output.py
12+
__init__.py
1313
)
1414

1515
FILE(GLOB UI_FILES *.ui)
16-
PYQT4_WRAP_UI(PYUI_FILES ${UI_FILES}) # returns absolute paths
16+
PYQT4_WRAP_UI(PYUI_FILES ${UI_FILES})
1717
ADD_CUSTOM_TARGET(pyconsole ALL DEPENDS ${PYUI_FILES})
1818

19-
# stage to output to make available when QGIS is run from build directory
2019
FOREACH(pyfile ${PY_CONSOLE_FILES} ${PYUI_FILES})
2120
ADD_CUSTOM_COMMAND(TARGET pyconsole
2221
POST_BUILD
23-
COMMAND ${CMAKE_COMMAND} -E copy ${pyfile} "${QGIS_PYTHON_OUTPUT_DIRECTORY}"
22+
COMMAND ${CMAKE_COMMAND} -E make_directory ${PYTHON_OUTPUT_DIRECTORY}/console
23+
COMMAND ${CMAKE_COMMAND} -E copy ${pyfile} ${PYTHON_OUTPUT_DIRECTORY}/console
2424
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
2525
DEPENDS ${pyfile}
2626
)
2727
ENDFOREACH(pyfile)
2828

29-
INSTALL(FILES ${PY_CONSOLE_FILES} ${PYUI_FILES} DESTINATION "${QGIS_PYTHON_DIR}")
29+
INSTALL(FILES ${PY_CONSOLE_FILES} ${PYUI_FILES} DESTINATION "${QGIS_CONSOLE_DIR}")
3030

python/console/__init__.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
***************************************************************************
5+
__init__.py
6+
---------------------
7+
Date : September 2012
8+
Copyright : (C) 2012 by Salvatore Larosa
9+
Email : lrssvtml at gmail dot com
10+
***************************************************************************
11+
* *
12+
* This program is free software; you can redistribute it and/or modify *
13+
* it under the terms of the GNU General Public License as published by *
14+
* the Free Software Foundation; either version 2 of the License, or *
15+
* (at your option) any later version. *
16+
* *
17+
***************************************************************************
18+
"""
19+
20+
__author__ = 'Salvatore Larosa'
21+
__date__ = 'September 2012'
22+
__copyright__ = '(C) 2012, Salvatore Larosa'
23+
# This will get replaced with a git SHA1 when you do a git archive
24+
__revision__ = '$Format:%H$'
25+
26+
from console import show_console

python/console/console.py

100755100644
File mode changed.

python/console/console_sci.py

100755100644
File mode changed.

src/app/qgisapp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,8 +1093,8 @@ void QgisApp::showPythonDialog()
10931093
return;
10941094

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

10991099
if ( !res )
11001100
{

0 commit comments

Comments
 (0)