def shutdown(cls, timeout): for user in Dungeon.user_list: user.savePlayer() time.sleep(timeout) try: reactor.shutdown() except: print("exception shutdown")
def process_midi_event(self, data): if data is None: return # for note events there is note and velocity, # for control events those are called param and value # in alsa, but we just call them note and velocity also midi_type, channel, note, velocity = data plugin = self.launchpad.get_plugin(note) if not plugin: return # figure out which callback to call if midi_type == Launchpad.TYPE_NOTEON and velocity == 0: plugin.pad_up_callback(note - plugin.position) elif midi_type == Launchpad.TYPE_NOTEON: plugin.pad_down_callback(note - plugin.position) elif midi_type == Launchpad.TYPE_CONTROL: launchpad.shutdown() reactor.shutdown()
def tearDown(self): """ Cleans up the test environment """ reactor.callLater(1, client.transport.loseConnection) reactor.callLater(2, reactor.stop) reactor.shutdown()