data-workers-publication/create_cover.py

173 lines
3.5 KiB
Python
Raw Normal View History

2019-03-25 08:35:09 +01:00
from functions import insert_linebreaks, language
# txt art
# unicode art
# plainpatterns
# plaintxtfun
covers = {
'en': {
'data_workers' : {
'subject' : 'data workers',
'action' : 'write, perform, clean, inform, read and learn'
},
'writers' : {
'subject' : 'writers',
'action' : 'write'
},
'oracles' : {
'subject' : 'oracles',
'action' : 'predict'
},
'cleaners' : {
'subject' : 'cleaners',
'action' : 'clean'
},
'informants' : {
'subject' : 'informants',
'action' : 'inform'
},
'readers' : {
'subject' : 'readers',
'action' : 'read'
},
'learners' : {
'subject' : 'learners',
'action' : 'learn'
}
},
'fr' : {
'data_workers' : {
'subject' : 'data workers',
'action' : 'write, perform, clean, inform, read and learn'
},
'écrivains' : {
'subject' : 'writers',
'action' : 'write'
},
'oracles' : {
'subject' : 'oracles',
'action' : 'predict'
},
'nettoyeurs' : {
'subject' : 'cleaners',
'action' : 'clean'
},
'informateurs' : {
'subject' : 'informants',
'action' : 'inform'
},
'lecteurs' : {
'subject' : 'readers',
'action' : 'read'
},
'apprenants' : {
'subject' : 'learners',
'action' : 'learn'
}
},
'fr.bak' : {
'data_workers' : {
'subject' : 'data workers',
'action' : 'écrire, exécuter, nettoyer, informer, lire et apprendre'
},
'écrivains' : {
'subject' : 'écrivains',
'action' : 'écrire'
},
'oracles' : {
'subject' : 'oracles',
'action' : 'exécuter'
},
'nettoyeurs' : {
'subject' : 'nettoyeurs',
'action' : 'nettoyer'
},
'informateurs' : {
'subject' : 'informateurs',
'action' : 'informer'
},
'lecteurs' : {
'subject' : 'lecteurs',
'action' : 'lire'
},
'apprenants' : {
'subject' : 'apprenants',
'action' : 'apprendre'
}
}
}
cover_bottom_en = '''
What
can
humans learn from humans
humans learn with machines
machines learn from machines
machines learn with humans
humans learn from machines
machines learn with machines
machines learn from humans
humans learn with humans
? ? ?
Data Workers, an exhibition at the Mundaneum in Mons from 28 March until 28 April 2019.'''
cover_bottom_fr = '''
What
can
humans learn from humans
humans learn with machines
machines learn from machines
machines learn with humans
humans learn from machines
machines learn with machines
machines learn from humans
humans learn with humans
? ? ?
Data Workers, une exposition au Mundaneum à Mons du 28 mars au 28 avril 2019.'''
def create_cover(zone, language, steps=1):
linewidth = 110
lines_per_page = 70
maximum = 100
subject = covers[language][zone]['subject']
action = covers[language][zone]['action']
tmp = ''
for i in range(2, maximum):
tmp += subject
tmp += ' '
tmp += action
tmp += ' ' * steps * i # spaces
for i in reversed(range(maximum)):
tmp += subject
tmp += ' '
tmp += action
tmp += ' ' * steps * i # spaces
out = insert_linebreaks(tmp, linewidth)
# insert bottom text only on the main cover
if 'data_workers' in zone:
if language == 'en':
out = '\n'.join(out.split('\n')[:lines_per_page-15]) # select the lines to fill one page
out += cover_bottom_en
else:
out = '\n'.join(out.split('\n')[:lines_per_page-15]) # select the lines to fill one page
out += cover_bottom_fr
else:
out = '\n'.join(out.split('\n')[:lines_per_page]) # select the lines to fill one page
return out + '\n'
# print(create_cover(zone, steps=1))