Beispiel #1
0
 def executeAlgorithm(self):
     item = self.algorithmTree.currentItem()
     if isinstance(item, TreeAlgorithmItem):
         alg = Processing.getAlgorithm(item.alg.commandLineName())
         message = alg.checkBeforeOpeningParametersDialog()
         if message:
             dlg = MissingDependencyDialog(message)
             dlg.exec_()
             return
         alg = alg.getCopy()
         dlg = alg.getCustomParametersDialog()
         if not dlg:
             dlg = ParametersDialog(alg)
         canvas = interface.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 = ProcessingConfig.getSetting(ProcessingConfig.SHOW_RECENT_ALGORITHMS)
             if showRecent:
                 self.addRecentAlgorithms(True)
     if isinstance(item, TreeActionItem):
         action = item.action
         action.setData(self)
         action.execute()
 def executeAlgorithm(self):
     item = self.algorithmTree.currentItem()
     if isinstance(item, TreeAlgorithmItem):
         alg = Processing.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 = ProcessingConfig.getSetting(ProcessingConfig.SHOW_RECENT_ALGORITHMS)
             if showRecent:
                 self.addRecentAlgorithms(True)
     if isinstance(item, TreeActionItem):
         action = item.action
         action.setData(self)
         action.execute()
Beispiel #3
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)
Beispiel #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 = iface.mapCanvas()
     prevMapTool = canvas.mapTool()
     dlg.show()
     dlg.exec_()
     if canvas.mapTool() != prevMapTool:
         try:
             canvas.mapTool().reset()
         except:
             pass
         canvas.setMapTool(prevMapTool)