SEXTANTE にはツールボックスを使わないでアルゴリズムを実行する実用的なツールが含まれています,ここでは実行したいアルゴリズムの名前をタイプすれば実行できます.
このツールは SEXTANTE commander という名前で自動補完機能つきのシンプルなテキストボックスで提供されています.このツールで実行したいコマンドをタイプできます.
Figure SEXTANTE 28:
The commander is started from the Analysis menu or, more practically, pressing Shift + Ctrl + M (you can change that default keyboard shortcut in the QGIS configuration if you prefer a different one). Apart from executing SEXTANTE algorithms, the commander gives you access to most of the functionality in QGIS, which means that it gives you a practical and efficient way of running QGIS tasks, and allows you to control QGIS reducing the usage of buttons and menus.
Moreover, the commander is configurable and you can add your custom commands and have them just a few keystrokes away, making it a powerful tool to become more productive in your daily work with QGIS
コマンドは以下のカテゴリのコマンダーフォールで利用できます
SEXTANTE アルゴリズム. SEXTANTE algorithm: <name of the algorithm> として表示されます.
Python 関数. 利用可能コマンドリストに含めることができる短い Python関数を作成することができます. それらは Function: <function name> として表示されます
上記のものを実行するためにはタイプを開始して入力したテキストを補完して表示されるコマンドリストから必要なエレメントを選択すればよいです.
In the case of calling a Python function, you can select the entry in the list, which is prefixed by Function: (for instance, Function: removeall), or just directly type the function name (``removeall in the previous example). There is no need to add brackets after the function name.
Custom functions are added by entering the corresponding Python code in the commands.py file that is found in the .qgis/sextante/commander directory in your user folder. It is just a simple Python file where you can add the functions that you need.
The file is created the first time you open the commander, with a few example functions. If you haven’t launched the commander yet, you can create the file yourself. To edit the commands file, use your favorite text editor. You can also use a built-in editor by calling the edit command from the commander. It will open the editor with the commands file, and you can edit it directly and then save your changes.
For instance, you can add the following function, which removes all layers:
from qgis.gui import *
def removeall():
mapreg = QgsMapLayerRegistry.instance()
mapreg.removeAllMapLayers()
Once you have added the function, it will be available in the commander, and you can invoke it by typing removeall. There is no need to do anything apart from writing the function itself.
Functions can receive parameters. Add *args to your function definition, to receive argument. When calling the function from the commander, parameters have to be passed separated by spaces.
Here is an example of a function that loads a layer and takes a parameter with the filename of the layer to load.
import sextante
def load(*args):
sextante.load(args[0])
If you want to load a layer in /home/myuser/points.shp, type load /home/myuser/points.shp in the commander text box.