Commit 8349b722 authored by Joseph Mirabel's avatar Joseph Mirabel

Add widget to explore the parameters

parent e48abada
......@@ -20,6 +20,7 @@ FINDPYTHON(2.7 EXACT)
INSTALL(
FILES
${CMAKE_CURRENT_SOURCE_DIR}/hpp/gui/plugin.py
${CMAKE_CURRENT_SOURCE_DIR}/hpp/gui/parameters.py
${CMAKE_CURRENT_SOURCE_DIR}/hpp/gui/directpath.py
${CMAKE_CURRENT_SOURCE_DIR}/hpp/gui/graphutility.py
${CMAKE_CURRENT_SOURCE_DIR}/hpp/gui/findGrasp.py
......
from PythonQt import QtGui, Qt, QtCore
_NAME=0
_VALUE=1
_TYPE=2
_DOCUMENTATION=3
class Parameters(QtGui.QWidget):
def __init__(self, plugin):
super(Parameters, self).__init__(plugin)
self.plugin = plugin
box = QtGui.QVBoxLayout(self)
# Button to refresh
button = QtGui.QPushButton(QtGui.QIcon.fromTheme("view-refresh"), "Refresh list", self)
button.connect("clicked()", self.refresh)
box.addWidget(button)
# Table view to show the parameters
self.tableWidget = QtGui.QTableWidget ()
#self.tableWidget.setColumnCount(3)
#self.tableWidget.setHorizontalHeaderLabels(("Name", "Description", "Value"))
self.tableWidget.setColumnCount(3)
self.tableWidget.setHorizontalHeaderLabels(("Name", "Value", "Type"))
box.addWidget (self.tableWidget)
def refresh(self):
defaultParams = self.plugin.client.problem.getAvailable('defaultparameter')
params = self.plugin.client.problem.getAvailable('parameter')
self.tableWidget.setRowCount (len(defaultParams))
for i, p in enumerate(defaultParams):
pdoc = self.plugin.client.problem.getParameterDoc(p)
pval = self.plugin.client.problem.getParameter(p)
if self.tableWidget.item(i, _NAME) is None:
# initialize the row
self.tableWidget.setItem(i, _NAME , QtGui.QTableWidgetItem (p))
#self.tableWidget.setItem(i, _DOCUMENTATION, QtGui.QTableWidgetItem (pdoc))
self.tableWidget.setItem(i, _VALUE , QtGui.QTableWidgetItem (str(pval.value())))
self.tableWidget.setItem(i, _TYPE , QtGui.QTableWidgetItem (str(pval.typecode())))
else:
self.tableWidget.item(i, _NAME ).setText (p)
#self.tableWidget.item(i, _DOCUMENTATION).text = pdoc
self.tableWidget.item(i, _VALUE ).setText (str(pval.value()))
self.tableWidget.item(i, _TYPE ).setText (str(pval.typecode()))
self.tableWidget.item(i, _NAME ).setToolTip (pdoc)
......@@ -11,6 +11,7 @@ from directpath import DirectPathBox
from findGrasp import GraspFinder
from inspector import InspectBodies
from collision_pairs import CollisionPairs
from .parameters import Parameters
class _PathTab(QtGui.QWidget):
def __init__ (self, parent):
......@@ -183,6 +184,7 @@ class Plugin(QtGui.QDockWidget):
self.tabWidget.addTab (_PathManagement(self), "Paths management")
self.tabWidget.addTab (InspectBodies(self), "Inspector")
self.tabWidget.addTab (CollisionPairs(self), "Collision pairs")
self.tabWidget.addTab (Parameters(self), "Parameters")
def resetConnection(self):
self.client = Client(url= str(self.hppPlugin.getHppIIOPurl()),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment