superboucle
superboucle copied to clipboard
duplicated code in learn.py
look at the processNote method - why is it that way?
I think it's more readable this way. But I agree with you, this is not good... There is also a bug with knowCtrl and knownBtn list : When you overwrite some mapping, old values are not removed from lists of used btn an ctrl. So you cannot switch two controls (for example play and pause). Those lines :
self.knownCtrl.add(ctrl_key)
self.knownBtn.add(btn_key)
are not present in every if part. Maybe we can replace string in self.send_midi_to by a callable function. This way, we can create separate little functions that will handle midi event.
That's a good idea - i'll put it in our fork :)
Actually I in gui.py there is a similar situation in processNote: There is a big if construct to decode what function to use for what message. i would consistently replace it with a mapping from midi-messages (or your abstract representations of them) directly to functions. Would you agree?
yes, but can you make this modification in a new branch created from last tag 1.2.0 ?
Damn i have already started - To be honest i have rewritten the whole device and most of learn.py. in the main branch of our fork..but I will try to put it in a new branch!
Ok, brace yourself @Vampouille, here it is: 660dd953ac96a5a0a9492f65db1e5f281f13242b
I'll clean it up a bit more, then we will do some more extensive testing - and then I'll issue a pull request. Its much but I hope you like it ;) I had to add another dependency: the wrapt package. Tried to get around without it, but vanilla python decorators aren't that nice with objects. I hope that's not a huge issue?!