Makro Křížek myši
File:Text-x-python Macro_Mouse_Cross |
Description |
---|
This macro turns the arrow of the mouse in a precision cross. Author: Mario52 |
Author |
Mario52 |
Download |
None |
Links |
Macros recipes How to install macros How to customize toolbars |
Macro Version |
1.0 |
Date last modified |
None |
FreeCAD Version(s) |
None |
Default shortcut |
"C" "A" |
See also |
None |
Popis
Toto malé makro mění šipku kurzoru myši na jemný křížek.
Malý příklad použití třídy ViewObserver() a použití klávesnice 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.