This commit is contained in:
Jean-Marie Place 2023-05-18 07:39:25 +02:00
parent 36e49c8106
commit 5c3c3d38a7

View File

@ -158,8 +158,10 @@ class Composante_boolean(Composante):
class Composante_number_format(Composante): class Composante_number_format(Composante):
WIDTH: int = 2
def __init__(self): def __init__(self):
super().__init__(width=2) assert (1 << self.WIDTH) > SCO_NUMBER_FORMAT.__len__()
super().__init__(width=self.WIDTH)
def set(self, data: SCO_NUMBER_FORMAT, signature=0) -> int: def set(self, data: SCO_NUMBER_FORMAT, signature=0) -> int:
return self.write(data.value, signature) return self.write(data.value, signature)
@ -171,9 +173,10 @@ class Composante_number_format(Composante):
class Composante_Colors(Composante): class Composante_Colors(Composante):
def __init__(self, default: SCO_COLORS = SCO_COLORS.BLACK): WIDTH: int = 5
super().__init__(width=5) def __init__(self):
self.default: SCO_COLORS = default assert (1 << self.WIDTH) > SCO_COLORS.__len__()
super().__init__(width=self.WIDTH)
def set(self, data: SCO_COLORS, signature=0) -> int: def set(self, data: SCO_COLORS, signature=0) -> int:
return self.write(data.value, signature) return self.write(data.value, signature)
@ -190,9 +193,10 @@ class Composante_Colors(Composante):
class Composante_borderThickness(Composante): class Composante_borderThickness(Composante):
WIDTH: int = 3
def __init__(self): def __init__(self):
assert (1 << 3) > SCO_BORDERTHICKNESS.__len__() assert (1 << self.WIDTH) > SCO_BORDERTHICKNESS.__len__()
super().__init__(width=3) super().__init__(width=self.WIDTH)
def set(self, data: SCO_BORDERTHICKNESS, signature=0) -> int: def set(self, data: SCO_BORDERTHICKNESS, signature=0) -> int:
return self.write(data.value, signature) return self.write(data.value, signature)
@ -207,8 +211,10 @@ class Composante_borderThickness(Composante):
class Composante_fontname(Composante): class Composante_fontname(Composante):
WIDTH: int = 3
def __init__(self): def __init__(self):
super().__init__(width=3) assert (1 << self.WIDTH) > SCO_FONTNAME.__len__()
super().__init__(width=self.WIDTH)
def set(self, data: SCO_FONTNAME, signature=0) -> int: def set(self, data: SCO_FONTNAME, signature=0) -> int:
return self.write(data.value, signature) return self.write(data.value, signature)
@ -223,8 +229,10 @@ class Composante_fontname(Composante):
class Composante_fontsize(Composante): class Composante_fontsize(Composante):
WIDTH: int = 3
def __init__(self): def __init__(self):
super().__init__(width=3) assert (1 << self.WIDTH) > SCO_FONTSIZE.__len__()
super().__init__(width=self.WIDTH)
def set(self, data: SCO_FONTSIZE, signature=0) -> int: def set(self, data: SCO_FONTSIZE, signature=0) -> int:
return self.write(data.value, signature) return self.write(data.value, signature)
@ -236,8 +244,9 @@ class Composante_fontsize(Composante):
class Composante_halign(Composante): class Composante_halign(Composante):
WIDTH: int = 3
def __init__(self): def __init__(self):
super().__init__(width=2) assert (1 << self.WIDTH) > SCO_HALIGN.__len__()
def set(self, data: SCO_HALIGN, signature=0) -> int: def set(self, data: SCO_HALIGN, signature=0) -> int:
return self.write(data.value, signature) return self.write(data.value, signature)
@ -252,8 +261,10 @@ class Composante_halign(Composante):
class Composante_valign(Composante): class Composante_valign(Composante):
WIDTH: int = 3
def __init__(self): def __init__(self):
super().__init__(width=2) assert (1 << self.WIDTH) > SCO_VALIGN.__len__()
super().__init__(width=self.WIDTH)
def set(self, data: SCO_VALIGN, signature=0) -> int: def set(self, data: SCO_VALIGN, signature=0) -> int:
return self.write(data.value, signature) return self.write(data.value, signature)