当前位置: 首页>>代码示例>>Python>>正文


Python Sextante.Sextante类代码示例

本文整理汇总了Python中sextante.core.Sextante.Sextante的典型用法代码示例。如果您正苦于以下问题:Python Sextante类的具体用法?Python Sextante怎么用?Python Sextante使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Sextante类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: initGui

  def initGui(self):
 
    # Create action that will start plugin configuration
     self.action = QAction(QIcon(":/plugins/QgsWPSClient/images/wps-add.png"), "QgsWPSClient", self.iface.mainWindow())
     self.action.triggered.connect(self.run)
     
     self.actionAbout = QAction("About", self.iface.mainWindow())
     self.actionAbout.triggered.connect(self.doAbout)
         
    # Add toolbar button and menu item
     self.iface.addToolBarIcon(self.action)
     
     if hasattr(self.iface,  "addPluginToWebMenu"):
         self.iface.addPluginToWebMenu("QgsWPSClient", self.action)
         self.iface.addPluginToWebMenu("QgsWPSClient", self.actionAbout)
     else:
         self.iface.addPluginToMenu("QgsWPSClient", self.action)
         self.iface.addPluginToWebMenu("QgsWPSClient", self.action)

     
     self.myDockWidget = QgsWpsDockWidget(self.iface)
     self.myDockWidget.setWindowTitle('QgsWPSClient-'+version())
     self.iface.addDockWidget(Qt.LeftDockWidgetArea, self.myDockWidget)
     self.myDockWidget.show()

     if SEXTANTE_SUPPORT:
         self.provider = WpsAlgorithmProvider(self.myDockWidget)
     else:
         self.provider = None

     if self.provider:
        try:
            Sextante.addProvider(self.provider, True) #Force tree update
        except TypeError:
            Sextante.addProvider(self.provider)
开发者ID:maelocrowd,项目名称:QGis_plugin,代码行数:35,代码来源:qgswps.py

示例2: createTest

def createTest(text):
    s = ""
    tokens =  text[len("sextante.runalg("):-1].split(",")
    cmdname = tokens[0][1:-1];
    methodname = "test_" + cmdname.replace(":","")
    s += "def " + methodname + "(self):\n"
    alg = Sextante.getAlgorithm(cmdname)
    execcommand = "sextante.runalg("
    i = 0
    for token in tokens:
        if i < alg.getVisibleParametersCount() + 1:                            
            if os.path.exists(token[1:-1]):
                token = os.path.basename(token[1:-1])[:-4]           
            execcommand += token + "(),"
        else:
            execcommand += "None,"
        i+=1
    s += "\toutputs=" + execcommand[:-1] + ")\n"

    i = -1 * len(alg.outputs)
    for out in alg.outputs:        
        filename = tokens[i][1:-1]
        if (filename == str(None)):
            raise Exception("Cannot create unit test for that algorithm execution.\nThe output cannot be a temporary file")        
        s+="\toutput=outputs['" + out.name + "']\n"
        if isinstance(out, (OutputNumber, OutputString)):
            s+="self.assertTrue(" + str(out) + ", output)\n"
        if isinstance(out, OutputRaster):
            dataset = gdal.Open(filename, GA_ReadOnly)
            array = dataset.ReadAsArray(1)
            s+="\tself.assertTrue(os.path.isfile(output))\n"
            s+="\tself.assertEqual(hashraster(output)," + str(hash(array)) + ")\n"
        if isinstance(out, OutputVector):
            layer = Sextante.getObject(filename)
            fields = layer.pendingFields()
            s+="\tlayer=QGisLayers.getObjectFromUri(output, True)\n"
            s+="\tfields=layer.pendingFields()\n"
            s+="\texpectednames=[" + ",".join(["'" + str(f.name()) + "'" for f in fields]) + "]\n"
            s+="\texpectedtypes=[" + ",".join(["'" + str(f.typeName()) +"'" for f in fields]) + "]\n"
            s+="\tnames=[str(f.name()) for f in fields]\n"
            s+="\ttypes=[str(f.typeName()) for f in fields]\n"
            s+="\tself.assertEqual(expectednames, names)\n"
            s+="\tself.assertEqual(expectedtypes, types)\n"
            features = QGisLayers.features(layer)
            numfeat = len(features)
            s+="\tfeatures=sextante.getfeatures(layer)\n"
            s+="\tself.assertEqual(" + str(numfeat) + ", len(features))\n"
            if numfeat > 0:
                feature = features.next()
                attrs = feature.attributes()
                s+="\tfeature=features.next()\n"
                s+="\tattrs=feature.attributes()\n"
                s+="\texpectedvalues=[" + ",".join(['"' + str(attr.toString()) + '"' for attr in attrs]) + "]\n"
                s+="\tvalues=[str(attr.toString()) for attr in attrs]\n"
                s+="\tself.assertEqual(expectedvalues, values)\n"

    dlg = ShowTestDialog(s)
    dlg.exec_()
开发者ID:jietaowang,项目名称:Quantum-GIS,代码行数:58,代码来源:TestTools.py

示例3: initGui

    def initGui(self):
        self.toolbox = SextanteToolbox(self.iface)
        self.toolbox.setVisible(False)
        Sextante.addAlgListListener(self.toolbox)

        self.menu = QMenu(self.iface.mainWindow())
        self.menu.setTitle(QCoreApplication.translate("SEXTANTE", "Analysis"))

        self.toolboxAction = QAction(
            QIcon(":/sextante/images/toolbox.png"),
            QCoreApplication.translate("SEXTANTE", "&SEXTANTE toolbox"),
            self.iface.mainWindow(),
        )
        QObject.connect(self.toolboxAction, SIGNAL("triggered()"), self.openToolbox)
        self.menu.addAction(self.toolboxAction)

        self.modelerAction = QAction(
            QIcon(":/sextante/images/model.png"),
            QCoreApplication.translate("SEXTANTE", "&SEXTANTE modeler"),
            self.iface.mainWindow(),
        )
        QObject.connect(self.modelerAction, SIGNAL("triggered()"), self.openModeler)
        self.menu.addAction(self.modelerAction)

        self.historyAction = QAction(
            QIcon(":/sextante/images/history.gif"),
            QCoreApplication.translate("SEXTANTE", "&SEXTANTE history and log"),
            self.iface.mainWindow(),
        )
        QObject.connect(self.historyAction, SIGNAL("triggered()"), self.openHistory)
        self.menu.addAction(self.historyAction)

        self.configAction = QAction(
            QIcon(":/sextante/images/config.png"),
            QCoreApplication.translate("SEXTANTE", "&SEXTANTE options and configuration"),
            self.iface.mainWindow(),
        )
        QObject.connect(self.configAction, SIGNAL("triggered()"), self.openConfig)
        self.menu.addAction(self.configAction)

        self.resultsAction = QAction(
            QIcon(":/sextante/images/results.png"),
            QCoreApplication.translate("SEXTANTE", "&SEXTANTE results viewer"),
            self.iface.mainWindow(),
        )
        QObject.connect(self.resultsAction, SIGNAL("triggered()"), self.openResults)
        self.menu.addAction(self.resultsAction)

        self.helpAction = QAction(
            QIcon(":/sextante/images/help.png"),
            QCoreApplication.translate("SEXTANTE", "&SEXTANTE help"),
            self.iface.mainWindow(),
        )
        QObject.connect(self.helpAction, SIGNAL("triggered()"), self.openHelp)
        self.menu.addAction(self.helpAction)

        menuBar = self.iface.mainWindow().menuBar()
        menuBar.insertMenu(menuBar.actions()[-1], self.menu)
开发者ID:geolab,项目名称:Quantum-GIS,代码行数:58,代码来源:SextantePlugin.py

示例4: fillTreeUsingProviders

    def fillTreeUsingProviders(self):
        self.algorithmTree.clear()
        text = unicode(self.searchBox.text())
        for providerName in Sextante.algs.keys():
            groups = {}
            provider = Sextante.algs[providerName]
            name = "ACTIVATE_" + providerName.upper().replace(" ", "_")
            if not SextanteConfig.getSetting(name):
                continue
            algs = provider.values()
            # add algorithms
            for alg in algs:
                if not alg.showInToolbox:
                    continue
                if text == "" or text.lower() in alg.name.lower():
                    if alg.group in groups:
                        groupItem = groups[alg.group]
                    else:
                        groupItem = QTreeWidgetItem()
                        groupItem.setText(0, alg.group)
                        groupItem.setToolTip(0, alg.group)
                        groups[alg.group] = groupItem
                    algItem = TreeAlgorithmItem(alg)
                    groupItem.addChild(algItem)

            actions = Sextante.actions[providerName]
            for action in actions:
                if text == "" or text.lower() in action.name.lower():
                    if action.group in groups:
                        groupItem = groups[action.group]
                    else:
                        groupItem = QTreeWidgetItem()
                        groupItem.setText(0, action.group)
                        groups[action.group] = groupItem
                    algItem = TreeActionItem(action)
                    groupItem.addChild(algItem)

            if len(groups) > 0:
                providerItem = QTreeWidgetItem()
                providerItem.setText(
                    0,
                    Sextante.getProviderFromName(providerName).getDescription()
                    + " ["
                    + str(len(provider))
                    + " geoalgorithms]",
                )
                providerItem.setIcon(0, Sextante.getProviderFromName(providerName).getIcon())
                providerItem.setToolTip(0, providerItem.text(0))
                for groupItem in groups.values():
                    providerItem.addChild(groupItem)
                self.algorithmTree.addTopLevelItem(providerItem)
                providerItem.setExpanded(text != "")
                for groupItem in groups.values():
                    groupItem.setExpanded(text != "")
开发者ID:jetuk,项目名称:Quantum-GIS,代码行数:54,代码来源:SextanteToolbox.py

示例5: createTest

def createTest(item):            
    s = ""                
    tokens = item.entry.text[len("sextante.runalg("):-1].split(",")                
    cmdname = tokens[0][1:-1];
    methodname = "test_" + cmdname.replace(":","")
    s += "def " + methodname + "():\n"
    alg = Sextante.getAlgorithm(cmdname)
    execcommand = "sextante.runalg("
    i = 0
    for token in tokens:
        if i < alg.getVisibleParametersCount():
            execcommand+=token + ","
        else:
            execcommand+="None,"
        i+=1                
    s += "\toutputs=" + execcommand[:-1] + ")\n"
                
    i = -1 * len(alg.outputs)
    for out in alg.outputs:
        filename = tokens[i][1:-1]                    
        s+="\toutput=outputs['" + out.name + "']\n"
        if isinstance(out, (OutputNumber, OutputString)):
            s+="self.assertTrue(" + str(out) + ", output)\n"
        if isinstance(out, OutputRaster):                   
            dataset = gdal.Open(filename, GA_ReadOnly)
            array = dataset.ReadAsArray(1)
            s+="\tself.assertTrue(os.path.isfile(output))\n"
            s+="\tself.assertEqual(hashraster(output)," + str(hash(array)) + ")\n"
        if isinstance(out, OutputVector):
            layer = Sextante.getObject(filename)
            fields = layer.pendingFields()
            s+="\tlayer=sextante.getobject(output)\n"
            s+="\tfields=layer.pendingFields()\n"
            s+="\texpectednames=[" + ",".join([str(f.name()) for f in fields]) + "]\n"
            s+="\texpectedtypes=[" + ",".join([str(f.typeName()) for f in fields]) + "]\n"
            s+="\tnames=[str(f.name()) for f in fields]\n"
            s+="\ttypes=[str(f.typeName()) for f in fields]\n"
            s+="\tself.assertEqual(exceptednames, names)\n"
            s+="\tself.assertEqual(exceptedtypes, types)\n"
            features = QGisLayers.features(layer)
            numfeat = len(features)
            s+="\tfeatures=sextante.getfeatures(layer))\n"
            s+="\tself.assertEqual(" + str(numfeat) + ", len(features)\n"
            if numfeat > 0:
                feature = features.next()
                attrs = feature.attributes()
                s+="\tfeature=features.next()\n"
                s+="\tattrs=feature.attributes()\n"
                s+="\texpectedvalues=[" + ",".join([str(attr.toString()) for attr in attrs]) + "]\n"
                s+="\tvalues=[str(attr.toString()) for attr in attrs]\n"
                s+="\tself.assertEqual(exceptedtypes, types)\n"
    
    dlg = ShowTestDialog(s)
    dlg.exec_()
开发者ID:badcock4412,项目名称:Quantum-GIS,代码行数:54,代码来源:TestTools.py

示例6: initGui

    def initGui(self):
        self.toolbox = SextanteToolbox(self.iface)
        self.toolbox.setVisible(False)
        Sextante.addAlgListListener(self.toolbox)

        self.menu = QMenu(self.iface.mainWindow())
        self.menu.setTitle("Analysis")

        icon = QIcon(os.path.dirname(__file__) + "/images/toolbox.png")
        self.toolboxAction = QAction(icon, \
            "&SEXTANTE Toolbox", self.iface.mainWindow())
        QObject.connect(self.toolboxAction, SIGNAL("triggered()"), self.openToolbox)
        self.menu.addAction(self.toolboxAction)

        icon = QIcon(os.path.dirname(__file__) + "/images/model.png")
        self.modelerAction = QAction(icon, \
            "&SEXTANTE Modeler", self.iface.mainWindow())
        QObject.connect(self.modelerAction, SIGNAL("triggered()"), self.openModeler)
        self.menu.addAction(self.modelerAction)

        icon = QIcon(os.path.dirname(__file__) + "/images/history.gif")
        self.historyAction = QAction(icon, \
            "&SEXTANTE History and log", self.iface.mainWindow())
        QObject.connect(self.historyAction, SIGNAL("triggered()"), self.openHistory)
        self.menu.addAction(self.historyAction)

        icon = QIcon(os.path.dirname(__file__) + "/images/config.png")
        self.configAction = QAction(icon, \
            "&SEXTANTE options and configuration", self.iface.mainWindow())
        QObject.connect(self.configAction, SIGNAL("triggered()"), self.openConfig)
        self.menu.addAction(self.configAction)

        icon = QIcon(os.path.dirname(__file__) + "/images/results.png")
        self.resultsAction = QAction(icon, \
            "&SEXTANTE results viewer", self.iface.mainWindow())
        QObject.connect(self.resultsAction, SIGNAL("triggered()"), self.openResults)
        self.menu.addAction(self.resultsAction)

        icon = QIcon(os.path.dirname(__file__) + "/images/help.png")
        self.helpAction = QAction(icon, \
            "&SEXTANTE help", self.iface.mainWindow())
        QObject.connect(self.helpAction, SIGNAL("triggered()"), self.openHelp)
        self.menu.addAction(self.helpAction)

        icon = QIcon(os.path.dirname(__file__) + "/images/info.png")
        self.aboutAction = QAction(icon, \
            "&About SEXTANTE", self.iface.mainWindow())
        QObject.connect(self.aboutAction, SIGNAL("triggered()"), self.openAbout)
        self.menu.addAction(self.aboutAction)

        menuBar = self.iface.mainWindow().menuBar()
        menuBar.insertMenu(menuBar.actions()[-1], self.menu)
开发者ID:mokerjoke,项目名称:Quantum-GIS,代码行数:52,代码来源:SextantePlugin.py

示例7: initGui

    def initGui(self):
        self.toolbox = SextanteToolbox(self.iface)
        self.iface.addDockWidget(Qt.RightDockWidgetArea, self.toolbox)
        self.toolbox.hide()
        Sextante.addAlgListListener(self.toolbox)

        self.menu = QMenu(self.iface.mainWindow())
        self.menu.setTitle(QCoreApplication.translate("SEXTANTE", "Analysis"))

        self.toolboxAction = self.toolbox.toggleViewAction()
        self.toolboxAction.setIcon(QIcon(":/sextante/images/toolbox.png"))
        self.toolboxAction.setText(QCoreApplication.translate("SEXTANTE", "&SEXTANTE toolbox"))
        self.menu.addAction(self.toolboxAction)

        self.modelerAction = QAction(QIcon(":/sextante/images/model.png"),
            QCoreApplication.translate("SEXTANTE", "&SEXTANTE modeler"),
            self.iface.mainWindow())
        self.modelerAction.triggered.connect(self.openModeler)
        self.menu.addAction(self.modelerAction)

        self.historyAction = QAction(QIcon(":/sextante/images/history.gif"),
            QCoreApplication.translate("SEXTANTE", "&SEXTANTE history and log"),
            self.iface.mainWindow())
        self.historyAction.triggered.connect(self.openHistory)
        self.menu.addAction(self.historyAction)

        self.configAction = QAction(QIcon(":/sextante/images/config.png"),
            QCoreApplication.translate("SEXTANTE", "&SEXTANTE options and configuration"),
            self.iface.mainWindow())
        self.configAction.triggered.connect(self.openConfig)
        self.menu.addAction(self.configAction)

        self.resultsAction = QAction(QIcon(":/sextante/images/results.png"),
            QCoreApplication.translate("SEXTANTE", "&SEXTANTE results viewer"),
            self.iface.mainWindow())
        self.resultsAction.triggered.connect(self.openResults)
        self.menu.addAction(self.resultsAction)

        #=======================================================================
        # self.helpAction = QAction(QIcon(":/sextante/images/help.png"),
        #    QCoreApplication.translate("SEXTANTE", "&SEXTANTE help"),
        #    self.iface.mainWindow())
        # self.helpAction.triggered.connect(self.openHelp)
        # self.menu.addAction(self.helpAction)
        #=======================================================================

        menuBar = self.iface.mainWindow().menuBar()
        menuBar.insertMenu(menuBar.actions()[-1], self.menu)
开发者ID:Nald,项目名称:Quantum-GIS,代码行数:48,代码来源:SextantePlugin.py

示例8: initGui

    def initGui(self):
        self.commander = None
        self.toolbox = SextanteToolbox(self.iface)
        self.iface.addDockWidget(Qt.RightDockWidgetArea, self.toolbox)
        self.toolbox.hide()
        Sextante.addAlgListListener(self.toolbox)

        self.menu = QMenu(self.iface.mainWindow())
        self.menu.setTitle(QCoreApplication.translate("SEXTANTE", "Analysis"))

        self.toolboxAction = self.toolbox.toggleViewAction()
        self.toolboxAction.setIcon(QIcon(":/sextante/images/toolbox.png"))
        self.toolboxAction.setText(QCoreApplication.translate("SEXTANTE", "&SEXTANTE toolbox"))
        self.menu.addAction(self.toolboxAction)

        self.modelerAction = QAction(QIcon(":/sextante/images/model.png"),
            QCoreApplication.translate("SEXTANTE", "&SEXTANTE modeler"),
            self.iface.mainWindow())
        self.modelerAction.triggered.connect(self.openModeler)
        self.menu.addAction(self.modelerAction)

        self.historyAction = QAction(QIcon(":/sextante/images/history.gif"),
            QCoreApplication.translate("SEXTANTE", "&SEXTANTE history and log"),
            self.iface.mainWindow())
        self.historyAction.triggered.connect(self.openHistory)
        self.menu.addAction(self.historyAction)

        self.configAction = QAction(QIcon(":/sextante/images/config.png"),
            QCoreApplication.translate("SEXTANTE", "&SEXTANTE options and configuration"),
            self.iface.mainWindow())
        self.configAction.triggered.connect(self.openConfig)
        self.menu.addAction(self.configAction)

        self.resultsAction = QAction(QIcon(":/sextante/images/results.png"),
            QCoreApplication.translate("SEXTANTE", "&SEXTANTE results viewer"),
            self.iface.mainWindow())
        self.resultsAction.triggered.connect(self.openResults)
        self.menu.addAction(self.resultsAction)

        menuBar = self.iface.mainWindow().menuBar()
        menuBar.insertMenu(self.iface.firstRightStandardMenu().menuAction(), self.menu)

        self.commanderAction = QAction(QIcon(":/sextante/images/toolbox.png"),
            QCoreApplication.translate("SEXTANTE", "&SEXTANTE commander"),
            self.iface.mainWindow())
        self.commanderAction.triggered.connect(self.openCommander)
        self.menu.addAction(self.commanderAction)
        self.iface.registerMainWindowAction(self.commanderAction, "Ctrl+Alt+M")
开发者ID:Adam-Brown,项目名称:Quantum-GIS,代码行数:48,代码来源:SextantePlugin.py

示例9: processAlgorithm

	def processAlgorithm(self, progress):
		# Include must be done here to avoid cyclic import
		from sextante.core.Sextante import Sextante
		qgis = Sextante.getInterface()

		layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.LAYERNAME))
		layername = layer.name()
		savename = self.getOutputValue(self.SAVENAME)

		index = self.getParameterValue(self.NEWTYPE)

		splitnodes = 0
		if index == 0:
			newtype = QGis.WKBPoint
		elif index == 1:
			newtype = QGis.WKBPoint
			splitnodes = 1
		elif index == 2:
			newtype = QGis.WKBLineString
		elif index == 3:
			newtype = QGis.WKBMultiLineString
		elif index == 4:
			newtype = QGis.WKBPolygon
		else:
			newtype = QGis.WKBPoint

		message = mmqgisx_geometry_convert(qgis, layername, newtype, splitnodes, savename, False)

		if message:
			raise GeoAlgorithmExecutionException(message)
开发者ID:carsonfarmer,项目名称:Quantum-GIS,代码行数:30,代码来源:MMQGISXAlgorithmProvider.py

示例10: processAlgorithm

    def processAlgorithm(self, progress):
        # Include must be done here to avoid cyclic import
        from sextante.core.Sextante import Sextante

        qgis = Sextante.getInterface()

        table = QGisLayers.getObjectFromUri(self.getParameterValue(self.CSVNAME))
        csvname = table.name()

        params = [
            self.getParameterValue(self.ADDRESS),
            self.getParameterValue(self.CITY),
            self.getParameterValue(self.STATE),
            self.getParameterValue(self.COUNTRY),
        ]

        keys = []
        for param in params:
            if not (param in keys):
                keys.append(param)

        shapefilename = self.getOutputValue(self.SHAPEFILENAME)
        notfoundfile = self.getOutputValue(self.NOTFOUNDFILE)

        message = mmqgisx_geocode_google(qgis, csvname, shapefilename, notfoundfile, keys, False)

        if message:
            raise GeoAlgorithmExecutionException(message)
开发者ID:psibi,项目名称:Quantum-GIS,代码行数:28,代码来源:MMQGISXAlgorithms.py

示例11: alghelp

def alghelp(name):
    alg = Sextante.getAlgorithm(name)
    if alg != None:
        print(str(alg))
        algoptions(name)
    else:
        print "Algorithm not found"
开发者ID:Adam-Brown,项目名称:Quantum-GIS,代码行数:7,代码来源:general.py

示例12: processAlgorithm

    def processAlgorithm(self, progress):
        '''Here is where the processing itself takes place'''

        #the first thing to do is retrieve the values of the parameters
        #entered by the user
        inputFilename = self.getParameterValue(self.INPUT_LAYER)
        output = self.getOutputValue(self.OUTPUT_LAYER)

        #input layers values are always a string with its location.
        #That string can be converted into a QGIS object (a QgsVectorLayer in this case))
        #using the Sextante.getObject() method
        vectorLayer = Sextante.getObject(inputFilename)

        #And now we can process

        #First we create the output layer.
        #The output value entered by the user is a string containing a filename,
        #so we can use it directly
        settings = QSettings()
        systemEncoding = settings.value( "/UI/encoding", "System" ).toString()
        provider = vectorLayer.dataProvider()
        writer = QgsVectorFileWriter( output, systemEncoding, provider.fields(), provider.geometryType(), provider.crs() )

        #Now we take the selected features and add them to the output layer
        selection = vectorLayer.selectedFeatures()
        for feat in selection:
            writer.addFeature(feat)
        del writer
开发者ID:mokerjoke,项目名称:Quantum-GIS,代码行数:28,代码来源:ExampleAlgorithm.py

示例13: fillTree

    def fillTree(self):
        useCategories = SextanteConfig.getSetting(SextanteConfig.USE_CATEGORIES)
        if useCategories:
            self.fillTreeUsingCategories()
        else:
            self.fillTreeUsingProviders()

        self.algorithmTree.sortItems(0, Qt.AscendingOrder)

        showRecent = SextanteConfig.getSetting(SextanteConfig.SHOW_RECENT_ALGORITHMS)
        if showRecent:
            recent = SextanteLog.getRecentAlgorithms()
            if len(recent) != 0:
                found = False
                recentItem = QTreeWidgetItem()
                recentItem.setText(0, self.tr("Recently used algorithms"))
                for algname in recent:
                    alg = Sextante.getAlgorithm(algname)
                    if alg is not None:
                        algItem = TreeAlgorithmItem(alg)
                        recentItem.addChild(algItem)
                        found = True
                if found:
                    self.algorithmTree.insertTopLevelItem(0, recentItem)
                    recentItem.setExpanded(True)

            self.algorithmTree.setWordWrap(True)
开发者ID:Nald,项目名称:Quantum-GIS,代码行数:27,代码来源:SextanteToolbox.py

示例14: addRecentAlgorithms

    def addRecentAlgorithms(self, updating):
        showRecent = SextanteConfig.getSetting(SextanteConfig.SHOW_RECENT_ALGORITHMS)
        if showRecent:
            recent = SextanteLog.getRecentAlgorithms()
            if len(recent) != 0:
                found = False
                if updating:
                    recentItem = self.algorithmTree.topLevelItem(0)
                    treeWidget = recentItem.treeWidget()
                    treeWidget.takeTopLevelItem(treeWidget.indexOfTopLevelItem(recentItem))
                    #self.algorithmTree.removeItemWidget(first, 0)

                recentItem = QTreeWidgetItem()
                recentItem.setText(0, self.tr("Recently used algorithms"))
                for algname in recent:
                    alg = Sextante.getAlgorithm(algname)
                    if alg is not None:
                        algItem = TreeAlgorithmItem(alg)
                        recentItem.addChild(algItem)
                        found = True
                if found:
                    self.algorithmTree.insertTopLevelItem(0, recentItem)
                    recentItem.setExpanded(True)

            self.algorithmTree.setWordWrap(True)
开发者ID:Hardysong,项目名称:Quantum-GIS,代码行数:25,代码来源:SextanteToolbox.py

示例15: processAlgorithm

	def processAlgorithm(self, progress):
		# Include must be done here to avoid cyclic import
		from sextante.core.Sextante import Sextante
		qgis = Sextante.getInterface()

		layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.LAYERNAME))
		layername = layer.name()

		node_filename = self.getOutputValue(self.NODEFILENAME)
		attribute_filename = self.getOutputValue(self.ATTRIBUTEFILENAME)
		print "Layer: " + str(layername)
		print "Nodes: " + str(node_filename)
		print "Attributes: " + str(attribute_filename)

		if self.getParameterValue(self.FIELDDELIMITER) == 1:
			field_delimiter = "|"
		elif self.getParameterValue(self.FIELDDELIMITER) == 2:
			field_delimiter = " "
		else:
			field_delimiter = ","

		if self.getParameterValue(self.LINETERMINATOR) == 1:
			line_terminator = "\n"
		else:
			line_terminator = "\r\n"

		message = mmqgisx_geometry_export_to_csv(qgis, layername, node_filename, attribute_filename,
			field_delimiter, line_terminator)

		if message:
			raise GeoAlgorithmExecutionException(message)
开发者ID:pka,项目名称:qgisenterprise-sextante-plugin,代码行数:31,代码来源:MMQGISXAlgorithms.py


注:本文中的sextante.core.Sextante.Sextante类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。