Esempio n. 1
0
 def executeAlgorithm(self):
     item = self.algorithmTree.currentItem()
     if isinstance(item, TreeAlgorithmItem):
         alg = Sextante.getAlgorithm(item.alg.commandLineName())
         message = alg.checkBeforeOpeningParametersDialog()
         if message:
             dlg = MissingDependencyDialog(message)
             dlg.exec_()
             #QMessageBox.warning(self, self.tr("Warning"), message)
             return
         alg = alg.getCopy()
         dlg = alg.getCustomParametersDialog()
         if not dlg:
             dlg = ParametersDialog(alg)
         canvas = QGisLayers.iface.mapCanvas()
         prevMapTool = canvas.mapTool()
         dlg.show()
         dlg.exec_()
         if canvas.mapTool() != prevMapTool:
             try:
                 canvas.mapTool().reset()
             except:
                 pass
             canvas.setMapTool(prevMapTool)
         if dlg.executed:
             showRecent = SextanteConfig.getSetting(
                 SextanteConfig.SHOW_RECENT_ALGORITHMS)
             if showRecent:
                 self.addRecentAlgorithms(True)
     if isinstance(item, TreeActionItem):
         action = item.action
         action.setData(self)
         action.execute()
Esempio n. 2
0
 def executeAlgorithm(self):
     item = self.algorithmTree.currentItem()
     if isinstance(item, TreeAlgorithmItem):
         alg = Sextante.getAlgorithm(item.alg.commandLineName())
         message = alg.checkBeforeOpeningParametersDialog()
         if message:
             dlg = MissingDependencyDialog(message)
             dlg.exec_()
             #QMessageBox.warning(self, self.tr("Warning"), message)
             return
         alg = alg.getCopy()
         dlg = alg.getCustomParametersDialog()
         if not dlg:
             dlg = ParametersDialog(alg)
         canvas = QGisLayers.iface.mapCanvas()
         prevMapTool = canvas.mapTool()
         dlg.show()
         dlg.exec_()
         if canvas.mapTool()!=prevMapTool:
             try:
                 canvas.mapTool().reset()
             except:
                 pass
             canvas.setMapTool(prevMapTool)
         if dlg.executed:
             showRecent = SextanteConfig.getSetting(SextanteConfig.SHOW_RECENT_ALGORITHMS)
             if showRecent:
                 self.addRecentAlgorithms(True)
     if isinstance(item, TreeActionItem):
         action = item.action
         action.setData(self)
         action.execute()
 def runAlgorithm(self, alg):
     alg = alg.getCopy()
     message = alg.checkBeforeOpeningParametersDialog()
     if message:
         dlg = MissingDependencyDialog(message)
         dlg.exec_()
         return
     dlg = alg.getCustomParametersDialog()
     if not dlg:
         dlg = ParametersDialog(alg)
     canvas = QGisLayers.iface.mapCanvas()
     prevMapTool = canvas.mapTool()
     dlg.show()
     dlg.exec_()
     if canvas.mapTool()!=prevMapTool:
         try:
             canvas.mapTool().reset()
         except:
             pass
         canvas.setMapTool(prevMapTool)
Esempio n. 4
0
 def runAlgorithm(self, alg):  
     alg = alg.getCopy()
     message = alg.checkBeforeOpeningParametersDialog()
     if message:
         dlg = MissingDependencyDialog(message)
         dlg.exec_()                
         return
     dlg = alg.getCustomParametersDialog()
     if not dlg:
         dlg = ParametersDialog(alg)
     canvas = QGisLayers.iface.mapCanvas()
     prevMapTool = canvas.mapTool()
     dlg.show()
     dlg.exec_()
     if canvas.mapTool()!=prevMapTool:
         try:
             canvas.mapTool().reset()
         except:
             pass
         canvas.setMapTool(prevMapTool)