Ejemplo n.º 1
0
    def onKeyPressRepeat(self, event):

        consumed = frameupdater.handleKey(event)

        # prevent these keys from going to vtkRenderWindow's default key press handler
        key = str(event.text()).lower()
        consumed = key in ViewBehaviors.CONSUMED_KEYS

        if consumed:
            self.consumeEvent()
Ejemplo n.º 2
0
    def onKeyPressRepeat(self, event):

        consumed = frameupdater.handleKey(event)

        # prevent these keys from going to vtkRenderWindow's default key press handler
        key = str(event.text()).lower()
        consumed = key in ViewBehaviors.CONSUMED_KEYS

        if consumed:
            self.consumeEvent()
Ejemplo n.º 3
0
    def onKeyPressRepeat(self, event):

        consumed = frameupdater.handleKey(event)

        # prevent these keys from going to vtkRenderWindow's default key press handler
        key = str(event.text()).lower()
        if key in ['r', 's', 'w', 'l', '3']:
            consumed = True

        if consumed:
            self.consumeEvent()
Ejemplo n.º 4
0
    def filterEvent(self, obj, event):

        consumed = False
        if event.type() == QtCore.QEvent.KeyPress and not event.isAutoRepeat():
            key = str(event.text()).lower()
            if key == 'f':
                zoomToPick(self.getCursorDisplayPosition(), self.view)
                consumed = True
            elif key == 'r':
                consumed = True
                if robotModel is not None:
                    resetCameraToRobot(self.view)
                else:
                    self.view.resetCamera()
                    self.view.render()
            elif key == 's':
                consumed = True
                if handFactory is not None:
                    side = 'left' if event.modifiers() != QtCore.Qt.ShiftModifier else 'right'
                    placeHandModel(self.getCursorDisplayPosition(), self.view, side)
            elif key == 'n':
                if neckDriver:
                    neckDriver.activateNeckControl()

            elif key in ['0', '1', '2', '3']:
                if neckDriver:
                    consumed = neckDriver.applyNeckPitchPreset(int(key))

            if key == '3':
                # block vtk keypress handler 3d mode
                consumed = True

        elif event.type() == QtCore.QEvent.KeyRelease and not event.isAutoRepeat():
            if str(event.text()).lower() == 'n':
                if neckDriver:
                    neckDriver.deactivateNeckControl()
        
        if event.type() == QtCore.QEvent.KeyPress and not consumed:
            consumed = frameupdater.handleKey(event)


        self.eventFilter.setEventHandlerResult(consumed)