2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
#----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
from wxPython.wx import *
|
|
|
|
from joystick_wdr import *
|
|
|
|
|
|
|
|
|
|
|
|
class JoystickTestPanel(wxPanel):
|
|
|
|
def __init__(self, parent, id,
|
2003-11-12 16:34:20 -05:00
|
|
|
pos = wxDefaultPosition, size = wxDefaultSize,
|
2001-05-19 21:18:39 -04:00
|
|
|
style = wxTAB_TRAVERSAL ):
|
|
|
|
wxPanel.__init__(self, parent, id, pos, size, style)
|
|
|
|
|
2003-03-25 01:35:27 -05:00
|
|
|
MakeJoystickTestPanel( self, True )
|
2001-05-19 21:18:39 -04:00
|
|
|
|
2001-05-19 22:00:31 -04:00
|
|
|
try:
|
|
|
|
self.stick = wxJoystick()
|
|
|
|
self.stick.SetCapture(self)
|
|
|
|
EVT_JOYSTICK_EVENTS(self, self.OnJoystick)
|
|
|
|
self.UpdateFields()
|
|
|
|
except NotImplementedError, v:
|
|
|
|
wxMessageBox(str(v), "Exception Message")
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
|
|
|
|
def UpdateFields(self):
|
|
|
|
s = self.stick
|
|
|
|
self.GetXPositionCtrl().SetValue(str(s.GetPosition().x))
|
|
|
|
self.GetYPositionCtrl().SetValue(str(s.GetPosition().y))
|
|
|
|
self.GetZPositionCtrl().SetValue(str(s.GetZPosition()))
|
|
|
|
self.GetPovCtsPosCtrl().SetValue(str(s.GetPOVPosition()))
|
|
|
|
self.GetRudderPosCtrl().SetValue(str(s.GetRudderPosition()))
|
|
|
|
self.GetHasRudderCtrl().SetValue(str(s.HasRudder()))
|
|
|
|
self.GetHasZCtrl().SetValue(str(s.HasZ()))
|
|
|
|
self.GetHasPovCtrl().SetValue(str(s.HasPOV()))
|
|
|
|
self.GetHasPov4dirCtrl().SetValue(str(s.HasPOV4Dir()))
|
|
|
|
self.GetMfgIdCtrl().SetValue(str(s.GetManufacturerId()))
|
|
|
|
self.GetProdNameCtrl().SetValue(str(s.GetProductName()))
|
|
|
|
self.GetZMinCtrl().SetValue(str(s.GetZMin()))
|
|
|
|
self.GetXMaxCtrl().SetValue(str(s.GetXMax()))
|
|
|
|
self.GetNumButtonsCtrl().SetValue(str(s.GetNumberButtons()))
|
|
|
|
self.GetNumAxesCtrl().SetValue(str(s.GetNumberAxes()))
|
|
|
|
self.GetPollingMinCtrl().SetValue(str(s.GetPollingMin()))
|
|
|
|
self.GetPollingMaxCtrl().SetValue(str(s.GetPollingMax()))
|
|
|
|
self.GetUMinCtrl().SetValue(str(s.GetUMin()))
|
|
|
|
self.GetUMaxCtrl().SetValue(str(s.GetUMax()))
|
|
|
|
self.GetButtonStateCtrl().SetValue(str(s.GetButtonState()))
|
|
|
|
self.GetPovPositionCtrl().SetValue(str(s.GetPOVPosition()))
|
|
|
|
self.GetUPositionCtrl().SetValue(str(s.GetUPosition()))
|
|
|
|
self.GetVPositionCtrl().SetValue(str(s.GetVPosition()))
|
|
|
|
self.GetHasUCtrl().SetValue(str(s.HasU()))
|
|
|
|
self.GetHasVCtrl().SetValue(str(s.HasV()))
|
|
|
|
self.GetHasPovCtsCtrl().SetValue(str(s.HasPOVCTS()))
|
|
|
|
self.GetNumSticksCtrl().SetValue(str(s.GetNumberJoysticks()))
|
|
|
|
self.GetXMinCtrl().SetValue(str(s.GetXMin()))
|
|
|
|
self.GetYMinCtrl().SetValue(str(s.GetYMin()))
|
|
|
|
self.GetYMaxCtrl().SetValue(str(s.GetYMax()))
|
|
|
|
self.GetZMaxCtrl().SetValue(str(s.GetZMax()))
|
|
|
|
self.GetMaxButtonsCtrl().SetValue(str(s.GetMaxButtons()))
|
|
|
|
self.GetMaxAxesCtrl().SetValue(str(s.GetMaxAxes()))
|
|
|
|
self.GetRudderMinCtrl().SetValue(str(s.GetRudderMin()))
|
|
|
|
self.GetRudderMaxCtrl().SetValue(str(s.GetRudderMax()))
|
|
|
|
self.GetVMinCtrl().SetValue(str(s.GetVMin()))
|
|
|
|
self.GetVMaxCtrl().SetValue(str(s.GetVMax()))
|
|
|
|
|
|
|
|
|
|
|
|
def OnJoystick(self, evt):
|
|
|
|
self.UpdateFields()
|
|
|
|
|
|
|
|
|
|
|
|
# WDR: methods for JoystickTestPanel
|
|
|
|
|
|
|
|
def GetYPositionCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_Y_Position_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetXPositionCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_X_Position_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
|
|
|
|
def GetVMaxCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_V_Max_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetVMinCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_V_Min_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetRudderMaxCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_Rudder_Max_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetRudderMinCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_Rudder_Min_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetMaxAxesCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_Max_Axes_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetMaxButtonsCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_Max_Buttons_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetZMaxCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_Z_Max_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetYMaxCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_Y_Max_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetYMinCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_Y_Min_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetXMinCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_X_Min_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetNumSticksCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_Num_Sticks_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetHasPovCtsCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_Has_POV_CTS_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetHasVCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_Has_V_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetHasUCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_Has_U_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetVPositionCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_V_Position_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetUPositionCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_U_Position_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetPovPositionCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_POV_Position_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetButtonStateCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_Button_State_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetUMaxCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_U_Max_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetUMinCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_U_Min_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetPollingMaxCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_Polling_Max_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetPollingMinCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_Polling_Min_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetNumAxesCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_Num_Axes_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetNumButtonsCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_Num_Buttons_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetXMaxCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_X_Max_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetZMinCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_Z_Min_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetProdNameCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_Prod_Name_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetMfgIdCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_Mfg_ID_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetHasPov4dirCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_Has_POV_4DIR_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetHasPovCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_Has_POV_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetHasZCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_Has_Z_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetHasRudderCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_Has_Rudder_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetRudderPosCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_Rudder_Pos_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetPovCtsPosCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_POV_CTS_Pos_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
def GetZPositionCtrl(self):
|
2001-05-22 01:59:09 -04:00
|
|
|
return self.FindWindowById(ID_Z_Position_Ctrl)
|
2001-05-19 21:18:39 -04:00
|
|
|
|
|
|
|
# WDR: handler implementations for JoysticktestPanel
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
|
|
def runTest(frame, nb, log):
|
|
|
|
win = JoystickTestPanel(nb, -1)
|
|
|
|
return win
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
overview = """\
|
|
|
|
"""
|
2003-07-02 19:13:10 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
import sys,os
|
|
|
|
import run
|
|
|
|
run.main(['', os.path.basename(sys.argv[0])])
|
|
|
|
|