From f08fa4912cf8fd6a09a6f5cf018da64f757f5c19 Mon Sep 17 00:00:00 2001 From: David Chang Date: Sun, 10 Mar 2024 18:03:02 +0800 Subject: [PATCH] ver Mar10th changed AT element filtering --- .gitignore | 1 + at_processing/.gitignore | 4 + at_processing/filter.anal | 249 ++++++++++++++++++ at_processing/ubuntu_node_statistics.py | 22 ++ desktop_env/server/main.py | 12 +- .../415ef462-bed3-493a-ac36-ca8c6d23bf1b.json | 2 +- .../heuristic_retrieve.py | 69 ++--- 7 files changed, 322 insertions(+), 37 deletions(-) create mode 100644 at_processing/.gitignore create mode 100644 at_processing/filter.anal create mode 100644 at_processing/ubuntu_node_statistics.py diff --git a/.gitignore b/.gitignore index fc9dc79..a3543d8 100644 --- a/.gitignore +++ b/.gitignore @@ -171,6 +171,7 @@ tags-opts snapshots *.syncthing.*.tmp cache +version.folder test.xlsx test2.xlsx diff --git a/at_processing/.gitignore b/at_processing/.gitignore new file mode 100644 index 0000000..1719b90 --- /dev/null +++ b/at_processing/.gitignore @@ -0,0 +1,4 @@ +/*.json +/*.xml +/*.list +/*.png diff --git a/at_processing/filter.anal b/at_processing/filter.anal new file mode 100644 index 0000000..6c2e203 --- /dev/null +++ b/at_processing/filter.anal @@ -0,0 +1,249 @@ +vimc: hi AnalSecTitle term=bold cterm=bold: +vimc: syn match AnalSecTitle /^|\d\+\.\ .*$/: +vimc: syn match Comment /^#.*$/: +vimc: hi AnalMetaInfo term=italic ctermfg=red: +vimc: syn match AnalMetaInfo /^[A-Z]\:\ /: +vimc: syn match Todo /\\|^I\:/: +vimc: hi VIMC ctermfg=grey: +vimc: syn match VIMC /^vimc\:\ .*\:$/: +vimc: hi AnalComplete term=reverse,bold ctermfg=green: +vimc: syn match AnalComplete /✓$/: +vimc: hi AnalFail term=reverse,bold ctermfg=red: +vimc: syn match AnalFail /✗$/: + +vimc: hi AnalInfoElm term=reverse,bold ctermfg=cyan: +vimc: syn match AnalInfoElm /\0): + coordinates: Tuple[int, int] = eval(node.get("{{{:}}}screencoord".format("uri:deskat:component.at-spi.gnome.org"))) + sizes: Tuple[int, int] = eval(node.get("{{{:}}}size".format("uri:deskat:component.at-spi.gnome.org"))) + if coordinates[0]>0 and coordinates[1]>0 and sizes[0]>0 and sizes[1]>0: + filtered_nodes.append(node) return filtered_nodes @@ -134,12 +141,14 @@ def print_nodes_with_indent(nodes, indent=0): if __name__ == '__main__': - with open('chrome_desktop_example_1.xml', 'r', encoding='utf-8') as f: - xml_file_str = f.read() + import json + with open('2.json', 'r', encoding='utf-8') as f: + xml_file_str = json.load(f)["AT"] filtered_nodes = filter_nodes(find_leaf_nodes(xml_file_str)) print(len(filtered_nodes)) - masks = draw_bounding_boxes(filtered_nodes, 'screenshot.png', - 'chrome_desktop_example_1_tagged_remove.png', ) + masks = draw_bounding_boxes( filtered_nodes, '2.png' + , '2.a.png' + ) # print(masks) print(len(masks))