Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Gepetto Utils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gepetto
Gepetto Utils
Commits
cb40b401
Commit
cb40b401
authored
1 year ago
by
Guilhem Saurel
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'main/master'
parents
cc7035c2
a58806a6
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
scripts/data/offices-ldap.json
+78
-58
78 additions, 58 deletions
scripts/data/offices-ldap.json
scripts/data/rdc.png
+0
-0
0 additions, 0 deletions
scripts/data/rdc.png
scripts/offices.py
+58
-42
58 additions, 42 deletions
scripts/offices.py
with
136 additions
and
100 deletions
scripts/data/offices-ldap.json
+
78
−
58
View file @
cb40b401
{
"
B181
"
:
[
"
Algeco4
"
:
[
[
"Bonnefoy"
,
"Aurélie"
"Lalles"
,
"Ariane"
]
],
"B01"
:
[
[
"Baudu"
,
"Dorian"
],
[
"
Otmani
"
,
"
Sabrina
"
"
Nguyen
"
,
"
Dinh Vinh Thanh
"
],
[
"
Risbourg
"
,
"
Fanny
"
"
Wojciechowski
"
,
"
Krzysztof
"
]
],
"B
61a
"
:
[
"B
03
"
:
[
[
"
Taix
"
,
"
Michel
"
"
Haffemayer
"
,
"
Arthur
"
],
[
"
Watier
"
,
"
Bruno
"
"
Pomarat
"
,
"
Zoé
"
]
],
"B63"
:
[
[
"Dantec"
,
"Ewen"
],
"B04"
:
[
[
"
Parag
"
,
"
Amit
"
"
Sabbah
"
,
"
Maxime
"
]
],
"B6
5
"
:
[
"B
0
6"
:
[
[
"
Flayols
"
,
"
Thomas
"
"
Batto
"
,
"
Virgile
"
],
[
"
Lasguigne
s"
,
"
Thibaud
"
"
De Mattei
s"
,
"
Ludovic
"
],
[
"
Marsan
"
,
"
Thibault
"
"
Hadj Sassi
"
,
"
Sonia-Laure
"
],
[
"
Naveau
"
,
"
Maximilien
"
"
Perrot
"
,
"
Côme
"
]
],
"B67"
:
[
[
"Fadini"
,
"Gabriele"
],
"B08"
:
[
[
"
Jallet
"
,
"
Wilson
"
"
Flayols
"
,
"
Thomas
"
],
[
"Leziart"
,
"Pierre-Alexandre"
],
[
"
Nguyen
"
,
"
Dinh Vinh Thanh
"
"
Martinez-Fouché
"
,
"
Théo
"
],
[
"
Perrot
"
,
"
Côme
"
"
Subburaman
"
,
"
Rajesh
"
]
],
"B
68
"
:
[
"B
10
"
:
[
[
"
Deves
"
,
"
Mathieu
"
"
Chane-Sane
"
,
"
Elliot
"
],
[
"Sabbah"
,
"Maxime"
"Fernbach"
,
"Pierre"
],
[
"Lasguignes"
,
"Thibaud"
],
[
"Marsan"
,
"Thibault"
]
],
"B
69.1
"
:
[
"B
114
"
:
[
[
"Bonnet"
,
"Vincent"
"Jeannot"
,
"Thibault"
],
[
"Lutz"
,
"Victor"
],
[
"Parent"
,
"Laure"
]
],
"B6
9.2
"
:
[
"B
1
6"
:
[
[
"
Villa
"
,
"
Nahuel
"
"
Lamiraux
"
,
"
Florent
"
]
],
"B
9
1"
:
[
"B1
7
"
:
[
[
"Soueres"
,
"Philippe"
"Taix"
,
"Michel"
],
[
"Watier"
,
"Bruno"
]
],
"B
92
"
:
[
"B
18
"
:
[
[
"Stasse"
,
"Olivier"
]
],
"B9
4
"
:
[
"B
1
9"
:
[
[
"Lamiraux"
,
"Florent"
],
"Soueres"
,
"Philippe"
]
],
"B20"
:
[
[
"Mansard"
,
"Nicolas"
...
...
This diff is collapsed.
Click to expand it.
scripts/data/rdc.png
0 → 100644
+
0
−
0
View file @
cb40b401
18.4 KiB
This diff is collapsed.
Click to expand it.
scripts/offices.py
+
58
−
42
View file @
cb40b401
...
...
@@ -22,20 +22,19 @@ LOGO = "data/logo-low-black.png"
DPCM
=
300
/
2.54
# dot per cm @300DPI
WIDTH
,
HEIGHT
=
int
(
6
*
DPCM
),
int
(
3
*
DPCM
)
# door labels are 6cm x 3cm
NOT_OFFICES
=
[
"
Exterieur
"
,
"
BSalleGerardBauzil
"
]
BAT_B
=
"
data/
bat_b
.png
"
BAT_B
=
"
data/
rdc
.png
"
MAP_POSITIONS
=
[
(
"
B181
"
,
1600
,
830
),
(
"
B185
"
,
1600
,
130
),
(
"
B61a
"
,
1333
,
1820
),
(
"
B63
"
,
1333
,
1500
),
(
"
B65
"
,
1333
,
1320
),
(
"
B67
"
,
1333
,
870
),
(
"
B69.1
"
,
1333
,
680
),
(
"
B69.2
"
,
1333
,
520
),
(
"
B90
"
,
0
,
130
),
(
"
B91
"
,
0
,
280
),
(
"
B92
"
,
0
,
430
),
(
"
B94
"
,
0
,
750
),
(
"
B20
"
,
460
,
50
,
650
,
228
,
-
350
),
(
"
B19
"
,
460
,
233
,
650
,
412
,
-
350
),
(
"
B18
"
,
460
,
420
,
650
,
598
,
-
350
),
(
"
B17
"
,
460
,
608
,
650
,
785
,
-
350
),
(
"
B16
"
,
460
,
793
,
650
,
966
,
-
350
),
(
"
B10
"
,
1410
,
450
,
1670
,
691
,
400
),
(
"
B08
"
,
1410
,
700
,
1670
,
925
,
400
),
(
"
B06
"
,
1410
,
932
,
1670
,
1161
,
400
),
(
"
B04
"
,
1410
,
1453
,
1670
,
1647
,
400
),
(
"
B03
"
,
1410
,
1656
,
1670
,
1834
,
400
),
(
"
B01
"
,
1410
,
2021
,
1670
,
2202
,
400
),
]
...
...
@@ -98,31 +97,29 @@ class Offices:
# Stuff that is wrong in LDAP… We should fix that there
WRONG_OFFICE
=
{
"
Exterieur
"
:
{(
"
Nils
"
,
"
Hareng
"
),
(
"
Wilson
"
,
"
Jallet
"
)},
"
BSalleGerardBauzil
"
:
{(
"
Quang Anh
"
,
"
Le
"
)},
"
B63
"
:
{(
"
Médéric
"
,
"
Fourmy
"
)},
"
B65
"
:
{(
"
Thomas
"
,
"
Flayols
"
)},
"
B69.1
"
:
{(
"
Pierre
"
,
"
Fernbach
"
)},
"
B90
"
:
{(
"
Nicolas
"
,
"
Mansard
"
)},
"
B69.2
"
:
{(
"
Dinh Vinh Thanh
"
,
"
Nguyen
"
),
(
"
Filip
"
,
"
Becanovic
"
)},
"
B04
"
:
{
(
"
Vincent
"
,
"
Bonnet
"
),
},
"
B10
"
:
{
(
"
Guilhem
"
,
"
Saurel
"
),
},
"
Exterieur
"
:
{
(
"
Ariane
"
,
"
Lalles
"
),
},
}
WRONG_OFFICE
=
{
k
:
{
Gepettist
(
sn
,
gn
)
for
(
gn
,
sn
)
in
v
}
for
k
,
v
in
WRONG_OFFICE
.
items
()
}
# Fix unicode from LDAP data…
ALIAS
=
{
"
B67
"
:
[
({
Gepettist
(
"
Leziart
"
,
"
Pierre-Alexandre
"
)},
{
Gepettist
(
"
Léziart
"
,
"
P-A
"
)}),
"
B08
"
:
[
(
{
Gepettist
(
"
Smaldone
"
,
"
Filippo Maria
"
)},
{
Gepettist
(
"
Smaldone
"
,
"
Filippo M.
"
)},
),
],
"
B61a
"
:
[({
Gepettist
(
"
Taix
"
,
"
Michel
"
)},
{
Gepettist
(
"
Taïx
"
,
"
Michel
"
)})],
"
B91
"
:
[({
Gepettist
(
"
Soueres
"
,
"
Philippe
"
)},
{
Gepettist
(
"
Souères
"
,
"
Philippe
"
)})],
"
B69.2
"
:
[
({
Gepettist
(
"
Nguyen
"
,
"
Dinh Vinh Thanh
"
)},
{
Gepettist
(
"
Nguyen
"
,
"
D. V. T.
"
)})
{
Gepettist
(
"
Leziart
"
,
"
Pierre-Alexandre
"
)},
{
Gepettist
(
"
Léziart
"
,
"
Pierre-Alexandre
"
)},
)
],
"
B17
"
:
[({
Gepettist
(
"
Taix
"
,
"
Michel
"
)},
{
Gepettist
(
"
Taïx
"
,
"
Michel
"
)})],
"
B19
"
:
[({
Gepettist
(
"
Soueres
"
,
"
Philippe
"
)},
{
Gepettist
(
"
Souères
"
,
"
Philippe
"
)})],
}
...
...
@@ -134,15 +131,15 @@ def door_label(members, logo=True):
width
=
WIDTH
,
height
=
HEIGHT
,
background
=
Color
(
"
white
"
)
)
as
img
,
Drawing
()
as
draw
:
if
logo
:
with
Image
(
filename
=
LOGO
)
as
l
ogo
:
l
ogo
.
transform
(
resize
=
f
"
{
WIDTH
}
x
{
HEIGHT
}
"
)
draw
.
composite
(
"
over
"
,
200
,
0
,
l
ogo
.
width
,
l
ogo
.
height
,
l
ogo
)
if
len
(
members
)
>
4
:
draw
.
font_size
=
7
0
elif
len
(
members
)
==
4
:
draw
.
font_size
=
80
with
Image
(
filename
=
LOGO
)
as
l
i
:
l
i
.
transform
(
resize
=
f
"
{
WIDTH
}
x
{
HEIGHT
}
"
)
draw
.
composite
(
"
over
"
,
200
,
0
,
l
i
.
width
,
l
i
.
height
,
l
i
)
if
len
(
members
)
>
2
or
not
logo
:
draw
.
font_size
=
6
0
#
elif len(members) ==
3
:
#
draw.font_size =
75
else
:
draw
.
font_size
=
9
0
draw
.
font_size
=
8
0
draw
.
text_alignment
=
"
center
"
height
=
HEIGHT
-
len
(
members
)
*
draw
.
font_size
draw
.
text
(
...
...
@@ -154,6 +151,16 @@ def door_label(members, logo=True):
return
img
.
clone
()
def
office_number
(
office
):
c
=
int
(
DPCM
*
1.5
)
with
Image
(
width
=
c
,
height
=
c
,
background
=
Color
(
"
white
"
))
as
img
,
Drawing
()
as
draw
:
draw
.
font_size
=
90
draw
.
text_alignment
=
"
center
"
draw
.
text
(
int
(
c
/
2
),
int
(
c
/
2
),
office
)
draw
(
img
)
return
img
.
clone
()
def
offices_ldap
():
"""
Get a dict of Gepettists in their respective office from LDAP.
"""
conn
=
Connection
(
"
ldap.laas.fr
"
,
auto_bind
=
True
)
...
...
@@ -176,6 +183,7 @@ def offices_ldap():
):
continue
# filter out alumni
if
room
==
"
[]
"
:
logging
.
warning
(
f
"
Pas de bureau pour
{
gn
}
{
sn
}
"
)
continue
# filter out the Sans-Bureaux-Fixes
offices
[
room
].
add
(
Gepettist
(
sn
,
gn
))
return
offices
...
...
@@ -221,10 +229,18 @@ def labels(offices):
def
maps
(
offices
,
fixed
):
"""
Generate a map with labels
"""
with
Image
(
filename
=
BAT_B
)
as
page
,
Drawing
()
as
draw
:
for
office
,
x
,
y
in
MAP_POSITIONS
:
label
=
door_label
(
offices
[
office
],
logo
=
False
)
if
label
:
draw
.
composite
(
"
over
"
,
x
,
y
,
label
.
width
/
3
,
label
.
height
/
3
,
label
)
for
office
,
x1
,
y1
,
x2
,
y2
,
shift
in
MAP_POSITIONS
:
for
i
,
img
in
enumerate
(
(
office_number
(
office
),
door_label
(
offices
[
office
],
logo
=
False
)),
):
if
img
:
width
=
img
.
width
/
2
height
=
img
.
height
/
2
x
=
(
x1
+
x2
-
width
)
/
2
+
shift
*
i
y
=
(
y1
+
y2
-
height
)
/
2
draw
.
composite
(
"
over
"
,
x
,
y
,
width
,
height
,
img
)
else
:
logging
.
warning
(
f
"
no label for
{
office
}
"
)
draw
(
page
)
page
.
save
(
filename
=
"
generated_map%s.png
"
%
(
"
_fixed
"
if
fixed
else
""
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment