Skip to content
Permalink
Browse files
use specific PyQt4/uic widget-plugins module for python compilation o…
…f widgets
  • Loading branch information
3nids committed May 12, 2014
1 parent d83f3ec commit 38c694d9adc3bc643a9d7ccc3b1c73760e52c0c5
Showing with 25 additions and 18 deletions.
  1. +5 −0 CMakeLists.txt
  2. +3 −1 python/CMakeLists.txt
  3. +0 −3 python/__init__.py
  4. +16 −12 python/{customwidgets.py → custom_widgets/qgis_customwidgets.py}
  5. +1 −2 src/gui/qgsmaplayercombobox.h
@@ -558,6 +558,7 @@ IF (UNIX AND NOT APPLE)
SET (QGIS_MANUAL_DIR ${CMAKE_INSTALL_PREFIX}/${QGIS_MANUAL_SUBDIR})
ENDIF (UNIX AND NOT APPLE)


#############################################################
# Python bindings

@@ -583,6 +584,10 @@ IF (WITH_BINDINGS)
SET(PYTHON_SITE_PACKAGES_DIR ${QGIS_DATA_DIR}/python)
ENDIF (NOT BINDINGS_GLOBAL_INSTALL)

IF (WITH_CUSTOM_WIDGETS)
SET(PYUIC_WIDGET_PLUGIN_DIRECTORY ${PYQT4_MOD_DIR}/uic/widget-plugins/)
ENDIF (WITH_CUSTOM_WIDGETS)

ENDIF (WITH_BINDINGS)

# Set QSCINTILLA_VERSION_STR to that of module, if no headers found
@@ -179,8 +179,10 @@ ENDIF(WITH_QSCIAPI)
SET(PY_FILES
__init__.py
utils.py
customwidgets.py
)
IF(WITH_CUSTOM_WIDGETS)
INSTALL(FILES custom_widgets/qgis_customwidgets.py DESTINATION "${PYUIC_WIDGET_PLUGIN_DIRECTORY}")
ENDIF(WITH_CUSTOM_WIDGETS)

ADD_CUSTOM_TARGET(pyutils ALL)
INSTALL(FILES ${PY_FILES} DESTINATION "${QGIS_PYTHON_DIR}")
@@ -24,7 +24,6 @@
__revision__ = '$Format:%H$'

import sip
from customwidgets import referenceCustomWidgets

try:
apis = ["QDate", "QDateTime", "QString", "QTextStream", "QTime", "QUrl", "QVariant"]
@@ -36,8 +35,6 @@

from qgis.core import QgsFeature, QgsGeometry

referenceCustomWidgets()

try:
# Add a __nonzero__ method onto QPyNullVariant so we can check for null values easier.
# >>> value = QPyNullVariant("int")
@@ -17,17 +17,21 @@
***************************************************************************
"""

import sys
import qgis
from qgis import gui
# If pluginType is MODULE, the plugin loader will call moduleInformation. The
# variable MODULE is inserted into the local namespace by the plugin loader.
pluginType = MODULE

"""
This allow to redirect the custom widget include header file to qgis.gui
"""

def referenceCustomWidgets():
sys.modules["qgscollapsiblegroupboxplugin"] = qgis.gui
sys.modules["qgsfieldcomboboxplugin"] = qgis.gui
sys.modules["qgsfieldexpressionwidgetplugin"] = qgis.gui
sys.modules["qgsmaplayercomboboxplugin"] = qgis.gui
sys.modules["qgsscalevisibilitywidgetplugin"] = qgis.gui
# moduleInformation() must return a tuple (module, widget_list). If "module"
# is "A" and any widget from this module is used, the code generator will write
# "import A". If "module" is "A[.B].C", the code generator will write
# "from A[.B] import C". Each entry in "widget_list" must be unique.
def moduleInformation():
return "qgis.gui", \
("QgsCollapsibleGroupbox" ,\
"QgsFieldComboBox" ,\
"QgsFieldExpressionWidget",\
"QgsMapLayerComboBox" ,\
"QgsMapLayerProxyModel" ,\
"QgsScalevisibilityWidget",\
)
@@ -44,7 +44,7 @@ class GUI_EXPORT QgsMapLayerComboBox : public QComboBox
void setFilters( QgsMapLayerProxyModel::Filters filters );

//! currently used filter on list layers
QgsMapLayerProxyModel::Filters filters() {return mProxyModel->filters();}
QgsMapLayerProxyModel::Filters filters() { return mProxyModel->filters(); }

//! currentLayer returns the current layer selected in the combo box
QgsMapLayer* currentLayer();
@@ -62,7 +62,6 @@ class GUI_EXPORT QgsMapLayerComboBox : public QComboBox

private:
QgsMapLayerProxyModel* mProxyModel;

};

#endif // QGSMAPLAYERCOMBOBOX_H

0 comments on commit 38c694d

Please sign in to comment.