Skip to content
Permalink
Browse files
create toolbox from .ui file
add clear button to filter (fix #5695)
  • Loading branch information
alexbruy committed Dec 3, 2012
1 parent 9dd4a92 commit e05519d508b6bc6b275ff1e40f3838737681d88c
@@ -21,9 +21,13 @@ ADD_SUBDIRECTORY(script)
ADD_SUBDIRECTORY(taudem)
#ADD_SUBDIRECTORY(tests)

FILE(GLOB UI_FILES ui/*.ui)
PYQT4_WRAP_UI(PYUI_FILES ${UI_FILES})

FILE(GLOB OTHER_FILES metadata.txt)
FILE(GLOB PY_FILES *.py)

PYQT4_ADD_RESOURCES(PYRC_FILES resources.qrc)

PLUGIN_INSTALL(sextante . ${PY_FILES} ${OTHER_FILES} ${PYRC_FILES})
PLUGIN_INSTALL(sextante ui ${PYUI_FILES} ui/__init__.py)
@@ -42,7 +42,7 @@

from sextante.modeler.ModelerDialog import ModelerDialog

import resources_rc
import sextante.resources_rc

cmd_folder = os.path.split(inspect.getfile( inspect.currentframe() ))[0]
if cmd_folder not in sys.path:
@@ -58,7 +58,8 @@ def __init__(self, iface):

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

self.menu = QMenu(self.iface.mainWindow())
@@ -119,7 +120,10 @@ def unload(self):
pass

def openToolbox(self):
self.toolbox.setVisible(True)
if self.toolbox.isVisible():
self.toolbox.hide()
else:
self.toolbox.show()

def openModeler(self):
dlg = ModelerDialog()
@@ -40,51 +40,41 @@
from sextante.gui.BatchProcessingDialog import BatchProcessingDialog
from sextante.gui.EditRenderingStylesDialog import EditRenderingStylesDialog

from sextante.ui.ui_SextanteToolbox import Ui_SextanteToolbox

import sextante.resources_rc

try:
_fromUtf8 = QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s


class SextanteToolbox(QDockWidget):
class SextanteToolbox(QDockWidget, Ui_SextanteToolbox):
def __init__(self, iface):
QDialog.__init__(self)
QDockWidget.__init__(self, None)
self.setupUi(self)
self.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)

self.iface=iface
self.setupUi()

self.btnClear.setIcon(QIcon(":/sextante/images/clear.png"))

self.externalAppsButton.clicked.connect(self.configureProviders)
self.searchBox.textChanged.connect(self.fillTree)
self.algorithmTree.customContextMenuRequested.connect(self.showPopupMenu)
self.algorithmTree.doubleClicked.connect(self.executeAlgorithm)
self.btnClear.clicked.connect(self.clearFilter)

self.fillTree()

def algsListHasChanged(self):
self.fillTree()

def updateTree(self):
Sextante.updateAlgsList()

def setupUi(self):
self.setObjectName("SEXTANTE_Toolbox")
self.setFloating(False)
self.resize(400, 500)
self.setWindowTitle(self.tr("SEXTANTE Toolbox"))
self.contents = QWidget()
self.verticalLayout = QVBoxLayout(self.contents)
self.verticalLayout.setSpacing(2)
self.verticalLayout.setMargin(0)
self.externalAppsButton = QPushButton()
self.externalAppsButton.setText(self.tr("Click here to configure\nadditional algorithm providers"))
QObject.connect(self.externalAppsButton, SIGNAL("clicked()"), self.configureProviders)
self.verticalLayout.addWidget(self.externalAppsButton)
self.searchBox = QLineEdit(self.contents)
self.searchBox.textChanged.connect(self.fillTree)
self.verticalLayout.addWidget(self.searchBox)
self.algorithmTree = QTreeWidget(self.contents)
self.algorithmTree.setHeaderHidden(True)
self.algorithmTree.setContextMenuPolicy(Qt.CustomContextMenu)
self.fillTree()
self.connect(self.algorithmTree, SIGNAL('customContextMenuRequested(QPoint)'),
self.showPopupMenu)
self.verticalLayout.addWidget(self.algorithmTree)
self.algorithmTree.doubleClicked.connect(self.executeAlgorithm)
self.setWidget(self.contents)
self.iface.addDockWidget(Qt.RightDockWidgetArea, self)
QMetaObject.connectSlotsByName(self)
def clearFilter(self):
self.searchBox.clear()

def configureProviders(self):
webbrowser.open("http://docs.qgis.org/html/en/user_manual/sextante/3rdParty.html")
Binary file not shown.
@@ -15,6 +15,7 @@
<file>images/script.png</file>
<file>images/tool.png</file>
<file>images/toolbox.png</file>
<file>images/clear.png</file>
<file>images/sextante_logo.png</file>
</qresource>
</RCC>
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SextanteToolbox</class>
<widget class="QDockWidget" name="SextanteToolbox">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>225</width>
<height>444</height>
</rect>
</property>
<property name="windowTitle">
<string>SEXTANTE Toolbox</string>
</property>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>2</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="externalAppsButton">
<property name="text">
<string>Click here to configure
additional algorithm providers</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>2</number>
</property>
<item>
<widget class="QLineEdit" name="searchBox"/>
</item>
<item>
<widget class="QToolButton" name="btnClear">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTreeWidget" name="algorithmTree">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="headerHidden">
<bool>true</bool>
</property>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>
@@ -0,0 +1 @@

0 comments on commit e05519d

Please sign in to comment.