|
| 1 | +from PyQt4.QtCore import * |
| 2 | +from PyQt4.QtGui import * |
| 3 | +from qgis.core import * |
| 4 | +# Initialize Qt resources from file resources.py |
| 5 | +import resources |
| 6 | +# Import the code for the dialog |
| 7 | + |
| 8 | + |
| 9 | +import os, sys |
| 10 | +import inspect |
| 11 | +from sextante.core.Sextante import Sextante |
| 12 | +from sextante.gui.SextanteToolbox import SextanteToolbox |
| 13 | +from sextante.core.QGisLayers import QGisLayers |
| 14 | + |
| 15 | +cmd_folder = os.path.split(inspect.getfile( inspect.currentframe() ))[0] |
| 16 | +if cmd_folder not in sys.path: |
| 17 | + sys.path.insert(0, cmd_folder) |
| 18 | + |
| 19 | +class SextanteToolboxPlugin: |
| 20 | + |
| 21 | + def __init__(self, iface): |
| 22 | + self.iface = iface |
| 23 | + QGisLayers.setInterface(iface) |
| 24 | + Sextante.initialize() |
| 25 | + |
| 26 | + def initGui(self): |
| 27 | + |
| 28 | + self.toolboxAction = QAction(QIcon(":/plugins/sextante/toolbox.png"), \ |
| 29 | + "SEXTANTE Toolbox", self.iface.mainWindow()) |
| 30 | + QObject.connect(self.toolboxAction, SIGNAL("triggered()"), self.openToolbox) |
| 31 | + self.iface.addPluginToMenu("&SEXTANTE", self.toolboxAction) |
| 32 | + |
| 33 | + self.modelerAction = QAction(QIcon(":/plugins/sextante/modeler.png"), \ |
| 34 | + "SEXTANTE Modeler", self.iface.mainWindow()) |
| 35 | + QObject.connect(self.modelerAction, SIGNAL("triggered()"), self.openModeler) |
| 36 | + self.iface.addPluginToMenu("&SEXTANTE", self.modelerAction) |
| 37 | + |
| 38 | + def unload(self): |
| 39 | + # Remove the plugin menu items |
| 40 | + self.iface.removePluginMenu("&SEXTANTE",self.toolboxAction) |
| 41 | + self.iface.removePluginMenu("&SEXTANTE",self.modelerAction) |
| 42 | + |
| 43 | + def openToolbox(self): |
| 44 | + |
| 45 | + dlg = SextanteToolbox() |
| 46 | + dlg.exec_() |
| 47 | + |
| 48 | + def openModeler(self): |
| 49 | + pass |
0 commit comments