feat(hooks): extend ApiHookClient and GUI for tab/listbox control
This commit is contained in:
@@ -83,3 +83,34 @@ class ApiHookClient:
|
||||
|
||||
def post_gui(self, gui_data):
|
||||
return self._make_request('POST', '/api/gui', data=gui_data)
|
||||
|
||||
def select_tab(self, tab_bar, tab):
|
||||
"""Tells the GUI to switch to a specific tab in a tab bar."""
|
||||
return self.post_gui({
|
||||
"action": "select_tab",
|
||||
"tab_bar": tab_bar,
|
||||
"tab": tab
|
||||
})
|
||||
|
||||
def select_list_item(self, listbox, item_value):
|
||||
"""Tells the GUI to select an item in a listbox by its value."""
|
||||
return self.post_gui({
|
||||
"action": "select_list_item",
|
||||
"listbox": listbox,
|
||||
"item_value": item_value
|
||||
})
|
||||
|
||||
def set_value(self, item, value):
|
||||
"""Sets the value of a GUI item."""
|
||||
return self.post_gui({
|
||||
"action": "set_value",
|
||||
"item": item,
|
||||
"value": value
|
||||
})
|
||||
|
||||
def click(self, item):
|
||||
"""Simulates a click on a GUI button or item."""
|
||||
return self.post_gui({
|
||||
"action": "click",
|
||||
"item": item
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user