fix bug where getter may return None

This commit is contained in:
onyx-and-iris 2022-04-29 03:24:32 +01:00
parent f8b964bc35
commit 637fe9fb88
2 changed files with 8 additions and 8 deletions

View File

@ -47,10 +47,10 @@ class OutputBus(Channel):
else: else:
return ((1 << 16) - 1) - val return ((1 << 16) - 1) - val
val = round(self.getter("gain"), 1) val = self.getter("gain")
if val is None: if val is None:
val = round((fget() * 0.01), 1) val = fget() * 0.01
return val return round(val, 1)
@gain.setter @gain.setter
def gain(self, val: float): def gain(self, val: float):

View File

@ -45,10 +45,10 @@ class InputStrip(Channel):
@property @property
def gain(self) -> float: def gain(self) -> float:
val = round(self.getter("gain"), 1) val = self.getter("gain")
if val is None: if val is None:
val = self.gainlayer[0].gain val = self.gainlayer[0].gain
return val return round(val, 1)
@gain.setter @gain.setter
def gain(self, val: float): def gain(self, val: float):
@ -139,10 +139,10 @@ class GainLayer(InputStrip):
else: else:
return ((1 << 16) - 1) - val return ((1 << 16) - 1) - val
val = round(self.getter(f"GainLayer[{self._i}]"), 1) val = self.getter(f"GainLayer[{self._i}]")
if val is None: if val is None:
val = round((fget() * 0.01), 1) val = fget() * 0.01
return val return round(val, 1)
@gain.setter @gain.setter
def gain(self, val: float): def gain(self, val: float):