mirror of
https://github.com/ksherlock/prez.git
synced 2024-11-22 18:31:44 +00:00
bug fixes
This commit is contained in:
parent
62c070fb1a
commit
8b39e26dc7
@ -617,12 +617,12 @@ class rRectangleControl(rControlTemplate):
|
|||||||
return rv
|
return rv
|
||||||
|
|
||||||
|
|
||||||
fSquishText = 0x0010 # 6.0.1
|
# fSquishText = 0x0010 # 6.0.1
|
||||||
fTextCanDim = 0x0008
|
# fTextCanDim = 0x0008
|
||||||
fBlastText = 0x0004
|
# fBlastText = 0x0004
|
||||||
fSubstituteText = 0x0002
|
# fSubstituteText = 0x0002
|
||||||
fSubTextIsPascal = 0x0001
|
# fSubTextIsPascal = 0x0001
|
||||||
fSubTextIsC = 0x0000
|
# fSubTextIsC = 0x0000
|
||||||
|
|
||||||
# leftJustify = 0
|
# leftJustify = 0
|
||||||
# centerJustify = 1
|
# centerJustify = 1
|
||||||
@ -665,7 +665,7 @@ class rStatTextControl(rControlTemplate):
|
|||||||
if fBlastText: flags |= 0x0004
|
if fBlastText: flags |= 0x0004
|
||||||
if fSubstituteText: flags |= 0x0002
|
if fSubstituteText: flags |= 0x0002
|
||||||
if fSubTextIsPascal: flags |= 0x0001| 0x0002
|
if fSubTextIsPascal: flags |= 0x0001| 0x0002
|
||||||
if fSubTextIsC != None: flags |= 0x0002
|
if fSubTextIsC: flags |= 0x0002
|
||||||
|
|
||||||
if leftJust: just = 0
|
if leftJust: just = 0
|
||||||
elif centerJust: just = 1
|
elif centerJust: just = 1
|
||||||
|
39
prez/rect.py
39
prez/rect.py
@ -280,8 +280,8 @@ class rect_class:
|
|||||||
return rect_class(
|
return rect_class(
|
||||||
x = self.x + horizontal,
|
x = self.x + horizontal,
|
||||||
y = self.y + vertical,
|
y = self.y + vertical,
|
||||||
width = self.width - horizontal,
|
width = self.width - horizontal * 2,
|
||||||
height = self.height - vertical
|
height = self.height - vertical * 2
|
||||||
)
|
)
|
||||||
|
|
||||||
def offset_to(self, x, y):
|
def offset_to(self, x, y):
|
||||||
@ -313,6 +313,27 @@ class rect_class:
|
|||||||
def bottom_right(self):
|
def bottom_right(self):
|
||||||
return point_class(x = self.x + self.width, y = self.y + self.height)
|
return point_class(x = self.x + self.width, y = self.y + self.height)
|
||||||
|
|
||||||
|
def split_horizontal(self, where):
|
||||||
|
|
||||||
|
if where < 0: where = self.width + where
|
||||||
|
where = max(0, min(self.width, where))
|
||||||
|
|
||||||
|
l = rect_class(x = self.x, y = self.y, height = self.height, width = where)
|
||||||
|
r = rect_class(x = where, y = self.y, height = self.height, width = self.width - where)
|
||||||
|
|
||||||
|
return l, r
|
||||||
|
|
||||||
|
def split_vertical(self, where):
|
||||||
|
|
||||||
|
if where < 0: where = self.height + where
|
||||||
|
where = max(0, min(self.height, where))
|
||||||
|
|
||||||
|
l = rect_class(x = self.x, y = self.y, height = where, width = self.width)
|
||||||
|
r = rect_class(x = self.x, y = where, height = self.height - where, width = self.width)
|
||||||
|
|
||||||
|
return l, r
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "{{ {:d}, {:d}, {:d}, {:d} }}".format(self.y, self.x, self.y + self.height, self.x + self.width)
|
return "{{ {:d}, {:d}, {:d}, {:d} }}".format(self.y, self.x, self.y + self.height, self.x + self.width)
|
||||||
@ -354,6 +375,20 @@ class rect_class:
|
|||||||
|
|
||||||
return rect_class(v1 = y1, h1 = x1, v2 = y2, h2 = x2)
|
return rect_class(v1 = y1, h1 = x1, v2 = y2, h2 = x2)
|
||||||
|
|
||||||
|
def __add__(self, other):
|
||||||
|
if type(other) == size_class:
|
||||||
|
return rect_class(x = self.x, y = self.y, height = self.height + other.height, width = self.width + other.width)
|
||||||
|
|
||||||
|
raise ValueError("bad parameter")
|
||||||
|
|
||||||
|
def __sub__(self, other):
|
||||||
|
if type(other) == size_class:
|
||||||
|
return rect_class(x = self.x, y = self.y, height = self.height - other.height, width = self.width - other.width)
|
||||||
|
|
||||||
|
raise ValueError("bad parameter")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
point = point_class
|
point = point_class
|
||||||
rect = rect_class
|
rect = rect_class
|
||||||
size = size_class
|
size = size_class
|
||||||
|
Loading…
Reference in New Issue
Block a user