Exemplo n.º 1
0
    def run(self):
        s = unicode(self.combo.currentText())
        if s.startswith('Processing algorithm: '):
            algName = s[len('Processing algorithm: '):]
            alg = Processing.getAlgorithmFromFullName(algName)
            if alg is not None:
                self.close()
                self.runAlgorithm(alg)
        elif s.startswith("Command: "):
            command = s[len("Command: "):]
            try:
                self.runCommand(command)
                self.close()
            except Exception as e:
                self.label.setVisible(True)
                self.label.setText('Error:' + unicode(e))

        elif s.startswith('Menu action: '):
            actionName = s[len('Menu action: '):]
            menuActions = []
            actions = iface.mainWindow().menuBar().actions()
            for action in actions:
                menuActions.extend(self.getActions(action))
            for action in menuActions:
                if action.text() == actionName:
                    self.close()
                    action.trigger()
                    return
        else:
            try:
                self.runCommand(s)
                self.close()
            except Exception as e:
                self.label.setVisible(True)
                self.label.setText('Error:' + unicode(e))
Exemplo n.º 2
0
    def run(self):
        s = unicode(self.combo.currentText())
        if s.startswith('Processing algorithm: '):
            algName = s[len('Processing algorithm: '):]
            alg = Processing.getAlgorithmFromFullName(algName)
            if alg is not None:
                self.close()
                self.runAlgorithm(alg)
        elif s.startswith("Command: "):
            command = s[len("Command: "):]
            try:
                self.runCommand(command)
                self.close()
            except Exception as e:
                self.label.setVisible(True)
                self.label.setText('Error:' + unicode(e))

        elif s.startswith('Menu action: '):
            actionName = s[len('Menu action: '):]
            menuActions = []
            actions = iface.mainWindow().menuBar().actions()
            for action in actions:
                menuActions.extend(self.getActions(action))
            for action in menuActions:
                if action.text() == actionName:
                    self.close()
                    action.trigger()
                    return
        else:
            try:
                self.runCommand(s)
                self.close()
            except Exception as e:
                self.label.setVisible(True)
                self.label.setText('Error:' + unicode(e))
Exemplo n.º 3
0
 def run(self):
     s = unicode(self.combo.currentText())
     if s.startswith("Processing algorithm: "):
         algName = s[len("Processing algorithm: "):]
         alg = Processing.getAlgorithmFromFullName(algName)
         if alg is not None:
             self.close()
             self.runAlgorithm(alg)
     elif s.startswith("Command: "):
         command = s[len("Command: "):]
         try:
             self.runCommand(command)
             self.close()
         except Exception, e:
             self.label.setVisible(True)
             self.label.setText("Error:" +  unicode(e) )
Exemplo n.º 4
0
 def run(self):
     s = unicode(self.combo.currentText())
     if s.startswith('Processing algorithm: '):
         algName = s[len('Processing algorithm: '):]
         alg = Processing.getAlgorithmFromFullName(algName)
         if alg is not None:
             self.close()
             self.runAlgorithm(alg)
     elif s.startswith("Command: "):
         command = s[len("Command: "):]
         try:
             self.runCommand(command)
             self.close()
         except Exception, e:
             self.label.setVisible(True)
             self.label.setText('Error:' + unicode(e))