""" Test reading a mapping file containing keyboard simulation instructions. Parse the file, put keys and arguments in a map. NOTE: some text editor are replacing tabs by spaces, which is not good for MappingItem. """ from KeyMapReader import * kmr = KeyMapReader() # setting the file address kmr.setMapFileName("/Users/jonathanlurie/Documents/code/pythonStuff/midiCombo/midiCombo/input/config.map") # process the mapping file kmr.processMapFile() # getting the mapping configuration as a python map container theMappingMap = kmr.getKeyArgumentMap() print(theMappingMap)
from collections import Counter # keyboard shortcut execution import win32com.client # project imports from KeyMapReader import * from SerialMatrixReader import * from CommandInterpreter import * try: # creating the key map reader, in charge of reading the # instruction from the .setting file kmr = KeyMapReader() kmr.setMapFileName("input\map.setting") kmr.readMapFile() # creating the command interpreter ci = CommandInterpreter() # giving the key-argument map to the command interpreter: ci.setKeyArgumentMap( kmr.getKeyArgumentMap() ) # creating the serial matrix reader, in charge of catching # the messages from the tangible matrix smr = SerialMatrixReader() smr.setCommandInterpreter(ci) smr.readFlow() except KeyboardInterrupt:
print("ERROR: this mapping file does not exist.") printInfo() exit() # finding the MIDI device name (optional) deviceName = findArgValue("-device", False) try: # creating the key map reader, in charge of reading the # instruction from the .setting file kmr = KeyMapReader() kmr.setMapFileName(mappingFile) kmr.processMapFile() # creating the command interpreter ci = CommandInterpreter() # giving the key-argument map to the command interpreter: ci.setKeyArgumentMap( kmr.getKeyArgumentMap() ) mdr = MidiDeviceReader(deviceName) mdr.setCommandInterpreter(ci) mdr.readFlow() except KeyboardInterrupt:
# data container from collections import Counter # project imports from KeyMapReader import * from MidiDeviceReader import * from CommandInterpreter import * try: # creating the key map reader, in charge of reading the # instruction from the .setting file kmr = KeyMapReader() kmr.setMapFileName("input/config.map") kmr.processMapFile() # creating the command interpreter ci = CommandInterpreter() # giving the key-argument map to the command interpreter: ci.setKeyArgumentMap( kmr.getKeyArgumentMap() ) mdr = MidiDeviceReader() mdr.setCommandInterpreter(ci) mdr.readFlow() # creating the serial matrix reader, in charge of catching
# data container from collections import Counter # keyboard shortcut execution import win32com.client # project imports from KeyMapReader import * from SerialMatrixReader import * from CommandInterpreter import * try: # creating the key map reader, in charge of reading the # instruction from the .setting file kmr = KeyMapReader() kmr.setMapFileName("input\map.setting") kmr.readMapFile() # creating the command interpreter ci = CommandInterpreter() # giving the key-argument map to the command interpreter: ci.setKeyArgumentMap(kmr.getKeyArgumentMap()) # creating the serial matrix reader, in charge of catching # the messages from the tangible matrix smr = SerialMatrixReader() smr.setCommandInterpreter(ci) smr.readFlow() except KeyboardInterrupt: