def effect(self): x, y = self.view_center bargen = getBarcode( self.options.type, text=self.options.text, height=self.options.height, document=self.document, x=0, y=0, scale=self.unittouu('0.33mm'), addon= self.options.addon, quietmark= self.options.quietmark, ) if bargen is not None: barcode,w,h = bargen.generate() if barcode is not None: (x,y) = self.view_center #Put in in the centre of the current view y-=h/2.0 x-=w/2.0 centre=(x,y) grp_transform = 'translate' + str( centre ) grp_name = 'Barcode' grp_attribs = {inkex.addNS('label','inkscape'):grp_name, 'transform':grp_transform } grp = inkex.etree.SubElement(self.current_layer, 'g', grp_attribs)#the group to put everything in if not isinstance(barcode,list): barcode=[barcode] for bc in barcode: grp.append(bc) else: sys.stderr.write("No barcode was generated\n") else: sys.stderr.write("Unable to make barcode with: " + str(self.options) + "\n")
def effect(self): (pos_x, pos_y) = computePointInNode( list(self.view_center), self.current_layer) barcode = getBarcode(self.options.type, text=self.options.text, height=self.options.height, document=self.document, x=pos_x, y=pos_y, scale=self.unittouu('1px'), ).generate() if barcode is not None: self.current_layer.append(barcode) else: sys.stderr.write("No barcode was generated\n")
def effect(self): x, y = self.view_center bargen = getBarcode( self.options.type, { 'text' : self.options.text, 'height' : self.options.height, 'document' : self.document, 'x' : x, 'y' : y, } ) if bargen is not None: barcode = bargen.generate() if barcode is not None: self.current_layer.append(barcode) else: sys.stderr.write("No barcode was generated\n") else: sys.stderr.write("Unable to make barcode with: " + str(self.options) + "\n")
def effect(self): x, y = computePointInNode(list(self.view_center), self.current_layer) bargen = getBarcode( self.options.type, text=self.options.text, height=self.options.height, document=self.document, x=x, y=y, scale=self.unittouu('1px'), ) if bargen is not None: barcode = bargen.generate() if barcode is not None: self.current_layer.append(barcode) else: sys.stderr.write("No barcode was generated\n") else: sys.stderr.write("Unable to make barcode with: " + str(self.options) + "\n")
def effect(self): x, y = self.view_center object = getBarcode( self.options.type, { 'text': self.options.text, 'height': self.options.height, 'document': self.document, 'x': x, 'y': y, }) if object is not None: barcode = object.generate() if barcode is not None: self.current_layer.append(barcode) else: sys.stderr.write("No barcode was generated\n") else: sys.stderr.write("Unable to make barcode with: " + str(self.options) + "\n")
def effect(self): x, y = self.view_center bargen = getBarcode( self.options.type, text=self.options.text, height=self.options.height, document=self.document, x=x, y=y, scale=self.unittouu('1px'), ) if bargen is not None: barcode = bargen.generate() if barcode is not None: self.current_layer.append(barcode) else: sys.stderr.write("No barcode was generated\n") else: sys.stderr.write("Unable to make barcode with: " + str(self.options) + "\n")
def test_barcode(): """Run from command line""" for (kind, text) in ( ('Ean2', '55'), ('Ean5', '54321'), ('Ean8', '0123456'), ('Ean13', '123456789101'), ('Ean13', '12345678910155'), ('Ean13', '12345678910154321'), ('Code128', 'Martin is Great'), ('Code25i', '3242322'), ('Code39', '4443322888'), ('Code93', '3332222'), ('Rm4scc', 'ROYAL POINT'), ('Upca', '12345678911'), ('Upce', '123456'), ): print "RENDER TEST: %s" % kind bargen = getBarcode(kind, text=text) if bargen is not None: barcode = bargen.generate() if barcode is not None: print inkex.etree.tostring(barcode, pretty_print=True)
def test_barcode(): bargen = getBarcode("Ean13", text="123456789101") if bargen is not None: barcode = bargen.generate() if barcode: print inkex.etree.tostring(barcode, pretty_print=True)
def test_barcode(): bargen = getBarcode("Ean13", text="123456789101") if bargen is not None: barcode,w,h = bargen.generate() if barcode: print inkex.etree.tostring(barcode, pretty_print=True)