Skip to content

Commit

Permalink
created the Raster menu and moved the "raster calculator" to it
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14675 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
brushtyler committed Nov 15, 2010
1 parent 9f91c54 commit 091cbd0
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
25 changes: 22 additions & 3 deletions python/plugins/GdalTools/GdalTools.py
@@ -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)
Expand Down Expand Up @@ -81,8 +81,27 @@ def initGui( self ):
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() )
Expand Down
10 changes: 7 additions & 3 deletions src/app/qgisapp.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions src/app/qgisapp.h
Expand Up @@ -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; }
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 091cbd0

Please sign in to comment.