]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/wxJoystick.py
compilation error fix (trailing comma in an enum)
[wxWidgets.git] / wxPython / demo / wxJoystick.py
1
2 #----------------------------------------------------------------------------
3
4 from wxPython.wx import *
5 from joystick_wdr import *
6
7
8 class JoystickTestPanel(wxPanel):
9 def __init__(self, parent, id,
10 pos = wxPyDefaultPosition, size = wxPyDefaultSize,
11 style = wxTAB_TRAVERSAL ):
12 wxPanel.__init__(self, parent, id, pos, size, style)
13
14 MakeJoystickTestPanel( self, true )
15
16 try:
17 self.stick = wxJoystick()
18 self.stick.SetCapture(self)
19 EVT_JOYSTICK_EVENTS(self, self.OnJoystick)
20 self.UpdateFields()
21 except NotImplementedError, v:
22 wxMessageBox(str(v), "Exception Message")
23
24
25 def UpdateFields(self):
26 s = self.stick
27 self.GetXPositionCtrl().SetValue(str(s.GetPosition().x))
28 self.GetYPositionCtrl().SetValue(str(s.GetPosition().y))
29 self.GetZPositionCtrl().SetValue(str(s.GetZPosition()))
30 self.GetPovCtsPosCtrl().SetValue(str(s.GetPOVPosition()))
31 self.GetRudderPosCtrl().SetValue(str(s.GetRudderPosition()))
32 self.GetHasRudderCtrl().SetValue(str(s.HasRudder()))
33 self.GetHasZCtrl().SetValue(str(s.HasZ()))
34 self.GetHasPovCtrl().SetValue(str(s.HasPOV()))
35 self.GetHasPov4dirCtrl().SetValue(str(s.HasPOV4Dir()))
36 self.GetMfgIdCtrl().SetValue(str(s.GetManufacturerId()))
37 self.GetProdNameCtrl().SetValue(str(s.GetProductName()))
38 self.GetZMinCtrl().SetValue(str(s.GetZMin()))
39 self.GetXMaxCtrl().SetValue(str(s.GetXMax()))
40 self.GetNumButtonsCtrl().SetValue(str(s.GetNumberButtons()))
41 self.GetNumAxesCtrl().SetValue(str(s.GetNumberAxes()))
42 self.GetPollingMinCtrl().SetValue(str(s.GetPollingMin()))
43 self.GetPollingMaxCtrl().SetValue(str(s.GetPollingMax()))
44 self.GetUMinCtrl().SetValue(str(s.GetUMin()))
45 self.GetUMaxCtrl().SetValue(str(s.GetUMax()))
46 self.GetButtonStateCtrl().SetValue(str(s.GetButtonState()))
47 self.GetPovPositionCtrl().SetValue(str(s.GetPOVPosition()))
48 self.GetUPositionCtrl().SetValue(str(s.GetUPosition()))
49 self.GetVPositionCtrl().SetValue(str(s.GetVPosition()))
50 self.GetHasUCtrl().SetValue(str(s.HasU()))
51 self.GetHasVCtrl().SetValue(str(s.HasV()))
52 self.GetHasPovCtsCtrl().SetValue(str(s.HasPOVCTS()))
53 self.GetNumSticksCtrl().SetValue(str(s.GetNumberJoysticks()))
54 self.GetXMinCtrl().SetValue(str(s.GetXMin()))
55 self.GetYMinCtrl().SetValue(str(s.GetYMin()))
56 self.GetYMaxCtrl().SetValue(str(s.GetYMax()))
57 self.GetZMaxCtrl().SetValue(str(s.GetZMax()))
58 self.GetMaxButtonsCtrl().SetValue(str(s.GetMaxButtons()))
59 self.GetMaxAxesCtrl().SetValue(str(s.GetMaxAxes()))
60 self.GetRudderMinCtrl().SetValue(str(s.GetRudderMin()))
61 self.GetRudderMaxCtrl().SetValue(str(s.GetRudderMax()))
62 self.GetVMinCtrl().SetValue(str(s.GetVMin()))
63 self.GetVMaxCtrl().SetValue(str(s.GetVMax()))
64
65
66 def OnJoystick(self, evt):
67 self.UpdateFields()
68
69
70 # WDR: methods for JoystickTestPanel
71
72 def GetYPositionCtrl(self):
73 return self.FindWindowById(ID_Y_Position_Ctrl)
74
75 def GetXPositionCtrl(self):
76 return self.FindWindowById(ID_X_Position_Ctrl)
77
78
79 def GetVMaxCtrl(self):
80 return self.FindWindowById(ID_V_Max_Ctrl)
81
82 def GetVMinCtrl(self):
83 return self.FindWindowById(ID_V_Min_Ctrl)
84
85 def GetRudderMaxCtrl(self):
86 return self.FindWindowById(ID_Rudder_Max_Ctrl)
87
88 def GetRudderMinCtrl(self):
89 return self.FindWindowById(ID_Rudder_Min_Ctrl)
90
91 def GetMaxAxesCtrl(self):
92 return self.FindWindowById(ID_Max_Axes_Ctrl)
93
94 def GetMaxButtonsCtrl(self):
95 return self.FindWindowById(ID_Max_Buttons_Ctrl)
96
97 def GetZMaxCtrl(self):
98 return self.FindWindowById(ID_Z_Max_Ctrl)
99
100 def GetYMaxCtrl(self):
101 return self.FindWindowById(ID_Y_Max_Ctrl)
102
103 def GetYMinCtrl(self):
104 return self.FindWindowById(ID_Y_Min_Ctrl)
105
106 def GetXMinCtrl(self):
107 return self.FindWindowById(ID_X_Min_Ctrl)
108
109 def GetNumSticksCtrl(self):
110 return self.FindWindowById(ID_Num_Sticks_Ctrl)
111
112 def GetHasPovCtsCtrl(self):
113 return self.FindWindowById(ID_Has_POV_CTS_Ctrl)
114
115 def GetHasVCtrl(self):
116 return self.FindWindowById(ID_Has_V_Ctrl)
117
118 def GetHasUCtrl(self):
119 return self.FindWindowById(ID_Has_U_Ctrl)
120
121 def GetVPositionCtrl(self):
122 return self.FindWindowById(ID_V_Position_Ctrl)
123
124 def GetUPositionCtrl(self):
125 return self.FindWindowById(ID_U_Position_Ctrl)
126
127 def GetPovPositionCtrl(self):
128 return self.FindWindowById(ID_POV_Position_Ctrl)
129
130 def GetButtonStateCtrl(self):
131 return self.FindWindowById(ID_Button_State_Ctrl)
132
133 def GetUMaxCtrl(self):
134 return self.FindWindowById(ID_U_Max_Ctrl)
135
136 def GetUMinCtrl(self):
137 return self.FindWindowById(ID_U_Min_Ctrl)
138
139 def GetPollingMaxCtrl(self):
140 return self.FindWindowById(ID_Polling_Max_Ctrl)
141
142 def GetPollingMinCtrl(self):
143 return self.FindWindowById(ID_Polling_Min_Ctrl)
144
145 def GetNumAxesCtrl(self):
146 return self.FindWindowById(ID_Num_Axes_Ctrl)
147
148 def GetNumButtonsCtrl(self):
149 return self.FindWindowById(ID_Num_Buttons_Ctrl)
150
151 def GetXMaxCtrl(self):
152 return self.FindWindowById(ID_X_Max_Ctrl)
153
154 def GetZMinCtrl(self):
155 return self.FindWindowById(ID_Z_Min_Ctrl)
156
157 def GetProdNameCtrl(self):
158 return self.FindWindowById(ID_Prod_Name_Ctrl)
159
160 def GetMfgIdCtrl(self):
161 return self.FindWindowById(ID_Mfg_ID_Ctrl)
162
163 def GetHasPov4dirCtrl(self):
164 return self.FindWindowById(ID_Has_POV_4DIR_Ctrl)
165
166 def GetHasPovCtrl(self):
167 return self.FindWindowById(ID_Has_POV_Ctrl)
168
169 def GetHasZCtrl(self):
170 return self.FindWindowById(ID_Has_Z_Ctrl)
171
172 def GetHasRudderCtrl(self):
173 return self.FindWindowById(ID_Has_Rudder_Ctrl)
174
175 def GetRudderPosCtrl(self):
176 return self.FindWindowById(ID_Rudder_Pos_Ctrl)
177
178 def GetPovCtsPosCtrl(self):
179 return self.FindWindowById(ID_POV_CTS_Pos_Ctrl)
180
181 def GetZPositionCtrl(self):
182 return self.FindWindowById(ID_Z_Position_Ctrl)
183
184 # WDR: handler implementations for JoysticktestPanel
185
186
187 #----------------------------------------------------------------------
188
189 def runTest(frame, nb, log):
190 win = JoystickTestPanel(nb, -1)
191 return win
192
193 #----------------------------------------------------------------------
194
195
196 overview = """\
197 """