File size: 1,154 Bytes
3b83fd0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from utils.options import *
from utils.fileSelect import *
from utils.files import *
from utils.input import *

from os.path import join, realpath
from os import startfile

regTemplate = r'template'

def choosePhase(): return validatedPhaseInput()

def getTemplatesDir():
    p = getDirectory(title='Select the template directory')
    while not p:
        print('input a valid directory')
        if input('continue?').lower() in exitinput: quit()
        p = getDirectory(title='Select the template directory')
    
    f = getFilesWith(p, regTemplate)
    if not f:
        print('no templates found')
        if input('continue?').lower() in exitinput: quit()
    return p
    
def getRoot(): return getDirectory(title='Select the root directory')

def copyPasteTemplates(root:str, phase:str, templatesDir:str):
    objs = getObjectsPerPhase(phase)
    
    objectslist = list(set([o for p in [objs[k] for k in objs] for o in p]))
    
    createNewFolders([join(root,o) for o in objectslist])
    print("directories created")

    createNewTemplates(objs, templatesDir, regTemplate, root)
    print("templates ready")

    startfile(realpath(root))