created the Raster menu and moved the "raster calculator" to it

git-svn-id: http://svn.osgeo.org/qgis/trunk@14675 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
brushtyler 2010-11-15 00:13:59 +00:00
parent 3b8e430aed
commit 5fe962a149
3 changed files with 32 additions and 6 deletions

View File

@ -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,8 +81,27 @@ class GdalTools:
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() )

View File

@ -1528,9 +1528,6 @@ void QgisApp::createMenus()
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,6 +1606,13 @@ void QgisApp::createMenus()
// 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

View File

@ -333,6 +333,7 @@ class QgisApp : public QMainWindow
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 @@ class QgisApp : public QMainWindow
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