Book Image

Building Mapping Applications with QGIS

By : Erik Westra
Book Image

Building Mapping Applications with QGIS

By: Erik Westra

Overview of this book

Table of Contents (16 chapters)
Building Mapping Applications with QGIS
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
1
Getting Started with QGIS
Index

Adjusting the toolbar actions


Now that we've finished creating all the necessary map tools and instance variables, we can finally implement the rest of the adjustActions() method to adjust the toolbar and menu items to reflect the current state of the system. Firstly, we want to change the final line of this method so that the Find Shortest Path action is only enabled if the start and end points have both been set:

self.actionFindShortestPath.setEnabled(
     self.curStartPt != None andself.curEndPt != None)

In the final part of this method, we'll want to find the action that is associated with the current map tool and check that action, while unchecking all the others. To do this, add the following code to the end of your adjustActions() method:

        curTool = self.mapCanvas.mapTool()

        self.actionPan.setChecked(curTool == self.panTool)
        self.actionEdit.setChecked(self.editing)
        self.actionAddTrack.setChecked(
                        curTool == self.addTrackTool)
 ...