|
|
@ -81,6 +81,20 @@ class Hui(wx.Frame):
|
|
|
|
self.sizer.Add(btn, 0, wx.EXPAND)
|
|
|
|
self.sizer.Add(btn, 0, wx.EXPAND)
|
|
|
|
self.Bind(wx.EVT_BUTTON, lambda event: self.discover_new_bridges(),
|
|
|
|
self.Bind(wx.EVT_BUTTON, lambda event: self.discover_new_bridges(),
|
|
|
|
btn)
|
|
|
|
btn)
|
|
|
|
|
|
|
|
@redraw
|
|
|
|
|
|
|
|
def add_manage_bridge(self):
|
|
|
|
|
|
|
|
"""Add bridges to sizer, the entry point of the program
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
self.SetTitle('Tinge - Manage Bridge')
|
|
|
|
|
|
|
|
label = "Delete Bridge"
|
|
|
|
|
|
|
|
btn: wx.Button = wx.Button(self.pnl, label=label)
|
|
|
|
|
|
|
|
self.sizer.Add(btn, 0, wx.EXPAND)
|
|
|
|
|
|
|
|
self.Bind(wx.EVT_BUTTON, lambda event: self.delete_bridge(),
|
|
|
|
|
|
|
|
btn)
|
|
|
|
|
|
|
|
back_btn: wx.Button = wx.Button(self.pnl, label="Go Back")
|
|
|
|
|
|
|
|
self.sizer.Add(back_btn, 0, wx.EXPAND)
|
|
|
|
|
|
|
|
self.Bind(wx.EVT_BUTTON, lambda event: self.add_groups(self.cur_bridge.get_groups()),
|
|
|
|
|
|
|
|
back_btn)
|
|
|
|
|
|
|
|
|
|
|
|
@redraw
|
|
|
|
@redraw
|
|
|
|
def add_groups(self, groups: list[HueGroup]):
|
|
|
|
def add_groups(self, groups: list[HueGroup]):
|
|
|
@ -152,6 +166,9 @@ class Hui(wx.Frame):
|
|
|
|
add_single_light(mlightid, True),
|
|
|
|
add_single_light(mlightid, True),
|
|
|
|
light_btn)
|
|
|
|
light_btn)
|
|
|
|
self.sizer.Add(inner_sizer, 0, wx.EXPAND)
|
|
|
|
self.sizer.Add(inner_sizer, 0, wx.EXPAND)
|
|
|
|
|
|
|
|
bridge_mgm_btn: wx.Button = wx.Button(self.pnl, label="Manage Bridge")
|
|
|
|
|
|
|
|
self.sizer.Add(bridge_mgm_btn, 0, wx.EXPAND)
|
|
|
|
|
|
|
|
self.Bind(wx.EVT_BUTTON, lambda event: self.manage_bridge(), bridge_mgm_btn)
|
|
|
|
|
|
|
|
|
|
|
|
def add_manual_discovery_dialog(self) -> bool:
|
|
|
|
def add_manual_discovery_dialog(self) -> bool:
|
|
|
|
self.sizer.Clear(delete_windows=True)
|
|
|
|
self.sizer.Clear(delete_windows=True)
|
|
|
@ -329,6 +346,19 @@ class Hui(wx.Frame):
|
|
|
|
delete_light_and_goto_group(mlightid),
|
|
|
|
delete_light_and_goto_group(mlightid),
|
|
|
|
delete_btn)
|
|
|
|
delete_btn)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def delete_bridge(self):
|
|
|
|
|
|
|
|
dlg: wx.MessageDialog = wx.MessageDialog(self.pnl,
|
|
|
|
|
|
|
|
"Delete " + self.cur_bridge.m_name + "?",
|
|
|
|
|
|
|
|
"Are you sure?",
|
|
|
|
|
|
|
|
style=wx.CANCEL | wx.CANCEL_DEFAULT | wx.OK)
|
|
|
|
|
|
|
|
dlg.SetOKCancelLabels("&Yes", "&Don't delete")
|
|
|
|
|
|
|
|
reply: int = dlg.ShowModal()
|
|
|
|
|
|
|
|
if reply == wx.ID_CANCEL:
|
|
|
|
|
|
|
|
self.add_groups(self.cur_bridge.get_groups())
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
self.m_tinge.delete_bridge(self.cur_bridge)
|
|
|
|
|
|
|
|
self.add_bridges()
|
|
|
|
|
|
|
|
|
|
|
|
def delete_light_and_goto_group(self, lightid):
|
|
|
|
def delete_light_and_goto_group(self, lightid):
|
|
|
|
"""Combo call back for delete and goto group
|
|
|
|
"""Combo call back for delete and goto group
|
|
|
|
|
|
|
|
|
|
|
@ -426,6 +456,12 @@ class Hui(wx.Frame):
|
|
|
|
self.cur_group = group
|
|
|
|
self.cur_group = group
|
|
|
|
self.add_lights(group.get_lights())
|
|
|
|
self.add_lights(group.get_lights())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def manage_bridge(self):
|
|
|
|
|
|
|
|
"""Call back for manage bridge button
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
self.add_manage_bridge()
|
|
|
|
|
|
|
|
|
|
|
|
def rename_light_and_goto_light(self, lightid, unattached: bool = False):
|
|
|
|
def rename_light_and_goto_light(self, lightid, unattached: bool = False):
|
|
|
|
"""Combo call back to rename a light and display that light again
|
|
|
|
"""Combo call back to rename a light and display that light again
|
|
|
|
|
|
|
|
|
|
|
|