renaem action_prop to action_fn

This commit is contained in:
onyx-and-iris 2023-06-25 02:38:59 +01:00
parent a730edc2c2
commit 3c85903554
2 changed files with 6 additions and 7 deletions

View File

@ -1,5 +1,5 @@
from .iremote import IRemote from .iremote import IRemote
from .meta import action_prop from .meta import action_fn
class Command(IRemote): class Command(IRemote):
@ -21,10 +21,9 @@ class Command(IRemote):
(cls,), (cls,),
{ {
**{ **{
param: action_prop(param) param: action_fn(param) for param in ["show", "shutdown", "restart"]
for param in ["show", "shutdown", "restart"]
}, },
"hide": action_prop("show", val=0), "hide": action_fn("show", val=0),
}, },
) )
return CMD_cls(remote) return CMD_cls(remote)

View File

@ -16,7 +16,7 @@ def channel_bool_prop(param):
)[self.index], )[self.index],
"little", "little",
) )
& getattr(self._modes, f'_{param.replace(".", "_").lower()}') & getattr(self._modes, f"_{param.lower()}")
== 0 == 0
) )
@ -91,8 +91,8 @@ def bus_mode_prop(param):
return property(fget, fset) return property(fget, fset)
def action_prop(param, val=1): def action_fn(param, val=1):
"""A param that performs an action""" """A function that performs an action"""
def fdo(self): def fdo(self):
self.setter(param, val) self.setter(param, val)