| | 54 | |
| | 55 | class Canvas(object): |
| | 56 | def __init__(self, aTitle, aLength=1234): |
| | 57 | self._iForm = """<canvas id="0" title="%s" length="%s">\n"""%(aTitle, |
| | 58 | str(aLength)) |
| | 59 | |
| | 60 | def addCommand(self, aType, aLabel, aOpCode, aKey=None): |
| | 61 | if aKey: |
| | 62 | self._iForm += """ <command type="%s" label="%s" opcode="%s" key="%s"/>\n"""\ |
| | 63 | % (aType, aLabel, aOpCode, aKey) |
| | 64 | else: |
| | 65 | self._iForm += """ <command type="%s" label="%s" opcode="%s"/>\n"""\ |
| | 66 | % (aType, aLabel, aOpCode) |
| | 67 | |
| | 68 | def addKeyCommand(self, aType, aKey, aOpCode): |
| | 69 | self._iForm += """ <command type="%s" key="%s" opcode="%s"/>\n"""\ |
| | 70 | % (aType, aKey, aOpCode) |
| | 71 | |
| | 72 | def getCanvas(self): |
| | 73 | self._iForm +="""</canvas>""" |
| | 74 | return self._iForm + """</canvas>""" |
| | 75 | |