Skip to content

Commit

Permalink
uic widget-plugins: do not crash if QGIS not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed May 19, 2014
1 parent 0ff4985 commit acd574d
Showing 1 changed file with 23 additions and 18 deletions.
41 changes: 23 additions & 18 deletions python/custom_widgets/qgis_customwidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,32 @@
It is copied on installation in /pythonX/dist-packages/PyQt4/uic/widget-plugins/
"""

#pluginType = CW_FILTER
#def getFilter():
# import qgis.gui
#
# QGIS_widgets = {}
# for pyClass in dir(qgis.gui):
# QGIS_widgets[pyClass] = 'qgis.gui'
#
# def _QGISfilter(widgetname, baseclassname, module):
# print widgetname, baseclassname, module
# if widgetname in QGIS_widgets:
# return (MATCH, (widgetname, baseclassname, QGIS_widgets[widgetname]))
# else:
# return (NO_MATCH, None)
#
# return _QGISfilter
# solution with CW_FILTER not fully working due to include of other files
# (e.g. for flags defined in other source files)

# pluginType = CW_FILTER
# def getFilter():
# import qgis.gui
#
# QGIS_widgets = {}
# for pyClass in dir(qgis.gui):
# QGIS_widgets[pyClass] = 'qgis.gui'
#
# def _QGISfilter(widgetname, baseclassname, module):
# print widgetname, baseclassname, module
# if widgetname in QGIS_widgets:
# return (MATCH, (widgetname, baseclassname, QGIS_widgets[widgetname]))
# else:
# return (NO_MATCH, None)
#
# return _QGISfilter


pluginType = MODULE
def moduleInformation():
import qgis.gui
return "qgis.gui", dir(qgis.gui)
try:
import qgis.gui
return "qgis.gui", dir(qgis.gui)
except ImportError:
return "", []

0 comments on commit acd574d

Please sign in to comment.