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
About the Author
About the Reviewers
Free Chapter
Getting Started with QGIS

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.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)
                        curTool == self.addTrackTool)