-
Notifications
You must be signed in to change notification settings - Fork 0
/
3.9.py
128 lines (117 loc) · 3.72 KB
/
3.9.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
from cardsmith import *
from data.source import OnlineSource
from elements.rect import RectElement
from elements.conditional import ConditionalElement
from elements.ellipse import EllipseElement
from elements.text import TextElement
from elements.image import ImageElement
from settings import Settings
url = "https://docs.google.com/spreadsheets/d/e/2PACX-1vQfcuVJtXMn4PGIY7id1qMlOi4IbkVqFpqSArPBe-YZlKZ2crQuPx_IzHGe5O8z86uPB93QAykHNT4T/pub?gid=2074238036&single=true&output=csv"
SUITE_SIZE = Point(120, 120)
Settings.CardsDirectory = 'out/cards/3.9'
Settings.DecksDirectory = 'out/decks/3.9'
schema = Schema(
dimensions=Point(2.5 * 96 * 2, 3.5 * 96 * 2),
naming='$name$',
deck_name='3.9 ',
group_by='$deck$',
required_entry_fields=['name', 'title', 'type', 'effect', 'deck'],
elements=[
# Background
ConditionalElement('$type$=Blades', [
RectElement(
fill='muted_green',
offset=Point(0, 0),
size=Point(PARENT, PARENT)
)
]),
ConditionalElement('$type$=Stone', [
RectElement(
fill='muted_red',
offset=Point(0, 0),
size=Point(PARENT, PARENT)
)
]),
ConditionalElement('$type$=Scrolls', [
RectElement(
fill='muted_blue',
offset=Point(0, 0),
size=Point(PARENT, PARENT)
)
]),
# Text
RectElement(
fill='white',
offset=Point(PARENT * (1 / 20), PARENT * (1/5)),
size=Point(PARENT * (1 - 1 / 10), PARENT * (1 - 1 / 5 - 1 / 20)),
children=[
TextElement(
text='$effect$',
font_path='alegreya',
fill='black',
font_size=50,
alignment=MiddleCenter,
)
],
outline='gold',
outlineWidth=8,
),
# Title
RectElement(
fill='blank',
offset=Point(PARENT / 20, 10),
size=Point(PARENT * (19/20) - SUITE_SIZE.x, 80),
alignment=TopLeft,
children=[
TextElement(
text='$name$',
font_path='alegreya_bold',
fill='black',
font_size=55,
alignment=MiddleLeft,
offset=Point(0, -10),
),
]
).make_invisible(),
# Subtitle
RectElement(
fill='blank',
offset=Point(PARENT / 20, 90),
size=Point(PARENT * (19/20) - SUITE_SIZE.x, 40),
alignment=TopLeft,
children=[
TextElement(
text='$title$',
font_path='alegreya_italic',
fill='black',
font_size=36,
alignment=MiddleLeft,
offset=Point(0, -15),
),
]
).make_invisible(),
# Suites
ConditionalElement('$type$=Blades', [
ImageElement(
name='Blades Suite.png',
alignment=TopRight,
size=SUITE_SIZE,
)
]),
ConditionalElement('$type$=Stone', [
ImageElement(
name='Stone Suite.png',
alignment=TopRight,
size=SUITE_SIZE,
)
]),
ConditionalElement('$type$=Scrolls', [
ImageElement(
name='Scrolls Suite.png',
alignment=TopRight,
size=SUITE_SIZE,
)
]),
],
)
schema.process(OnlineSource(url))