3
3
"""
4
4
/***************************************************************************
5
5
Name : DB Manager
6
- Description : Database manager plugin for QuantumGIS
6
+ Description : Database manager plugin for QGIS
7
7
Date : May 23, 2011
8
8
copyright : (C) 2011 by Giuseppe Sucameli
9
9
email : brush.tyler@gmail.com
@@ -45,8 +45,8 @@ def __init__(self, iface, parent=None):
45
45
46
46
# restore the window state
47
47
settings = QSettings ()
48
- self .restoreGeometry ( settings .value ("/DB_Manager/mainWindow/geometry" ) )
49
- self .restoreState ( settings .value ("/DB_Manager/mainWindow/windowState" ) )
48
+ self .restoreGeometry ( settings .value ("/DB_Manager/mainWindow/geometry" , QByteArray (), type = QByteArray ) )
49
+ self .restoreState ( settings .value ("/DB_Manager/mainWindow/windowState" , QByteArray (), type = QByteArray ) )
50
50
51
51
self .connect (self .tabs , SIGNAL ("currentChanged(int)" ), self .tabChanged )
52
52
self .connect (self .tree , SIGNAL ("selectedItemChanged" ), self .itemChanged )
@@ -147,7 +147,7 @@ def refreshActionSlot(self):
147
147
def importActionSlot (self ):
148
148
db = self .tree .currentDatabase ()
149
149
if db is None :
150
- QMessageBox .information (self , "Sorry" , "No database selected or you are not connected to it." )
150
+ QMessageBox .information (self , self . tr ( "Sorry" ), self . tr ( "No database selected or you are not connected to it." ) )
151
151
return
152
152
153
153
outUri = db .uri ()
@@ -162,7 +162,7 @@ def importActionSlot(self):
162
162
def exportActionSlot (self ):
163
163
table = self .tree .currentTable ()
164
164
if table is None :
165
- QMessageBox .information (self , "Sorry" , "Select the table you want export to file." )
165
+ QMessageBox .information (self , self . tr ( "Sorry" ), self . tr ( "Select the table you want export to file." ) )
166
166
return
167
167
168
168
inLayer = table .toMapLayer ()
@@ -176,7 +176,7 @@ def exportActionSlot(self):
176
176
def runSqlWindow (self ):
177
177
db = self .tree .currentDatabase ()
178
178
if db == None :
179
- QMessageBox .information (self , "Sorry" , "No database selected or you are not connected to it." )
179
+ QMessageBox .information (self , self . tr ( "Sorry" ), self . tr ( "No database selected or you are not connected to it." ) )
180
180
return
181
181
182
182
from dlg_sql_window import DlgSqlWindow
@@ -333,18 +333,18 @@ def unregisterAllActions(self):
333
333
del self ._registeredDbActions
334
334
335
335
def setupUi (self ):
336
- self .setWindowTitle ("DB Manager" )
336
+ self .setWindowTitle (self . tr ( "DB Manager" ) )
337
337
self .setWindowIcon (QIcon (":/db_manager/icon" ))
338
338
self .resize (QSize (700 ,500 ).expandedTo (self .minimumSizeHint ()))
339
339
340
340
# create central tab widget
341
341
self .tabs = QTabWidget ()
342
342
self .info = InfoViewer (self )
343
- self .tabs .addTab (self .info , "Info" )
343
+ self .tabs .addTab (self .info , self . tr ( "Info" ) )
344
344
self .table = TableViewer (self )
345
- self .tabs .addTab (self .table , "Table" )
345
+ self .tabs .addTab (self .table , self . tr ( "Table" ) )
346
346
self .preview = LayerPreview (self )
347
- self .tabs .addTab (self .preview , "Preview" )
347
+ self .tabs .addTab (self .preview , self . tr ( "Preview" ) )
348
348
self .setCentralWidget (self .tabs )
349
349
350
350
# create database tree
@@ -361,13 +361,13 @@ def setupUi(self):
361
361
362
362
# create menus
363
363
self .menuBar = QMenuBar (self )
364
- self .menuDb = QMenu ("&Database" , self )
364
+ self .menuDb = QMenu (self . tr ( "&Database" ) , self )
365
365
actionMenuDb = self .menuBar .addMenu (self .menuDb )
366
- self .menuSchema = QMenu ("&Schema" , self )
366
+ self .menuSchema = QMenu (self . tr ( "&Schema" ) , self )
367
367
actionMenuSchema = self .menuBar .addMenu (self .menuSchema )
368
- self .menuTable = QMenu ("&Table" , self )
368
+ self .menuTable = QMenu (self . tr ( "&Table" ) , self )
369
369
actionMenuTable = self .menuBar .addMenu (self .menuTable )
370
- self .menuHelp = None # QMenu("&Help", self)
370
+ self .menuHelp = None # QMenu(self.tr( "&Help") , self)
371
371
#actionMenuHelp = self.menuBar.addMenu(self.menuHelp)
372
372
373
373
self .setMenuBar (self .menuBar )
@@ -382,21 +382,21 @@ def setupUi(self):
382
382
383
383
# menu DATABASE
384
384
sep = self .menuDb .addSeparator (); sep .setObjectName ("DB_Manager_DbMenu_placeholder" ); sep .setVisible (False )
385
- self .actionRefresh = self .menuDb .addAction ( QIcon (":/db_manager/actions/refresh" ), "&Refresh" , self .refreshActionSlot , QKeySequence ("F5" ) )
386
- self .actionSqlWindow = self .menuDb .addAction ( QIcon (":/db_manager/actions/sql_window" ), "&SQL window" , self .runSqlWindow , QKeySequence ("F2" ) )
385
+ self .actionRefresh = self .menuDb .addAction ( QIcon (":/db_manager/actions/refresh" ), self . tr ( "&Refresh" ) , self .refreshActionSlot , QKeySequence ("F5" ) )
386
+ self .actionSqlWindow = self .menuDb .addAction ( QIcon (":/db_manager/actions/sql_window" ), self . tr ( "&SQL window" ) , self .runSqlWindow , QKeySequence ("F2" ) )
387
387
self .menuDb .addSeparator ()
388
- self .actionClose = self .menuDb .addAction ( QIcon (), "&Exit" , self .close , QKeySequence ("CTRL+Q" ) )
388
+ self .actionClose = self .menuDb .addAction ( QIcon (), self . tr ( "&Exit" ) , self .close , QKeySequence ("CTRL+Q" ) )
389
389
390
390
# menu SCHEMA
391
391
sep = self .menuSchema .addSeparator (); sep .setObjectName ("DB_Manager_SchemaMenu_placeholder" ); sep .setVisible (False )
392
392
actionMenuSchema .setVisible (False )
393
393
394
394
# menu TABLE
395
395
sep = self .menuTable .addSeparator (); sep .setObjectName ("DB_Manager_TableMenu_placeholder" ); sep .setVisible (False )
396
- self .actionImport = self .menuTable .addAction ( QIcon (":/db_manager/actions/import" ), "&Import layer/file" , self .importActionSlot )
397
- self .actionExport = self .menuTable .addAction ( QIcon (":/db_manager/actions/export" ), "&Export to file" , self .exportActionSlot )
396
+ self .actionImport = self .menuTable .addAction ( QIcon (":/db_manager/actions/import" ), self . tr ( "&Import layer/file" ) , self .importActionSlot )
397
+ self .actionExport = self .menuTable .addAction ( QIcon (":/db_manager/actions/export" ), self . tr ( "&Export to file" ) , self .exportActionSlot )
398
398
self .menuTable .addSeparator ()
399
- #self.actionShowSystemTables = self.menuTable.addAction("Show system tables/views", self.showSystemTables)
399
+ #self.actionShowSystemTables = self.menuTable.addAction(self.tr( "Show system tables/views") , self.showSystemTables)
400
400
#self.actionShowSystemTables.setCheckable(True)
401
401
#self.actionShowSystemTables.setChecked(True)
402
402
actionMenuTable .setVisible (False )
@@ -406,4 +406,3 @@ def setupUi(self):
406
406
self .toolBar .addAction ( self .actionSqlWindow )
407
407
self .toolBar .addAction ( self .actionImport )
408
408
self .toolBar .addAction ( self .actionExport )
409
-
0 commit comments