Esempio n. 1
0
    def setTrackMode(self, mode):
        self.trackerManager.setTrackerMode(mode)

        clearLayout(self.ui.actionsFrame)
        actions = self.trackerManager.getModeActions()

        for actionName in actions:

            def newActionButton(actionName):
                actionButton = QtGui.QPushButton(actionName)

                def onAction():
                    self.trackerManager.onModeAction(actionName)

                actionButton.connect('clicked()', onAction)
                return actionButton

            self.ui.actionsFrame.layout().addWidget(
                newActionButton(actionName))

        self.propertiesPanel.clear()
        if self.panelConnector:
            self.panelConnector.cleanup()
            self.panelConnector = None

        properties = self.trackerManager.getModeProperties()
        if properties:
            self.panelConnector = propertyset.PropertyPanelConnector(
                properties, self.propertiesPanel)
Esempio n. 2
0
 def _setupPropertiesPanel(self):
     l = QtGui.QVBoxLayout(self.ui.propertyFrame)
     l.setMargin(0)
     self.propertiesPanel = PythonQt.dd.ddPropertiesPanel()
     self.propertiesPanel.setBrowserModeToWidget()
     l.addWidget(self.propertiesPanel)
     self.panelConnector = propertyset.PropertyPanelConnector(self.params.properties, self.propertiesPanel)
Esempio n. 3
0
def main():

    obj = om.ObjectModelItem('test')
    obj.addProperty('double',
                    1.0,
                    attributes=om.PropertyAttributes(decimals=2,
                                                     minimum=0,
                                                     maximum=100,
                                                     singleStep=0.5))
    obj.addProperty('double list', [1.0, 2.0, 3.0],
                    attributes=om.PropertyAttributes(decimals=2,
                                                     minimum=0,
                                                     maximum=100,
                                                     singleStep=0.5))

    obj.addProperty('int',
                    1,
                    attributes=om.PropertyAttributes(minimum=0,
                                                     maximum=100,
                                                     singleStep=5))
    obj.addProperty('int list', [1, 2, 3],
                    attributes=om.PropertyAttributes(minimum=0,
                                                     maximum=100,
                                                     singleStep=1))

    obj.addProperty('bool', True)

    obj.addProperty('str', 'value')

    obj.addProperty('str list',
                    0,
                    attributes=om.PropertyAttributes(
                        enumNames=['value 1', 'value 2', 'value 3']))

    obj.addProperty('color', [1.0, 0.5, 0.0])

    panel = PythonQt.dd.ddPropertiesPanel()
    panel.setBrowserModeToWidget()
    panel.show()

    panelConnector = propertyset.PropertyPanelConnector(obj.properties, panel)

    def onPropertyChanged(propertySet, propertyName):
        obj.properties.setPropertyAttribute('str list', 'enumNames',
                                            ['one', 'two', 'three'])

    obj.properties.connectPropertyChanged(onPropertyChanged)
    obj.setProperty('bool', False)

    assert 'one' in obj.properties.getPropertyAttribute(
        'str list', 'enumNames')

    _pythonManager.consoleWidget().show()
    startApplication(enableQuitTimer=True)
    def _setupPropertiesPanel(self):

        propertyNames = self.driver.params.propertyNames()

        l = QtGui.QGridLayout(self.ui.paramsOneContainer)
        l.setMargin(0)
        self.propertiesPanel = PythonQt.dd.ddPropertiesPanel()
        self.propertiesPanel.setBrowserModeToWidget()
        l.addWidget(self.propertiesPanel)
        self.panelConnector = propertyset.PropertyPanelConnector(
            self.driver.params.properties, self.propertiesPanel,
            propertyNames[0:15])
        l = QtGui.QGridLayout(self.ui.paramsTwoContainer)
        l.setMargin(0)
        self.propertiesPanel = PythonQt.dd.ddPropertiesPanel()
        self.propertiesPanel.setBrowserModeToWidget()
        l.addWidget(self.propertiesPanel)
        self.panelConnector = propertyset.PropertyPanelConnector(
            self.driver.params.properties, self.propertiesPanel,
            propertyNames[15:])
        self.driver.params.properties.connectPropertyChanged(
            self.onPropertyChanged)
Esempio n. 5
0
def showRightClickMenu(displayPoint, view):

    pickedObj, pickedPoint = vis.findPickedObject(displayPoint, view)
    if not pickedObj:
        return

    objectName = pickedObj.getProperty('Name')
    if objectName == 'grid':
        return

    objectName = getShortenedName(objectName)

    displayPoint = displayPoint[0], view.height - displayPoint[1]

    globalPos = view.mapToGlobal(QtCore.QPoint(*displayPoint))

    menu = QtGui.QMenu(view)

    widgetAction = QtGui.QWidgetAction(menu)
    label = QtGui.QLabel('<b>%s</b>' % objectName)
    label.setContentsMargins(9, 9, 6, 6)
    widgetAction.setDefaultWidget(label)
    menu.addAction(widgetAction)
    menu.addSeparator()

    propertiesPanel = PythonQt.dd.ddPropertiesPanel()
    propertiesPanel.setBrowserModeToWidget()
    panelConnector = propertyset.PropertyPanelConnector(
        pickedObj.properties, propertiesPanel)

    def onMenuHidden():
        panelConnector.cleanup()

    menu.connect('aboutToHide()', onMenuHidden)

    propertiesMenu = menu.addMenu('Properties')
    propertiesWidgetAction = QtGui.QWidgetAction(propertiesMenu)
    propertiesWidgetAction.setDefaultWidget(propertiesPanel)
    propertiesMenu.addAction(propertiesWidgetAction)

    actions = getContextMenuActions(view, pickedObj, pickedPoint)

    for actionName, func in actions:
        if not actionName:
            menu.addSeparator()
        else:
            action = menu.addAction(actionName)
            action.connect('triggered()', func)

    selectedAction = menu.popup(globalPos)