From 892f6a734b5d6500126d51d1ef5b432cdb561c14 Mon Sep 17 00:00:00 2001 From: Maximilien Rigaut Date: Mon, 11 Oct 2021 22:43:36 +0200 Subject: [PATCH] A little more interconnection --- README.md | 3 ++- mapping/midipagehandler.py | 21 ++++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 053b8c5..8718aaf 100644 --- a/README.md +++ b/README.md @@ -51,4 +51,5 @@ To do so add a custom patch (or use a currently defined one, but chances are pat * TODO: Color management, get colors associated to all statuses * TODO: General decorators @armtake -* URGENT : Fix the connection issue \ No newline at end of file +* URGENT : Fix the connection issue +* TODO: Connect the IOHandler with handler, binding and vice-versa, check some. \ No newline at end of file diff --git a/mapping/midipagehandler.py b/mapping/midipagehandler.py index 6636db6..5eb3ed3 100644 --- a/mapping/midipagehandler.py +++ b/mapping/midipagehandler.py @@ -73,6 +73,20 @@ class IOInterface(): except KeyError: wprint("Can't send action request",name) +class IOInterfacePulse(IOInterface): + "Specialised pulse interface" + + def __init__(self,pagehandler,remoteController): + super(IOInterfacePulse,self).__init__(pagehandler,remoteController) + self.addActionIO("STATUS",self._externalProgram.getStatus) + self.addActionIO("LAYERINP",self._externalProgram.changeLayer) + self.addActionIO("TAKEALL",self._externalProgram.takeAll) + self.addActionIO("LOADMM",self._externalProgram.loadMM) + self.addActionIO("QUICKF",self._externalProgram.quickFrame) + self.addActionIO("FREEZE",self._externalProgram.freezeScreenAll) + + self.addActionH("LAYERINP",self._pageHandler.layerCommand) + class midiPageHandler(object): "Page Handler, with some methods to manage a midi remote more easily" @@ -359,6 +373,7 @@ class pulseController(object): self.idlastmemorypressed=0 self.offset=0 # Offset on the lines + def pressReceived(self,linecol,val): "Received an order from the controller, the order must be associated with an actual command and send it to the IOController" try: @@ -375,6 +390,10 @@ class pulseController(object): except KeyError as e: wprint("An error occured while the pulse was processing order",e) + def layerCommand(self,match): + "Received a layer command from the pulse, should be the only controller" + pass + def layerPress(self,linecol,layer,val,liveprev): "Adjust the color and info depending on the press" self.idlastlayerpressed=layer @@ -388,7 +407,7 @@ class pulseController(object): self.returnInterface.addStatus(truelinecol,"Selected") else: self.returnInterface.addStatus(truelinecol,"Live") - self.returnInterface.applyChanges() + self.returnInterface.applyChanges() self.returnInterface.applyColors() def memoryPress(self,linecol,val,liveprev):