|
|
@ -103,7 +103,7 @@ class Hui(wx.Frame):
|
|
|
|
Args:
|
|
|
|
Args:
|
|
|
|
lights (list[HueLight]): The lights to display
|
|
|
|
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))
|
|
|
|
group_btn: wx.Button = wx.Button(self.pnl, label=str(self.cur_bridge))
|
|
|
|
self.sizer.Add(group_btn, 0, wx.EXPAND)
|
|
|
|
self.sizer.Add(group_btn, 0, wx.EXPAND)
|
|
|
|
self.Bind(wx.EVT_BUTTON,
|
|
|
|
self.Bind(wx.EVT_BUTTON,
|
|
|
@ -200,22 +200,41 @@ class Hui(wx.Frame):
|
|
|
|
toggle_btn)
|
|
|
|
toggle_btn)
|
|
|
|
|
|
|
|
|
|
|
|
# Slider for brightness
|
|
|
|
# Slider for brightness
|
|
|
|
if is_on and light.get_brightness() > 0:
|
|
|
|
if is_on:
|
|
|
|
b_label: wx.StaticText = wx.StaticText(self.pnl, label="Brightness")
|
|
|
|
if light.get_brightness() > 0:
|
|
|
|
self.sizer.Add(b_label, 0, wx.EXPAND)
|
|
|
|
b_label: wx.StaticText = wx.StaticText(self.pnl, label="Brightness")
|
|
|
|
b_slider: wx.Slider = wx.Slider(self.pnl, value=light.get_state().get_brightness(), minValue=1,
|
|
|
|
self.sizer.Add(b_label, 0, wx.EXPAND)
|
|
|
|
maxValue=254)
|
|
|
|
b_slider: wx.Slider = wx.Slider(self.pnl, value=light.get_state().get_brightness(), minValue=1,
|
|
|
|
self.sizer.Add(b_slider, 0, wx.EXPAND)
|
|
|
|
maxValue=254)
|
|
|
|
self.Bind(wx.EVT_SCROLL,
|
|
|
|
self.sizer.Add(b_slider, 0, wx.EXPAND)
|
|
|
|
lambda event: self.set_brightness(event, light.get_id()), b_slider)
|
|
|
|
self.Bind(wx.EVT_SCROLL,
|
|
|
|
# Slider for colortemp
|
|
|
|
lambda event: self.set_brightness(event, light.get_id()), b_slider)
|
|
|
|
if is_on and light.can_set_ct():
|
|
|
|
# Slider for colortemp
|
|
|
|
c_label: wx.StaticText = wx.StaticText(self.pnl, label="Color Temperature")
|
|
|
|
if light.can_set_ct():
|
|
|
|
self.sizer.Add(c_label, 0, wx.EXPAND)
|
|
|
|
c_label: wx.StaticText = wx.StaticText(self.pnl, label="Color Temperature")
|
|
|
|
c_slider: wx.Slider = wx.Slider(self.pnl, value=light.get_ct(), minValue=153, maxValue=500)
|
|
|
|
self.sizer.Add(c_label, 0, wx.EXPAND)
|
|
|
|
self.sizer.Add(c_slider, 0, wx.EXPAND)
|
|
|
|
c_slider: wx.Slider = wx.Slider(self.pnl, value=light.get_ct(), minValue=153, maxValue=500)
|
|
|
|
self.Bind(wx.EVT_SCROLL,
|
|
|
|
self.sizer.Add(c_slider, 0, wx.EXPAND)
|
|
|
|
lambda event: self.set_colortemp(event, light.get_id()), c_slider)
|
|
|
|
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):
|
|
|
|
def set_brightness(self, event: wx.ScrollEvent, lightid: int):
|
|
|
|
"""Call back for brightness slider
|
|
|
|
"""Call back for brightness slider
|
|
|
@ -248,6 +267,28 @@ class Hui(wx.Frame):
|
|
|
|
light: HueLight = self.cur_bridge.get_light_by_id(lightid)
|
|
|
|
light: HueLight = self.cur_bridge.get_light_by_id(lightid)
|
|
|
|
light.set_ct(ct)
|
|
|
|
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__":
|
|
|
|
if __name__ == "__main__":
|
|
|
|
app = wx.App()
|
|
|
|
app = wx.App()
|
|
|
|