Fix minor bugs of get_terminal output caused by a11y tree depth

This commit is contained in:
Timothyxxx
2024-01-30 18:48:00 +08:00
parent 8885ea0aef
commit d5d9fc56de
2 changed files with 11 additions and 4 deletions

View File

@@ -176,8 +176,9 @@ def get_terminal_output():
# raise NotImplementedError
return "Currently not implemented for platform {:}.".format(platform.platform()), 500
return jsonify({"output": output, "status": "success"})
except:
return jsonify({"output": None, "status": "error"})
except Exception as e:
logger.error("Failed to get terminal output. Error: %s", e)
return jsonify({"status": "error", "message": str(e)}), 500
_accessibility_ns_map = {"st": "uri:deskat:state.at-spi.gnome.org"
@@ -191,7 +192,7 @@ _accessibility_ns_map = {"st": "uri:deskat:state.at-spi.gnome.org"
}
def _create_atspi_node(node: Accessible, depth: int, flag: Optional[str] = None) -> _Element:
def _create_atspi_node(node: Accessible, depth: int = 0, flag: Optional[str] = None) -> _Element:
if node.getRoleName() == "document spreadsheet":
flag = "calc"
if node.getRoleName() == "application" and node.name=="Thunderbird":