Changeset 25

Show
Ignore:
Timestamp:
07/09/07 23:44:57 (5 years ago)
Author:
dlefevre
Message:

Added Canvas class.
Creates an XML form used to control the elements of the "Playing now" view.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • mymrc/trunk/mymrc/src/mobileclient/appuifw.py

    r18 r25  
    1212             
    1313    def getList(self): 
    14         self._iForm +="""</list>""" 
    15         return self._iForm 
     14        return self._iForm + """</list>""" 
    1615     
    1716     
     
    5352        return self._iForm + """</form>""" 
    5453     
     54 
     55class 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     
    5576