Skip to content

Commit cb414f5

Browse files
slarosanyalldawson
authored andcommitted
[dbmanager] again replacement box->bar stuff....hopefully the last :-)
1 parent a778e26 commit cb414f5

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

python/plugins/db_manager/db_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def populate(self):
152152
return False
153153

154154
except BaseError, e:
155-
QMessageBox.warning( None, self.tr("Unable to connect"), unicode(e) )
155+
DlgDbError.showError(unicode(e), None)
156156
return False
157157

158158
database = connection.database()

python/plugins/db_manager/layer_preview.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@
2323
from PyQt4.QtCore import *
2424
from PyQt4.QtGui import *
2525

26-
from qgis.gui import QgsMapCanvas, QgsMapCanvasLayer
26+
from qgis.gui import QgsMapCanvas, QgsMapCanvasLayer, QgsMessageBar
2727
from qgis.core import QgsVectorLayer, QgsMapLayerRegistry
2828

2929
from .db_plugins.plugin import DbError, Table
3030

3131
class LayerPreview(QgsMapCanvas):
3232
def __init__(self, parent=None):
3333
QgsMapCanvas.__init__(self, parent)
34+
self.parent = parent
3435
self.setCanvasColor(QColor(255,255,255))
3536

3637
self.item = None
@@ -95,7 +96,9 @@ def _loadTablePreview(self, table, limit=False):
9596
if limit and table.rowCount > 1000:
9697
uniqueField = table.getValidQGisUniqueFields(True)
9798
if uniqueField == None:
98-
QMessageBox.warning(self, QApplication.translate("DBManagerPlugin", "Sorry"), QApplication.translate("DBManagerPlugin", "Unable to find a valid unique field"))
99+
self.parent.tabs.setCurrentWidget(self.parent.info)
100+
self.parent.infoBar.pushMessage(QApplication.translate("DBManagerPlugin", "Unable to find a valid unique field"),
101+
QgsMessageBar.WARNING, self.parent.iface.messageTimeout())
99102
return
100103

101104
uri = table.database().uri()

0 commit comments

Comments
 (0)