Argumentless launch

This commit is contained in:
Maximilien Rigaut 2021-10-18 00:47:28 +02:00
parent 09e28468af
commit da792366c1
2 changed files with 27 additions and 15 deletions

View File

@ -488,9 +488,9 @@ class AkaiAPCMini(midiPageHandler):
}
self.listModules=[[None]*8] # Only one page and 8x8 for now
# self.pulse1=pulseController(self,IOInterface)
###########
# For debug purposes
# For debug purposes coloring all neutral to be able to skip initialisation
for j in range(5):
for i in range(8):
self.addStatus((j,i),"Inactive")
@ -534,10 +534,11 @@ class AkaiAPCMini(midiPageHandler):
def lightnote(self,note,val=1):
self.output.send(mido.Message("note_on",note=note,velocity=val))
def receiveAction(self,action,*args,**kwargs):
"Receive an action from the pulse and transmit it to the handler"
dprint("ACTION TO BE HANDLED",action,args,kwargs)
# Do the changing of the light if layer press etc.
# Only hard part is knowing where
_TEST=True
if __name__ == '__main__':

View File

@ -1,19 +1,14 @@
#!/bin/python3
import mido, argparse, sys
import mido, argparse, sys,os
import configparser,importlib,mapping
import traceback
import platform
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Listen to a midi interface for incomming messages and send messages to different midi interfaces according to a patch file')
parser.add_argument('patch', type=str,help='The patch file, this file is mandatory')
parser.add_argument('--verbose', action='store_true',default=False,help='Make the program verbose)')
args = parser.parse_args()
def launchWithArgs(args):
try:
path="patch/{}.ini".format(args.patch)
local=os.path.dirname(__file__)
path=os.path.join(local,"patch","{}.ini".format(args.patch))
print(path)
conf=configparser.ConfigParser()
conf.read(path)
interpath="mapping.{}".format(conf["interface"]["mapping"])
@ -65,4 +60,20 @@ if __name__ == '__main__':
print("[Error] Can't iterate over an empty list, check the list of inputs for an available input")
print(e)
traceback.print_exc()
# except:
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Listen to a midi interface for incomming messages and send messages to different midi interfaces according to a patch file')
parser.add_argument('patch', type=str,help='The patch file, this file is mandatory')
parser.add_argument('--verbose', action='store_true',default=False,help='Make the program verbose)')
if len(sys.argv)==1:
agv=[__file__,"panapulsewin"]
else:
agv=sys.argv
args = parser.parse_args(agv[1:])
launchWithArgs(args)