Skip to content

Commit

Permalink
[FEATURE] [DBManager] Add a GeoPackage dedicated plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Oct 25, 2016
1 parent 3113fc6 commit 390588b
Show file tree
Hide file tree
Showing 15 changed files with 1,288 additions and 3 deletions.
11 changes: 11 additions & 0 deletions python/plugins/CMakeLists.txt
Expand Up @@ -68,6 +68,17 @@ MACRO (PLUGIN_INSTALL plugin subdir )
ENDFOREACH(file)
ENDMACRO (PLUGIN_INSTALL)

ADD_CUSTOM_TARGET(staged-plugins-copy-init-py ALL DEPENDS staged-plugins)

# Dummy file to stage to output/python/plugins for testing purposes
ADD_CUSTOM_COMMAND(TARGET staged-plugins-copy-init-py
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory "${PYTHON_OUTPUT_DIRECTORY}/plugins"
COMMAND ${CMAKE_COMMAND} -E copy __init__.py "${PYTHON_OUTPUT_DIRECTORY}/plugins"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS __init__.py
)

ADD_SUBDIRECTORY(GdalTools)
ADD_SUBDIRECTORY(db_manager)
ADD_SUBDIRECTORY(processing)
Expand Down
3 changes: 2 additions & 1 deletion python/plugins/db_manager/db_model.py
Expand Up @@ -298,6 +298,7 @@ def __init__(self, parent=None):
self.importVector.connect(self.vectorImport)

self.hasSpatialiteSupport = "spatialite" in supportedDbTypes()
self.hasGPKGSupport = "gpkg" in supportedDbTypes()

self.rootItem = TreeItem(None, None)
for dbtype in supportedDbTypes():
Expand Down Expand Up @@ -399,7 +400,7 @@ def flags(self, index):
flags |= Qt.ItemIsDropEnabled

# SL/Geopackage db files can be dropped everywhere in the tree
if self.hasSpatialiteSupport:
if self.hasSpatialiteSupport or self.hasGPKGSupport:
flags |= Qt.ItemIsDropEnabled

return flags
Expand Down
1 change: 1 addition & 0 deletions python/plugins/db_manager/db_plugins/CMakeLists.txt
@@ -1,5 +1,6 @@
ADD_SUBDIRECTORY(postgis)
ADD_SUBDIRECTORY(spatialite)
ADD_SUBDIRECTORY(gpkg)
IF(WITH_ORACLE)
ADD_SUBDIRECTORY(oracle)
ENDIF(WITH_ORACLE)
Expand Down
3 changes: 2 additions & 1 deletion python/plugins/db_manager/db_plugins/__init__.py
Expand Up @@ -24,7 +24,8 @@
class NotSupportedDbType(Exception):

def __init__(self, dbtype):
self.msg = self.tr("%s is not supported yet") % dbtype
from qgis.PyQt.QtWidgets import QApplication
self.msg = QApplication.translate("DBManagerPlugin", "%s is not supported yet" % dbtype)
Exception(self, self.msg)

def __str__(self):
Expand Down
9 changes: 9 additions & 0 deletions python/plugins/db_manager/db_plugins/gpkg/CMakeLists.txt
@@ -0,0 +1,9 @@

FILE(GLOB PY_FILES *.py)
FILE(GLOB ICON_FILES icons/*.png)

PYQT_ADD_RESOURCES(PYRC_FILES resources.qrc)

PLUGIN_INSTALL(db_manager db_plugins/gpkg ${PY_FILES} ${PYRC_FILES})
PLUGIN_INSTALL(db_manager db_plugins/gpkg/icons ${ICON_FILES})

Empty file.

0 comments on commit 390588b

Please sign in to comment.