Changeset 10
- Timestamp:
- 10/25/08 21:52:46 (2 months ago)
- Files:
-
- trunk/rasterinfo/rasterfileinfo.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/rasterinfo/rasterfileinfo.py
r8 r10 45 45 # Save a reference to the QGIS iface 46 46 self.iface = iface 47 self.canvas = iface. getMapCanvas()47 self.canvas = iface.mapCanvas() 48 48 49 49 def initGui(self): 50 50 # Create action 51 51 self.action = QAction(QIcon(":/rasterinfo.png"), 52 "Get Raster File Info", self.iface. getMainWindow())52 "Get Raster File Info", self.iface.mainWindow()) 53 53 self.action.setWhatsThis("Raster File Info Plugin") 54 54 QObject.connect(self.action, SIGNAL("activated()"), self.run) 55 55 self.helpaction = QAction(QIcon(":/rasterhelp.png"), 56 "About", self.iface. getMainWindow())56 "About", self.iface.mainWindow()) 57 57 self.helpaction.setWhatsThis("Raster File Info Plugin Help") 58 58 QObject.connect(self.helpaction, SIGNAL("activated()"), self.helprun) … … 60 60 # Add to the main toolbar 61 61 self.iface.addToolBarIcon(self.action) 62 self.iface.addPlugin Menu("&RasterFileInfo", self.action)63 self.iface.addPlugin Menu("&RasterFileInfo", self.helpaction)62 self.iface.addPluginToMenu("&RasterFileInfo", self.action) 63 self.iface.addPluginToMenu("&RasterFileInfo", self.helpaction) 64 64 65 65 self.tool = RasterFileInfoTool(self.canvas) … … 78 78 infoString = infoString.append("TRAC: http://trac.reprojected.com/") 79 79 infoString = infoString.append("qgisplugins\n") 80 QMessageBox.information(self.iface. getMainWindow(),80 QMessageBox.information(self.iface.mainWindow(), 81 81 "Raster File Info Plugin About",infoString) 82 82 … … 96 96 nLayers=self.canvas.layerCount() 97 97 for l in range(nLayers): 98 layer = self.canvas. getZpos(l)99 if layer and layer.type() == QgsMapLayer.R ASTER:98 layer = self.canvas.layer(l) 99 if layer and layer.type() == QgsMapLayer.RasterLayer: 100 100 extent = layer.extent() 101 101 if pt.x() > extent.xMin() and pt.x() < extent.xMax() and \ … … 105 105 infoString.append(layer.source()).append(QString("\n")) 106 106 if infoString != None: 107 QMessageBox.information(self.iface. getMainWindow(),107 QMessageBox.information(self.iface.mainWindow(), 108 108 "Raster File Info",infoString) 109 109 else: 110 QMessageBox.information(self.iface. getMainWindow(),110 QMessageBox.information(self.iface.mainWindow(), 111 111 "Raster File Info","No Raster Layers Intersect") 112 112 self.canvas.setMapTool(self.saveTool)
