A little cleanup

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33054 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2005-03-25 20:16:27 +00:00
parent 818f944269
commit 8bd882eec1
3 changed files with 48 additions and 49 deletions

View File

@@ -1,6 +1,5 @@
#******************* #*******************
#By Daniel Pozmanter #By Daniel Pozmanter
#Under the GPL, etc, etc.
#Thanks to Robin Dunn for taking the time to show me how to do this #Thanks to Robin Dunn for taking the time to show me how to do this
#via the mailing list. #via the mailing list.
@@ -9,7 +8,7 @@
#This is a hacked version of DragAndDrop.py from the wxPython demo 2.5.2.8 #This is a hacked version of DragAndDrop.py from the wxPython demo 2.5.2.8
import wx, wx.stc, wx.lib.dialogs import wx, wx.lib.dialogs
from wx.lib.gestures import MouseGestures from wx.lib.gestures import MouseGestures
#ToDo: #ToDo:
@@ -32,7 +31,8 @@ class TestPanel(wx.Panel):
#Mouse Gestures: #Mouse Gestures:
self.mg = MouseGestures(self, Auto=True) self.mg = MouseGestures(self, Auto=True,
MouseButton=wx.MOUSE_BTN_RIGHT)
self.mg.SetGesturesVisible(True) self.mg.SetGesturesVisible(True)
@@ -62,8 +62,6 @@ class TestPanel(wx.Panel):
text.SetSize(wx.Size(w,h+1)) text.SetSize(wx.Size(w,h+1))
text.SetForegroundColour(wx.BLUE) text.SetForegroundColour(wx.BLUE)
self.SetBackgroundColour(wx.WHITE)
#Sizer: #Sizer:
outsideSizer = wx.BoxSizer(wx.VERTICAL) outsideSizer = wx.BoxSizer(wx.VERTICAL)
@@ -134,7 +132,8 @@ class TestPanel(wx.Panel):
def OnChangeMouseButton(self, event): def OnChangeMouseButton(self, event):
choices = [wx.MOUSE_BTN_LEFT, wx.MOUSE_BTN_MIDDLE, wx.MOUSE_BTN_RIGHT] choices = [wx.MOUSE_BTN_LEFT, wx.MOUSE_BTN_MIDDLE, wx.MOUSE_BTN_RIGHT]
schoices = ['Left', 'Middle', 'Right'] schoices = ['Left', 'Middle', 'Right']
d = wx.SingleChoiceDialog(self, "Set Mouse Button To", "Change Mouse Button", schoices, wx.OK|wx.CANCEL) d = wx.SingleChoiceDialog(self, "Set Mouse Button To", "Change Mouse Button", schoices,
wx.CHOICEDLG_STYLE|wx.OK|wx.CANCEL)
d.SetSize(wx.Size(250, 200)) d.SetSize(wx.Size(250, 200))
answer = d.ShowModal() answer = d.ShowModal()
i = d.GetSelection() i = d.GetSelection()

View File

@@ -83,7 +83,6 @@ class MultipleChoiceDialog(wx.Dialog):
self.SetSizer(dlgsizer) self.SetSizer(dlgsizer)
self.SetAutoLayout(1)
self.lst = lst self.lst = lst
self.Layout() self.Layout()

View File

@@ -7,57 +7,58 @@
#Released under the terms of the wxWindows License. #Released under the terms of the wxWindows License.
#This is a class to add Mouse Gestures to a program. """
#It can be used in two ways: This is a class to add Mouse Gestures to a program.
# It can be used in two ways:
#1. Automatic:
# Automatically runs mouse gestures.
# You need to set the gestures, and their associated actions,
# as well as the Mouse Button/Modifiers to use.
#
#2. Manual:
# Same as above, but you do not need to set the mouse button/modifiers.
# You can launch this from events as you wish.
#
#An example is provided in the demo.
#The parent window is where the mouse events will be recorded.
#(So if you want to record them in a pop up window, use manual mode,
#and set the pop up as the parent).
#
#Start() starts recording mouse movement.
#End() stops the recording, compiles all the gestures into a list,
#and looks through the registered gestures to find a match.
#The first matchs associated action is then run.
#The marginoferror is how much to forgive when calculating movement: 1. Automatic:
#If the margin is 25, then movement less than 25 pixels will not be detected. Automatically runs mouse gestures.
You need to set the gestures, and their associated actions,
as well as the Mouse Button/Modifiers to use.
#Recognized: L, R, U, D, 1, 3, 7, 9 2. Manual:
Same as above, but you do not need to set the mouse button/modifiers.
You can launch this from events as you wish.
#Styles: Manual (Automatic By Default), DisplayNumbersForDiagonals (Off By Default). An example is provided in the demo.
#Not Yet Implemented The parent window is where the mouse events will be recorded.
(So if you want to record them in a pop up window, use manual mode,
and set the pop up as the parent).
#The criteria for a direction is as follows: Start() starts recording mouse movement.
#x in a row. (Where x is the WobbleTolerance). End() stops the recording, compiles all the gestures into a list,
#So if the WobbleTolerance is 9 and looks through the registered gestures to find a match.
# 'URUUUUUUUUUUUUUUURUURUUUU1' is Up. The first matchs associated action is then run.
#The higher this number, the less sensitive this class is. The marginoferror is how much to forgive when calculating movement:
#So the more likely something like 1L will translate to 1. If the margin is 25, then movement less than 25 pixels will not be detected.
#This is good, since the mouse does tend to wobble somewhat, Recognized: L, R, U, D, 1, 3, 7, 9
#and a higher number allows for this.
#To change this, use SetWobbleTolerance Styles: Manual (Automatic By Default), DisplayNumbersForDiagonals (Off By Default).
Not Yet Implemented
#Also, to help with recognition of a diagonal versus The criteria for a direction is as follows:
#a vey messy straight line, if the greater absolute value x in a row. (Where x is the WobbleTolerance).
#is not greater than twice the lesser, only the grater value So if the WobbleTolerance is 9
#is counted. 'URUUUUUUUUUUUUUUURUURUUUU1' is Up.
The higher this number, the less sensitive this class is.
So the more likely something like 1L will translate to 1.
#In automatic mode, EVT_MOUSE_EVENTS is used. This is good, since the mouse does tend to wobble somewhat,
#This allows the user to change the mouse button/modifiers at runtime. and a higher number allows for this.
To change this, use SetWobbleTolerance
Also, to help with recognition of a diagonal versus
a vey messy straight line, if the greater absolute value
is not greater than twice the lesser, only the grater value
is counted.
In automatic mode, EVT_MOUSE_EVENTS is used.
This allows the user to change the mouse button/modifiers at runtime.
"""
########################################### ###########################################