예제 #1
0
def player_render(self, h, binding, *args):
    tmpl = template("playerbox", h, True)[0]

    tmpl.findmeld("playername").fill(self.o.username)
    tmpl.findmeld("hp").fill(self.o.health)

    h << tmpl

    return h.root
예제 #2
0
def wordbag_render(self, h, binding, *args):
    tmpl = template("wordbag", h, True)[0]

    if len(self.wordbag.words) > 0:
        for (elem, (wo, ct)) in tmpl.findmeld("entry").repeat(self.wordbag.words.iteritems()):
            elem[0].fill(str(ct))
            elem[1].fill(wo.word)
            #elem.findmeld("count").fill(str(ct))
            #elem.findmeld("word").fill(wo.word)

        tmpl.remove(tmpl.findmeld("error"))
    else:
        tmpl.remove(tmpl.findmeld("words"))
    
    h << tmpl

    return h.root
예제 #3
0
def render(self, h, *args):
    tmpl = template("main", h)

    if self.model() == "login":
        cdiv = h.div(id="content")
        with cdiv:
            h << self.loginManager
    elif self.model() == "game":
        cdiv = h.div(id="content")
        with cdiv:
            h << self.playerBox
            h << self.playerBox.render(xhtml.AsyncRenderer(h), model="wordbag")
            h << self.spellInput.render(h)
            h << self.roomDisplay
            h << self.eventlog
            h << h.div(self.roomDisplay.render(h, model="map"), style="position:absolute; right: 0; top: 0;")

    tmpl.findmeld("content").replace(cdiv)

    h << tmpl
    return h.root