-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.py
More file actions
28 lines (23 loc) · 793 Bytes
/
utils.py
File metadata and controls
28 lines (23 loc) · 793 Bytes
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
from termcolor import colored
import shutil
from shutil import copyfile
# from otree.api import Page
from pgg._builtin import Page
def cp(*x, color='red', center=True):
columns = shutil.get_terminal_size().columns
x = ' '.join([str(i) for i in x])
if center:
x = x.center(columns, '-')
print(colored(x, color, 'on_cyan', attrs=['bold']))
# TODO: move to management
def create_templates():
from pgg.pages import page_sequence
path = 'pgg/templates/pgg/'
for p in page_sequence:
if issubclass(p, Page):
print(f'gonna create for {p.__name__}')
copyfile(f'{path}MyPage.html', f'{path}{p.__name__}.html')
else:
print(f'NOT gonna create for {p.__name__}')
if __name__ == '__main__':
create_templates()