|
|
|
@ -55,14 +55,26 @@ class Hui(wx.Frame):
|
|
|
|
|
"""Add bridges to sizer, the entry point of the program
|
|
|
|
|
"""
|
|
|
|
|
self.SetTitle('Tinge - All Bridges')
|
|
|
|
|
one_unreachable: bool = False
|
|
|
|
|
no_bridges: bool = True
|
|
|
|
|
if self.m_tinge.get_bridges():
|
|
|
|
|
no_bridges = False
|
|
|
|
|
for bridge in self.m_tinge.get_bridges():
|
|
|
|
|
btn: wx.Button = wx.Button(self.pnl, label=str(bridge))
|
|
|
|
|
self.sizer.Add(btn, 0, wx.EXPAND)
|
|
|
|
|
self.Bind(wx.EVT_BUTTON,
|
|
|
|
|
lambda event, mbridge=bridge: self.goto_bridge(mbridge), btn)
|
|
|
|
|
else:
|
|
|
|
|
btn: wx.Button = wx.Button(self.pnl, label="Press Hue Bridge button, and then press here")
|
|
|
|
|
if bridge.is_reachable():
|
|
|
|
|
btn: wx.Button = wx.Button(self.pnl, label=str(bridge))
|
|
|
|
|
self.sizer.Add(btn, 0, wx.EXPAND)
|
|
|
|
|
self.Bind(wx.EVT_BUTTON,
|
|
|
|
|
lambda event, mbridge=bridge: self.goto_bridge(mbridge), btn)
|
|
|
|
|
else:
|
|
|
|
|
one_unreachable = True
|
|
|
|
|
|
|
|
|
|
if one_unreachable or no_bridges:
|
|
|
|
|
if one_unreachable:
|
|
|
|
|
warn_label = "{} At least one previously discovered bridge unreachable.".format(self.m_unreachable_icon)
|
|
|
|
|
warning: wx.StaticText = wx.StaticText(self.pnl, label=warn_label, style=wx.ALIGN_CENTER)
|
|
|
|
|
self.sizer.Add(warning, 0, wx.EXPAND)
|
|
|
|
|
label = "Press Hue Bridge button, and then here within 30 seconds to connect"
|
|
|
|
|
btn: wx.Button = wx.Button(self.pnl, label=label)
|
|
|
|
|
self.sizer.Add(btn, 0, wx.EXPAND)
|
|
|
|
|
self.Bind(wx.EVT_BUTTON,
|
|
|
|
|
lambda event: self.discover_new_bridges(), btn)
|
|
|
|
@ -235,7 +247,6 @@ class Hui(wx.Frame):
|
|
|
|
|
self.add_bridges()
|
|
|
|
|
return found_any
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_ok_cancel_answer_from_modal(self, message: str) -> bool:
|
|
|
|
|
"""Display a message dialog and return ok or cancel
|
|
|
|
|
|
|
|
|
|