def setupUi(self): self.objectTree = QtGui.QTreeWidget() self.propertiesPanel = PythonQt.dd.ddPropertiesPanel() sidePanel = QtGui.QSplitter(QtCore.Qt.Vertical) sidePanel.addWidget(self.objectTree) sidePanel.addWidget(self.propertiesPanel) sidePanel.setSizes([6, 4]) om.init(self.objectTree, self.propertiesPanel) self.view = PythonQt.dd.ddQVTKWidgetView() lcmgl.init(self.view) self.view.backgroundRenderer().SetBackground(1,1,1) self.view.backgroundRenderer().SetBackground2(1,1,1) def setTextProperty(caption): prop = caption.GetCaptionTextProperty() prop.ShadowOff() prop.BoldOn() prop.ItalicOff() prop.SetColor(0,0,0) axesActor = self.view.orientationMarkerWidget().GetOrientationMarker() setTextProperty(axesActor.GetXAxisCaptionActor2D()) setTextProperty(axesActor.GetYAxisCaptionActor2D()) setTextProperty(axesActor.GetZAxisCaptionActor2D()) w = QtGui.QWidget() l = QtGui.QHBoxLayout(w) self.slider = QtGui.QSlider(QtCore.Qt.Horizontal) self.clearButton = QtGui.QPushButton('clear') self.zeroButton = QtGui.QPushButton('zero') l.addWidget(self.clearButton) l.addWidget(self.zeroButton) l.addWidget(self.slider) self.slider.connect(self.slider, 'valueChanged(int)', self.onSlider) self.slider.connect(self.zeroButton, 'clicked()', self.onZeroButtonClicked) self.slider.connect(self.clearButton, 'clicked()', self.onClearButtonClicked) ww = QtGui.QWidget() ll = QtGui.QVBoxLayout(ww) ll.addWidget(self.view) #ll.addWidget(w) ll.setMargin(0) splitter = QtGui.QSplitter() splitter.addWidget(sidePanel) splitter.addWidget(ww) splitter.setSizes([0, 1]) splitter.show() splitter.resize(800, 600) self.widget = splitter self.widget.setWindowTitle('Drake Viewer')
viewBackgroundLightHandler.action.trigger() if useHands: handcontrolpanel.init(lHandDriver, rHandDriver, robotStateModel, robotStateJointController, view) else: app.removeToolbarMacro('ActionHandControlPanel') if useFootsteps: footstepsPanel = footstepsdriverpanel.init(footstepsDriver, robotStateModel, robotStateJointController, irisDriver) else: app.removeToolbarMacro('ActionFootstepPanel') if useLCMGL: lcmglManager = lcmgl.init(view) app.MenuActionToggleHelper('Tools', 'Renderer - LCM GL', lcmglManager.isEnabled, lcmglManager.setEnabled) if useOctomap: octomapManager = lcmoctomap.init(view) app.MenuActionToggleHelper('Tools', 'Renderer - Octomap', octomapManager.isEnabled, octomapManager.setEnabled) if useCollections: collectionsManager = lcmcollections.init(view) app.MenuActionToggleHelper('Tools', 'Renderer - Collections', collectionsManager.isEnabled, collectionsManager.setEnabled) if useDrakeVisualizer: drakeVisualizer = drakevisualizer.DrakeVisualizer(view) app.MenuActionToggleHelper('Tools', 'Renderer - Drake', drakeVisualizer.isEnabled, drakeVisualizer.setEnabled)
if useHands: handcontrolpanel.init(lHandDriver, rHandDriver, robotStateModel, robotStateJointController, view) else: app.removeToolbarMacro('ActionHandControlPanel') if useFootsteps: footstepsPanel = footstepsdriverpanel.init(footstepsDriver, robotStateModel, robotStateJointController, irisDriver) else: app.removeToolbarMacro('ActionFootstepPanel') if useLCMGL: lcmglManager = lcmgl.init(view) app.MenuActionToggleHelper('Tools', 'Renderer - LCM GL', lcmglManager.isEnabled, lcmglManager.setEnabled) if useOctomap: octomapManager = lcmoctomap.init(view) app.MenuActionToggleHelper('Tools', 'Renderer - Octomap', octomapManager.isEnabled, octomapManager.setEnabled) if useCollections: collectionsManager = lcmcollections.init(view) app.MenuActionToggleHelper('Tools', 'Renderer - Collections', collectionsManager.isEnabled, collectionsManager.setEnabled)
def setupUi(self): self.objectTree = QtGui.QTreeWidget() self.propertiesPanel = PythonQt.dd.ddPropertiesPanel() sidePanel = QtGui.QSplitter(QtCore.Qt.Vertical) sidePanel.addWidget(self.objectTree) sidePanel.addWidget(self.propertiesPanel) sidePanel.setSizes([6, 4]) om.init(self.objectTree, self.propertiesPanel) self.view = PythonQt.dd.ddQVTKWidgetView() lcmgl.init(self.view) self.view.backgroundRenderer().SetBackground(1, 1, 1) self.view.backgroundRenderer().SetBackground2(1, 1, 1) def setTextProperty(caption): prop = caption.GetCaptionTextProperty() prop.ShadowOff() prop.BoldOn() prop.ItalicOff() prop.SetColor(0, 0, 0) axesActor = self.view.orientationMarkerWidget().GetOrientationMarker() setTextProperty(axesActor.GetXAxisCaptionActor2D()) setTextProperty(axesActor.GetYAxisCaptionActor2D()) setTextProperty(axesActor.GetZAxisCaptionActor2D()) w = QtGui.QWidget() l = QtGui.QHBoxLayout(w) self.slider = QtGui.QSlider(QtCore.Qt.Horizontal) self.clearButton = QtGui.QPushButton('clear') self.zeroButton = QtGui.QPushButton('zero') l.addWidget(self.clearButton) l.addWidget(self.zeroButton) l.addWidget(self.slider) self.slider.connect(self.slider, 'valueChanged(int)', self.onSlider) self.slider.connect(self.zeroButton, 'clicked()', self.onZeroButtonClicked) self.slider.connect(self.clearButton, 'clicked()', self.onClearButtonClicked) ww = QtGui.QWidget() ll = QtGui.QVBoxLayout(ww) ll.addWidget(self.view) #ll.addWidget(w) ll.setMargin(0) splitter = QtGui.QSplitter() splitter.addWidget(sidePanel) splitter.addWidget(ww) splitter.setSizes([0, 1]) splitter.show() splitter.resize(800, 600) self.widget = splitter self.widget.setWindowTitle('Drake Viewer')