-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release support for Python 3.8 and above versions
Fixes #53
- Loading branch information
1 parent
f638057
commit 9ea227e
Showing
13 changed files
with
1,441 additions
and
352 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,22 @@ | ||
import os | ||
"""This module holds all settings for the tool.""" | ||
from pathlib import Path | ||
from typing import List | ||
|
||
from pydantic import BaseSettings | ||
from pydantic import FilePath | ||
from pydantic_settings import BaseSettings | ||
|
||
|
||
class Settings(BaseSettings): | ||
BIN_HOME: str = os.path.join(Path(__file__).parent.resolve(), "flaui", "bin") | ||
WRAPPERS_HOME: str = os.path.join(Path(__file__).parent.resolve(), "flaui", "wrappers_temp") | ||
FLAUI_HOME: str = str(Path(r"C:\Users\Amruth.Vithala\Projects\FlaUI\src")) | ||
"""Holds all common settings for the tool""" | ||
BIN_HOME: Path = Path(__file__).parent.joinpath("flaui", "bin") | ||
|
||
|
||
class TestSettings(BaseSettings): | ||
"""Holds all settings for the unit test usages""" | ||
WPF_TEST_APP_EXE: FilePath = Path(__file__).parent.joinpath("test_applications", "WPFApplication", "WpfApplication.exe") | ||
WPF_TEST_APP_PROCESS: str = "WpfApplication.exe" | ||
WINFORMS_TEST_APP_EXE: FilePath = Path(__file__).parent.joinpath("test_applications", "WINFORMSApplication", "WinFormsApplication.exe") | ||
WINFORMS_TEST_APP_PROCESS: str = "WinFormsApplication.exe" | ||
|
||
|
||
settings = Settings() | ||
test_settings = TestSettings() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
"""Enums for UIAutomationTypes.""" | ||
from enum import Enum | ||
|
||
|
||
class UIAutomationTypes(Enum): | ||
"""Enum for UIAutomationTypes.""" | ||
UIA2 = 'UIA2' | ||
UIA3 = 'UIA3' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,25 @@ | ||
import os | ||
"""This module provides a bridge between Python and .NET using Python.NET.""" | ||
|
||
import clr | ||
from loguru import logger | ||
|
||
import config | ||
|
||
from loguru import logger | ||
|
||
def setup_pythonnet_bridge() -> None: | ||
"""Sets up PythonNet bridge | ||
Sets up PythonNet bridge for FlaUI and automation dependencies for UI Automation | ||
""" | ||
Sets up Python.NET bridge for FlaUI and automation dependencies for UI Automation | ||
so that the interlinked C# .NET dependencies are injected into the Python environment | ||
listed under flaui/bin folder. | ||
:param dll_list: List of DLL's to add to the PythonNet wrapper | ||
:raises err: On failure to load the existing C# dependencies listed under flaui/bin | ||
""" | ||
BIN_HOME = config.settings.BIN_HOME | ||
logger.info(f"Looking for valid binaries at - {BIN_HOME}") | ||
try: | ||
for _ in os.listdir(BIN_HOME): | ||
path, dll = os.path.join(BIN_HOME, _), _.replace(".dll", "") | ||
clr.AddReference(path) | ||
clr.AddReference(dll) | ||
logger.info(f"Added {dll} DLL from {path} to PythonNet bridge") | ||
for _ in BIN_HOME.glob("*.dll"): | ||
clr.AddReference(_.as_posix()) # pyright: ignore | ||
clr.AddReference(_.stem) # pyright: ignore | ||
logger.info(f"Added {_.name} DLL from {_} to Python.NET bridge") | ||
except Exception as err: | ||
logger.exception(f"{err}") | ||
raise err | ||
|
||
logger.info("Python.NET bridge setup complete") |
Empty file.
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.