コード例 #1
0
def init(view, imageWidget, robotName=""):
    global panels
    global docks

    if "panels" not in globals():
        panels = {}
    if "docks" not in globals():
        docks = {}

    panel = ScreenGrabberPanel(view, imageWidget)
    action = app.addDockAction(
        "ActionScreenGrabberPanel" + robotName,
        "Screen Grabber",
        os.path.join(os.path.dirname(__file__), "images/video_record.png"),
        append=True,
    )
    dock = app.addWidgetToDock(panel.widget,
                               action=action,
                               associatedRobotName=robotName)
    app.getRobotSelector().associateWidgetWithRobot(action, robotName)

    dock.hide()

    panels[robotName] = panel
    docks[robotName] = dock

    return panel
コード例 #2
0
ファイル: cameraview.py プロジェクト: ori-drs/director
    def initView(self, view):
        # Must call the createview function with the robot name so that the view can be associated, but cannot pass
        # keyword arguments to python_qt functions so need to also pass the -1 to add the tab to the end of the list
        # rather than insert it.
        self.view = view or app.getViewManager().createView(
            self.viewName, "VTK View", -1, self.robotName)
        app.getRobotSelector().associateViewWithRobot(self.view,
                                                      self.robotName)
        self.view.installImageInteractor()
        # self.interactorStyle = self.view.renderWindow().GetInteractor().GetInteractorStyle()
        # self.interactorStyle.AddObserver('SelectionChangedEvent', self.onRubberBandPick)

        self.imageActor = vtk.vtkImageActor()
        self.imageActor.SetInputData(self.getImage())
        self.imageActor.SetVisibility(False)
        self.view.renderer().AddActor(self.imageActor)

        self.view.orientationMarkerWidget().Off()
        self.view.backgroundRenderer().SetBackground(0, 0, 0)
        self.view.backgroundRenderer().SetBackground2(0, 0, 0)

        self.timerCallback = TimerCallback()
        self.timerCallback.targetFps = 60
        self.timerCallback.callback = self.updateView
        self.timerCallback.start()
コード例 #3
0
ファイル: cameraview.py プロジェクト: ori-drs/director
    def initView(self, view):
        # Must call the createview function with the robot name so that the view can be associated, but cannot pass
        # keyword arguments to python_qt functions so need to also pass the -1 to add the tab to the end of the list
        # rather than insert it.
        self.view = view or app.getViewManager().createView(
            "Camera View", "VTK View", -1, self.robotName)
        app.getRobotSelector().associateViewWithRobot(self.view,
                                                      self.robotName)
        self.renderers = [self.view.renderer()]
        renWin = self.view.renderWindow()
        renWin.SetNumberOfLayers(3)
        for i in [1, 2]:
            ren = vtk.vtkRenderer()
            ren.SetLayer(2)
            ren.SetActiveCamera(self.view.camera())
            renWin.AddRenderer(ren)
            self.renderers.append(ren)

        def applyCustomBounds():
            self.view.addCustomBounds([-100, 100, -100, 100, -100, 100])

        self.view.connect("computeBoundsRequest(ddQVTKWidgetView*)",
                          applyCustomBounds)

        app.setCameraTerrainModeEnabled(self.view, True)
        self.resetCamera()
コード例 #4
0
ファイル: tasklaunchpanel.py プロジェクト: ori-drs/director
def init(widgetMap, robotName=""):
    global panels

    if "panels" not in globals():
        panels = {}

    import os

    panel = TaskLaunchPanel(widgetMap)
    action = app.addDockAction(
        "ActionTaskLauncher" + robotName,
        "Task Launcher",
        os.path.join(os.path.dirname(__file__), "images/task_icon.png"),
        append=True,
    )
    action.connect("triggered()", panel.showTaskLaunchPanel)
    app.getRobotSelector().associateWidgetWithRobot(action, robotName)

    panels[robotName] = panel

    return panel
コード例 #5
0
ファイル: viewbehaviors.py プロジェクト: xijunke/director-1
def getContextMenuActions(view, pickedObj, pickedPoint):
    actions = []

    robotName = applogic.getRobotSelector().selectedRobotName()
    # TODO replace iteritems with items in python3
    for contextName, actionList in _contextMenuActions.iteritems():
        # Only return default menu items or the items associated with the currently selected robot
        if contextName == "" or contextName == robotName:
            for func in actionList:
                actions.extend(func(view, pickedObj, pickedPoint))

    return actions
コード例 #6
0
    # Iterate over all sources and reset time when reset button pressed
    def reset_sources_time():
        for source in robotSystem.sources:
            if hasattr(source, "resetTime"):
                source.resetTime()
            else:
                print(
                    "WARNING: source {} does not have a resetTime function. This is probably a mistake."
                    .format(source))

    reset_time_button.connect("clicked()", reset_sources_time)
    reset_time_button.connect(
        "clicked()", cameraview.cameraViews[robotSystem.robotName].resetTime)
    app.getMainWindow().statusBar().addPermanentWidget(reset_time_button)
    app.getRobotSelector().associateWidgetWithRobot(reset_time_button,
                                                    robotSystem.robotName)

    if useSkybox:
        skyboxDataDir = os.path.expanduser("~/Downloads/skybox")
        imageMap = skybox.getSkyboxImages(skyboxDataDir)
        skyboxObjs = skybox.createSkybox(imageMap, view)
        skybox.connectSkyboxCamera(view)

    robotHighlighter = RobotLinkHighlighter(robotSystem.robotStateModel)

    if useDataFiles:

        for filename in drcargs.args().data_files:
            actionhandlers.onOpenFile(filename)

    cameras = [