Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge update #40

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
ea5450e
Alterações na contagem da primeira página
Apr 1, 2010
78aa5cc
Merge branch 'master' of git://github.com/marinho/geraldo
Apr 1, 2010
ee96ba6
Merge branch 'master' of git://github.com/marinho/geraldo
Apr 12, 2010
f5d6dd9
Merge branch 'master' of git://github.com/marinho/geraldo
Apr 12, 2010
9bd38a9
Correcting page numbering and on_new_page event
Apr 13, 2010
f8136e2
Merge branch 'master' of git://github.com/marinho/geraldo
Apr 13, 2010
3d117fd
Correcting widgets borders and adding padding for widgets
Apr 13, 2010
f15af6a
Just to include BarCode
Apr 14, 2010
8048724
Small change regarding widgets padding_bottom
Apr 14, 2010
5e226b1
Subreports anywhere - first try
Apr 15, 2010
11781a3
Including a proper transform_classes_to_objects method into class Sub…
Apr 15, 2010
72103a2
Changes additional_fonts in order to support font mapping
Apr 16, 2010
e6b6d6e
Missed import from last commit
Apr 16, 2010
be63035
Allow events to be either a method or a regular function
Apr 16, 2010
e6d429c
Merge remote branch 'marinho/master'
Apr 16, 2010
f5b24cf
Merge remote branch 'marinho/master'
Aug 25, 2010
f9bd07b
Merge remote branch 'marinho/master'
Dec 20, 2010
c37a6e7
Merge remote-tracking branch 'marinho/master'
aricaldeira Aug 29, 2012
b018973
Corrigindo a geração de bandas via classes
aricaldeira Aug 29, 2012
cdba968
Start new page correctly when auto_height is enabled for the detail band
aricaldeira Mar 1, 2013
a02d922
Adicionando código de barras QRCode
Jan 20, 2014
5831b76
Ajuste para valores padrão (django, campo ForeignKey retorna None, _d…
Feb 17, 2014
b1f04a6
Ajustando cópia de widgets
Feb 17, 2014
ee0a76e
Adicionando arquivo a ignorar
Mar 7, 2014
5bb1b6d
Ajustando bordas e tratamento de subrelatórios com cabeçalho
Mar 7, 2014
d0815a2
Permitindo valores padrão para os widget (útil para a inexistência de…
Mar 24, 2014
6f5bb17
Ajustando gerador CSV para tratar unicode
Jul 4, 2014
a1215f3
setup.py: Don't import packages that aren't installed yet.
leorochael Mar 24, 2016
a882f5b
Merge pull request #1 from leorochael/master
mileo Mar 24, 2016
702514c
Merge pull request #1 from odoo-brazil/master
aricaldeira Aug 1, 2017
e559032
Merge pull request #2 from marinho/master
mileo Aug 21, 2018
60ff16f
Merge branch 'marinho:master' into master
amendoncabh Aug 10, 2022
b5684dc
Merge pull request #1 from odoo-brazil/master
amendoncabh May 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ Geraldo.egg-info
*$py.class
site/fonts
site/layout

*~
.directory
1 change: 1 addition & 0 deletions geraldo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,5 @@
from graphics import RoundRect, Rect, Line, Circle, Arc, Ellipse, Image
from exceptions import EmptyQueryset, ObjectNotFound, ManyObjectsFound, AbortEvent
from cross_reference import CrossReferenceMatrix
from barcodes import BarCode

27 changes: 17 additions & 10 deletions geraldo/barcodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
from reportlab.graphics.barcode.code93 import Extended93, Standard93
from reportlab.graphics.barcode.usps import FIM, POSTNET
from reportlab.graphics.barcode.usps4s import USPS_4State
from reportlab.graphics.barcode import createBarcodeDrawing
from reportlab.graphics.barcode.qr import QrCodeWidget
from reportlab.graphics.barcode import createBarcodeDrawing

SUPPORTED_BARCODE_TYPES = getCodeNames()
BARCODE_CLASSES = {
Expand All @@ -29,8 +30,10 @@
'Standard39': Standard39,
'Standard93': Standard93,
'USPS_4State': USPS_4State,
'QR': QrCodeWidget,
}


class BarCode(Graphic):
"""Class used by all barcode types generation. A barcode is just another graphic
element, with basic attributes, like 'left', 'top', 'width', 'height' and
Expand All @@ -41,7 +44,7 @@ class BarCode(Graphic):
means you must have a value like 0.01*cm or less to have a good result).

Another attribute is 'routing_attribute' used only by type 'USPS_4State'.

Also supports 'get_value' lambda attribute, like ObjectValue (with the argument
'inst')"""

Expand All @@ -51,6 +54,7 @@ class BarCode(Graphic):
attribute_name = None
checksum = 0
routing_attribute = None
aditional_barcode_params = {}
get_value = None # A lambda function to get customized values

def clone(self):
Expand All @@ -61,6 +65,7 @@ def clone(self):
new.get_value = self.get_value
new.checksum = self.checksum
new.routing_attribute = self.routing_attribute
new.aditional_barcode_params = self.aditional_barcode_params

return new

Expand All @@ -73,13 +78,16 @@ def set_type(self, typ):

def render(self):
if not getattr(self, '_rendered_drawing', None):
kwargs = {
'value': self.get_object_value(),
'barWidth': self.width,
'barHeight': self.height,
}

if self.type in ('EAN13','EAN8',):
kwargs = self.aditional_barcode_params
kwargs['value'] = self.get_object_value()

if 'barWidth' not in kwargs:
kwargs['barWidth'] = self.width

if 'barHeight' not in kwargs:
kwargs['barHeight'] = self.height

if self.type in ('EAN13','EAN8','QR'):
self._rendered_drawing = createBarcodeDrawing(self.type, **kwargs)
else:
cls = BARCODE_CLASSES[self.type]
Expand Down Expand Up @@ -113,4 +121,3 @@ def _set_width(self, value):
self._width = value

width = property(_get_width, _set_width)

Loading