Skip to content
Permalink
Browse files

dbManager - remove more 'Sorry' strings

  • Loading branch information
nyalldawson committed Sep 25, 2014
1 parent cb414f5 commit a9c4136aa97255041949303f5796b9602718425a
@@ -46,7 +46,7 @@ def __init__(self, parent=None, table=None, db=None):
def createGeomColumn(self):
""" first check whether everything's fine """
if self.editName.text() == "":
QMessageBox.critical(self, self.tr("Sorry"), self.tr("field name must not be empty"))
QMessageBox.critical(self, self.tr("DB Manager"), self.tr("field name must not be empty"))
return

name = self.editName.text()
@@ -206,7 +206,7 @@ def deleteField(self):
""" delete selected field """
row = self.selectedField()
if row is None:
QMessageBox.information(self, self.tr("Sorry"), self.tr("no field selected"))
QMessageBox.information(self, self.tr("DB Manager"), self.tr("no field selected"))
else:
self.fields.model().removeRows(row,1)

@@ -216,10 +216,10 @@ def fieldUp(self):
""" move selected field up """
row = self.selectedField()
if row is None:
QMessageBox.information(self, self.tr("Sorry"), self.tr("no field selected"))
QMessageBox.information(self, self.tr("DB Manager"), self.tr("no field selected"))
return
if row == 0:
QMessageBox.information(self, self.tr("Sorry"), self.tr("field is at top already"))
QMessageBox.information(self, self.tr("DB Manager"), self.tr("field is at top already"))
return

# take row and reinsert it
@@ -236,10 +236,10 @@ def fieldDown(self):
""" move selected field down """
row = self.selectedField()
if row is None:
QMessageBox.information(self, self.tr("Sorry"), self.tr("No field selected"))
QMessageBox.information(self, self.tr("DB Manager"), self.tr("No field selected"))
return
if row == self.fields.model().rowCount()-1:
QMessageBox.information(self, self.tr("Sorry"), self.tr("field is at bottom already"))
QMessageBox.information(self, self.tr("DB Manager"), self.tr("field is at bottom already"))
return

# take row and reinsert it
@@ -259,24 +259,24 @@ def createTable(self):
else:
schema = unicode(self.cboSchema.currentText())
if len(schema) == 0:
QMessageBox.information(self, self.tr("Sorry"), self.tr("select schema!"))
QMessageBox.information(self, self.tr("DB Manager"), self.tr("select schema!"))
return

table = unicode(self.editName.text())
if len(table) == 0:
QMessageBox.information(self, self.tr("Sorry"), self.tr("enter table name!"))
QMessageBox.information(self, self.tr("DB Manager"), self.tr("enter table name!"))
return

m = self.fields.model()
if m.rowCount() == 0:
QMessageBox.information(self, self.tr("Sorry"), self.tr("add some fields!"))
QMessageBox.information(self, self.tr("DB Manager"), self.tr("add some fields!"))
return

useGeomColumn = self.chkGeomColumn.isChecked()
if useGeomColumn:
geomColumn = unicode(self.editGeomColumn.text())
if len(geomColumn) == 0:
QMessageBox.information(self, self.tr("Sorry"), self.tr("set geometry column name"))
QMessageBox.information(self, self.tr("DB Manager"), self.tr("set geometry column name"))
return

geomType = self.GEOM_TYPES[ self.cboGeomType.currentIndex() ]
@@ -77,10 +77,10 @@ def onOK(self):
""" first check whether everything's fine """
fld = self.getField(True) # don't change the original copy
if fld.name == "":
QMessageBox.critical(self, self.tr("Sorry"), self.tr("field name must not be empty"))
QMessageBox.critical(self, self.tr("DB Manager"), self.tr("field name must not be empty"))
return
if fld.dataType == "":
QMessageBox.critical(self, self.tr("Sorry"), self.tr("field type must not be empty"))
QMessageBox.critical(self, self.tr("DB Manager"), self.tr("field type must not be empty"))
return

self.accept()
@@ -167,16 +167,16 @@ def loadSqlLayer(self):
geomFieldName = self.geomCombo.currentText()

if geomFieldName == "" or uniqueFieldName == "":
QMessageBox.warning(self, self.tr( "Sorry" ), self.tr( "You must fill the required fields: \ngeometry column - column with unique integer values" ) )
QMessageBox.warning(self, self.tr( "DB Manager" ), self.tr( "You must fill the required fields: \ngeometry column - column with unique integer values" ) )
return

query = self.editSql.text()
if query == "":
return

# remove a trailing ';' from query if present
if query.strip().endswith(';'):
query = query.strip()[:-1]
query = query.strip()[:-1]

QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))

@@ -220,11 +220,11 @@ def fillColumnCombos(self):
if not escaped.search(query):
break
aliasIndex += 1

# remove a trailing ';' from query if present
if query.strip().endswith(';'):
query = query.strip()[:-1]

# get all the columns
cols = []
connector = self.db.connector
@@ -244,7 +244,7 @@ def fillColumnCombos(self):
if c:
c.close()
del c

# get sensible default columns. do this before sorting in case there's hints in the column order (eg, id is more likely to be first)
try:
defaultGeomCol = next(col for col in cols if col in ['geom','geometry','the_geom'])
@@ -261,14 +261,14 @@ def fillColumnCombos(self):

# set sensible default columns
try:
self.geomCombo.setCurrentIndex( cols.index(defaultGeomCol) )
self.geomCombo.setCurrentIndex( cols.index(defaultGeomCol) )
except:
pass
try:
self.uniqueCombo.setCurrentIndex( cols.index(defaultUniqueCol) )
self.uniqueCombo.setCurrentIndex( cols.index(defaultUniqueCol) )
except:
pass

QApplication.restoreOverrideCursor()

def copySelectedResults(self):
@@ -102,7 +102,7 @@ def currentColumn(self):
sel = self.viewFields.selectionModel()
indexes = sel.selectedRows()
if len(indexes) == 0:
QMessageBox.information(self, self.tr("Sorry"), self.tr("nothing selected"))
QMessageBox.information(self, self.tr("DB Manager"), self.tr("nothing selected"))
return -1
return indexes[0].row()

@@ -242,7 +242,7 @@ def currentConstraint(self):
sel = self.viewConstraints.selectionModel()
indexes = sel.selectedRows()
if len(indexes) == 0:
QMessageBox.information(self, self.tr("Sorry"), self.tr("nothing selected"))
QMessageBox.information(self, self.tr("DB Manager"), self.tr("nothing selected"))
return -1
return indexes[0].row()

@@ -277,7 +277,7 @@ def createIndex(self):
def createSpatialIndex(self):
""" create spatial index for the geometry column """
if self.table.type != self.table.VectorType:
QMessageBox.information(self, self.tr("Sorry"), self.tr("The selected table has no geometry"))
QMessageBox.information(self, self.tr("DB Manager"), self.tr("The selected table has no geometry"))
return

res = QMessageBox.question(self, self.tr("Create?"), self.tr("Create spatial index for field %s?") % self.table.geomColumn, QMessageBox.Yes | QMessageBox.No)
@@ -302,7 +302,7 @@ def currentIndex(self):
sel = self.viewIndexes.selectionModel()
indexes = sel.selectedRows()
if len(indexes) == 0:
QMessageBox.information(self, self.tr("Sorry"), self.tr("Nothing selected"))
QMessageBox.information(self, self.tr("DB Manager"), self.tr("Nothing selected"))
return -1
return indexes[0].row()

0 comments on commit a9c4136

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