예제 #1
0
def addWidgetToDock(widget,
                    dockArea=QtCore.Qt.RightDockWidgetArea,
                    action=None,
                    associatedRobotName=""):
    """
    This function adds the given widget to the specified dock area. The widgets can then be accesses by clicking the
    icon. It also adds the widgets to the view menu

    :param widget: The widget to add
    :param dockArea: The dock area to which the widget should be added
    :param action: The action associated with the widget, which is required for it to work TODO: what is the actual relationship
    :param associatedRobotName: The name of the robot associated with this action. This is used to set the name of
    the submenu of the view menu to which this widget will also be added
    :return:
    """
    dock = QtGui.QDockWidget()
    dock.setWidget(widget)
    dock.setWindowTitle(widget.windowTitle)
    getMainWindow().addDockWidget(dockArea, dock)

    if dockArea == QtCore.Qt.RightDockWidgetArea and action:
        if action in _exclusiveDockWidgets:
            _exclusiveDockWidgets[action].append((dock, widget))
        else:
            _exclusiveDockWidgets[action] = [(dock, widget)]
        action.connect("triggered()",
                       functools.partial(hideDockWidgets, action))

    if action is None:
        getMainWindow().addWidgetToViewMenu(dock, associatedRobotName)
    else:
        getMainWindow().addWidgetToViewMenu(dock, action, associatedRobotName)

    return dock
 def addWidgetToDock(self, widget, dockArea, visible=True):
     dock = QtGui.QDockWidget()
     dock.setWidget(widget)
     dock.setWindowTitle(widget.windowTitle)
     dock.setObjectName(widget.windowTitle + ' Dock')
     dock.setVisible(visible)
     self.mainWindow.addDockWidget(dockArea, dock)
     self.addWidgetToViewMenu(dock)
     return dock
예제 #3
0
def addWidgetToDock(widget, dockArea=QtCore.Qt.RightDockWidgetArea, action=None):

    dock = QtGui.QDockWidget()
    dock.setWidget(widget)
    dock.setWindowTitle(widget.windowTitle)
    getMainWindow().addDockWidget(dockArea, dock)

    if dockArea == QtCore.Qt.RightDockWidgetArea and action:
        _exclusiveDockWidgets[action] = (dock, widget)
        action.connect('triggered()', functools.partial(hideDockWidgets, action))

    if action is None:
        getMainWindow().addWidgetToViewMenu(dock)
    else:
        getMainWindow().addWidgetToViewMenu(dock, action)


    return dock
예제 #4
0
 def addWidgetToDock(self, widget, dockArea):
     dock = QtGui.QDockWidget()
     dock.setWidget(widget)
     dock.setWindowTitle(widget.windowTitle)
     self.mainWindow.addDockWidget(dockArea, dock)
     return dock
예제 #5
0
view = app.createView()
view.show()
view.resize(1080, 768)
robotSystem = robotsystem.create(view)

widget = LinkWidget(view, robotSystem.robotStateModel)
widget.start()

app.viewOptions.setProperty('Gradient background', False)
app.viewOptions.setProperty('Background color', [1,1,1])
app.viewOptions.setProperty('Orientation widget', False)
app.gridObj.setProperty('Color', [0,0,0])
app.gridObj.setProperty('Surface Mode', 'Surface with edges')


w = ForcesPanel()

m = QtGui.QMainWindow()
m.setCentralWidget(view)
dock = QtGui.QDockWidget()
dock.setWindowTitle('Forces panel')
dock.setWidget(w.widget)

m.addDockWidget(QtCore.Qt.RightDockWidgetArea, dock)
m.resize(1080, 768)
m.show()



app.start()