|
23 | 23 | from PyQt4.QtCore import * |
24 | 24 | from PyQt4.QtGui import * |
25 | 25 |
|
26 | | -from qgis.gui import QgsMapCanvas, QgsMapCanvasLayer |
| 26 | +from qgis.gui import QgsMapCanvas, QgsMapCanvasLayer, QgsMessageBar |
27 | 27 | from qgis.core import QgsVectorLayer, QgsMapLayerRegistry |
28 | 28 |
|
29 | 29 | from .db_plugins.plugin import DbError, Table |
30 | 30 |
|
31 | 31 | class LayerPreview(QgsMapCanvas): |
32 | 32 | def __init__(self, parent=None): |
33 | 33 | QgsMapCanvas.__init__(self, parent) |
| 34 | + self.parent = parent |
34 | 35 | self.setCanvasColor(QColor(255,255,255)) |
35 | 36 |
|
36 | 37 | self.item = None |
@@ -95,7 +96,9 @@ def _loadTablePreview(self, table, limit=False): |
95 | 96 | if limit and table.rowCount > 1000: |
96 | 97 | uniqueField = table.getValidQGisUniqueFields(True) |
97 | 98 | 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()) |
99 | 102 | return |
100 | 103 |
|
101 | 104 | uri = table.database().uri() |
|
0 commit comments