Beispiel #1
0
 def testremapper(self):
     #Make a remapper object and reads the buttonmap
     rem = remapper.remapper("testcontroller")
     #Writes the current buttonmap to the file
     rem.writeButtons('testcontroller')
     #Tests if the square buttons is mapped to ID 2 
     Test.assertEqual(self, rem.buttons['square'], 2, "Square button was not mapped to ID 2")
     #remapping square button to button ID 6
     rem.mapButton('square', 6)
     #checks if the square button has been succesfully moved to ID 6
     Test.assertEqual(self, rem.buttons['square'], 6, "Square button was not mapped to ID 6")
     #sets square button to tab action
     rem.mapAction('square', 'tab')
     #tests if tab is mapped to square
     Test.assertEqual(self, rem.actions['square'], 'tab', "Tab was not mapped to square")
     #write the action mapping to a file
     rem.writeActions('default')
     pass
Beispiel #2
0
    pass
elif os.name == 'posix':
    from linterface import Interface
    pass
from remapper import remapper

pygame.init()            # Starts pygame
t = pygame.time.Clock()        # Make a tracker
interface = Interface()
os.system('cls' if os.name=='nt' else 'clear') # Clear terminal // remove "there is no soundcard"
try: 

    print "Number of Devices:", pygame.joystick.get_count()
    d = pygame.joystick.Joystick(0)
    d.init()            # Start pygame.joystick.Joystick(0)
    rem = remapper(d.get_name())
    maingui = gui.gui(rem)

# Gives info about the device
    print "Connected device", d.get_name()
    print d.get_name(), "have"
    print "Buttons:", d.get_numbuttons()
    print "Axes:", d.get_numaxes()
    print "Hats:", d.get_numhats()
    print "Balls:", d.get_numballs()
    print "The device ID is", d.get_id()
    print "Press button 0 to exit"

# Start showing the info in terminal

    def loop():