Exemplo n.º 1
0
    def default(self,*args,**kw):
        frm=self.mainForm
        if len(args) >= 2:
            mnu=frm.menuBar.findMenu(args[0])
            mi=mnu.findItem(args[1])
            mi.click()
            frm=self.toolkit._formStack[-1]
        if len(args) >= 3:
            m=getattr(frm,args[2])
            m(*args[3:])
            frm=self.toolkit._formStack[-1]
            
        title=str(frm.getLabel())
        doc=Document(title=html.TITLE(title))
        
        div = html.DIV(klass="title")
        doc.append(div)
        div.append(html.H1(title))
        
        div = html.DIV(klass="menu")
        doc.append(div)
        
        p = html.P("Menu:")
        div.append(p)

        if frm.menuBar is not None:
            for mnu in frm.menuBar.menus:
                p.append(html.BR())
                #p.append(html.A(mnu.getLabel(),href=mnu.name))
                p.append(label2txt(mnu.getLabel()))
                for mi in mnu.items:
                    p.append(html.BR())
                    p.append(" ·  ",
                             html.A(label2txt(mi.getLabel()),
                                    href=mnu.name+"/"+mi.name))
        frm.mainComp.render(doc)
        #doc.append(html.HR())
        #doc.append(html.P(self.dbsess.app.aboutString()))
        #doc.append(html.P('args='+repr(args)))
        #doc.append(html.P('kw='+repr(kw)))
        #
        div = html.DIV(klass="footer")
        doc.append(div)
        div.append(html.P("foo "+cherrypy.request.base + " bar"))
        return str(doc)
Exemplo n.º 2
0
 def setup(self):
     div = html.DIV(klass="title")
     self.append(div)
     div.append(html.H1(self.title))