Skip to content

Commit 69ad124

Browse files
committed
removed -lsa and -dui to avoid premature dependency of linux installation
1 parent d2ba0e1 commit 69ad124

1 file changed

Lines changed: 0 additions & 154 deletions

File tree

node_cli.py

Lines changed: 0 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -837,120 +837,6 @@ def install_linux_inspector_deps():
837837
return False
838838

839839

840-
def list_available_apps():
841-
"""List all available applications for UI inspection."""
842-
console = Console()
843-
844-
console.print("\n[cyan]Scanning for available applications...[/cyan]\n")
845-
846-
try:
847-
# Import the Linux BuiltInFunctions module
848-
sys.path.insert(
849-
0,
850-
str(
851-
Path(__file__).parent
852-
/ "Framework"
853-
/ "Built_In_Automation"
854-
/ "Desktop"
855-
/ "Linux"
856-
),
857-
)
858-
try:
859-
import pyatspi
860-
except ImportError:
861-
install_missing_modules(["python3-pyatspi==1.19.0", "pygobject==3.50.1"])
862-
try:
863-
import pyatspi
864-
except ImportError:
865-
sys.stderr.write(
866-
"Error: system dependency is not installed. Install them by running Installer/setup_linux_inspector.sh.\n"
867-
)
868-
sys.exit(1)
869-
870-
desktop = pyatspi.Registry.getDesktop(0)
871-
apps = []
872-
873-
for app in desktop:
874-
if app and app.name:
875-
apps.append(app.name)
876-
877-
if apps:
878-
console.print(f"[green]✓[/green] Found {len(apps)} application(s):\n")
879-
for idx, app_name in enumerate(apps, 1):
880-
console.print(f" {idx}. {app_name}")
881-
console.print()
882-
return True
883-
else:
884-
console.print("[yellow]No applications found[/yellow]\n")
885-
return False
886-
887-
except Exception as e:
888-
console.print(f"\n[red]✗[/red] Error listing applications: {str(e)}\n")
889-
import traceback as tb
890-
891-
tb.print_exc()
892-
return False
893-
894-
895-
def generate_ui_dump(app_keyword: str):
896-
"""Generate UI dump for a specific application."""
897-
console = Console()
898-
899-
console.print(
900-
f"\n[cyan]Generating UI dump for application: '{app_keyword}'[/cyan]\n"
901-
)
902-
903-
try:
904-
# Import the Linux BuiltInFunctions module
905-
sys.path.insert(
906-
0,
907-
str(
908-
Path(__file__).parent
909-
/ "Framework"
910-
/ "Built_In_Automation"
911-
/ "Desktop"
912-
/ "Linux"
913-
),
914-
)
915-
from BuiltInFunctions import get_ui_tree
916-
917-
ui_tree = get_ui_tree(app_keyword)
918-
919-
if ui_tree:
920-
# Save to file
921-
timestamp = dt.now().strftime("%Y%m%d_%H%M%S")
922-
output_file = (
923-
Path(__file__).parent
924-
/ "AutomationLog"
925-
/ f"ui_dump_{app_keyword}_{timestamp}.xml"
926-
)
927-
output_file.parent.mkdir(exist_ok=True)
928-
929-
with open(output_file, "w", encoding="utf-8") as f:
930-
f.write(ui_tree)
931-
932-
console.print(f"[green]✓[/green] UI dump generated successfully!")
933-
console.print(f"[cyan]Location:[/cyan] {output_file}\n")
934-
935-
# Also print to console
936-
console.print("[cyan]UI Tree:[/cyan]")
937-
print(ui_tree)
938-
939-
return True
940-
else:
941-
console.print(
942-
f"\n[red]✗[/red] Failed to generate UI dump. Application '{app_keyword}' not found or no UI tree available.\n"
943-
)
944-
return False
945-
946-
except Exception as e:
947-
console.print(f"\n[red]✗[/red] Error generating UI dump: {str(e)}\n")
948-
import traceback as tb
949-
950-
tb.print_exc()
951-
return False
952-
953-
954840
def fetch_private_keys(share_code: str):
955841
"""Fetch and decrypt shared RSA private keys from server."""
956842
console = Console()
@@ -1139,12 +1025,6 @@ async def command_line_args() -> Path | None:
11391025
Example 15 - Install Linux desktop automation dependencies:
11401026
python node_cli.py -ild
11411027
1142-
Example 16 - List all available applications:
1143-
python node_cli.py -lsa
1144-
1145-
Example 17 - Generate UI dump for an application:
1146-
python node_cli.py -dui firefox
1147-
11481028
Use -h or --help to see full documentation of all available arguments.
11491029
"""
11501030
# try:
@@ -1265,19 +1145,6 @@ async def command_line_args() -> Path | None:
12651145
action="store_true",
12661146
help="Install Linux desktop automation dependencies (runs Installer/setup_linux_inspector.sh)",
12671147
)
1268-
parser_object.add_argument(
1269-
"-lsa",
1270-
"--list-apps",
1271-
action="store_true",
1272-
help="List all available applications for UI inspection",
1273-
)
1274-
parser_object.add_argument(
1275-
"-dui",
1276-
"--dump-ui",
1277-
action="store",
1278-
help="Generate UI dump for a specific application (provide app name or keyword)",
1279-
metavar="",
1280-
)
12811148

12821149
all_arguments = parser_object.parse_args()
12831150

@@ -1560,25 +1427,4 @@ async def main():
15601427
await asyncio.sleep(1)
15611428

15621429

1563-
def handle_inspection_commands():
1564-
"""Handle inspection commands that should not kill existing node processes."""
1565-
parser = argparse.ArgumentParser(add_help=False)
1566-
parser.add_argument("-lsa", "--list-apps", action="store_true")
1567-
parser.add_argument("-dui", "--dump-ui", action="store")
1568-
1569-
# Parse only known args to avoid errors from other arguments
1570-
args, _ = parser.parse_known_args()
1571-
1572-
if args.list_apps:
1573-
list_available_apps()
1574-
sys.exit(0)
1575-
1576-
if args.dump_ui:
1577-
generate_ui_dump(args.dump_ui)
1578-
sys.exit(0)
1579-
1580-
1581-
# Handle inspection commands before starting main process
1582-
handle_inspection_commands()
1583-
15841430
asyncio.run(main())

0 commit comments

Comments
 (0)