-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSection.py
35 lines (28 loc) · 1.18 KB
/
Section.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
from Layout import Layout
from Padding import Padding
class Section(Layout):
def __init__(this, xstart, ystart, width, height, pdf):
super(Section, this).__init__(xstart, ystart, width, height, pdf)
this.sections=[]
def getTotal(this, definitions):
t=0;
for i in range(0, len(definitions)):
t=t+definitions[i]
return t
def createsections(this, rowdefinitions, coldefinitions):
this.sections=[]
rth=this.getTotal(rowdefinitions)
ctw=this.getTotal(coldefinitions)
cy=this.paddedDef.y
for i in range(0, len(rowdefinitions)):
this.sections.append([])
crh=(this.paddedDef.height*rowdefinitions[i])/rth
cx=this.paddedDef.x
for j in range(0, len(coldefinitions)):
ccw=(this.paddedDef.width*coldefinitions[j])/ctw
print(str(i)+" "+str(j)+" "+str(cx)+" "+str(cy)+" "+str(ccw)+" "+str(crh))
section=Section(cx, cy, ccw, crh, this.pdf)
section.setpadding(Padding(1, 0.5, 0.5, 0.5))
this.sections[i].append(section)
cx=cx+ccw
cy=cy+crh