示例#1
0
 def configure_joypads(self):
     joypads = joypad.get_joypads()
     key = self.hkcu_prefix + '/Software/Wine/DirectInput/Joysticks'
     self.clear_registry_key(key)
     for device, joypad_name in joypads:
         if 'event' in device:
             disabled_joypad = "{} (js)".format(joypad_name)
         else:
             disabled_joypad = "{} (event)".format(joypad_name)
         self.set_registry_key(key, disabled_joypad, 'disabled')
示例#2
0
 def configure_joypads(self):
     joypads = joypad.get_joypads()
     key = self.hkcu_prefix + '/Software/Wine/DirectInput/Joysticks'
     self.clear_registry_key(key)
     for device, joypad_name in joypads:
         if 'event' in device:
             disabled_joypad = "{} (js)".format(joypad_name)
         else:
             disabled_joypad = "{} (event)".format(joypad_name)
         self.set_registry_key(key, disabled_joypad, 'disabled')
示例#3
0
 def configure_joypads(self):
     """Disables some joypad devices"""
     key = self.hkcu_prefix + "/Software/Wine/DirectInput/Joysticks"
     self.clear_registry_key(key)
     for _device, joypad_name in joypad.get_joypads():
         # Attempt at disabling mice that register as joysticks.
         # Although, those devices aren't returned by `get_joypads`
         # A better way would be to read /dev/input files directly.
         if "HARPOON RGB" in joypad_name:
             self.set_registry_key(key, "{} (js)".format(joypad_name), "disabled")
             self.set_registry_key(key, "{} (event)".format(joypad_name), "disabled")
示例#4
0
 def get_joypads(self):
     """Return list of joypad in a format usable in the options"""
     if self.joypads:
         return self.joypads
     joypad_list = [("No joystick", "-1")]
     joypad_devices = joypad.get_joypads()
     name_counter = Counter([j[1] for j in joypad_devices])
     name_indexes = {}
     for (dev, joy_name) in joypad_devices:
         dev_id = re.findall(r"(\d+)", dev)[0]
         if name_counter[joy_name] > 1:
             index = 1 if joy_name not in name_indexes else name_indexes[
                 joy_name] + 1
             name_indexes[joy_name] = index
         else:
             index = 0
         if index:
             joy_name += " (%d)" % index
         joypad_list.append((joy_name, dev_id))
     self.joypads = joypad_list
     return joypad_list
示例#5
0
 def get_joypads(self):
     """Return list of joypad in a format usable in the options"""
     if self.joypads:
         return self.joypads
     joypad_list = [('No joystick', '-1')]
     joypad_devices = joypad.get_joypads()
     name_counter = Counter([j[1] for j in joypad_devices])
     name_indexes = {}
     for (dev, joy_name) in joypad_devices:
         dev_id = re.findall(r'(\d+)', dev)[0]
         if name_counter[joy_name] > 1:
             if joy_name not in name_indexes:
                 index = 1
             else:
                 index = name_indexes[joy_name] + 1
             name_indexes[joy_name] = index
         else:
             index = 0
         if index:
             joy_name += " (%d)" % index
         joypad_list.append((joy_name, dev_id))
     self.joypads = joypad_list
     return joypad_list