Merge branch 'zdy'

This commit is contained in:
David Chang
2024-01-17 22:48:30 +08:00
27 changed files with 818 additions and 151 deletions

View File

@@ -298,11 +298,11 @@ class SetupController:
# TODO # TODO
raise NotImplementedError() raise NotImplementedError()
def _activate_window_setup(self, window_name: str): def _activate_window_setup(self, window_name: str, strict: bool = False, by_class: bool = False):
if not window_name: if not window_name:
raise Exception(f"Setup Open - Invalid path ({window_name}).") raise Exception(f"Setup Open - Invalid path ({window_name}).")
payload = json.dumps({"window_name": window_name}) payload = json.dumps({"window_name": window_name, "strict": strict, "by_class": by_class})
headers = { headers = {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
} }
@@ -317,6 +317,25 @@ class SetupController:
except requests.exceptions.RequestException as e: except requests.exceptions.RequestException as e:
logger.error("An error occurred while trying to send the request: %s", e) logger.error("An error occurred while trying to send the request: %s", e)
def _close_window_setup(self, window_name: str, strict: bool = False, by_class: bool = False):
if not window_name:
raise Exception(f"Setup Open - Invalid path ({window_name}).")
payload = json.dumps({"window_name": window_name, "strict": strict, "by_class": by_class})
headers = {
'Content-Type': 'application/json'
}
# send request to server to open file
try:
response = requests.post(self.http_server + "/setup" + "/close_window", headers=headers, data=payload)
if response.status_code == 200:
logger.info("Command executed successfully: %s", response.text)
else:
logger.error(f"Failed to close window {window_name}. Status code: %s", response.text)
except requests.exceptions.RequestException as e:
logger.error("An error occurred while trying to send the request: %s", e)
# Chrome setup # Chrome setup
def _chrome_open_tabs_setup(self, urls_to_open: List[str]): def _chrome_open_tabs_setup(self, urls_to_open: List[str]):
host = self.vm_ip host = self.vm_ip

View File

@@ -1,50 +1,92 @@
import os import os
from typing import Dict from typing import Dict, List, Set
from typing import Optional from typing import Optional, Any, Union
import requests import requests
def get_cloud_file(env, config: Dict[str, str]) -> str: def get_cloud_file(env, config: Dict[str, Any]) -> Union[str, List[str]]:
""" """
Config: Config:
path (str): the url to download from path (str|List[str]): the url to download from
dest (str): file name of the downloaded file dest (str|List[str])): file name of the downloaded file
multi (bool) : optional. if path and dest are lists providing
information of multiple files. defaults to False
gives (List[int]): optional. defaults to [0]. which files are directly
returned to the metric. if len==1, str is returned; else, list is
returned.
""" """
_path = os.path.join(env.cache_dir, config["dest"]) if not config.get("multi", False):
if os.path.exists(_path): paths: List[str] = [config["path"]]
return _path dests: List[str] = [config["dest"]]
else:
paths: List[str] = config["path"]
dests: List[str] = config["dest"]
cache_paths: List[str] = []
url = config["path"] gives: Set[int] = set(config.get("gives", [0]))
response = requests.get(url, stream=True)
response.raise_for_status()
with open(_path, 'wb') as f: for i, (p, d) in enumerate(zip(paths, dests)):
for chunk in response.iter_content(chunk_size=8192): _path = os.path.join(env.cache_dir, d)
if chunk: if i in gives:
f.write(chunk) cache_paths.append(_path)
return _path if os.path.exists(_path):
#return _path
continue
url = p
response = requests.get(url, stream=True)
response.raise_for_status()
with open(_path, 'wb') as f:
for chunk in response.iter_content(chunk_size=8192):
if chunk:
f.write(chunk)
return cache_paths[0] if len(cache_paths)==1 else cache_paths
def get_vm_file(env, config: Dict[str, str]) -> Optional[str]: def get_vm_file(env, config: Dict[str, Any]) -> Union[Optional[str], List[Optional[str]]]:
""" """
Config: Config:
path (str): absolute path on the VM to fetch path (str): absolute path on the VM to fetch
dest (str): file name of the downloaded file dest (str): file name of the downloaded file
multi (bool) : optional. if path and dest are lists providing
information of multiple files. defaults to False
gives (List[int]): optional. defaults to [0]. which files are directly
returned to the metric. if len==1, str is returned; else, list is
returned.
""" """
_path = os.path.join(env.cache_dir, config["dest"]) if not config.get("multi", False):
paths: List[str] = [config["path"]]
dests: List[str] = [config["dest"]]
else:
paths: List[str] = config["path"]
dests: List[str] = config["dest"]
cache_paths: List[str] = []
file = env.controller.get_file(config["path"]) gives: Set[int] = set(config.get("gives", [0]))
if file is None:
return None
# raise FileNotFoundError("File not found on VM: {:}".format(config["path"]))
with open(_path, "wb") as f:
f.write(file)
return _path for i, (p, d) in enumerate(zip(paths, dests)):
_path = os.path.join(env.cache_dir, d)
file = env.controller.get_file(p)
if file is None:
#return None
# raise FileNotFoundError("File not found on VM: {:}".format(config["path"]))
if i in gives:
cache_paths.append(None)
continue
if i in gives:
cache_paths.append(_path)
with open(_path, "wb") as f:
f.write(file)
return cache_paths[0] if len(cache_paths)==1 else cache_paths
def get_cache_file(env, config: Dict[str, str]) -> str: def get_cache_file(env, config: Dict[str, str]) -> str:

View File

@@ -3,6 +3,8 @@ import operator
from numbers import Number from numbers import Number
from typing import Any, Union from typing import Any, Union
from typing import Dict, List from typing import Dict, List
import os.path
import itertools
import openpyxl import openpyxl
import pandas as pd import pandas as pd
@@ -26,6 +28,7 @@ def compare_table(actual: str, expected: str, **options) -> float:
* chart * chart
* number_format * number_format
"chart_props": list of str, giving the converned chart properties "chart_props": list of str, giving the converned chart properties
"as_shown": bool, TODO
} }
Return: Return:
@@ -35,10 +38,35 @@ def compare_table(actual: str, expected: str, **options) -> float:
if actual is None: if actual is None:
return 0. return 0.
df1 = pd.read_excel(expected) if options.get("as_shown", False):
df2 = pd.read_excel(actual) expected_csv: str = os.path.splitext(expected)[0] + ".csv"
metric: bool = df1.equals(df2) actual_csv: str = os.path.splitext(actual)[0] + ".csv"
logger.debug("Normal Contents Metric: {:}".format(metric))
with open(expected_csv) as f:
expected_lines: List[str] = list( itertools.dropwhile( lambda l: len(l)==0
, map( lambda l: l.strip()
, reversed(f.read().splitlines())
)
)
)
if options.get("ignore_case", False):
expected_lines = [l.lower() for l in expected_lines]
with open(actual_csv) as f:
actual_lines: List[str] = list( itertools.dropwhile( lambda l: len(l)==0
, map( lambda l: l.strip()
, reversed(f.read().splitlines())
)
)
)
if options.get("ignore_case", False):
actual_lines = [l.lower() for l in actual_lines]
metric: bool = expected_lines==actual_lines
logger.debug("Content Metric just as shown: %s", metric)
else:
df1 = pd.read_excel(expected)
df2 = pd.read_excel(actual)
metric: bool = df1.equals(df2)
logger.debug("Normal Content Metric: {:}".format(metric))
features: List[str] = options.get("features", []) features: List[str] = options.get("features", [])
for ftr in features: for ftr in features:
@@ -219,6 +247,8 @@ if __name__ == '__main__':
# print(check_zoom(path1, {"relation": "lt", "ref_value": 100})) # print(check_zoom(path1, {"relation": "lt", "ref_value": 100}))
# print(check_zoom(path2, {"relation": "lt", "ref_value": 100})) # print(check_zoom(path2, {"relation": "lt", "ref_value": 100}))
path1 = "../../任务数据/LibreOffice Calc/Padding_Decimals_In_Formular_gold.xlsx" path1 = "../../任务数据/LibreOffice Calc/Customers_New_7digit_Id.xlsx"
data_frame: pd.DataFrame = pd.read_excel(path1) path2 = "../../任务数据/LibreOffice Calc/Customers_New_7digit_Id_gold.xlsx"
print(data_frame) #data_frame: pd.DataFrame = pd.read_excel(path1)
#print(data_frame)
print(compare_table(path1, path2, as_shown=True))

View File

@@ -14,7 +14,7 @@ import pyautogui
import requests import requests
from PIL import Image from PIL import Image
from Xlib import display, X from Xlib import display, X
from flask import Flask, request, jsonify, send_file, abort, send_from_directory from flask import Flask, request, jsonify, send_file, abort #, send_from_directory
from lxml.etree import _Element from lxml.etree import _Element
from pyatspi import Accessible, StateType from pyatspi import Accessible, StateType
from pyatspi import Action as ATAction from pyatspi import Action as ATAction
@@ -579,39 +579,114 @@ def open_file():
def activate_window(): def activate_window():
data = request.json data = request.json
window_name = data.get('window_name', None) window_name = data.get('window_name', None)
if not window_name:
return "window_name required", 400
strict: bool = data.get("strict", False) # compare case-sensitively and match the whole string
by_class_name: bool = data.get("by_class", False)
os_name = platform.system() os_name = platform.system()
if os_name == 'Windows': if os_name == 'Windows':
import pygetwindow as gw import pygetwindow as gw
try: if by_class_name:
# Find the VS Code window return "Get window by class name is not supported on Windows currently.", 500
vscode_window = gw.getWindowsWithTitle(window_name)[0] windows: List[gw.Window] = gw.getWindowsWithTitle(window_name)
# Activate the window, bringing it to the front
vscode_window.activate() window: Optional[gw.Window] = None
except IndexError: if len(windows)==0:
return "VS Code window not found.", 404 return "Window {:} not found (empty results)".format(window_name), 404
elif strict:
for wnd in windows:
if wnd.title==wnd:
window = wnd
if window is None:
return "Window {:} not found (strict mode).".format(window_name), 404
else:
window = windows[0]
window.activate()
elif os_name == 'Darwin': elif os_name == 'Darwin':
import pygetwindow as gw import pygetwindow as gw
try: if by_class_name:
# Find the VS Code window return "Get window by class name is not supported on macOS currently.", 500
vscode_window = gw.getWindowsWithTitle(window_name)[0] # Find the VS Code window
# Un-minimize the window and then bring it to the front windows = gw.getWindowsWithTitle(window_name)
vscode_window.unminimize()
vscode_window.activate() window: Optional[gw.Window] = None
except IndexError: if len(windows)==0:
return "VS Code window not found.", 404 return "Window {:} not found (empty results)".format(window_name), 404
elif strict:
for wnd in windows:
if wnd.title==wnd:
window = wnd
if window is None:
return "Window {:} not found (strict mode).".format(window_name), 404
else:
window = windows[0]
# Un-minimize the window and then bring it to the front
window.unminimize()
window.activate()
elif os_name == 'Linux': elif os_name == 'Linux':
# Attempt to activate VS Code window using wmctrl # Attempt to activate VS Code window using wmctrl
subprocess.Popen(["wmctrl", "-a", window_name]) subprocess.run( [ "wmctrl"
, "-{:}{:}a".format( "x" if by_class_name else ""
, "F" if strict else ""
)
, window_name
]
)
else: else:
return f"Operating system {os_name} not supported.", 400 return f"Operating system {os_name} not supported.", 400
return "File opened successfully", 200 return "Window activated successfully", 200
@app.route("/setup/close_window", methods=["POST"])
def close_window():
data = request.json
if "window_name" not in data:
return "window_name required", 400
window_name: str = data["window_name"]
strict: bool = data.get("strict", False) # compare case-sensitively and match the whole string
by_class_name: bool = data.get("by_class", False)
os_name: str = platform.system()
if os_name == "Windows":
import pygetwindow as gw
if by_class_name:
return "Get window by class name is not supported on Windows currently.", 500
windows: List[gw.Window] = gw.getWindowsWithTitle(window_name)
window: Optional[gw.Window] = None
if len(windows)==0:
return "Window {:} not found (empty results)".format(window_name), 404
elif strict:
for wnd in windows:
if wnd.title==wnd:
window = wnd
if window is None:
return "Window {:} not found (strict mode).".format(window_name), 404
else:
window = windows[0]
window.close()
elif os_name == "Linux":
subprocess.run( [ "wmctrl"
, "-{:}{:}c".format( "x" if by_class_name else ""
, "F" if strict else ""
)
, window_name
]
)
elif os_name=="Darwin":
import pygetwindow as gw
return "Currently not supported on macOS.", 500
else:
return "Not supported platform {:}".format(os_name), 500
return "Window closed successfully.", 200
@app.route('/start_recording', methods=['POST']) @app.route('/start_recording', methods=['POST'])
def start_recording(): def start_recording():
@@ -639,7 +714,7 @@ def end_recording():
recording_process.terminate() recording_process.terminate()
recording_process.wait() recording_process.wait()
return_code = recording_process.returncode #return_code = recording_process.returncode
output, error = recording_process.communicate() output, error = recording_process.communicate()
recording_process = None recording_process = None

View File

@@ -3,20 +3,101 @@
"snapshot": "libreoffice_calc", "snapshot": "libreoffice_calc",
"instruction": "I would like to pad all the numbers in the 'Old ID' column with zeros in front, to fill them up to seven digits in the 'New 7 Digit ID' column.", "instruction": "I would like to pad all the numbers in the 'Old ID' column with zeros in front, to fill them up to seven digits in the 'New 7 Digit ID' column.",
"source": "https://www.youtube.com/shorts/FPAQaDTS8VY", "source": "https://www.youtube.com/shorts/FPAQaDTS8VY",
"config": { "config": [
"download": [ {
[ "type": "download",
"", "parameters": {
"C:\\Users\\tianbaox\\Desktop\\Customers_New_7digit_Id.xlsx" "file": [
] {
], "url": "https://drive.usercontent.google.com/download?id=1DqGy5JRKOuZMRJ8O76d4Cds4WaRyz8V1&export=download&authuser=0&confirm=t&uuid=fa0694d1-2a77-4fd2-89d3-d9b854317823&at=APZUnTU9BxqG7E8tLZ104c0E8BEL:1705501029016",
"open": [ "path": "/home/user/Customers_New_7digit_Id.xlsx"
"C:\\Users\\tianbaox\\Desktop\\Customers_New_7digit_Id.xlsx" }
] ]
}
},
{
"type": "open",
"parameters": {
"path": "/home/user/Customers_New_7digit_Id.xlsx"
}
}
}, },
"trajectory": "trajectories/0bf05a7d-b28b-44d2-955a-50b41e24012a", "trajectory": "trajectories/0bf05a7d-b28b-44d2-955a-50b41e24012a",
"related_apps": [ "related_apps": [
"libreoffice calc" "libreoffice calc"
], ],
"evaluator": "evaluation_dir" "evaluator": {
"postconfig": [
{
"type": "activate_window",
"parameters": {
"window_name": "Customers_New_7digit_Id.xlsx - LibreOffice Calc",
"strict": true
}
},
{
"type": "sleep",
"parameters": {
"seconds": 0.5
}
},
{
"type": "execute",
"parameters": {
"command": [
"python",
"-c",
"import pyautogui; pyautogui.press([\"ctrl\", \"s\"]);"
]
}
},
{
"type": "sleep",
"parameters": {
"seconds": 0.5
}
},
{
"type": "execute",
"parameters": {
"command": [
"libreoffice",
"--convert-to",
"csv:Text - txt - csv (StarCalc):44,34,UTF-8,,,,false,true,true",
"--outdir",
"/home/user",
"/home/user/Customers_New_7digit_Id.xlsx"
]
}
}
],
"func": "compare_table",
"result": {
"type": "vm_file",
"path": [
"/home/user/Customers_New_7digit_Id.xlsx",
"/home/user/Customers_New_7digit_Id.csv"
],
"dest": [
"Customers_New_7digit_Id.xlsx",
"Customers_New_7digit_Id.csv"
],
"multi": true
},
"expected": {
"type": "cloud_file",
"path": [
"https://drive.usercontent.google.com/download?id=1zXz5k5A403IR0GE6DRRXRgQZrSIoVFSz&export=download&authuser=0&confirm=t&uuid=ba70b841-969c-4d91-9288-0011aeecf251&at=APZUnTWx3LL9udCgJAh-VMFzzfod:1705501007861",
"https://drive.usercontent.google.com/download?id=1h1GnUpyj92K7FXiHJ1xVaUYW_UYMDLPM&export=download&authuser=0&confirm=t&uuid=98de75bd-ba32-4ceb-97a7-b8d303a8dc96&at=APZUnTUewdfFIsyC3UlSlMcmmRbo:1705500978790"
],
"dest": [
"Customers_New_7digit_Id_gold.xlsx",
"Customers_New_7digit_Id_gold.csv"
],
"multi": true
},
"options": {
"as_shown": true
}
}
} }

View File

@@ -27,6 +27,31 @@
"libreoffice_calc" "libreoffice_calc"
], ],
"evaluator": { "evaluator": {
"postconfig": [
{
"type": "activate_window",
"parameters": {
"window_name": "copy_sheet_insert.xlsx - LibreOffice Calc",
"strict": true
}
},
{
"type": "sleep",
"parameters": {
"seconds": 0.5
}
},
{
"type": "execute",
"parameters": {
"command": [
"python",
"-c",
"import pyautogui; pyautogui.press([\"ctrl\", \"s\"]);"
]
}
}
],
"func": "check_sheet_list", "func": "check_sheet_list",
"result": { "result": {
"type": "vm_file", "type": "vm_file",

View File

@@ -27,6 +27,31 @@
"libreoffice_calc" "libreoffice_calc"
], ],
"evaluator": { "evaluator": {
"postconfig": [
{
"type": "activate_window",
"parameters": {
"window_name": "Zoom_Out_Oversized_Cells.xlsx - LibreOffice Calc",
"strict": true
}
},
{
"type": "sleep",
"parameters": {
"seconds": 0.5
}
},
{
"type": "execute",
"parameters": {
"command": [
"python",
"-c",
"import pyautogui; pyautogui.press([\"ctrl\", \"s\"]);"
]
}
}
],
"func": "check_xlsx_zoom", "func": "check_xlsx_zoom",
"result": { "result": {
"type": "vm_file", "type": "vm_file",

View File

@@ -27,21 +27,78 @@
"libreoffice_calc" "libreoffice_calc"
], ],
"evaluator": { "evaluator": {
"postconfig": [
{
"type": "activate_window",
"parameters": {
"window_name": "Represent_in_millions_billions.xlsx - LibreOffice Calc",
"strict": true
}
},
{
"type": "sleep",
"parameters": {
"seconds": 0.5
}
},
{
"type": "execute",
"parameters": {
"command": [
"python",
"-c",
"import pyautogui; pyautogui.press([\"ctrl\", \"s\"]);"
]
}
},
{
"type": "sleep",
"parameters": {
"seconds": 0.5
}
},
{
"type": "execute",
"parameters": {
"command": [
"libreoffice",
"--convert-to",
"csv:Text - txt - csv (StarCalc):44,34,UTF-8,,,,false,true,true",
"--outdir",
"/home/user",
"/home/user/Represent_in_millions_billions.xlsx"
]
}
}
],
"func": "compare_table", "func": "compare_table",
"result": { "result": {
"type": "vm_file", "type": "vm_file",
"path": "/home/user/Represent_in_millions_billions.xlsx", "path": [
"dest": "Represent_in_millions_billions.xlsx" "/home/user/Represent_in_millions_billions.xlsx",
"/home/user/Represent_in_millions_billions.csv"
],
"dest": [
"Represent_in_millions_billions.xlsx",
"Represent_in_millions_billions.csv"
],
"multi": true
}, },
"expected": { "expected": {
"type": "cloud_file", "type": "cloud_file",
"path": "https://drive.usercontent.google.com/download?id=1Jy6lZexhU5t0eW1GwXJ_csnwIe0Xiy9-&export=download&authuser=0&confirm=t&uuid=601701e7-9eb8-4ce8-83d5-35916094a15d&at=APZUnTW4WE-plIC5MmWTuFu24qLL:1703857882995", "path": [
"dest": "Represent_in_millions_billions_gold.xlsx" "https://drive.usercontent.google.com/download?id=1Jy6lZexhU5t0eW1GwXJ_csnwIe0Xiy9-&export=download&authuser=0&confirm=t&uuid=601701e7-9eb8-4ce8-83d5-35916094a15d&at=APZUnTW4WE-plIC5MmWTuFu24qLL:1703857882995",
"https://drive.usercontent.google.com/download?id=1CjzmJ4vqwPI7DMTR_6a8ytO-W-4xavBS&export=download&authuser=0&confirm=t&uuid=32c3430a-6d3d-47cc-bb5c-e683963b19f7&at=APZUnTWSBLNtkrZTix_BRl9gyaek:1705497493679"
],
"dest": [
"Represent_in_millions_billions_gold.xlsx",
"Represent_in_millions_billions_gold.csv"
],
"multi": true
}, },
"options": { "options": {
"features": [ "as_shown": true,
"number_format" "ignore_case": true
]
} }
} }
} }

View File

@@ -26,6 +26,31 @@
"libreoffice calc" "libreoffice calc"
], ],
"evaluator": { "evaluator": {
"postconfig": [
{
"type": "activate_window",
"parameters": {
"window_name": "OrderId_Month_Chart.xlsx - LibreOffice Calc",
"strict": true
}
},
{
"type": "sleep",
"parameters": {
"seconds": 0.5
}
},
{
"type": "execute",
"parameters": {
"command": [
"python",
"-c",
"import pyautogui; pyautogui.press([\"ctrl\", \"s\"]);"
]
}
}
],
"func": "compare_table", "func": "compare_table",
"expected": { "expected": {
"type": "cloud_file", "type": "cloud_file",

View File

@@ -27,6 +27,31 @@
"libreoffice_calc" "libreoffice_calc"
], ],
"evaluator": { "evaluator": {
"postconfig": [
{
"type": "activate_window",
"parameters": {
"window_name": "Create_column_charts_using_statistics.xlsx - LibreOffice Calc",
"strict": true
}
},
{
"type": "sleep",
"parameters": {
"seconds": 0.5
}
},
{
"type": "execute",
"parameters": {
"command": [
"python",
"-c",
"import pyautogui; pyautogui.press([\"ctrl\", \"s\"]);"
]
}
}
],
"func": "compare_table", "func": "compare_table",
"result": { "result": {
"type": "vm_file", "type": "vm_file",

View File

@@ -27,6 +27,31 @@
"libreoffice_calc" "libreoffice_calc"
], ],
"evaluators": { "evaluators": {
"postconfig": [
{
"type": "activate_window",
"parameters": {
"window_name": "Freeze_row_column.xlsx - LibreOffice Calc",
"strict": true
}
},
{
"type": "sleep",
"parameters": {
"seconds": 0.5
}
},
{
"type": "execute",
"parameters": {
"command": [
"python",
"-c",
"import pyautogui; pyautogui.press([\"ctrl\", \"s\"]);"
]
}
}
],
"func": "check_xlsx_freeze", "func": "check_xlsx_freeze",
"result": { "result": {
"type": "vm_file", "type": "vm_file",

View File

@@ -27,6 +27,31 @@
"libreoffice_calc" "libreoffice_calc"
], ],
"evaluator": { "evaluator": {
"postconfig": [
{
"type": "activate_window",
"parameters": {
"window_name": "OrderId_Month_Chart.xlsx - LibreOffice Calc",
"strict": true
}
},
{
"type": "sleep",
"parameters": {
"seconds": 0.5
}
},
{
"type": "execute",
"parameters": {
"command": [
"python",
"-c",
"import pyautogui; pyautogui.press([\"ctrl\", \"s\"]);"
]
}
}
],
"func": "compare_table", "func": "compare_table",
"result": { "result": {
"type": "vm_file", "type": "vm_file",

View File

@@ -1,7 +1,7 @@
{ {
"id": "a01fbce3-2793-461f-ab86-43680ccbae25", "id": "a01fbce3-2793-461f-ab86-43680ccbae25",
"snapshot": "libreoffice_calc", "snapshot": "libreoffice_calc",
"instruction": "Could you help me setting decimal separator as a dot (.)?", "instruction": "I need to set the decimal separator as a comma (,) for localized data representation and clarity in visualization. Can you assist with this?",
"source": "https://superuser.com/questions/1250677/how-to-set-decimal-separator-in-libre-office-calc", "source": "https://superuser.com/questions/1250677/how-to-set-decimal-separator-in-libre-office-calc",
"config": [ "config": [
{ {
@@ -14,6 +14,12 @@
} }
] ]
} }
},
{
"type": "open",
"parameters": {
"path": "/home/user/Set_Decimal_Separator_Dot.xlsx"
}
} }
], ],
"trajectory": "trajectories/a01fbce3-2793-461f-ab86-43680ccbae25", "trajectory": "trajectories/a01fbce3-2793-461f-ab86-43680ccbae25",
@@ -21,24 +27,77 @@
"libreoffice_calc" "libreoffice_calc"
], ],
"evaluator": { "evaluator": {
"func": "check_libre_locale", "postconfig": [
{
"type": "activate_window",
"parameters": {
"window_name": "Set_Decimal_Separator_Dot.xlsx - LibreOffice Calc",
"strict": true
}
},
{
"type": "sleep",
"parameters": {
"seconds": 0.5
}
},
{
"type": "execute",
"parameters": {
"command": [
"python",
"-c",
"import pyautogui; pyautogui.press([\"ctrl\", \"s\"]);"
]
}
},
{
"type": "sleep",
"parameters": {
"seconds": 0.5
}
},
{
"type": "execute",
"parameters": {
"command": [
"libreoffice",
"--convert-to",
"csv:Text - txt - csv (StarCalc):44,34,UTF-8,,,,false,true,true",
"--outdir",
"/home/user",
"/home/user/Set_Decimal_Separator_Dot.xlsx"
]
}
}
],
"func": "compare_table",
"result": { "result": {
"type": "vm_file", "type": "vm_file",
"path": "/home/user/.config/libreoffice/4/user/registrymodifications.xcu", "path": [
"dest": "registrymodifications.xcu" "/home/user/Set_Decimal_Separator_Dot.xlsx",
"/home/user/Set_Decimal_Separator_Dot.csv"
],
"dest": [
"Set_Decimal_Separator_Dot.xlsx",
"Set_Decimal_Separator_Dot.csv"
],
"multi": true
}, },
"expected": { "expected": {
"type": "rule", "type": "cloud_file",
"rules": { "path": [
"locale_set": [ "https://drive.usercontent.google.com/download?id=15O0l5fxVi1JX_12KOLfbxWPHjXPZPon5&export=download&authuser=0&confirm=t&uuid=395e6c57-11a7-4b33-af4c-98ff2390742b&at=APZUnTVKcrUGrjRfBEwT_AD53Cmn:1705497822975",
"ru-*", "https://drive.usercontent.google.com/download?id=1rKDWcovxw4Qtd3RHs7M5p_QqryI0SQO3&export=download&authuser=0&confirm=t&uuid=eb6ffb6d-f7c2-44d8-ad77-db6c0aaf5cc7&at=APZUnTWr2VxrJPiiKVMdFd0IykrR:1705497846507"
"de-*", ],
"fr-*", "dest": [
"pt-*", "Set_Decimal_Separator_Dot_gold.xlsx",
"es-*", "Set_Decimal_Separator_Dot_gold.csv"
"it-*" ],
] "multi": true
} },
"options": {
"as_shown": true
} }
} }
} }

View File

@@ -0,0 +1,85 @@
{
"id": "a01fbce3-2793-461f-ab86-43680ccbae25",
"snapshot": "libreoffice_calc",
"instruction": "I need to set the decimal separator as a comma (,) for localized data representation and clarity in visualization. Can you assist with this?",
"source": "https://superuser.com/questions/1250677/how-to-set-decimal-separator-in-libre-office-calc",
"config": [],
"trajectory": "trajectories/a01fbce3-2793-461f-ab86-43680ccbae25",
"related_apps": [
"libreoffice_calc"
],
"evaluator": {
"postconfig": [
{
"type": "activate_window",
"parameters": {
"window_name": "Set_Decimal_Separator_Dot.xlsx - LibreOffice Calc",
"strict": true
}
},
{
"type": "sleep",
"parameters": {
"seconds": 0.5
}
},
{
"type": "execute",
"parameters": {
"command": [
"python",
"-c",
"import pyautogui; pyautogui.press([\"ctrl\", \"s\"]);"
]
}
},
{
"type": "sleep",
"parameters": {
"seconds": 0.5
}
},
{
"type": "execute",
"parameters": {
"command": [
"libreoffice",
"--convert-to",
"csv:Text - txt - csv (StarCalc):44,34,UTF-8,,,,false,true,true",
"--outdir",
"/home/user",
"/home/user/Set_Decimal_Separator_Dot.xlsx"
]
}
}
],
"func": "compare_table",
"result": {
"type": "vm_file",
"path": [
"/home/user/Set_Decimal_Separator_Dot.xlsx",
"/home/user/Set_Decimal_Separator_Dot.csv"
],
"dest": [
"Set_Decimal_Separator_Dot.xlsx",
"Set_Decimal_Separator_Dot.csv"
],
"multi": true
},
"expected": {
"type": "cloud_file",
"path": [
"https://drive.usercontent.google.com/download?id=15O0l5fxVi1JX_12KOLfbxWPHjXPZPon5&export=download&authuser=0&confirm=t&uuid=395e6c57-11a7-4b33-af4c-98ff2390742b&at=APZUnTVKcrUGrjRfBEwT_AD53Cmn:1705497822975",
"https://drive.usercontent.google.com/download?id=1rKDWcovxw4Qtd3RHs7M5p_QqryI0SQO3&export=download&authuser=0&confirm=t&uuid=eb6ffb6d-f7c2-44d8-ad77-db6c0aaf5cc7&at=APZUnTWr2VxrJPiiKVMdFd0IykrR:1705497846507"
],
"dest": [
"Set_Decimal_Separator_Dot_gold.xlsx",
"Set_Decimal_Separator_Dot_gold.csv"
],
"multi": true
},
"options": {
"as_shown": true
}
}
}

View File

@@ -30,8 +30,8 @@
"func": "check_pdf_pages", "func": "check_pdf_pages",
"result": { "result": {
"type": "vm_file", "type": "vm_file",
"path": "/home/user/Resize_Cells_Fit_Page.xlsx", "path": "/home/user/Resize_Cells_Fit_Page.pdf",
"dest": "Resize_Cells_Fit_Page.xlsx" "dest": "Resize_Cells_Fit_Page.pdf"
}, },
"expected": { "expected": {
"type": "rule", "type": "rule",

View File

@@ -27,6 +27,31 @@
"libreoffice calc" "libreoffice calc"
], ],
"evaluator": { "evaluator": {
"postconfig": [
{
"type": "activate_window",
"parameters": {
"window_name": "Quarterly_Product_Sales_by_Zone.xlsx - LibreOffice Calc",
"strict": true
}
},
{
"type": "sleep",
"parameters": {
"seconds": 0.5
}
},
{
"type": "execute",
"parameters": {
"command": [
"python",
"-c",
"import pyautogui; pyautogui.press([\"ctrl\", \"s\"]);"
]
}
}
],
"func": "compare_table", "func": "compare_table",
"expected": { "expected": {
"type": "cloud_file", "type": "cloud_file",

View File

@@ -45,12 +45,17 @@
"evaluator": { "evaluator": {
"postconfig": [ "postconfig": [
{ {
"type": "command", "type": "close_window",
"parameters": { "parameters": {
"command": ["wmctrl", "-xFc", "Mail.thunderbird"], "window_name": "Mail.thunderbird",
"until": { "strict": true,
"returncode": 1 "by_class": true
} }
},
{
"type": "sleep",
"parameters": {
"seconds": 0.5
} }
} }
], ],

View File

@@ -45,12 +45,16 @@
"evaluator": { "evaluator": {
"postconfig": [ "postconfig": [
{ {
"type": "command", "type": "close_window",
"parameters": { "parameters": {
"command": ["wmctrl", "-Fc", "Message Filters"], "window_name": "Message Filters",
"until": { "strict": true
"returncode": 1 }
} },
{
"type": "sleep",
"parameters": {
"seconds": 0.5
} }
} }
], ],

View File

@@ -45,16 +45,17 @@
"evaluator": { "evaluator": {
"postconfig": [ "postconfig": [
{ {
"type": "execute", "type": "close_window",
"parameters": { "parameters": {
"command": [ "window_name": "Mail.thunderbird",
"wmctrl", "strict": true,
"-xFc", "by_class": true
"Mail.thunderbird" }
], },
"until": { {
"returncode": 1 "type": "sleep",
} "parameters": {
"seconds": 0.5
} }
} }
], ],

View File

@@ -23,16 +23,17 @@
"evaluator": { "evaluator": {
"postconfig": [ "postconfig": [
{ {
"type": "execute", "type": "close_window",
"parameters": { "parameters": {
"command": [ "window_name": "Mail.thunderbird",
"wmctrl", "strict": true,
"-xFc", "by_class": true
"Mail.thunderbird" }
], },
"until": { {
"returncode": 1 "type": "sleep",
} "parameters": {
"seconds": 0.5
} }
} }
], ],

View File

@@ -45,12 +45,17 @@
"evaluator": { "evaluator": {
"postconfig": [ "postconfig": [
{ {
"type": "command", "type": "close_window",
"parameters": { "parameters": {
"command": ["wmctrl", "-xFc", "Mail.thunderbird"], "window_name": "Mail.thunderbird",
"until": { "strict": true,
"returncode": 1 "by_class": true
} }
},
{
"type": "sleep",
"parameters": {
"seconds": 0.5
} }
} }
], ],

View File

@@ -45,12 +45,17 @@
"evaluator": { "evaluator": {
"postconfig": [ "postconfig": [
{ {
"type": "command", "type": "close_window",
"parameters": { "parameters": {
"command": ["wmctrl", "-xFc", "Mail.thunderbird"], "window_name": "Mail.thunderbird",
"until": { "strict": true,
"returncode": 1 "by_class": true
} }
},
{
"type": "sleep",
"parameters": {
"seconds": 0.5
} }
} }
], ],

View File

@@ -23,12 +23,17 @@
"evaluator": { "evaluator": {
"postconfig": [ "postconfig": [
{ {
"type": "command", "type": "close_window",
"parameters": { "parameters": {
"command": ["wmctrl", "-xFc", "Mail.thunderbird"], "window_name": "Mail.thunderbird",
"until": { "strict": true,
"returncode": 1 "by_class": true
} }
},
{
"type": "sleep",
"parameters": {
"seconds": 0.5
} }
} }
], ],

View File

@@ -45,12 +45,17 @@
"evaluator": { "evaluator": {
"postconfig": [ "postconfig": [
{ {
"type": "command", "type": "close_window",
"parameters": { "parameters": {
"command": ["wmctrl", "-xFc", "Mail.thunderbird"], "window_name": "Mail.thunderbird",
"until": { "strict": true,
"returncode": 1 "by_class": true
} }
},
{
"type": "sleep",
"parameters": {
"seconds": 0.5
} }
} }
], ],

View File

@@ -45,12 +45,17 @@
"evaluator": { "evaluator": {
"postconfig": [ "postconfig": [
{ {
"type": "command", "type": "close_window",
"parameters": { "parameters": {
"command": ["wmctrl", "-xFc", "Mail.thunderbird"], "window_name": "Mail.thunderbird",
"until": { "strict": true,
"returncode": 1 "by_class": true
} }
},
{
"type": "sleep",
"parameters": {
"seconds": 0.5
} }
} }
], ],

View File

@@ -45,12 +45,16 @@
"evaluator": { "evaluator": {
"postconfig": [ "postconfig": [
{ {
"type": "command", "type": "close_window",
"parameters": { "parameters": {
"command": ["wmctrl", "-Fc", "Message Filters"], "window_name": "Message Filters",
"until": { "strict": true
"returncode": 1 }
} },
{
"type": "sleep",
"parameters": {
"seconds": 0.5
} }
} }
], ],

View File

@@ -23,12 +23,16 @@
"evaluator": { "evaluator": {
"postconfig": [ "postconfig": [
{ {
"type": "command", "type": "close_window",
"parameters": { "parameters": {
"command": ["wmctrl", "-Fc", "Message Filters"], "window_name": "Message Filters",
"until": { "strict": true
"returncode": 1 }
} },
{
"type": "sleep",
"parameters": {
"seconds": 0.5
} }
} }
], ],