zeth / inputs

Cross-platform Python support for keyboards, mice and gamepads
BSD 3-Clause "New" or "Revised" License
269 stars 87 forks source link

Fix empty type_codes #81

Open d3m3vilurr opened 5 years ago

d3m3vilurr commented 5 years ago

if call DeviceManager outside of the module, self.code['type_codes'] could be always empty

rirze commented 4 years ago

This is such a critical bug that hasn't been merged yet...

The original code has a generator for the value of self.code['type_codes']. When the first instantiation of DeviceManager is created on module import, it exhausts the generator, meaning that any future instances of DeviceManager won't have any values for self.code['type_codes']. This PR is definitely the way to go-- by converting the whole data structure from a generator to the actual values so they can be reused.

Alas, I hope the contributor(s) merge this and other features.