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