Macro Mouse Cross
File:Text-x-python Macro_Mouse_Cross |
Description |
---|
Cette macro change la forme de la souris en une croix de précision. Auteur: Mario52 |
Auteur |
Mario52 |
Téléchargement |
None |
Liens |
Page des macros Comment installer une macro Comment créer une barre d'outils |
Version Macro |
1.0 |
Dernière modification |
None |
Version(s) FreeCAD |
None |
Raccourci clavier |
"C" "A" |
Voir aussi |
None |
Description
This small macro turns the arrow of the mouse in a precision cross.
Small example of using the class ViewObserver() and the use of the keyboard with SoKeyboardEvent
How to use
- Press the C button to activate the cross.
- Press the A button to activate the arrow.
Script
Macro_Mouse_Cross.FCMacro
# -*- coding: utf-8 -*-
# Macro_Mouse_Cross mouse cursor to cross or arrow
from PyQt4 import QtCore, QtGui
class ViewObserver:
def logPosition(self, info):
self.pos = info["Key"]
if (self.pos.upper() == "C"):
# change the cursor cross ( + )
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.CrossCursor))
elif (self.pos.upper() == "A"):
# change the cursor Arrow
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
v=Gui.activeDocument().activeView()
o = ViewObserver()
c = v.addEventCallback("SoKeyboardEvent",o.logPosition)
Cursors that can be used
ArrowCursor, UpArrowCursor, CrossCursor, WaitCursor, IBeamCursor, SizeVerCursor, SizeHorCursor SizeBDiagCursor, SizeFDiagCursor, SizeAllCursor, BlankCursor, SplitVCursor, SplitHCursor PointingHandCursor, ForbiddenCursor, OpenHandCursor, ClosedHandCursor, WhatsThisCursor, BusyCursor, BitmapCursor
Limitation
The cursor can change appearance depending on the used Workbench, he must repeat the operation.
The cursor can be subtituer to the other sliders (ex: expansion of a window, corner...).
The rest resident macro.