Example #1
0
    def update_qr_code(self, vals):
        print "smartphone.update_qr_code"
        value = 'cfg;' + str(
            self.id
        ) + ';' + self.transmissiontime + ';' + self.serveraddress + ';' + self.databasename + ';' + self.username + ';' + self.userpassword + ';' + self.scanmethod + ';' + self.transfertmethod + ';' + self.cfgpassword + ';'
        if self.manualok:
            value = value + '1'
        else:
            value = value + '0'

        barcode = createBarcodeImageInMemory('QR',
                                             value=value,
                                             format='png',
                                             width=400,
                                             height=400,
                                             humanReadable=0)
        vals['qrconfig'] = base64.b64encode(barcode)
        value = self.softwareurl
        barcode = createBarcodeImageInMemory('QR',
                                             value=value,
                                             format='png',
                                             width=400,
                                             height=400,
                                             humanReadable=0)
        vals['qrdownload'] = base64.b64encode(barcode)
Example #2
0
                s.append(Spacer(36, 12))
            s.append(Paragraph('Barcode should say: ' + dr._bc.value, styleN))
            story.append(KeepTogether(s))

    SimpleDocTemplate(fileName).build(story)
    print('created', fileName)


if __name__ == '__main__':
    run()
    fullTest()

    def createSample(name, memory):
        f = open(name, 'wb')
        f.write(memory)
        f.close()

    createSample('test_cbcim.png',
                 createBarcodeImageInMemory('EAN13', value='123456789012'))
    createSample(
        'test_cbcim.gif',
        createBarcodeImageInMemory('EAN8', value='1234567', format='gif'))
    createSample(
        'test_cbcim.pdf',
        createBarcodeImageInMemory('UPCA', value='03600029145', format='pdf'))
    createSample(
        'test_cbcim.tiff',
        createBarcodeImageInMemory('USPS_4State',
                                   value='01234567094987654321',
                                   routing='01234567891',
                                   format='tiff'))
Example #3
0
    scales = list(map(float,scales and flatten(scales) or [1]))
    for scale in scales:
        story.append(PageBreak())
        story.append(Paragraph('Scale = %.1f'%scale, styleH2))
        story.append(Spacer(36, 12))
        for codeName in codeNames:
            s = [Paragraph('Code: ' + codeName, styleH2)]
            for hr in (0,1):
                s.append(Spacer(36, 12))
                dr = createBarcodeDrawing(codeName, humanReadable=hr,**options)
                dr.renderScale = scale
                s.append(dr)
                s.append(Spacer(36, 12))
            s.append(Paragraph('Barcode should say: ' + dr._bc.value, styleN))
            story.append(KeepTogether(s))

    SimpleDocTemplate(fileName).build(story)
    print('created', fileName)

if __name__=='__main__':
    run()
    fullTest()
    def createSample(name,memory):
        f = open(name,'wb')
        f.write(memory)
        f.close()
    createSample('test_cbcim.png',createBarcodeImageInMemory('EAN13', value='123456789012'))
    createSample('test_cbcim.gif',createBarcodeImageInMemory('EAN8', value='1234567', format='gif'))
    createSample('test_cbcim.pdf',createBarcodeImageInMemory('UPCA', value='03600029145',format='pdf'))
    createSample('test_cbcim.tiff',createBarcodeImageInMemory('USPS_4State', value='01234567094987654321',routing='01234567891',format='tiff'))
            s = [Paragraph("Code: " + codeName, styleH2)]
            for hr in (0, 1):
                s.append(Spacer(36, 12))
                dr = createBarcodeDrawing(codeName, humanReadable=hr, **options)
                dr.renderScale = scale
                s.append(dr)
                s.append(Spacer(36, 12))
            s.append(Paragraph("Barcode should say: " + dr._bc.value, styleN))
            story.append(KeepTogether(s))

    SimpleDocTemplate(fileName).build(story)
    print "created", fileName


if __name__ == "__main__":
    run()
    fullTest()

    def createSample(name, memory):
        f = open(name, "wb")
        f.write(memory)
        f.close()

    createSample("test_cbcim.png", createBarcodeImageInMemory("EAN13", value="123456789012"))
    createSample("test_cbcim.gif", createBarcodeImageInMemory("EAN8", value="1234567", format="gif"))
    createSample("test_cbcim.pdf", createBarcodeImageInMemory("UPCA", value="03600029145", format="pdf"))
    createSample(
        "test_cbcim.tiff",
        createBarcodeImageInMemory("USPS_4State", value="01234567094987654321", routing="01234567891", format="tiff"),
    )
Example #5
0
    scales = list(map(float,scales and flatten(scales) or [1]))
    for scale in scales:
        story.append(PageBreak())
        story.append(Paragraph('Scale = %.1f'%scale, styleH2))
        story.append(Spacer(36, 12))
        for codeName in codeNames:
            s = [Paragraph('Code: ' + codeName, styleH2)]
            for hr in (0,1):
                s.append(Spacer(36, 12))
                dr = createBarcodeDrawing(codeName, humanReadable=hr,**options)
                dr.renderScale = scale
                s.append(dr)
                s.append(Spacer(36, 12))
            s.append(Paragraph('Barcode should say: ' + dr._bc.value, styleN))
            story.append(KeepTogether(s))

    SimpleDocTemplate(fileName).build(story)
    print('created', fileName)

if __name__=='__main__':
    run()
    fullTest()
    def createSample(name,memory):
        f = open(name,'wb')
        f.write(memory)
        f.close()
    createSample('test_cbcim.png',createBarcodeImageInMemory('EAN13', value='123456789012'))
    createSample('test_cbcim.gif',createBarcodeImageInMemory('EAN8', value='1234567', format='gif'))
    createSample('test_cbcim.pdf',createBarcodeImageInMemory('UPCA', value='03600029145',format='pdf', barHeight=40))
    createSample('test_cbcim.tiff',createBarcodeImageInMemory('USPS_4State', value='01234567094987654321',routing='01234567891',format='tiff'))