Skip to content
Permalink
Browse files

[dbmanager] followp 1646f67: fixes some string and changes more messa…

…geboxes
  • Loading branch information
slarosa authored and nyalldawson committed Sep 25, 2014
1 parent 5fc78bf commit a778e265a71c2b9e49a02ddaaafd7268156f00bc
@@ -148,7 +148,7 @@ def refreshActionSlot(self):
def importActionSlot(self):
db = self.tree.currentDatabase()
if db is None:
self.infoBar.pushMessage(self.tr("Sorry"), self.tr("No database selected or you are not connected to it."), QgsMessageBar.INFO, self.iface.messageTimeout())
self.infoBar.pushMessage(self.tr("No database selected or you are not connected to it."), QgsMessageBar.INFO, self.iface.messageTimeout())
return

outUri = db.uri()
@@ -163,7 +163,7 @@ def importActionSlot(self):
def exportActionSlot(self):
table = self.tree.currentTable()
if table is None:
self.infoBar.pushMessage(self.tr("Sorry"), self.tr("Select the table you want export to file."), QgsMessageBar.INFO, self.iface.messageTimeout())
self.infoBar.pushMessage(self.tr("Select the table you want export to file."), QgsMessageBar.INFO, self.iface.messageTimeout())
return

inLayer = table.toMapLayer()
@@ -270,8 +270,7 @@ def deleteActionSlot(self, item, action, parent):
self.deleteTableActionSlot(item, action, parent)
else:
QApplication.restoreOverrideCursor()
parent.infoBar.pushMessage(QApplication.translate("DBManagerPlugin", "Sorry"),
QApplication.translate("DBManagerPlugin", "Cannot delete the selected item."),
parent.infoBar.pushMessage(QApplication.translate("DBManagerPlugin", "Cannot delete the selected item."),
QgsMessageBar.INFO, parent.iface.messageTimeout())
QApplication.setOverrideCursor(Qt.WaitCursor)

@@ -280,8 +279,7 @@ def createSchemaActionSlot(self, item, action, parent):
QApplication.restoreOverrideCursor()
try:
if not isinstance(item, (DBPlugin, Schema, Table)) or item.database() == None:
parent.infoBar.pushMessage(QApplication.translate("DBManagerPlugin", "Sorry"),
QApplication.translate("DBManagerPlugin", "No database selected or you are not connected to it."),
parent.infoBar.pushMessage(QApplication.translate("DBManagerPlugin", "No database selected or you are not connected to it."),
QgsMessageBar.INFO, parent.iface.messageTimeout())
return
(schema, ok) = QInputDialog.getText(parent, QApplication.translate("DBManagerPlugin", "New schema"), QApplication.translate("DBManagerPlugin", "Enter new schema name"))
@@ -296,8 +294,7 @@ def deleteSchemaActionSlot(self, item, action, parent):
QApplication.restoreOverrideCursor()
try:
if not isinstance(item, Schema):
parent.infoBar.pushMessage(QApplication.translate("DBManagerPlugin", "Sorry"),
QApplication.translate("DBManagerPlugin", "Select an empty SCHEMA for deletion."),
parent.infoBar.pushMessage(QApplication.translate("DBManagerPlugin", "Select an empty schema for deletion."),
QgsMessageBar.INFO, parent.iface.messageTimeout())
return
res = QMessageBox.question(parent, QApplication.translate("DBManagerPlugin", "hey!"), QApplication.translate("DBManagerPlugin", "Really delete schema %s?") % item.name, QMessageBox.Yes | QMessageBox.No)
@@ -325,8 +322,7 @@ def createSchema(self, name):
def createTableActionSlot(self, item, action, parent):
QApplication.restoreOverrideCursor()
if not hasattr(item, 'database') or item.database() == None:
parent.infoBar.pushMessage(QApplication.translate("DBManagerPlugin", "Sorry"),
QApplication.translate("DBManagerPlugin", "No database selected or you are not connected to it."),
parent.infoBar.pushMessage(QApplication.translate("DBManagerPlugin", "No database selected or you are not connected to it."),
QgsMessageBar.INFO, parent.iface.messageTimeout())
return
from ..dlg_create_table import DlgCreateTable
@@ -337,8 +333,7 @@ def editTableActionSlot(self, item, action, parent):
QApplication.restoreOverrideCursor()
try:
if not isinstance(item, Table) or item.isView:
parent.infoBar.pushMessage(QApplication.translate("DBManagerPlugin", "Sorry"),
QApplication.translate("DBManagerPlugin", "Select a TABLE for editation."),
parent.infoBar.pushMessage(QApplication.translate("DBManagerPlugin", "Select a table for editation."),
QgsMessageBar.INFO, parent.iface.messageTimeout())
return
from ..dlg_table_properties import DlgTableProperties
@@ -350,8 +345,7 @@ def deleteTableActionSlot(self, item, action, parent):
QApplication.restoreOverrideCursor()
try:
if not isinstance(item, Table):
parent.infoBar.pushMessage(QApplication.translate("DBManagerPlugin", "Sorry"),
QApplication.translate("DBManagerPlugin", "Select a TABLE/VIEW for deletion."),
parent.infoBar.pushMessage(QApplication.translate("DBManagerPlugin", "Select a table/view for deletion."),
QgsMessageBar.INFO, parent.iface.messageTimeout())
return
res = QMessageBox.question(parent, QApplication.translate("DBManagerPlugin", "hey!"), QApplication.translate("DBManagerPlugin", "Really delete table/view %s?") % item.name, QMessageBox.Yes | QMessageBox.No)
@@ -366,8 +360,7 @@ def emptyTableActionSlot(self, item, action, parent):
QApplication.restoreOverrideCursor()
try:
if not isinstance(item, Table) or item.isView:
parent.infoBar.pushMessage(QApplication.translate("DBManagerPlugin", "Sorry"),
QApplication.translate("DBManagerPlugin", "Select a TABLE to empty it."),
parent.infoBar.pushMessage(QApplication.translate("DBManagerPlugin", "Select a table to empty it."),
QgsMessageBar.INFO, parent.iface.messageTimeout())
return
res = QMessageBox.question(parent, QApplication.translate("DBManagerPlugin", "hey!"), QApplication.translate("DBManagerPlugin", "Really delete all items from table %s?") % item.name, QMessageBox.Yes | QMessageBox.No)
@@ -390,8 +383,7 @@ def moveTableToSchemaActionSlot(self, item, action, parent, new_schema):
QApplication.restoreOverrideCursor()
try:
if not isinstance(item, Table):
parent.infoBar.pushMessage(QApplication.translate("DBManagerPlugin", "Sorry"),
QApplication.translate("DBManagerPlugin", "Select a TABLE/VIEW."),
parent.infoBar.pushMessage(QApplication.translate("DBManagerPlugin", "Select a table/view."),
QgsMessageBar.INFO, parent.iface.messageTimeout())
return
finally:
@@ -25,6 +25,7 @@

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.gui import QgsMessageBar

from ..plugin import ConnectionError, InvalidDataException, DBPlugin, Database, Schema, Table, VectorTable, RasterTable, TableField, TableConstraint, TableIndex, TableTrigger, TableRule

@@ -168,7 +169,7 @@ def runVacuumAnalyzeActionSlot(self, item, action, parent):
QApplication.restoreOverrideCursor()
try:
if not isinstance(item, Table) or item.isView:
QMessageBox.information(parent, self.tr("Sorry"), self.tr("Select a TABLE for vacuum analyze."))
parent.infoBar().pushMessage(self.tr("Select a table for vacuum analyze."), QgsMessageBar.INFO, parent.iface.messageTimeout())
return
finally:
QApplication.setOverrideCursor(Qt.WaitCursor)
@@ -24,6 +24,7 @@
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
from qgis.gui import QgsMessageBar

import os
current_path = os.path.dirname(__file__)
@@ -68,19 +69,19 @@ def run(item, action, mainwindow):
isTopoSchema = False

if not hasattr(item, 'schema'):
QMessageBox.critical(mainwindow, "Invalid topology", u'Select a topology schema to continue.')
return False
mainwindow.infoBar.pushMessage("Invalid topology", u'Select a topology schema to continue.', QgsMessageBar.INFO, mainwindow.iface.messageTimeout())
return False

if item.schema() != None:
sql = u"SELECT srid FROM topology.topology WHERE name = %s" % quoteStr(item.schema().name)
c = db.connector._get_cursor()
db.connector._execute( c, sql )
res = db.connector._fetchone( c )
isTopoSchema = res != None
sql = u"SELECT srid FROM topology.topology WHERE name = %s" % quoteStr(item.schema().name)
c = db.connector._get_cursor()
db.connector._execute( c, sql )
res = db.connector._fetchone( c )
isTopoSchema = res != None

if not isTopoSchema:
QMessageBox.critical(mainwindow, "Invalid topology", u'Schema "%s" is not registered in topology.topology.' % item.schema().name)
return False
mainwindow.infoBar.pushMessage("Invalid topology", u'Schema "{0}" is not registered in topology.topology.'.format(item.schema().name), QgsMessageBar.WARNING, mainwindow.iface.messageTimeout())
return False

toposrid = str(res[0])

@@ -116,7 +116,7 @@ def runVacuumActionSlot(self, item, action, parent):
QApplication.restoreOverrideCursor()
try:
if not isinstance(item, (DBPlugin, Table)) or item.database() == None:
QMessageBox.information(parent, self.tr("Sorry"), self.tr("No database selected or you are not connected to it."))
parent.infoBar.pushMessage(self.tr("No database selected or you are not connected to it."), QgsMessageBar.INFO, parent.iface.messageTimeout())
return
finally:
QApplication.setOverrideCursor(Qt.WaitCursor)

0 comments on commit a778e26

Please sign in to comment.
You can’t perform that action at this time.