|
|
|
@ -103,7 +103,7 @@ class Hui(wx.Frame):
|
|
|
|
|
Args:
|
|
|
|
|
lights (list[HueLight]): The lights to display
|
|
|
|
|
"""
|
|
|
|
|
self.SetTitle("Tinge - {}". format(self.cur_group))
|
|
|
|
|
self.SetTitle("Tinge - {}".format(self.cur_group))
|
|
|
|
|
group_btn: wx.Button = wx.Button(self.pnl, label=str(self.cur_bridge))
|
|
|
|
|
self.sizer.Add(group_btn, 0, wx.EXPAND)
|
|
|
|
|
self.Bind(wx.EVT_BUTTON,
|
|
|
|
@ -200,7 +200,8 @@ class Hui(wx.Frame):
|
|
|
|
|
toggle_btn)
|
|
|
|
|
|
|
|
|
|
# Slider for brightness
|
|
|
|
|
if is_on and light.get_brightness() > 0:
|
|
|
|
|
if is_on:
|
|
|
|
|
if light.get_brightness() > 0:
|
|
|
|
|
b_label: wx.StaticText = wx.StaticText(self.pnl, label="Brightness")
|
|
|
|
|
self.sizer.Add(b_label, 0, wx.EXPAND)
|
|
|
|
|
b_slider: wx.Slider = wx.Slider(self.pnl, value=light.get_state().get_brightness(), minValue=1,
|
|
|
|
@ -209,7 +210,7 @@ class Hui(wx.Frame):
|
|
|
|
|
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():
|
|
|
|
|
if light.can_set_ct():
|
|
|
|
|
c_label: wx.StaticText = wx.StaticText(self.pnl, label="Color Temperature")
|
|
|
|
|
self.sizer.Add(c_label, 0, wx.EXPAND)
|
|
|
|
|
c_slider: wx.Slider = wx.Slider(self.pnl, value=light.get_ct(), minValue=153, maxValue=500)
|
|
|
|
@ -217,6 +218,24 @@ class Hui(wx.Frame):
|
|
|
|
|
self.Bind(wx.EVT_SCROLL,
|
|
|
|
|
lambda event: self.set_colortemp(event, light.get_id()), c_slider)
|
|
|
|
|
|
|
|
|
|
# Slider for hue
|
|
|
|
|
if light.can_set_hue():
|
|
|
|
|
d_label: wx.StaticText = wx.StaticText(self.pnl, label="Hue")
|
|
|
|
|
self.sizer.Add(d_label, 0, wx.EXPAND)
|
|
|
|
|
d_slider: wx.Slider = wx.Slider(self.pnl, value=light.get_hue(), minValue=0, maxValue=65535)
|
|
|
|
|
self.sizer.Add(d_slider, 0, wx.EXPAND)
|
|
|
|
|
self.Bind(wx.EVT_SCROLL,
|
|
|
|
|
lambda event: self.set_hue(event, light.get_id()), d_slider)
|
|
|
|
|
|
|
|
|
|
# Slider for saturation
|
|
|
|
|
if light.can_set_sat():
|
|
|
|
|
e_label: wx.StaticText = wx.StaticText(self.pnl, label="Saturation")
|
|
|
|
|
self.sizer.Add(e_label, 0, wx.EXPAND)
|
|
|
|
|
e_slider: wx.Slider = wx.Slider(self.pnl, value=light.get_sat(), minValue=0, maxValue=254)
|
|
|
|
|
self.sizer.Add(e_slider, 0, wx.EXPAND)
|
|
|
|
|
self.Bind(wx.EVT_SCROLL,
|
|
|
|
|
lambda event: self.set_saturation(event, light.get_id()), e_slider)
|
|
|
|
|
|
|
|
|
|
def set_brightness(self, event: wx.ScrollEvent, lightid: int):
|
|
|
|
|
"""Call back for brightness slider
|
|
|
|
|
|
|
|
|
@ -248,6 +267,28 @@ class Hui(wx.Frame):
|
|
|
|
|
light: HueLight = self.cur_bridge.get_light_by_id(lightid)
|
|
|
|
|
light.set_ct(ct)
|
|
|
|
|
|
|
|
|
|
def set_hue(self, event, lightid):
|
|
|
|
|
"""Call back for colortemp slider
|
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
event (wx.ScrollEvent): The scroll event to react to
|
|
|
|
|
lightid (int): The light id of the light to adjust hue of
|
|
|
|
|
"""
|
|
|
|
|
hue: int = event.GetPosition()
|
|
|
|
|
light: HueLight = self.cur_bridge.get_light_by_id(lightid)
|
|
|
|
|
light.set_hue(hue)
|
|
|
|
|
|
|
|
|
|
def set_saturation(self, event, lightid):
|
|
|
|
|
"""Call back for colortemp slider
|
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
event (wx.ScrollEvent): The scroll event to react to
|
|
|
|
|
lightid (int): The light id of the light to adjust hue of
|
|
|
|
|
"""
|
|
|
|
|
sat: int = event.GetPosition()
|
|
|
|
|
light: HueLight = self.cur_bridge.get_light_by_id(lightid)
|
|
|
|
|
light.set_hue(sat)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
app = wx.App()
|
|
|
|
|