Skip to content
Permalink
Browse files

[dbmanager] Fix inconsistent capitalization, HIG violations,

and unprofessional strings
  • Loading branch information
nyalldawson committed Feb 13, 2018
1 parent c08e4c5 commit 6b4e734d9545263ae519f57338e607a59c4382b9
@@ -430,7 +430,7 @@ def setupUi(self):

self.actionRefresh = self.menuDb.addAction(QIcon(":/db_manager/actions/refresh"), self.tr("&Refresh"),
self.refreshActionSlot, QKeySequence("F5"))
self.actionSqlWindow = self.menuDb.addAction(QIcon(":/db_manager/actions/sql_window"), self.tr("&SQL window"),
self.actionSqlWindow = self.menuDb.addAction(QIcon(":/db_manager/actions/sql_window"), self.tr("&SQL Window"),
self.runSqlWindow, QKeySequence("F2"))
self.menuDb.addSeparator()
self.actionClose = self.menuDb.addAction(QIcon(), self.tr("&Exit"), self.close, QKeySequence("CTRL+Q"))
@@ -448,8 +448,8 @@ def setupUi(self):
sep.setVisible(False)

self.actionImport = self.menuTable.addAction(QIcon(":/db_manager/actions/import"),
self.tr("&Import layer/file"), self.importActionSlot)
self.actionExport = self.menuTable.addAction(QIcon(":/db_manager/actions/export"), self.tr("&Export to file"),
self.tr("&Import Layer/file"), self.importActionSlot)
self.actionExport = self.menuTable.addAction(QIcon(":/db_manager/actions/export"), self.tr("&Export to File…"),
self.exportActionSlot)
self.menuTable.addSeparator()
#self.actionShowSystemTables = self.menuTable.addAction(self.tr("Show system tables/views"), self.showSystemTables)
@@ -52,7 +52,7 @@ def initGui(self):
else:
self.iface.addPluginToMenu(QApplication.translate("DBManagerPlugin", "DB Manager"), self.action)

self.layerAction = QAction(QgsApplication.getThemeIcon('dbmanager.svg'), QApplication.translate("DBManagerPlugin", "Update Sql Layer"),
self.layerAction = QAction(QgsApplication.getThemeIcon('dbmanager.svg'), QApplication.translate("DBManagerPlugin", "Update Sql Layer"),
self.iface.mainWindow())
self.layerAction.setObjectName("dbManagerUpdateSqlLayer")
self.layerAction.triggered.connect(self.onUpdateSqlLayer)
@@ -225,36 +225,36 @@ def registerDatabaseActions(self, mainWindow):

if self.schemas():
action = QAction(QApplication.translate(
"DBManagerPlugin", "&Create schema"), self)
"DBManagerPlugin", "&Create Schema…"), self)
mainWindow.registerAction(action, QApplication.translate(
"DBManagerPlugin", "&Schema"), self.createSchemaActionSlot)
action = QAction(QApplication.translate(
"DBManagerPlugin", "&Delete (empty) schema"), self)
"DBManagerPlugin", "&Delete (Empty) Schema…"), self)
mainWindow.registerAction(action, QApplication.translate(
"DBManagerPlugin", "&Schema"), self.deleteSchemaActionSlot)

action = QAction(QApplication.translate(
"DBManagerPlugin", "Delete selected item"), self)
"DBManagerPlugin", "Delete Selected Item"), self)
mainWindow.registerAction(action, None, self.deleteActionSlot)
action.setShortcuts(QKeySequence.Delete)

action = QAction(QIcon(":/db_manager/actions/create_table"),
QApplication.translate(
"DBManagerPlugin", "&Create table"), self)
"DBManagerPlugin", "&Create Table…"), self)
mainWindow.registerAction(action, QApplication.translate(
"DBManagerPlugin", "&Table"), self.createTableActionSlot)
action = QAction(QIcon(":/db_manager/actions/edit_table"),
QApplication.translate(
"DBManagerPlugin", "&Edit table"), self)
"DBManagerPlugin", "&Edit Eable…"), self)
mainWindow.registerAction(action, QApplication.translate(
"DBManagerPlugin", "&Table"), self.editTableActionSlot)
action = QAction(QIcon(":/db_manager/actions/del_table"),
QApplication.translate(
"DBManagerPlugin", "&Delete table/view"), self)
"DBManagerPlugin", "&Delete Table/View…"), self)
mainWindow.registerAction(action, QApplication.translate(
"DBManagerPlugin", "&Table"), self.deleteTableActionSlot)
action = QAction(QApplication.translate(
"DBManagerPlugin", "&Empty table"), self)
"DBManagerPlugin", "&Empty Table…"), self)
mainWindow.registerAction(action, QApplication.translate(
"DBManagerPlugin", "&Table"), self.emptyTableActionSlot)

@@ -175,7 +175,7 @@ def addConnectionActionSlot(self, item, action, parent):
def removeActionSlot(self, item, action, parent):
QApplication.restoreOverrideCursor()
try:
res = QMessageBox.question(parent, QApplication.translate("DBManagerPlugin", "hey!"),
res = QMessageBox.question(parent, QApplication.translate("DBManagerPlugin", "DB Manager"),
QApplication.translate("DBManagerPlugin",
"Really remove connection to {0}?").format(item.connectionName()),
QMessageBox.Yes | QMessageBox.No)
@@ -308,34 +308,34 @@ def registerDatabaseActions(self, mainWindow):
self.reconnectActionSlot)

if self.schemas() is not None:
action = QAction(QApplication.translate("DBManagerPlugin", "&Create schema"), self)
action = QAction(QApplication.translate("DBManagerPlugin", "&Create Schema…"), self)
mainWindow.registerAction(action, QApplication.translate("DBManagerPlugin", "&Schema"),
self.createSchemaActionSlot)
action = QAction(QApplication.translate("DBManagerPlugin", "&Delete (empty) schema"), self)
action = QAction(QApplication.translate("DBManagerPlugin", "&Delete (Empty) Schema"), self)
mainWindow.registerAction(action, QApplication.translate("DBManagerPlugin", "&Schema"),
self.deleteSchemaActionSlot)

action = QAction(QApplication.translate("DBManagerPlugin", "Delete selected item"), self)
action = QAction(QApplication.translate("DBManagerPlugin", "Delete Selected Item"), self)
mainWindow.registerAction(action, None, self.deleteActionSlot)
action.setShortcuts(QKeySequence.Delete)

action = QAction(QIcon(":/db_manager/actions/create_table"),
QApplication.translate("DBManagerPlugin", "&Create table"), self)
QApplication.translate("DBManagerPlugin", "&Create Table…"), self)
mainWindow.registerAction(action, QApplication.translate("DBManagerPlugin", "&Table"),
self.createTableActionSlot)
action = QAction(QIcon(":/db_manager/actions/edit_table"),
QApplication.translate("DBManagerPlugin", "&Edit table"), self)
QApplication.translate("DBManagerPlugin", "&Edit Table…"), self)
mainWindow.registerAction(action, QApplication.translate("DBManagerPlugin", "&Table"), self.editTableActionSlot)
action = QAction(QIcon(":/db_manager/actions/del_table"),
QApplication.translate("DBManagerPlugin", "&Delete table/view"), self)
QApplication.translate("DBManagerPlugin", "&Delete Table/view"), self)
mainWindow.registerAction(action, QApplication.translate("DBManagerPlugin", "&Table"),
self.deleteTableActionSlot)
action = QAction(QApplication.translate("DBManagerPlugin", "&Empty table"), self)
action = QAction(QApplication.translate("DBManagerPlugin", "&Empty Table…"), self)
mainWindow.registerAction(action, QApplication.translate("DBManagerPlugin", "&Table"),
self.emptyTableActionSlot)

if self.schemas() is not None:
action = QAction(QApplication.translate("DBManagerPlugin", "&Move to schema"), self)
action = QAction(QApplication.translate("DBManagerPlugin", "&Move to Schema"), self)
action.setMenu(QMenu(mainWindow))

def invoke_callback():
@@ -385,7 +385,7 @@ def deleteSchemaActionSlot(self, item, action, parent):
QApplication.translate("DBManagerPlugin", "Select an empty schema for deletion."),
Qgis.Info, parent.iface.messageTimeout())
return
res = QMessageBox.question(parent, QApplication.translate("DBManagerPlugin", "hey!"),
res = QMessageBox.question(parent, QApplication.translate("DBManagerPlugin", "DB Manager"),
QApplication.translate("DBManagerPlugin",
"Really delete schema {0}?").format(item.name),
QMessageBox.Yes | QMessageBox.No)
@@ -442,7 +442,7 @@ def deleteTableActionSlot(self, item, action, parent):
QApplication.translate("DBManagerPlugin", "Select a table/view for deletion."),
Qgis.Info, parent.iface.messageTimeout())
return
res = QMessageBox.question(parent, QApplication.translate("DBManagerPlugin", "hey!"),
res = QMessageBox.question(parent, QApplication.translate("DBManagerPlugin", "DB Manager"),
QApplication.translate("DBManagerPlugin",
"Really delete table/view {0}?").format(item.name),
QMessageBox.Yes | QMessageBox.No)
@@ -460,7 +460,7 @@ def emptyTableActionSlot(self, item, action, parent):
parent.infoBar.pushMessage(QApplication.translate("DBManagerPlugin", "Select a table to empty it."),
Qgis.Info, parent.iface.messageTimeout())
return
res = QMessageBox.question(parent, QApplication.translate("DBManagerPlugin", "hey!"),
res = QMessageBox.question(parent, QApplication.translate("DBManagerPlugin", "DB Manager"),
QApplication.translate("DBManagerPlugin",
"Really delete all items from table {0}?").format(item.name),
QMessageBox.Yes | QMessageBox.No)
@@ -31,7 +31,7 @@

def load(db, mainwindow):
# add the action to the DBManager menu
action = QAction(QIcon(), QApplication.translate("DBManagerPlugin", "&Change logging"), db)
action = QAction(QIcon(), QApplication.translate("DBManagerPlugin", "&Change Logging…"), db)
mainwindow.registerAction(action, QApplication.translate("DBManagerPlugin", "&Table"), run)


@@ -276,5 +276,5 @@ def onOK(self):
finally:
QApplication.restoreOverrideCursor()

QMessageBox.information(self, "good!", "everything went fine!")
QMessageBox.information(self, "DB Manager", "Versioning was successfully created.")
self.accept()
@@ -125,20 +125,20 @@ def contextMenuEvent(self, ev):
menu = QMenu(self)

if isinstance(item, (Table, Schema)):
menu.addAction(self.tr("Rename"), self.rename)
menu.addAction(self.tr("Delete"), self.delete)
menu.addAction(self.tr("Rename"), self.rename)
menu.addAction(self.tr("Delete"), self.delete)

if isinstance(item, Table) and item.canBeAddedToCanvas():
menu.addSeparator()
menu.addAction(self.tr("Add to canvas"), self.addLayer)
menu.addAction(self.tr("Add to Canvas"), self.addLayer)

elif isinstance(item, DBPlugin):
if item.database() is not None:
menu.addAction(self.tr("Re-connect"), self.reconnect)
menu.addAction(self.tr("Remove"), self.delete)

elif not index.parent().isValid() and item.typeName() in ("spatialite", "gpkg"):
menu.addAction(self.tr("New Connection..."), self.newConnection)
menu.addAction(self.tr("New Connection"), self.newConnection)

if not menu.isEmpty():
menu.exec_(ev.globalPos())
@@ -47,7 +47,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("DB Manager"), 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()
@@ -57,7 +57,7 @@ def columnChanged(self):
def createIndex(self):
idx = self.getIndex()
if idx.name == "":
QMessageBox.critical(self, self.tr("Error"), self.tr("Please enter some name for the index"))
QMessageBox.critical(self, self.tr("Error"), self.tr("Please enter a name for the index."))
return

# now create the index
@@ -212,7 +212,7 @@ def deleteField(self):
""" delete selected field """
row = self.selectedField()
if row is None:
QMessageBox.information(self, self.tr("DB Manager"), self.tr("no field selected"))
QMessageBox.information(self, self.tr("DB Manager"), self.tr("No field selected."))
else:
self.fields.model().removeRows(row, 1)

@@ -222,10 +222,10 @@ def fieldUp(self):
""" move selected field up """
row = self.selectedField()
if row is None:
QMessageBox.information(self, self.tr("DB Manager"), 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("DB Manager"), self.tr("field is at top already"))
QMessageBox.information(self, self.tr("DB Manager"), self.tr("Field is already at the top."))
return

# take row and reinsert it
@@ -242,10 +242,10 @@ def fieldDown(self):
""" move selected field down """
row = self.selectedField()
if row is None:
QMessageBox.information(self, self.tr("DB Manager"), 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("DB Manager"), self.tr("field is at bottom already"))
QMessageBox.information(self, self.tr("DB Manager"), self.tr("Field is already at the bottom."))
return

# take row and reinsert it
@@ -265,24 +265,24 @@ def createTable(self):
else:
schema = str(self.cboSchema.currentText())
if len(schema) == 0:
QMessageBox.information(self, self.tr("DB Manager"), self.tr("select schema!"))
QMessageBox.information(self, self.tr("DB Manager"), self.tr("A valid schema must be selected first."))
return

table = str(self.editName.text())
if len(table) == 0:
QMessageBox.information(self, self.tr("DB Manager"), self.tr("enter table name!"))
QMessageBox.information(self, self.tr("DB Manager"), self.tr("A valid table name is required."))
return

m = self.fields.model()
if m.rowCount() == 0:
QMessageBox.information(self, self.tr("DB Manager"), self.tr("add some fields!"))
QMessageBox.information(self, self.tr("DB Manager"), self.tr("At least one field is required."))
return

useGeomColumn = self.chkGeomColumn.isChecked()
if useGeomColumn:
geomColumn = str(self.editGeomColumn.text())
if len(geomColumn) == 0:
QMessageBox.information(self, self.tr("DB Manager"), self.tr("set geometry column name"))
QMessageBox.information(self, self.tr("DB Manager"), self.tr("A name is required for the geometry column."))
return

geomType = self.GEOM_TYPES[self.cboGeomType.currentIndex()]
@@ -311,4 +311,4 @@ def createTable(self):
DlgDbError.showError(e, self)
return

QMessageBox.information(self, self.tr("Good"), self.tr("everything went fine"))
QMessageBox.information(self, self.tr("DB Manager"), self.tr("Table created successfully."))
@@ -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("DB Manager"), 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("DB Manager"), 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()
@@ -107,7 +107,7 @@ def currentColumn(self):
sel = self.viewFields.selectionModel()
indexes = sel.selectedRows()
if len(indexes) == 0:
QMessageBox.information(self, self.tr("DB Manager"), self.tr("nothing selected"))
QMessageBox.information(self, self.tr("DB Manager"), self.tr("No columns were selected."))
return -1
return indexes[0].row()

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

@@ -296,7 +296,7 @@ def currentIndex(self):
sel = self.viewIndexes.selectionModel()
indexes = sel.selectedRows()
if len(indexes) == 0:
QMessageBox.information(self, self.tr("DB Manager"), self.tr("Nothing selected"))
QMessageBox.information(self, self.tr("DB Manager"), self.tr("No indices were selected."))
return -1
return indexes[0].row()

@@ -281,7 +281,7 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()

if ( layer && layer->type() == QgsMapLayer::VectorLayer && static_cast<QgsVectorLayer *>( layer )->providerType() == QLatin1String( "virtual" ) )
{
menu->addAction( tr( "Edit virtual layer settings" ), QgisApp::instance(), SLOT( addVirtualLayer() ) );
menu->addAction( tr( "Edit Virtual Layer…" ), QgisApp::instance(), SLOT( addVirtualLayer() ) );
}
}

0 comments on commit 6b4e734

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