-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLayout.py
29 lines (21 loc) · 1.07 KB
/
Layout.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
from LayoutDefinition import LayoutDefinition
from Padding import DefaultPadding
from Padding import EqualPadding
class Layout:
def __init__(this, xstart, ystart, width, height, pdf):
this.actualDef=LayoutDefinition(xstart, ystart, width, height, DefaultPadding())
this.pdf=pdf
this.updatepadding(EqualPadding(0.5))
def setpadding(this, padding):
this.updatepadding(padding)
def setbackground(this, color):
this.pdf.set_fill_color(color[0], color[1], color[2])
this.pdf.rect(this.paddedDef.x, this.paddedDef.y, this.paddedDef.width, this.paddedDef.height, 'F')
def updatepadding(this, padding):
this.paddedDef=LayoutDefinition(this.actualDef.x, this.actualDef.y, this.actualDef.width, this.actualDef.height, padding)
this.currentX=this.paddedDef.x
this.currentY=this.paddedDef.y
def relocateY(this, deltay):
this.actualDef.y=this.actualDef.y-deltay
this.paddedDef.y=this.paddedDef.y-deltay
this.currentY=this.currentY-deltay