|
|
|
@ -41,12 +41,11 @@ class Hui(wx.Frame):
|
|
|
|
|
"""
|
|
|
|
|
func = args[0]
|
|
|
|
|
|
|
|
|
|
def wrapper(*args, **kwargs):
|
|
|
|
|
def wrapper(self, *wrapper_args):
|
|
|
|
|
"""The wrapper function for the decorator
|
|
|
|
|
"""
|
|
|
|
|
self = args[0]
|
|
|
|
|
self.sizer.Clear(delete_windows=True)
|
|
|
|
|
func(*args, **kwargs)
|
|
|
|
|
func(self, *wrapper_args)
|
|
|
|
|
self.sizer.Layout()
|
|
|
|
|
|
|
|
|
|
return wrapper
|
|
|
|
@ -115,8 +114,7 @@ class Hui(wx.Frame):
|
|
|
|
|
toggle_btn: wx.Button = wx.Button(self.pnl, label=icon)
|
|
|
|
|
inner_sizer.Add(toggle_btn, 0, wx.EXPAND)
|
|
|
|
|
self.Bind(wx.EVT_BUTTON,
|
|
|
|
|
lambda event, mlightid=lightid, mlights=lights: self.toggle_light_and_goto_group(mlightid,
|
|
|
|
|
mlights),
|
|
|
|
|
lambda event, mlightid=lightid: self.toggle_light_and_goto_group(mlightid, lights),
|
|
|
|
|
toggle_btn)
|
|
|
|
|
label: str = "{}".format(light)
|
|
|
|
|
light_btn: wx.Button = wx.Button(self.pnl, label=label)
|
|
|
|
@ -204,7 +202,7 @@ class Hui(wx.Frame):
|
|
|
|
|
b_slider: wx.Slider = wx.Slider(self.pnl, value=light.get_state().get_brightness(), minValue=1,
|
|
|
|
|
maxValue=254)
|
|
|
|
|
self.sizer.Add(b_slider, 0, wx.EXPAND)
|
|
|
|
|
self.Bind(wx.EVT_SCROLL_THUMBRELEASE,
|
|
|
|
|
self.Bind(wx.EVT_SCROLL,
|
|
|
|
|
lambda event: self.set_brightness(event, light.get_id()), b_slider)
|
|
|
|
|
# Slider for colortemp
|
|
|
|
|
if is_on and light.can_set_ct():
|
|
|
|
@ -212,7 +210,7 @@ class Hui(wx.Frame):
|
|
|
|
|
self.sizer.Add(c_label, 0, wx.EXPAND)
|
|
|
|
|
c_slider: wx.Slider = wx.Slider(self.pnl, value=light.get_ct(), minValue=153, maxValue=500)
|
|
|
|
|
self.sizer.Add(c_slider, 0, wx.EXPAND)
|
|
|
|
|
self.Bind(wx.EVT_SCROLL_THUMBRELEASE,
|
|
|
|
|
self.Bind(wx.EVT_SCROLL,
|
|
|
|
|
lambda event: self.set_colortemp(event, light.get_id()), c_slider)
|
|
|
|
|
|
|
|
|
|
def set_brightness(self, event: wx.ScrollEvent, lightid: int):
|
|
|
|
|