Exemplo n.º 1
0
def dialogaction(action,var):
    cutil.printVar("runpdf",action,var)
    
    if action == "runpdf" :
      s = "<H1> Hello </H1>"
      b = pdfutil.createPDFH(s)
      assert b != None

    if action == "runpdf1" :
      s = "<H1> Hello </H1>"
      map={}
      map[pdfutil.CREATOR] = "I am"
      map[pdfutil.PRODUCER] = ""
      map[pdfutil.AUTHOR] = "Author"
      map[pdfutil.TITLE] = "Title"
      b = pdfutil.createPDFH(s,map)
      assert b != None
      
    if action == "createxml" :
        s = "<?xml version=\"1.0\" ?>"
        s = s +  "<persons>"
        s = s +  "<person username=\"JS1\">"
        s = s + "<name>John</name>"
        s = s + "<family-name>Smith</family-name>"
        s = s + "</person>"
        s = s + "<person username=\"MI1\">"
        s = s + "<name>Morka</name>"
        s = s + "<family-name>Ismincius</family-name>"
        s = s + "</person>"
        s = s + "</persons>"
          
        
    if action == "runxslt" :
#       iS = Holder.getIJython().getResource().getRes("dialogs/data.xml")
#       s = s + "/data.xml"
#       inS = FileInputStream(iS)
#       print inS
#       xml = Util.readFromFileInput(iS)
       xml = xmlutil.fileToS("dialogs/data.xml")
       print xml
               
       b = pdfutil.xsltHtml("dialogs/template.xsl",xml)
       assert b != None
       
       print b.toString()
       
    if action == "runxsltpdf" :   
#       s = Util.getResourceAsDirectory("dialogs")
#       s = Holder.getIJython().getResourceDirectory() + "/dialogs";
#       print s
#       s = s + "/data.xml"
#       print s
#       inS = FileInputStream(s)
#       print inS
#       xml = Util.readFromFileInput(inS)
       xml = xmlutil.fileToS("dialogs/data.xml")
       print xml
               
       b = pdfutil.createPDFXSLT("dialogs/template.xsl",xml)
       assert b != None
Exemplo n.º 2
0
def dialogaction(action, var):

    cutil.printVar("test41", action, var)

    if action == "test1":
        xml = xmlutil.fileToS("xslt/indata.xml")
        html = pdfutil.xsltHtmlS("xslt/generateindata.xslt", xml)
        assert html != None

        print html
        var["OK"] = True

    if action == "test2":
        xml = xmlutil.fileToS("xslt/data/data.xml")
        html = pdfutil.xsltHtmlS("xslt/data/data.xslt", xml)
        assert html != None

        print html, type(html)
        i = html.find('My name is')
        print i
        assert -1 != i
        var["OK"] = True

    if action == "test3":
        xml = xmlutil.fileToS("xslt/data/data.xml")
        html = pdfutil.xsltHtmlS("xslt/data/data.xslt", xml)
        assert html != None

        print html, type(html)
        i = html.find('Hans Kloss')
        print i
        assert -1 != i
        var["OK"] = True
Exemplo n.º 3
0
def dialogaction(action,var):
    
    cutil.printVar("test42",action,var)
    
    if action == "test1" :
       xml = xmlutil.fileToS("xslt/data1/data.xml")              
       html = pdfutil.xsltHtmlS("xslt/data1/data.xslt",xml)
       assert html != None

       print html
       i = html.find("English")
       print i       
       assert i != -1
       var["OK"] = True     

    if action == "test2" :
       xml = xmlutil.fileToS("xslt/data1/data.xml")              
       html = pdfutil.xsltHtmlS("xslt/data1/data.xslt",xml)
       assert html != None

       print html
       i = html.find("Polish")
       print i
       assert i != -1       
       var["OK"] = True     
Exemplo n.º 4
0
def dialogaction(action, var):
    cutil.printVar("runpdf", action, var)

    if action == "runpdf":
        s = "<H1> Hello </H1>"
        b = pdfutil.createPDFH(s)
        assert b != None

    if action == "runpdf1":
        s = "<H1> Hello </H1>"
        map = {}
        map[pdfutil.CREATOR] = "I am"
        map[pdfutil.PRODUCER] = ""
        map[pdfutil.AUTHOR] = "Author"
        map[pdfutil.TITLE] = "Title"
        b = pdfutil.createPDFH(s, map)
        assert b != None

    if action == "createxml":
        s = "<?xml version=\"1.0\" ?>"
        s = s + "<persons>"
        s = s + "<person username=\"JS1\">"
        s = s + "<name>John</name>"
        s = s + "<family-name>Smith</family-name>"
        s = s + "</person>"
        s = s + "<person username=\"MI1\">"
        s = s + "<name>Morka</name>"
        s = s + "<family-name>Ismincius</family-name>"
        s = s + "</person>"
        s = s + "</persons>"

    if action == "runxslt":
        #       iS = Holder.getIJython().getResource().getRes("dialogs/data.xml")
        #       s = s + "/data.xml"
        #       inS = FileInputStream(iS)
        #       print inS
        #       xml = Util.readFromFileInput(iS)
        xml = xmlutil.fileToS("dialogs/data.xml")
        print xml

        b = pdfutil.xsltHtml("dialogs/template.xsl", xml)
        assert b != None

        print b.toString()

    if action == "runxsltpdf":
        #       s = Util.getResourceAsDirectory("dialogs")
        #       s = Holder.getIJython().getResourceDirectory() + "/dialogs";
        #       print s
        #       s = s + "/data.xml"
        #       print s
        #       inS = FileInputStream(s)
        #       print inS
        #       xml = Util.readFromFileInput(inS)
        xml = xmlutil.fileToS("dialogs/data.xml")
        print xml

        b = pdfutil.createPDFXSLT("dialogs/template.xsl", xml)
        assert b != None
Exemplo n.º 5
0
def dialogaction(action, var):
    cutil.printVar("binder29", action, var)

    if action == "before":
        json = xmlutil.fileToS("docs/contacts.json")
        #    print json
        cutil.setBinderItemsAttr(var, "list", json)
Exemplo n.º 6
0
def dialogaction(action,var) :
  cutil.printVar("binder29",action,var)  
  
  if action == "before" :
    json = xmlutil.fileToS("docs/contacts.json")
#    print json
    cutil.setBinderItemsAttr(var,"list",json)
      
       
Exemplo n.º 7
0
def dialogaction(action,var) :
     cutil.printVar("doaction",action,var)
     
     if action == "runxslt" :
       xml = xmlutil.fileToS("invoice/test.xml")

               
       b = pdfutil.xsltHtml("invoice/test.xslt",xml)
       assert b != None
       
       print b.toString()
       
     if action == "invoicehtml" :
       xml = xmlutil.fileToS("invoice/guest.xml")
               
       b = pdfutil.xsltHtml("invoice/invoicestandard.xslt",xml)
       assert b != None
       
       print b.toString()
       var["OK"] = True     

     if action == "invoicexmlforbill" :
       name = var["billno"]
       s = rpdf.buildXMLBill(var,name)       
       print s
       var["OK"] = True     
       var["xml"] = s

     if action == "invoicehtmlforbill" :
       name = var["billno"]
       s = rpdf.buildXMLBill(var,name)       
       b = pdfutil.xsltHtml("invoice/invoicestandard.xslt",s)
       assert b != None       
       print b.toString()
       var["html"] = b.toString()
       var["OK"] = True     

     if action == "invoicepdfforbill" :
       name = var["billno"]
       s = rpdf.buildXMLBill(var,name)
       b  = pdfutil.createPDFXSLT("invoice/invoicestandard.xslt",s)       
       assert b != None
       var["OK"] = True     
Exemplo n.º 8
0
def dialogaction(action, var):
    cutil.printVar("binder32", action, var)

    if action == "before":
        json = xmlutil.fileToS("docs/elements.json")
        cutil.setBinderItemsAttr(var, "comboBox", json)
        cutil.setBinderItemsAttr(var, "comboBox2", json)
        # comboBox2.setValue("Bohrium");
        var["comboBox2"] = "Bohrium"
        cutil.setCopy(var, "comboBox2")

    if action == "signalchange":
        cutil.setToastText(var, "toast", "Value: " + var[var["changefield"]])
Exemplo n.º 9
0
def dialogaction(action,var) :
  cutil.printVar("binder32",action,var)
  
  if action == "before" :
     json = xmlutil.fileToS("docs/elements.json")
     cutil.setBinderItemsAttr(var,"comboBox",json)
     cutil.setBinderItemsAttr(var,"comboBox2",json)
# comboBox2.setValue("Bohrium");     
     var["comboBox2"] = "Bohrium";
     cutil.setCopy(var,"comboBox2")
     
  if action == "signalchange" :
     cutil.setToastText(var,"toast","Value: " + var[var["changefield"]])
Exemplo n.º 10
0
def dialogaction(action,var) :    
    
   cutil.printVar("binder36",action,var)
   
   if action == "before" :
       cutil.setBinderListenOnAction(var,"basiccontext","opener")
       json = xmlutil.fileToS("docs/contacts.json")
       cutil.setBinderItemsAttr(var,"grid",json)
       cutil.setBinderListenOnAction(var,"gridcontext","grid")

       
   if action == "signalchange" and var["changefield"] == "basiccontext" :
       cutil.setToastText(var,"toast",var["basiccontext"])
       
   if action == "signalchange" and var["changefield"] == "gridcontext" :
       cutil.setToastText(var,"toast",var["gridcontext"])
       
Exemplo n.º 11
0
def createPDF2(var) :
#    s = Util.getResourceAsDirectory("docs")
#    inS = FileInputStream(s+"/data.xml")
#    xml = Util.readFromFileInput(inS)
    xml = xmlutil.fileToS("docs/data.xml")
    return pdfutil.createPDFXSLT("docs/template.xsl",xml)