-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
42 lines (36 loc) · 2.21 KB
/
main.py
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
41
42
from pptx import Presentation
from utils import *
from themeColor import *
from setColor import *
# --------------------------------- settings --------------------------------- #
_change_font_color = 1 # 1: change font color; 0: not change font color
_change_outline_color = 0 # 1: change outline color; 0: not change outline color
_change_background_color = 1 # 1: change background color; 0: not change background color
_change_shape_color = 1 # 1: change shape color; 0: not change fill color
_gradient_angle = 0 # angle of gradient, 90: vertical; 0: horizontal
_transparency = 0 # transparency of fill color, 0: not transparent; 1: transparent
_set_single_slile = 0 # 1: only set one slide; 0: set all slides
slide_index = 0 # index of slide to be set (if set_single_slile=1)
# --------------------------------- filepath --------------------------------- #
input_ppt_path = './input/'
output_ppt_path = './output/'
inFile = 'motiongo科技1.pptx' # 全部
outFile = 'motiongo科技1_new.pptx'
# --------------------- set theme color at themeColor.py --------------------- #
myThemeColor = myThemeColor_user
NewThemeColor = set_my_theme_color(myThemeColor)
# --------------------------------- load ppt --------------------------------- #
prs = Presentation(input_ppt_path+inFile)
print('loading ppt from %s' % input_ppt_path+inFile)
# ----------------------------------- main ----------------------------------- #
report_choice(_change_font_color,_change_outline_color,_change_background_color,_change_shape_color)
for slide in prs.slides:
if _set_single_slile:
if slide_index == prs.slides.index(slide):
set_color(slide,NewThemeColor,_gradient_angle,_transparency,_change_font_color,_change_outline_color,_change_background_color,_change_shape_color)
break
else:
set_color(slide,NewThemeColor,_gradient_angle,_transparency,_change_font_color,_change_outline_color,_change_background_color,_change_shape_color)
# --------------------------------- save ppt --------------------------------- #
print('done! saving ppt to %s' % output_ppt_path+outFile)
prs.save(output_ppt_path+outFile)