Macro Mouse Cross/fr: Difference between revisions

From FreeCAD Documentation
(create page)
 
(Updating to match new version of source page)
Line 1: Line 1:
{{Macro/fr|Icon=Text-x-python|Name=Macro_Mouse_Cross||Name/fr=Macro_Mouse_Cross|Description=Cette macro change la forme de la souris en une croix de précision.|Shortcut="C" "A" |Author=Mario52}}
{{Macro|Icon=Text-x-python|Name=Macro_Mouse_Cross|Description=This macro turns the arrow of the mouse in a precision cross.|Shortcut="C" "A" |Author=Mario52}}


==Description==
==Description==
This small macro turns the arrow of the mouse in a precision cross.<br />

Small example of using the class '''ViewObserver()''' and the use of the keyboard with '''[[Code_snippets#Observing_mouse_events_in_the_3D_viewer_via_Python|SoKeyboardEvent]]'''
Cette macro change la forme de la souris en une croix de précision..<br />
Petit exemple d'utilisation de la class '''ViewObserver()''' et de l'utilisation du clavier avec '''[[Code_snippets/fr#Observation_des_.C3.A9v.C3.A8nements_de_la_souris_dans_la_vue_3D_via_Python|SoKeyboardEvent]]'''


[[File:Macro_Mouse_Cross_00.png|480px|Macro_Mouse_Cross]]
[[File:Macro_Mouse_Cross_00.png|480px|Macro_Mouse_Cross]]
{{clear}}
{{clear}}


==Utilisation==
==How to use==
# Press the {{KEY|C}} button to activate the cross.

# Pressez la touche {{KEY|C}} pour activer la croix.
# Press the {{KEY|A}} button to activate the arrow.
# Pressez la touche {{KEY|A}} pour activer la flèche.


==Script==
==Script==

Macro_Mouse_Cross.FCMacro
Macro_Mouse_Cross.FCMacro


Line 37: Line 34:


</syntaxhighlight>
</syntaxhighlight>
===Cursors that can be used===

===Les curseurs pouvant être utilisés===

ArrowCursor, UpArrowCursor, CrossCursor, WaitCursor, IBeamCursor, SizeVerCursor, SizeHorCursor
ArrowCursor, UpArrowCursor, CrossCursor, WaitCursor, IBeamCursor, SizeVerCursor, SizeHorCursor
SizeBDiagCursor, SizeFDiagCursor, SizeAllCursor, BlankCursor, SplitVCursor, SplitHCursor
SizeBDiagCursor, SizeFDiagCursor, SizeAllCursor, BlankCursor, SplitVCursor, SplitHCursor
PointingHandCursor, ForbiddenCursor, OpenHandCursor, ClosedHandCursor, WhatsThisCursor, BusyCursor, BitmapCursor
PointingHandCursor, ForbiddenCursor, OpenHandCursor, ClosedHandCursor, WhatsThisCursor, BusyCursor, BitmapCursor
==Limitation==

The cursor can change appearance depending on the used Workbench, he must repeat the operation.<br />
==Limitations==
The cursor can be subtituer to the other sliders (ex: expansion of a window, corner...).<br />

The rest resident macro.
Le curseur peut changer d'apparence suivant l'établi utilisé, il faut alors répéter l’opération.<br />
Le curseur peut se substituer aux autre curseurs (ex: lors de l'agrandissement d'une fenêtre, coins...).<br />
La macro reste résidente.


{{languages/fr | {{en|Macro_Mouse_Cross}} {{it|Macro_Mouse_Cross/it}} }}


[[Category:Poweruser Documentation]]
[[Category:Poweruser Documentation]]
[[Category:Python Code]]
[[Category:Python Code]]
<languages/>

Revision as of 22:13, 2 February 2014

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
Macro Version
1.0
Date last modified
None
FreeCAD Version(s)
None
Default shortcut
"C" "A"
See also
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

Macro_Mouse_Cross

How to use

  1. Press the C button to activate the cross.
  2. 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.