Skip to content
Browse files
[DBManager] fix add new SL/GPKG connection from "New connection" cont…
…ext menu entry
  • Loading branch information
brushtyler committed Sep 3, 2015
1 parent bef84dc commit 80a13e38526d7c7e6cc4869170818b66955e6517
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
@@ -270,7 +270,7 @@ def registerAction(self, action, menuName, callback=None):

return True

def invokeCallback(self, callback, params=None):
def invokeCallback(self, callback, *params):
""" Call a method passing the selected item in the database tree,
the sender (usually a QAction), the plugin mainWindow and
optionally additional parameters.
@@ -280,10 +280,7 @@ def invokeCallback(self, callback, params=None):
if params is None:
callback(self.tree.currentItem(), self.sender(), self)
callback(self.tree.currentItem(), self.sender(), self, *params)
callback(self.tree.currentItem(), self.sender(), self, *params)

except BaseError as e:
# catch database errors and display the error dialog
@@ -23,8 +23,9 @@
# this will disable the dbplugin if the connector raise an ImportError
from .connector import SpatiaLiteDBConnector

from PyQt4.QtCore import Qt, QSettings
from PyQt4.QtGui import QIcon, QApplication, QAction
from PyQt4.QtCore import Qt, SIGNAL, QSettings, QFileInfo
from PyQt4.QtGui import QIcon, QApplication, QAction, QFileDialog
from qgis.core import QgsDataSourceURI
from qgis.gui import QgsMessageBar

from ..plugin import DBPlugin, Database, Table, VectorTable, RasterTable, TableField, TableIndex, TableTrigger, \
@@ -75,9 +76,7 @@ def connect(self, parent=None):

database = settings.value("sqlitepath")

import qgis.core

uri = qgis.core.QgsDataSourceURI()
uri = QgsDataSourceURI()
return self.connectToUri(uri)

@@ -93,17 +92,17 @@ def addConnection(self, conn_name, uri):
def addConnectionActionSlot(self, item, action, parent, index):
filename = QFileDialog.getOpenFileName(self, "Choose Sqlite/Spatialite/Geopackage file")
filename = QFileDialog.getOpenFileName(parent, "Choose Sqlite/Spatialite/Geopackage file")
if not filename:

conn_name = QFileInfo(filepath).fileName()
uri = qgis.core.QgsDataSourceURI()
conn_name = QFileInfo(filename).fileName()
uri = QgsDataSourceURI()
self.addConnection(conn_name, uri)
index.internalPointer().emit(SIGNAL('itemChanged'), index.internalPointer())

@@ -21,7 +21,7 @@

from PyQt4.QtCore import SIGNAL, SLOT, QSettings, Qt
from PyQt4.QtGui import QWidget, QTreeView, QMenu, QLabel, QFileDialog
from PyQt4.QtGui import QWidget, QTreeView, QMenu, QLabel

from qgis.core import QgsMapLayerRegistry, QgsMessageLog
from qgis.gui import QgsMessageBar, QgsMessageBarItem

0 comments on commit 80a13e3

Please sign in to comment.