def mousePressEvent(self, event): ''' Inform the scene viewer of a mouse press event. ''' self._handle_mouse_events = False # Track when the zinc should be handling mouse events if not self._ignore_mouse_events and (event.modifiers() & self._editModifier) and \ (self._nodeEditMode or self._nodeEditVectorMode or self._nodeCreateMode) and \ button_map[event.button()] == Sceneviewerinput.BUTTON_TYPE_LEFT: return_code, selectedNode, selectedCoordinateField, selectedGraphics = \ self.nodeIsSelectedAtCoordinates(event.x(), event.y()) if return_code: self._nodeEditInfo._node = selectedNode self._nodeEditInfo._coordinateField = selectedCoordinateField self._nodeEditInfo._graphics = selectedGraphics self._selection_position_start = (event.x(), event.y()) if self._nodeEditMode: self._selection_mode = SelectionMode.EDIT_POSITION else: attributes = self._nodeEditInfo._graphics.getGraphicspointattributes() if attributes.isValid(): self._nodeEditInfo._orientationField = attributes.getOrientationScaleField() if self._nodeEditInfo._orientationField and self._nodeEditInfo._orientationField.isValid(): self._selection_mode = SelectionMode.EDIT_VECTOR return_code, self._nodeEditInfo._glyphCentre = attributes.getGlyphOffset(3) return_code, self._nodeEditInfo._glyphSize = attributes.getBaseSize(3) return_code, self._nodeEditInfo._glyphScaleFactors = attributes.getScaleFactors(3) self._nodeEditInfo._variableScaleField = attributes.getSignedScaleField() elif self._nodeCreateMode: self._selection_mode = SelectionMode.CREATE else: SelectionSceneviewerWidget.mousePressEvent(self, event)
def mousePressEvent(self, event): ''' Inform the scene viewer of a mouse press event. ''' self._handle_mouse_events = False # Track when the zinc should be handling mouse events if not self._ignore_mouse_events and (event.modifiers() & self._editModifier) and \ (self._nodeEditMode or self._nodeEditVectorMode or self._nodeCreateMode) and \ button_map[event.button()] == Sceneviewerinput.BUTTON_TYPE_LEFT: return_code, selectedNode, selectedCoordinateField, selectedGraphics = \ self.nodeIsSelectedAtCoordinates(event.x(), event.y()) if return_code: self._nodeEditInfo._node = selectedNode self._nodeEditInfo._coordinateField = selectedCoordinateField self._nodeEditInfo._graphics = selectedGraphics self._selection_position_start = (event.x(), event.y()) if self._nodeEditMode: self._selection_mode = SelectionMode.EDIT_POSITION else: attributes = self._nodeEditInfo._graphics.getGraphicspointattributes( ) if attributes.isValid(): self._nodeEditInfo._orientationField = attributes.getOrientationScaleField( ) if self._nodeEditInfo._orientationField and self._nodeEditInfo._orientationField.isValid( ): self._selection_mode = SelectionMode.EDIT_VECTOR return_code, self._nodeEditInfo._glyphCentre = attributes.getGlyphOffset( 3) return_code, self._nodeEditInfo._glyphSize = attributes.getBaseSize( 3) return_code, self._nodeEditInfo._glyphScaleFactors = attributes.getScaleFactors( 3) self._nodeEditInfo._variableScaleField = attributes.getSignedScaleField( ) elif self._nodeCreateMode: self._selection_mode = SelectionMode.CREATE else: SelectionSceneviewerWidget.mousePressEvent(self, event)