Skip to content

Commit a487a3c

Browse files
committed
adding things
1 parent f8a05ca commit a487a3c

File tree

8 files changed

+19
-11
lines changed

8 files changed

+19
-11
lines changed

Config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
BAK_FILE = 'plantilla.png'
2626
BAK_PATH = path.join(RES_PATH, EDITIONS_FOLDER, EDITION, BAK_FILE)
2727

28-
# FONT_FILE = 'Montserrat-Regular.ttf'
28+
FONT_FOLDER = 'fonts'
2929
FONT_FILE = 'SpaceMono-Bold.ttf'
30-
FONT_PATH = path.join(RES_PATH, FONT_FILE)
30+
FONT_PATH = path.join(RES_PATH, FONT_FOLDER, FONT_FILE)
3131
TYPE_FONT_SIZE = 18
3232
NAME_FONT_SIZE = 12
3333
FONT_COLOR = (0,0,0)

Model.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
class Card:
1212
QR_PIX_SIZE = 1
13-
QR_POS = (1301, 172)
14-
QR_SIZE = (723, 723)
13+
QR_POS = (147, 10)
14+
QR_SIZE = (100, 100)
1515
QR_BORDER_SIZE = 0
1616
TYPE_POS = (0, 155)
1717
# NAME_POS = (500, 1250)
@@ -64,7 +64,7 @@ def get_data():
6464

6565
class Guest(Assistant):
6666
__ID = 1
67-
__TYPE = 'INVITADO'
67+
__TYPE = 'CONVIDAT'
6868
__DATA = 'guests'
6969

7070
def __init__(self, name, mtype=None, has_qr=False):
@@ -94,7 +94,7 @@ def get_data(name=None):
9494

9595
class Company(Assistant):
9696
__ID = 1
97-
__TYPE = ''
97+
__TYPE = 'EMPRESSA'
9898
__DATA = 'companies'
9999

100100
def __init__(self, name, image):
@@ -127,7 +127,7 @@ def get_data(name=None):
127127
class Volunteer(Assistant):
128128
__ID = 1
129129
__LOGO_PATH = os.path.join(Config.RES_PATH, 'editions', Config.EDITION, 'images', 'logogran.png')
130-
__TYPE = 'VOLUNTARIA/O'
130+
__TYPE = 'VOLUNTARI/A'
131131
__DATA = 'volunteers'
132132

133133
def __init__(self, name):
@@ -156,7 +156,7 @@ def get_data(name=None):
156156
class Organizer(Assistant):
157157
__ID = 1
158158
__LOGO_PATH = os.path.join(Config.RES_PATH, 'editions', Config.EDITION, 'images', 'logogran.png')
159-
__TYPE = 'ORGANIZACIÓN'
159+
__TYPE = 'ORGANIZACIÓ'
160160
__DATA = 'organizers'
161161

162162
def __init__(self, name):

Tools.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ def draw_text(image, text, pos, font, fill, centrate=True, mayus=True):
3838
else:
3939
ImageDraw.Draw(image).text(pos, text, font=font,fill=fill)
4040

41+
def centrate_text_relative(image, text, font, fill, relative_pos, relative_size, mayus=True):
42+
if mayus:
43+
text = text.upper()
44+
draw = ImageDraw.Draw(image)
45+
w, h = draw.textsize(text, font=font)
46+
x = relative_pos[0] + (relative_size[0] - w) / 2
47+
y = relative_pos[1] + (relative_size[1] - h) / 2
48+
ImageDraw.Draw(image).text((x, y), text, font=font,fill=fill)
4149

4250
def scale(image, max_size, add_mask=True, method=Image.ANTIALIAS):
4351
"""

main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
for u in users:
1919
u.generate_card()
2020
u.save()
21-
break
21+
# break

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ grpcio==1.25.0
1616
httplib2==0.19.0
1717
idna==2.8
1818
msgpack==0.6.2
19-
Pillow==8.4
19+
Pillow==8.3.2
2020
# pkg-resources==0.0.0
2121
protobuf==3.15.0
2222
pyasn1==0.4.7
2323
pyasn1-modules==0.2.7
2424
pytz==2019.3
25-
qrcode==7.0
25+
qrcode==6.1
2626
requests==2.22.0
2727
rsa==4.0
2828
six==1.13.0
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)