[QGIS Commit] r8540 - trunk/qgis/src/app

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed May 28 18:59:12 EDT 2008


Author: jef
Date: 2008-05-28 18:59:11 -0400 (Wed, 28 May 2008)
New Revision: 8540

Modified:
   trunk/qgis/src/app/qgisapp.cpp
Log:
qgisapp update:
- 'remove layer', 'add to overview', 'toggle editing' and 'edit copy' only enable
  with active layer
- add 'python console' only when python is available


Modified: trunk/qgis/src/app/qgisapp.cpp
===================================================================
--- trunk/qgis/src/app/qgisapp.cpp	2008-05-28 21:51:05 UTC (rev 8539)
+++ trunk/qgis/src/app/qgisapp.cpp	2008-05-28 22:59:11 UTC (rev 8540)
@@ -387,13 +387,12 @@
   
   if (mPythonUtils && mPythonUtils->isEnabled())
   {
+    mActionShowPythonDialog = new QAction(tr("Python console"), this);
+    connect(mActionShowPythonDialog, SIGNAL(triggered()), this, SLOT(showPythonDialog()));
+
+    mPluginMenu->addAction(mActionShowPythonDialog);
     QgsDebugMsg("Python support ENABLED :-)");
   }
-  else
-  {
-    mActionShowPythonDialog->setEnabled(false);
-    QgsDebugMsg("Python support DISABLED :-(");
-  }
 
   // Create the plugin registry and load plugins
   // load any plugins that were running in the last session
@@ -616,6 +615,7 @@
   mActionRemoveLayer->setShortcut(tr("Ctrl+D","Remove a Layer"));
   mActionRemoveLayer->setStatusTip(tr("Remove a Layer"));
   connect(mActionRemoveLayer, SIGNAL(triggered()), this, SLOT(removeLayer()));
+  mActionRemoveLayer->setEnabled(false);
   //
   mActionAddAllToOverview= new QAction(QIcon(myIconPath+"/mActionAddAllToOverview.png"), tr("Add All To Overview"), this);
   mActionAddAllToOverview->setShortcut(tr("+","Show all layers in the overview map"));
@@ -784,6 +784,7 @@
   mActionInOverview->setShortcut(tr("O","Add current layer to overview map"));
   mActionInOverview->setStatusTip(tr("Add current layer to overview map"));
   connect(mActionInOverview, SIGNAL(triggered()), this, SLOT(inOverview()));
+  mActionInOverview->setEnabled(false);
   //
   // Plugin Menu Related Items
   //
@@ -804,6 +805,7 @@
   mActionToggleEditing->setStatusTip(tr("Toggles the editing state of the current layer")); 
   mActionToggleEditing->setCheckable(true);
   connect(mActionToggleEditing, SIGNAL(triggered()), this, SLOT(toggleEditing()));
+  mActionToggleEditing->setEnabled(false);
   
   //
   mActionCapturePoint= new QAction(QIcon(myIconPath+"/mActionCapturePoint.png"), tr("Capture Point"), this);
@@ -884,9 +886,6 @@
   mActionMapTips->setStatusTip(tr("Show information about a feature when the mouse is hovered over it"));
   connect ( mActionMapTips, SIGNAL ( triggered() ), this, SLOT ( toggleMapTips() ) );
   mActionMapTips->setCheckable(true);
-  
-  mActionShowPythonDialog = new QAction(tr("Python console"), this);
-  connect(mActionShowPythonDialog, SIGNAL(triggered()), this, SLOT(showPythonDialog()));
 }
 
 void QgisApp::showPythonDialog()
@@ -1017,7 +1016,6 @@
   // Plugins Menu
   mPluginMenu = menuBar()->addMenu(tr("&Plugins"));
   mPluginMenu->addAction(mActionShowPluginManager);
-  mPluginMenu->addAction(mActionShowPythonDialog);
   mPluginMenu->addSeparator();
 
   // Add the plugin manager action to it
@@ -1084,15 +1082,15 @@
   mDigitizeToolBar->addAction(mActionCapturePolygon);
   mDigitizeToolBar->addAction(mActionAddRing);
   mDigitizeToolBar->addAction(mActionAddIsland);
-  mDigitizeToolBar->addAction(mActionDeleteSelected);
-  mDigitizeToolBar->addAction(mActionEditCut);
-  mDigitizeToolBar->addAction(mActionEditCopy);
-  mDigitizeToolBar->addAction(mActionEditPaste);
   mDigitizeToolBar->addAction(mActionSplitFeatures);
   mDigitizeToolBar->addAction(mActionMoveFeature);
   mDigitizeToolBar->addAction(mActionMoveVertex);
   mDigitizeToolBar->addAction(mActionAddVertex);
   mDigitizeToolBar->addAction(mActionDeleteVertex);
+  mDigitizeToolBar->addAction(mActionDeleteSelected);
+  mDigitizeToolBar->addAction(mActionEditCut);
+  mDigitizeToolBar->addAction(mActionEditCopy);
+  mDigitizeToolBar->addAction(mActionEditPaste);
   //
   // Map Navigation Toolbar
   mMapNavToolBar = addToolBar(tr("Map Navigation"));
@@ -4843,9 +4841,17 @@
 {
   if(!layer)
   {
+    mActionToggleEditing->setEnabled(false);
+    mActionRemoveLayer->setEnabled(false);
+    mActionInOverview->setEnabled(false);
+    mActionEditCopy->setEnabled(false);
     return;
   }
 
+  mActionToggleEditing->setEnabled(true);
+  mActionRemoveLayer->setEnabled(true);
+  mActionInOverview->setEnabled(true);
+
   /***********Vector layers****************/
   if(layer->type() == QgsMapLayer::VECTOR)
   {
@@ -4890,28 +4896,28 @@
         if(vlayer->isEditable() && dprovider->capabilities() & QgsVectorDataProvider::AddFeatures)
         {
           mActionCapturePoint->setEnabled(true);
-	  mActionMoveFeature->setEnabled(true);
+          mActionMoveFeature->setEnabled(true);
         }
         else
         {
           mActionCapturePoint->setEnabled(false);
-	  mActionMoveFeature->setEnabled(false);
+          mActionMoveFeature->setEnabled(false);
         }
         mActionCaptureLine->setEnabled(false);
         mActionCapturePolygon->setEnabled(false);
         mActionAddVertex->setEnabled(false);
         mActionDeleteVertex->setEnabled(false);
-	mActionMoveVertex->setEnabled(false);
+        mActionMoveVertex->setEnabled(false);
         mActionAddRing->setEnabled(false);
         mActionAddIsland->setEnabled(false);
-	mActionSplitFeatures->setEnabled(false);
+        mActionSplitFeatures->setEnabled(false);
         if(vlayer->isEditable() && dprovider->capabilities() & QgsVectorDataProvider::ChangeGeometries)
         {
-	  //don't enable vertex move for single point
-	  if(vlayer->geometryType() != QGis::WKBPoint && vlayer->geometryType() != QGis::WKBPoint25D)
-	    {
-	      mActionMoveVertex->setEnabled(true);
-	    }
+          //don't enable vertex move for single point
+          if(vlayer->geometryType() != QGis::WKBPoint && vlayer->geometryType() != QGis::WKBPoint25D)
+          {
+            mActionMoveVertex->setEnabled(true);
+          }
           mActionMoveFeature->setEnabled(true);
         }
         return;
@@ -4921,14 +4927,14 @@
         if(vlayer->isEditable() && dprovider->capabilities() & QgsVectorDataProvider::AddFeatures)
         {
           mActionCaptureLine->setEnabled(true);
-	  mActionSplitFeatures->setEnabled(true);
-	  mActionMoveFeature->setEnabled(true);
+          mActionSplitFeatures->setEnabled(true);
+          mActionMoveFeature->setEnabled(true);
         }
         else
         {
           mActionCaptureLine->setEnabled(false);
-	  mActionSplitFeatures->setEnabled(false);
-	  mActionMoveFeature->setEnabled(false);
+          mActionSplitFeatures->setEnabled(false);
+          mActionMoveFeature->setEnabled(false);
         }
         mActionCapturePoint->setEnabled(false);
         mActionCapturePolygon->setEnabled(false);
@@ -4940,18 +4946,18 @@
         if(vlayer->isEditable() && dprovider->capabilities() & QgsVectorDataProvider::AddFeatures)
         {
           mActionCapturePolygon->setEnabled(true);
-	  mActionAddRing->setEnabled(true);
-	  mActionAddIsland->setEnabled(true);
-	  mActionSplitFeatures->setEnabled(true);
-	  mActionMoveFeature->setEnabled(true);
+          mActionAddRing->setEnabled(true);
+          mActionAddIsland->setEnabled(true);
+          mActionSplitFeatures->setEnabled(true);
+          mActionMoveFeature->setEnabled(true);
         }
         else
         {
           mActionCapturePolygon->setEnabled(false);
-	  mActionAddRing->setEnabled(false);
-	  mActionAddIsland->setEnabled(false);
-	  mActionSplitFeatures->setEnabled(false);
-	  mActionMoveFeature->setEnabled(false);
+          mActionAddRing->setEnabled(false);
+          mActionAddIsland->setEnabled(false);
+          mActionSplitFeatures->setEnabled(false);
+          mActionMoveFeature->setEnabled(false);
         }
         mActionCapturePoint->setEnabled(false);
         mActionCaptureLine->setEnabled(false);



More information about the QGIS-commit mailing list