Macro Mouse Cross/cs: Difference between revisions

From FreeCAD Documentation
(Updating to match new version of source page)
No edit summary
Line 8: Line 8:
{{clear}}
{{clear}}


==Použití==
==How to use==
# Stiskněte klávesu {{KEY|C}} pro aktivaci křížku.
# Press the {{KEY|C}} button to activate the cross.
# Stiskněte klávesu {{KEY|A}} pro aktivaci šipky.
# Press the {{KEY|A}} button to activate the arrow.
# Press the {{KEY|G}} button to activate the grid.


===Skript===
===Skript===
Line 42: Line 43:
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
==Omezení==
==Limitation==
The cursor can change appearance depending on the used Workbench, he must repeat the operation.<br />
Kurzor může měnit vzhled v závislosti na používané pracovní ploše, musí opakovat funkci.<br />
The cursor can be subtituer to the other sliders (ex: expansion of a window, corner...).<br />

The grid is permanent.<br />
The cursor can be subtitued to the other sliders (ex: expansion of a window, corner...).<br />
The rest resident macro.
The rest resident macro.


[[Category:Poweruser Documentation|Kategorie:Dokumentace pokročilého uživatele]]
[[Category:Poweruser Documentation/cs]]
[[Category:Python Code|Kategorie:Python kódy]]
[[Category:Python Code/cs]]
<languages/>
<languages/>

Revision as of 18:24, 14 May 2014

File:Text-x-python Macro_Mouse_Cross

Description
Toto malé makro mění šipku kurzoru myši na jemný křížek.

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

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

Macro_Mouse_Cross

How to use

  1. Press the C button to activate the cross.
  2. Press the A button to activate the arrow.
  3. Press the G button to activate the grid.

Skript

Macro_Mouse_Cross.FCMacro

# -*- coding: utf-8 -*-
# mouse cursor to Cross or Arrow + Grig 
from PyQt4 import QtCore, QtGui
from pivy import coin
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))
       elif (self.pos.upper() == "G"):
           # "wmayer" http://forum.freecadweb.org/viewtopic.php?f=3&t=1065&hilit=cross#p8818
           # Create Grid
           grid=coin.SoType.fromName("SoDrawingGrid").createInstance()
           Gui.ActiveDocument.ActiveView.getSceneGraph().addChild(grid)
v=Gui.activeDocument().activeView()
o = ViewObserver()
c = v.addEventCallback("SoKeyboardEvent",o.logPosition)

Kurzory, které mohou být používány

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 grid is permanent.
The rest resident macro.