Beispiel #1
0
 def printRow(self):
     from lino.gendoc.html import HtmlDocument
     doc=HtmlDocument()
     for i in self.grid.getSelectedRows():
         row = self.rpt[i]
         row.printRow(doc)
     filename="tmp.html"
     doc.saveas(filename)
     self.session.showfile(filename)
Beispiel #2
0
    def run(self, body=defaultbody, **kw):

        if len(self.args):
            filenames = self.args
        else:
            filenames = [self.default_output_file]

        for filename in filenames:
            if filename.endswith('.pdf'):
                doc = PdfDocument()
            elif filename.endswith('.html'):
                doc = HtmlDocument()
            else:
                raise UsageError("%s : unknown output file format")

            try:
                self.status("Preparing %s...", filename)
                body(doc)
                #print doc.body.toxml()
                self.status("Writing %s...", filename)
                doc.saveas(filename, **kw)
                self.notice("%d pages." % doc.getPageNumber())
                self.showfile(filename)

            except IOError, e:
                print e
                return -1
Beispiel #3
0
    def test01(self):
        #targetDir = opj(tempfile.gettempdir(), "reports_test_2")
        #targetDir = opj(r"c:\temp","linoweb")
        #targetDir="temp"
        #print targetDir

        root = HtmlDocument(title="The first Linoweb",
                            stylesheet="wp-admin.css")
        mnu = root.addMenu()

        ds = self.sess.query(tables.Nation, pageLen=50, orderBy="name")
        rpt = QueryReport(ds)
        doc = root.addChild(location="nations",
                            name=rpt.name,
                            title=rpt.getLabel())
        doc.report(rpt)
        mnu.addLink(doc)

        if True:
            ds = self.sess.query(tables.Quote,
                                 "quote author.name id",
                                 pageLen=50,
                                 orderBy="id")
            rpt = QueryReport(ds)
            doc = root.addChild(location="quotes",
                                name=rpt.name,
                                title=rpt.getLabel())
            doc.report(rpt)
            mnu.addLink(doc)

        files = root.save(self.sess, opj(self.tempDir, "gendoc", "2"))
        self.addTempFile(files[0], showOutput=True)
        for fn in files[1:]:
            self.addTempFile(fn)
Beispiel #4
0
    def run(self):
        if len(self.args) == 0:
            filename="sysinfo.html" # self.toolkit.stdout
        elif len(self.args) == 1:
            filename=self.args[0]
        else:
            raise UsageError("Got more than 1 argument")

        self.notice("Generating %s ...",filename)
        doc=HtmlDocument()
        #doc=StaticHtmlDocument()
        
        doc.body.h1("System Information")
        doc.body.par("This report has been generated by:")
        doc.body.pre(self.aboutString())
        diag_encoding(doc.body)
        
        diag_printer(doc.body)

        if True:
            doc.body.h2("sys.modules")
            doc.body.report(DictReport(sys.modules))

            

        
        if filename == "-":
            doc.__xml__(self.toolkit.stdout.write)
        else:
            doc.saveas(filename)
            os.system(filename)
Beispiel #5
0
    def test01(self):
        #targetDir = opj(tempfile.gettempdir(), "reports_test_2")
        #targetDir = opj(r"c:\temp","linoweb")
        #targetDir="temp"
        #print targetDir
        
        root = HtmlDocument(title="The first Linoweb",
                            stylesheet="wp-admin.css")
        mnu = root.addMenu()
                            
        
        ds = self.sess.query(tables.Nation,
                             pageLen=50,
                             orderBy="name")
        rpt = QueryReport(ds)
        doc=root.addChild(location="nations",
                          name=rpt.name,
                          title=rpt.getLabel())
        doc.report(rpt)
        mnu.addLink(doc)

        if True:
            ds = self.sess.query(tables.Quote,"quote author.name id",
                                 pageLen=50,
                                 orderBy="id")
            rpt = QueryReport(ds)
            doc=root.addChild(location="quotes",
                              name=rpt.name,
                              title=rpt.getLabel())
            doc.report(rpt)
            mnu.addLink(doc)
                

            
        files=root.save(self.sess,
                        opj(self.tempDir,"gendoc","2"))
        self.addTempFile(files[0],showOutput=True)
        for fn in files[1:]:
            self.addTempFile(fn)