| 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)) |
|
|