[QGIS Commit] r14675 - in trunk/qgis: python/plugins/GdalTools src/app

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sun Nov 14 19:13:59 EST 2010


Author: brushtyler
Date: 2010-11-14 16:13:59 -0800 (Sun, 14 Nov 2010)
New Revision: 14675

Modified:
   trunk/qgis/python/plugins/GdalTools/GdalTools.py
   trunk/qgis/src/app/qgisapp.cpp
   trunk/qgis/src/app/qgisapp.h
Log:
created the Raster menu and moved the "raster calculator" to it


Modified: trunk/qgis/python/plugins/GdalTools/GdalTools.py
===================================================================
--- trunk/qgis/python/plugins/GdalTools/GdalTools.py	2010-11-14 23:57:03 UTC (rev 14674)
+++ trunk/qgis/python/plugins/GdalTools/GdalTools.py	2010-11-15 00:13:59 UTC (rev 14675)
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 """
 /***************************************************************************
-Name			 	 : GdalTools
+Name                  : GdalTools
 Description          : Integrate gdal tools into qgis
 Date                 : 17/Sep/09
 copyright            : (C) 2009 by Lorenzo Masini (Faunalia)
@@ -81,9 +81,28 @@
     from tools.GdalTools_utils import Version, GdalConfig
     self.GdalVersion = Version( GdalConfig.version() )
 
-    self.menu = QMenu()
-    self.menu.setTitle( QCoreApplication.translate( "GdalTools", "&Raster" ) )
+    # find the Raster menu
+    rasterMenu = None
+    menu_bar = self.iface.mainWindow().menuBar()
+    actions = menu_bar.actions()
 
+    rasterText = QCoreApplication.translate( "QgisApp", "&Raster" )
+
+    for a in actions:
+        if a.menu().title() == rasterText:
+            rasterMenu = a.menu()
+            break
+
+    if rasterMenu == None:
+        # no Raster menu, create and insert it before the Help menu
+        self.menu = QMenu()
+        self.menu.setTitle( QCoreApplication.translate( "GdalTools", "&Raster" ) )
+        lastAction = actions[ len( actions ) - 1 ]
+        menu_bar.insertMenu( lastAction, self.menu )
+    else:
+        self.menu = rasterMenu
+        self.menu.addSeparator()
+
     if self.GdalVersion >= "1.6":
       self.buildVRT = QAction( QIcon(":/icons/vrt.png"), QCoreApplication.translate( "GdalTools", "Build Virtual Raster (catalog)" ), self.iface.mainWindow() )
       self.buildVRT.setStatusTip( QCoreApplication.translate( "GdalTools", "Builds a VRT from a list of datasets") )

Modified: trunk/qgis/src/app/qgisapp.cpp
===================================================================
--- trunk/qgis/src/app/qgisapp.cpp	2010-11-14 23:57:03 UTC (rev 14674)
+++ trunk/qgis/src/app/qgisapp.cpp	2010-11-15 00:13:59 UTC (rev 14675)
@@ -1528,9 +1528,6 @@
   mLayerMenu->addAction( mActionNewVectorLayer );
 #endif
 
-  //todo: should probably go into a raster menu
-  mLayerMenu->addAction( mActionShowRasterCalculator );
-
   mLayerMenu->addAction( mActionAddOgrLayer );
   mLayerMenu->addAction( mActionAddRasterLayer );
 #ifdef HAVE_POSTGRESQL
@@ -1609,7 +1606,14 @@
   // don't add it yet, wait for a plugin
   mDatabaseMenu = new QMenu( tr( "&Database" ) );
 
+  
+  // Raster Menu
 
+  mRasterMenu = menuBar()->addMenu( tr( "&Raster" ) );
+
+  mRasterMenu->addAction( mActionShowRasterCalculator );
+
+
   // Help Menu
 
   menuBar()->addSeparator();

Modified: trunk/qgis/src/app/qgisapp.h
===================================================================
--- trunk/qgis/src/app/qgisapp.h	2010-11-14 23:57:03 UTC (rev 14674)
+++ trunk/qgis/src/app/qgisapp.h	2010-11-15 00:13:59 UTC (rev 14675)
@@ -333,6 +333,7 @@
     QMenu *settingsMenu() { return mSettingsMenu; }
     QMenu *pluginMenu() { return mPluginMenu; }
     QMenu *databaseMenu() { return mDatabaseMenu; }
+    QMenu *rasterMenu() { return mRasterMenu; }
 #ifdef Q_WS_MAC
     QMenu *firstRightStandardMenu() { return mWindowMenu; }
     QMenu *windowMenu() { return mWindowMenu; }
@@ -1100,6 +1101,8 @@
     QMenu *mPluginMenu;
     //! Top level database menu
     QMenu *mDatabaseMenu;
+    //! Top level raster menu
+    QMenu *mRasterMenu;
     //! Popup menu for the map overview tools
     QMenu *toolPopupOverviews;
     //! Popup menu for the display tools



More information about the QGIS-commit mailing list