File size: 654 Bytes
83e35a7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from backend.class_def import Page,panel,bubble
import json

def page_create(page_templates,panels,bubbles):
    count = 0
    pages = []
    for page_template in page_templates:

        new_page = Page(panels[count:count+len(page_template)],bubbles[count:count+len(page_template)])
        pages.append(new_page)
        count = count +len(page_template)
        print(new_page.__dict__)        

    return pages


def page_json(pages):
    pages_dict = []

    for page in pages:
        pages_dict.append(page.__dict__)

    with open('output_template/page.js', 'w') as f:
        f.write(f'var pages = ')
        json.dump(pages_dict, f , indent=4)