Skip to content

Commit 091cbd0

Browse files
author
brushtyler
committedNov 15, 2010
created the Raster menu and moved the "raster calculator" to it
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14675 c8812cc2-4d05-0410-92ff-de0c093fc19c

File tree

3 files changed

+32
-6
lines changed

3 files changed

+32
-6
lines changed
 

‎python/plugins/GdalTools/GdalTools.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22
"""
33
/***************************************************************************
4-
Name : GdalTools
4+
Name : GdalTools
55
Description : Integrate gdal tools into qgis
66
Date : 17/Sep/09
77
copyright : (C) 2009 by Lorenzo Masini (Faunalia)
@@ -81,8 +81,27 @@ def initGui( self ):
8181
from tools.GdalTools_utils import Version, GdalConfig
8282
self.GdalVersion = Version( GdalConfig.version() )
8383

84-
self.menu = QMenu()
85-
self.menu.setTitle( QCoreApplication.translate( "GdalTools", "&Raster" ) )
84+
# find the Raster menu
85+
rasterMenu = None
86+
menu_bar = self.iface.mainWindow().menuBar()
87+
actions = menu_bar.actions()
88+
89+
rasterText = QCoreApplication.translate( "QgisApp", "&Raster" )
90+
91+
for a in actions:
92+
if a.menu().title() == rasterText:
93+
rasterMenu = a.menu()
94+
break
95+
96+
if rasterMenu == None:
97+
# no Raster menu, create and insert it before the Help menu
98+
self.menu = QMenu()
99+
self.menu.setTitle( QCoreApplication.translate( "GdalTools", "&Raster" ) )
100+
lastAction = actions[ len( actions ) - 1 ]
101+
menu_bar.insertMenu( lastAction, self.menu )
102+
else:
103+
self.menu = rasterMenu
104+
self.menu.addSeparator()
86105

87106
if self.GdalVersion >= "1.6":
88107
self.buildVRT = QAction( QIcon(":/icons/vrt.png"), QCoreApplication.translate( "GdalTools", "Build Virtual Raster (catalog)" ), self.iface.mainWindow() )

‎src/app/qgisapp.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,9 +1528,6 @@ void QgisApp::createMenus()
15281528
mLayerMenu->addAction( mActionNewVectorLayer );
15291529
#endif
15301530

1531-
//todo: should probably go into a raster menu
1532-
mLayerMenu->addAction( mActionShowRasterCalculator );
1533-
15341531
mLayerMenu->addAction( mActionAddOgrLayer );
15351532
mLayerMenu->addAction( mActionAddRasterLayer );
15361533
#ifdef HAVE_POSTGRESQL
@@ -1609,6 +1606,13 @@ void QgisApp::createMenus()
16091606
// don't add it yet, wait for a plugin
16101607
mDatabaseMenu = new QMenu( tr( "&Database" ) );
16111608

1609+
1610+
// Raster Menu
1611+
1612+
mRasterMenu = menuBar()->addMenu( tr( "&Raster" ) );
1613+
1614+
mRasterMenu->addAction( mActionShowRasterCalculator );
1615+
16121616

16131617
// Help Menu
16141618

‎src/app/qgisapp.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ class QgisApp : public QMainWindow
333333
QMenu *settingsMenu() { return mSettingsMenu; }
334334
QMenu *pluginMenu() { return mPluginMenu; }
335335
QMenu *databaseMenu() { return mDatabaseMenu; }
336+
QMenu *rasterMenu() { return mRasterMenu; }
336337
#ifdef Q_WS_MAC
337338
QMenu *firstRightStandardMenu() { return mWindowMenu; }
338339
QMenu *windowMenu() { return mWindowMenu; }
@@ -1100,6 +1101,8 @@ class QgisApp : public QMainWindow
11001101
QMenu *mPluginMenu;
11011102
//! Top level database menu
11021103
QMenu *mDatabaseMenu;
1104+
//! Top level raster menu
1105+
QMenu *mRasterMenu;
11031106
//! Popup menu for the map overview tools
11041107
QMenu *toolPopupOverviews;
11051108
//! Popup menu for the display tools

0 commit comments

Comments
 (0)
Please sign in to comment.