Commit d3e11d8d authored by Lisa's avatar Lisa

GUI: individual capability checkboxes in ConfigEditor (exec, browser_control, computer_control)

parent 31e0f15d
......@@ -145,6 +145,20 @@ class ConfigEditor(wx.Frame):
self.heartbeat = wx.TextCtrl(self.panel, value="30")
grid.Add(self.heartbeat, 1, wx.EXPAND)
# Capabilities
cap_sizer = wx.BoxSizer(wx.HORIZONTAL)
self.cb_exec = wx.CheckBox(self.panel, label="exec")
self.cb_exec.SetValue(True)
self.cb_browser = wx.CheckBox(self.panel, label="browser_control")
self.cb_computer = wx.CheckBox(self.panel, label="computer_control")
label_txt = wx.StaticText(self.panel, label="Capabilities:")
cap_sizer.Add(label_txt, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 10)
cap_sizer.Add(self.cb_exec, 0, wx.RIGHT, 10)
cap_sizer.Add(self.cb_browser, 0, wx.RIGHT, 10)
cap_sizer.Add(self.cb_computer, 0)
self.sizer.Add(cap_sizer, 0, wx.ALL | wx.EXPAND, 15)
grid.AddGrowableCol(1, 1)
self.sizer.Add(grid, 0, wx.ALL | wx.EXPAND, 15)
......@@ -171,6 +185,28 @@ class ConfigEditor(wx.Frame):
self.sexec_path.SetValue(cfg.get('sexec_path', str(Path.home() / '.openclaw' / 'skills' / 'sexec' / 'sexec.ps1')))
self.reconnect.SetValue(str(cfg.get('reconnect_interval', 5)))
self.heartbeat.SetValue(str(cfg.get('heartbeat_interval', 30)))
# Capabilities checkboxes
caps = cfg.get('capabilities', ['exec'])
self.cb_exec.SetValue('exec' in caps)
self.cb_browser.SetValue('browser_control' in caps)
self.cb_computer.SetValue('computer_control' in caps)
# Load capabilities
caps = cfg.get('capabilities', ['exec'])
self.cb_exec.SetValue('exec' in caps)
self.cb_browser.SetValue('browser_control' in caps)
self.cb_computer.SetValue('computer_control' in caps)
def _get_capabilities(self) -> list:
"""Collect capabilities from checkboxes."""
caps = []
if self.cb_exec.GetValue():
caps.append('exec')
if self.cb_browser.GetValue():
caps.append('browser_control')
if self.cb_computer.GetValue():
caps.append('computer_control')
return caps
def on_save(self, event):
cfg = {
......@@ -180,6 +216,7 @@ class ConfigEditor(wx.Frame):
'sexec_path': self.sexec_path.GetValue(),
'reconnect_interval': int(self.reconnect.GetValue()),
'heartbeat_interval': int(self.heartbeat.GetValue()),
'capabilities': self._get_capabilities(),
}
if not cfg['gateway_url'] or not cfg['token']:
wx.MessageBox("Gateway URL and Token are required", "Error", wx.OK | wx.ICON_ERROR)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment