Changeset 10

Show
Ignore:
Timestamp:
10/25/08 21:52:46 (2 months ago)
Author:
aaronr
Message:

Updating to QGIS 1.0 api changes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/rasterinfo/rasterfileinfo.py

    r8 r10  
    4545    # Save a reference to the QGIS iface 
    4646    self.iface = iface 
    47     self.canvas = iface.getMapCanvas() 
     47    self.canvas = iface.mapCanvas() 
    4848 
    4949  def initGui(self): 
    5050    # Create action 
    5151    self.action = QAction(QIcon(":/rasterinfo.png"), 
    52                           "Get Raster File Info", self.iface.getMainWindow()) 
     52                          "Get Raster File Info", self.iface.mainWindow()) 
    5353    self.action.setWhatsThis("Raster File Info Plugin") 
    5454    QObject.connect(self.action, SIGNAL("activated()"), self.run) 
    5555    self.helpaction = QAction(QIcon(":/rasterhelp.png"), 
    56                               "About", self.iface.getMainWindow()) 
     56                              "About", self.iface.mainWindow()) 
    5757    self.helpaction.setWhatsThis("Raster File Info Plugin Help") 
    5858    QObject.connect(self.helpaction, SIGNAL("activated()"), self.helprun) 
     
    6060    # Add to the main toolbar 
    6161    self.iface.addToolBarIcon(self.action) 
    62     self.iface.addPluginMenu("&RasterFileInfo", self.action) 
    63     self.iface.addPluginMenu("&RasterFileInfo", self.helpaction) 
     62    self.iface.addPluginToMenu("&RasterFileInfo", self.action) 
     63    self.iface.addPluginToMenu("&RasterFileInfo", self.helpaction) 
    6464 
    6565    self.tool = RasterFileInfoTool(self.canvas) 
     
    7878    infoString = infoString.append("TRAC: http://trac.reprojected.com/") 
    7979    infoString = infoString.append("qgisplugins\n") 
    80     QMessageBox.information(self.iface.getMainWindow(), 
     80    QMessageBox.information(self.iface.mainWindow(), 
    8181                            "Raster File Info Plugin About",infoString) 
    8282 
     
    9696    nLayers=self.canvas.layerCount() 
    9797    for l in range(nLayers): 
    98       layer = self.canvas.getZpos(l) 
    99       if layer and layer.type() == QgsMapLayer.RASTER
     98      layer = self.canvas.layer(l) 
     99      if layer and layer.type() == QgsMapLayer.RasterLayer
    100100        extent = layer.extent() 
    101101        if pt.x() > extent.xMin() and pt.x() < extent.xMax() and \ 
     
    105105          infoString.append(layer.source()).append(QString("\n")) 
    106106    if infoString != None: 
    107       QMessageBox.information(self.iface.getMainWindow(), 
     107      QMessageBox.information(self.iface.mainWindow(), 
    108108                              "Raster File Info",infoString) 
    109109    else: 
    110       QMessageBox.information(self.iface.getMainWindow(), 
     110      QMessageBox.information(self.iface.mainWindow(), 
    111111                              "Raster File Info","No Raster Layers Intersect") 
    112112    self.canvas.setMapTool(self.saveTool)