appwindows 1.2.0__tar.gz → 1.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- appwindows-1.2.2/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
- appwindows-1.2.2/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- appwindows-1.2.2/.github/workflows/build.yml +78 -0
- appwindows-1.2.2/.github/workflows/unit_tests.yml +110 -0
- {appwindows-1.2.0 → appwindows-1.2.2}/.gitignore +2 -1
- {appwindows-1.2.0 → appwindows-1.2.2}/PKG-INFO +10 -5
- {appwindows-1.2.0 → appwindows-1.2.2}/README.md +6 -1
- appwindows-1.2.2/lib/__init__.pyi +192 -0
- appwindows-1.2.2/lib/exceptions/__init__.pyi +11 -0
- appwindows-1.2.2/lib/geometry/__init__.pyi +151 -0
- appwindows-1.2.2/lib/py.typed +0 -0
- {appwindows-1.2.0 → appwindows-1.2.2}/meson.build +4 -17
- {appwindows-1.2.0 → appwindows-1.2.2}/pyproject.toml +5 -5
- {appwindows-1.2.0 → appwindows-1.2.2}/src/appwindows.cc +1 -1
- {appwindows-1.2.0 → appwindows-1.2.2}/src/core/base_finder.h +2 -3
- {appwindows-1.2.0 → appwindows-1.2.2}/src/core/base_window.h +3 -3
- {appwindows-1.2.0 → appwindows-1.2.2}/src/core/bind.cc +41 -23
- {appwindows-1.2.0 → appwindows-1.2.2}/src/core/geometry/bind_geometry.cc +28 -11
- {appwindows-1.2.0 → appwindows-1.2.2}/src/core/geometry/point.h +6 -0
- appwindows-1.2.2/src/core/geometry/quad_points.h +34 -0
- {appwindows-1.2.0 → appwindows-1.2.2}/src/core/geometry/size.cc +9 -0
- appwindows-1.2.2/src/core/geometry/size.h +26 -0
- {appwindows-1.2.0 → appwindows-1.2.2}/src/windows/window.getters.cc +1 -1
- {appwindows-1.2.0 → appwindows-1.2.2}/src/windows/window.setters.cc +5 -8
- {appwindows-1.2.0 → appwindows-1.2.2}/src/x_server/finder.h +1 -1
- {appwindows-1.2.0 → appwindows-1.2.2}/src/x_server/window.getters.cc +6 -6
- {appwindows-1.2.0 → appwindows-1.2.2}/src/x_server/window.h +1 -1
- {appwindows-1.2.0 → appwindows-1.2.2}/src/x_server/window.setters.cc +16 -0
- appwindows-1.2.2/tests/geometry/test_point.py +103 -0
- appwindows-1.2.2/tests/geometry/test_size.py +26 -0
- appwindows-1.2.2/tests/test_finder.py +80 -0
- appwindows-1.2.2/tests/test_get_finder.py +17 -0
- appwindows-1.2.2/tests/test_import.py +18 -0
- appwindows-1.2.2/tests/test_window.py +91 -0
- appwindows-1.2.2/tests/window_creator.py +72 -0
- appwindows-1.2.0/src/core/geometry/quad_points.h +0 -25
- appwindows-1.2.0/src/core/geometry/size.h +0 -16
- {appwindows-1.2.0 → appwindows-1.2.2}/.clang-format +0 -0
- {appwindows-1.2.0 → appwindows-1.2.2}/LICENSE.md +0 -0
- {appwindows-1.2.0 → appwindows-1.2.2}/appwindows.svg +0 -0
- {appwindows-1.2.0 → appwindows-1.2.2}/lib/__init__.py +0 -0
- {appwindows-1.2.0 → appwindows-1.2.2}/lib/exceptions/__init__.py +0 -0
- {appwindows-1.2.0 → appwindows-1.2.2}/lib/geometry/__init__.py +0 -0
- {appwindows-1.2.0 → appwindows-1.2.2}/src/core/bind.h +0 -0
- {appwindows-1.2.0 → appwindows-1.2.2}/src/core/exceptions/bind_exceptions.cc +0 -0
- {appwindows-1.2.0 → appwindows-1.2.2}/src/core/exceptions/bind_exceptions.h +0 -0
- {appwindows-1.2.0 → appwindows-1.2.2}/src/core/exceptions/invalid_size.h +0 -0
- {appwindows-1.2.0 → appwindows-1.2.2}/src/core/exceptions/window_does_not_found.h +0 -0
- {appwindows-1.2.0 → appwindows-1.2.2}/src/core/exceptions/window_does_not_valid.h +0 -0
- {appwindows-1.2.0 → appwindows-1.2.2}/src/core/geometry/bind_geometry.h +0 -0
- {appwindows-1.2.0 → appwindows-1.2.2}/src/core/geometry/point.cc +0 -0
- {appwindows-1.2.0 → appwindows-1.2.2}/src/core/platform.cc +0 -0
- {appwindows-1.2.0 → appwindows-1.2.2}/src/core/platform.h +0 -0
- {appwindows-1.2.0 → appwindows-1.2.2}/src/macos/finder.cc +0 -0
- {appwindows-1.2.0 → appwindows-1.2.2}/src/macos/finder.h +0 -0
- {appwindows-1.2.0 → appwindows-1.2.2}/src/macos/window.getters.cc +0 -0
- {appwindows-1.2.0 → appwindows-1.2.2}/src/macos/window.h +0 -0
- {appwindows-1.2.0 → appwindows-1.2.2}/src/macos/window.setters.cc +0 -0
- {appwindows-1.2.0 → appwindows-1.2.2}/src/windows/finder.cc +0 -0
- {appwindows-1.2.0 → appwindows-1.2.2}/src/windows/finder.h +0 -0
- {appwindows-1.2.0 → appwindows-1.2.2}/src/windows/window.h +0 -0
- {appwindows-1.2.0 → appwindows-1.2.2}/src/x_server/finder.cc +0 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Create a report to help us improve
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Describe the bug**
|
|
11
|
+
A clear and concise description of what the bug is.
|
|
12
|
+
|
|
13
|
+
**To Reproduce**
|
|
14
|
+
Steps to reproduce the behavior:
|
|
15
|
+
1. Go to '...'
|
|
16
|
+
2. Click on '....'
|
|
17
|
+
3. Scroll down to '....'
|
|
18
|
+
4. See error
|
|
19
|
+
|
|
20
|
+
**Expected behavior**
|
|
21
|
+
A clear and concise description of what you expected to happen.
|
|
22
|
+
|
|
23
|
+
**Screenshots**
|
|
24
|
+
If applicable, add screenshots to help explain your problem.
|
|
25
|
+
|
|
26
|
+
**Desktop (please complete the following information):**
|
|
27
|
+
- OS: [e.g. iOS]
|
|
28
|
+
- Browser [e.g. chrome, safari]
|
|
29
|
+
- Version [e.g. 22]
|
|
30
|
+
|
|
31
|
+
**Smartphone (please complete the following information):**
|
|
32
|
+
- Device: [e.g. iPhone6]
|
|
33
|
+
- OS: [e.g. iOS8.1]
|
|
34
|
+
- Browser [e.g. stock browser, safari]
|
|
35
|
+
- Version [e.g. 22]
|
|
36
|
+
|
|
37
|
+
**Additional context**
|
|
38
|
+
Add any other context about the problem here.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest an idea for this project
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Is your feature request related to a problem? Please describe.**
|
|
11
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
12
|
+
|
|
13
|
+
**Describe the solution you'd like**
|
|
14
|
+
A clear and concise description of what you want to happen.
|
|
15
|
+
|
|
16
|
+
**Describe alternatives you've considered**
|
|
17
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
|
18
|
+
|
|
19
|
+
**Additional context**
|
|
20
|
+
Add any other context or screenshots about the feature request here.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
name: build
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main, master ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main, master ]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build_wheels:
|
|
12
|
+
name: Build on ${{ matrix.os }}
|
|
13
|
+
runs-on: ${{ matrix.os }}
|
|
14
|
+
strategy:
|
|
15
|
+
matrix:
|
|
16
|
+
os: [ubuntu-22.04, windows-2019]
|
|
17
|
+
fail-fast: false
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- name: Checkout code
|
|
21
|
+
uses: actions/checkout@v4
|
|
22
|
+
|
|
23
|
+
- name: Set up Python
|
|
24
|
+
uses: actions/setup-python@v5
|
|
25
|
+
with:
|
|
26
|
+
python-version: '3.13'
|
|
27
|
+
|
|
28
|
+
- name: Install cibuildwheel
|
|
29
|
+
run: |
|
|
30
|
+
pip install cibuildwheel==3.3.0
|
|
31
|
+
|
|
32
|
+
- name: Set up MSVC (Windows only)
|
|
33
|
+
if: runner.os == 'Windows'
|
|
34
|
+
uses: microsoft/setup-msbuild@v1
|
|
35
|
+
|
|
36
|
+
- name: Install delvewheel (Windows only)
|
|
37
|
+
if: runner.os == 'Windows'
|
|
38
|
+
run: pip install delvewheel
|
|
39
|
+
|
|
40
|
+
- name: Build wheels
|
|
41
|
+
run: python -m cibuildwheel --output-dir wheelhouse
|
|
42
|
+
env:
|
|
43
|
+
CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-* cp312-* cp313-* cp314-*"
|
|
44
|
+
CIBW_SKIP: "*-musllinux_*"
|
|
45
|
+
CIBW_ARCHS_LINUX: "x86_64"
|
|
46
|
+
CIBW_ARCHS_WINDOWS: "AMD64"
|
|
47
|
+
CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux2014_x86_64
|
|
48
|
+
CIBW_BEFORE_BUILD_LINUX: |
|
|
49
|
+
yum install -y \
|
|
50
|
+
libX11-devel \
|
|
51
|
+
libXext-devel \
|
|
52
|
+
libXrender-devel \
|
|
53
|
+
libXtst-devel \
|
|
54
|
+
libXi-devel \
|
|
55
|
+
libXinerama-devel \
|
|
56
|
+
libXcursor-devel \
|
|
57
|
+
libXrandr-devel \
|
|
58
|
+
libXfixes-devel \
|
|
59
|
+
libXdamage-devel \
|
|
60
|
+
libXcomposite-devel \
|
|
61
|
+
libxkbcommon-devel \
|
|
62
|
+
mesa-libGL-devel \
|
|
63
|
+
mesa-libEGL-devel \
|
|
64
|
+
libgbm-devel \
|
|
65
|
+
pkgconfig
|
|
66
|
+
CIBW_BEFORE_BUILD_WINDOWS: "pip install meson ninja pybind11"
|
|
67
|
+
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair --wheel-dir {dest_dir} {wheel}"
|
|
68
|
+
CIBW_REPAIR_WHEEL_COMMAND_LINUX: "auditwheel repair --wheel-dir {dest_dir} {wheel}"
|
|
69
|
+
CIBW_ENVIRONMENT_WINDOWS: >
|
|
70
|
+
PYBIND11_INCLUDE="${{ github.workspace }}/pybind11/include"
|
|
71
|
+
PYBIND11_ABI=1
|
|
72
|
+
|
|
73
|
+
- name: Upload wheels as artifact
|
|
74
|
+
uses: actions/upload-artifact@v4
|
|
75
|
+
with:
|
|
76
|
+
name: wheels-${{ matrix.os }}
|
|
77
|
+
path: ./wheelhouse/*.whl
|
|
78
|
+
retention-days: 7
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
name: unit_tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_run:
|
|
5
|
+
workflows: ["build"]
|
|
6
|
+
types: [completed]
|
|
7
|
+
branches: [main, master]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test_windows:
|
|
11
|
+
name: Test on Windows
|
|
12
|
+
runs-on: windows-2019
|
|
13
|
+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout code
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Set up Python 3.13
|
|
19
|
+
uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: '3.13'
|
|
22
|
+
|
|
23
|
+
- name: Download wheels from build workflow
|
|
24
|
+
uses: dawidd6/action-download-artifact@v2
|
|
25
|
+
with:
|
|
26
|
+
workflow: build.yml
|
|
27
|
+
workflow_conclusion: success
|
|
28
|
+
name: wheels-windows-2019
|
|
29
|
+
path: ./wheelhouse
|
|
30
|
+
run_id: ${{ github.event.workflow_run.id }}
|
|
31
|
+
|
|
32
|
+
- name: Install dependencies
|
|
33
|
+
run: |
|
|
34
|
+
pip install pytest pillow numpy
|
|
35
|
+
shell: powershell
|
|
36
|
+
|
|
37
|
+
- name: Install wheel
|
|
38
|
+
run: |
|
|
39
|
+
$wheel = Get-ChildItem -Path "./wheelhouse/*cp313*.whl" -ErrorAction SilentlyContinue | Select-Object -First 1
|
|
40
|
+
Write-Host "Found wheel: $($wheel.FullName)"
|
|
41
|
+
pip install --force-reinstall "$($wheel.FullName)"
|
|
42
|
+
shell: powershell
|
|
43
|
+
|
|
44
|
+
- name: Run tests
|
|
45
|
+
run: |
|
|
46
|
+
pytest tests/ -v
|
|
47
|
+
env:
|
|
48
|
+
PYTHONPATH: ${{ github.workspace }}
|
|
49
|
+
shell: powershell
|
|
50
|
+
|
|
51
|
+
test_linux:
|
|
52
|
+
runs-on: ubuntu-22.04
|
|
53
|
+
name: Test on Linux
|
|
54
|
+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
|
55
|
+
timeout-minutes: 15
|
|
56
|
+
steps:
|
|
57
|
+
- name: Checkout code
|
|
58
|
+
uses: actions/checkout@v4
|
|
59
|
+
|
|
60
|
+
- name: Set up Python 3.13
|
|
61
|
+
uses: actions/setup-python@v5
|
|
62
|
+
with:
|
|
63
|
+
python-version: '3.13'
|
|
64
|
+
|
|
65
|
+
- name: Install X11 utilities
|
|
66
|
+
run: |
|
|
67
|
+
sudo apt-get update
|
|
68
|
+
sudo apt-get install -y \
|
|
69
|
+
xvfb \
|
|
70
|
+
x11-utils \
|
|
71
|
+
xterm \
|
|
72
|
+
xdotool \
|
|
73
|
+
wmctrl \
|
|
74
|
+
zenity \
|
|
75
|
+
yad \
|
|
76
|
+
shell: bash
|
|
77
|
+
|
|
78
|
+
- name: Install Python dependencies
|
|
79
|
+
run: |
|
|
80
|
+
pip install pytest pillow numpy
|
|
81
|
+
shell: bash
|
|
82
|
+
|
|
83
|
+
- name: Download wheels
|
|
84
|
+
uses: dawidd6/action-download-artifact@v2
|
|
85
|
+
with:
|
|
86
|
+
workflow: build.yml
|
|
87
|
+
workflow_conclusion: success
|
|
88
|
+
name: wheels-ubuntu-22.04
|
|
89
|
+
path: ./wheelhouse
|
|
90
|
+
run_id: ${{ github.event.workflow_run.id }}
|
|
91
|
+
|
|
92
|
+
- name: Install wheel
|
|
93
|
+
run: |
|
|
94
|
+
wheel=$(find ./wheelhouse -name "*cp313*.whl" -print -quit)
|
|
95
|
+
pip install --force-reinstall "$wheel"
|
|
96
|
+
shell: bash
|
|
97
|
+
|
|
98
|
+
- name: Run tests with xterm windows
|
|
99
|
+
run: |
|
|
100
|
+
# Запускаем Xvfb
|
|
101
|
+
Xvfb :99 -screen 0 1024x768x24 &
|
|
102
|
+
export DISPLAY=:99
|
|
103
|
+
sleep 2
|
|
104
|
+
|
|
105
|
+
# Запускаем тесты
|
|
106
|
+
python -m pytest tests/ -v
|
|
107
|
+
env:
|
|
108
|
+
PYTHONPATH: ${{ github.workspace }}
|
|
109
|
+
DISPLAY: ":99"
|
|
110
|
+
shell: bash
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
2
|
Name: appwindows
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.2
|
|
4
4
|
Summary: The appwindows library solves the problem of working with a graphical shell on different operating systems.
|
|
5
5
|
Author-Email: "Terochkin A.S" <apparser.development@gmail.com>
|
|
6
|
-
License-File: LICENSE.md
|
|
7
6
|
Classifier: Programming Language :: Python :: 3
|
|
8
7
|
Classifier: License :: OSI Approved :: BSD License
|
|
9
8
|
Classifier: Operating System :: Microsoft :: Windows :: Windows 10
|
|
@@ -11,15 +10,20 @@ Classifier: Operating System :: Microsoft :: Windows :: Windows 11
|
|
|
11
10
|
Classifier: Operating System :: POSIX :: Linux
|
|
12
11
|
Classifier: Environment :: X11 Applications
|
|
13
12
|
Classifier: Environment :: Win32 (MS Windows)
|
|
13
|
+
Classifier: Typing :: Stubs Only
|
|
14
14
|
Project-URL: Repository, https://github.com/lexter0705/appwindows
|
|
15
15
|
Project-URL: Issues, https://github.com/lexter0705/appwindows/issues
|
|
16
16
|
Project-URL: Docs, https://apparser.gitbook.io/appwindows
|
|
17
|
-
Requires-Python: >=3.
|
|
17
|
+
Requires-Python: >=3.8
|
|
18
18
|
Requires-Dist: numpy>=2.0
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
|
|
21
21
|
<img src="https://raw.githubusercontent.com/lexter0705/appwindows/refs/heads/master/appwindows.svg" alt="" width="40%" >
|
|
22
22
|
|
|
23
|
+
[](https://pypi.org/project/appwindows/) [](https://github.com/lexter0705/appwindows/blob/master/LICENSE.md)
|
|
24
|
+
<br>
|
|
25
|
+
[](https://github.com/lexter0705/appwindows/actions/workflows/unit_tests.yml)
|
|
26
|
+
|
|
23
27
|
# Appwindows
|
|
24
28
|
The appwindows library solves the problem of working with a graphical shell on different operating systems.
|
|
25
29
|
# Install
|
|
@@ -27,7 +31,8 @@ The appwindows library solves the problem of working with a graphical shell on d
|
|
|
27
31
|
pip install appwindows
|
|
28
32
|
```
|
|
29
33
|
# Docs
|
|
30
|
-
All documentation <a href="https://apparser.gitbook.io/appwindows">here</a>
|
|
34
|
+
All documentation <a href="https://apparser.gitbook.io/appwindows">here</a> <br>
|
|
35
|
+
Link to <a href="https://pypi.org/project/appwindows/">PyPi</a>
|
|
31
36
|
# For Developers
|
|
32
37
|
1) If something doesn't work - open issue.
|
|
33
38
|
2) If you want something fixed - open issue.
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
<img src="https://raw.githubusercontent.com/lexter0705/appwindows/refs/heads/master/appwindows.svg" alt="" width="40%" >
|
|
2
2
|
|
|
3
|
+
[](https://pypi.org/project/appwindows/) [](https://github.com/lexter0705/appwindows/blob/master/LICENSE.md)
|
|
4
|
+
<br>
|
|
5
|
+
[](https://github.com/lexter0705/appwindows/actions/workflows/unit_tests.yml)
|
|
6
|
+
|
|
3
7
|
# Appwindows
|
|
4
8
|
The appwindows library solves the problem of working with a graphical shell on different operating systems.
|
|
5
9
|
# Install
|
|
@@ -7,7 +11,8 @@ The appwindows library solves the problem of working with a graphical shell on d
|
|
|
7
11
|
pip install appwindows
|
|
8
12
|
```
|
|
9
13
|
# Docs
|
|
10
|
-
All documentation <a href="https://apparser.gitbook.io/appwindows">here</a>
|
|
14
|
+
All documentation <a href="https://apparser.gitbook.io/appwindows">here</a> <br>
|
|
15
|
+
Link to <a href="https://pypi.org/project/appwindows/">PyPi</a>
|
|
11
16
|
# For Developers
|
|
12
17
|
1) If something doesn't work - open issue.
|
|
13
18
|
2) If you want something fixed - open issue.
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Python bindings for appwindows library
|
|
3
|
+
|
|
4
|
+
The appwindows library solves the problem of working with a graphical shell on different operating systems.
|
|
5
|
+
"""
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
import numpy
|
|
8
|
+
import numpy.typing
|
|
9
|
+
import typing
|
|
10
|
+
from . import exceptions
|
|
11
|
+
from . import geometry
|
|
12
|
+
__all__: list[str] = ['Finder', 'Window', 'exceptions', 'geometry', 'get_finder']
|
|
13
|
+
class Finder:
|
|
14
|
+
"""
|
|
15
|
+
Interface for finding application windows
|
|
16
|
+
"""
|
|
17
|
+
def get_all_titles(self) -> list[str]:
|
|
18
|
+
"""
|
|
19
|
+
Get all window titles
|
|
20
|
+
|
|
21
|
+
Returns:
|
|
22
|
+
list[str]: Found titles
|
|
23
|
+
"""
|
|
24
|
+
def get_all_windows(self) -> list[Window]:
|
|
25
|
+
"""
|
|
26
|
+
Find all opened windows
|
|
27
|
+
|
|
28
|
+
Returns:
|
|
29
|
+
list[Window]: Found windows
|
|
30
|
+
"""
|
|
31
|
+
def get_os(self) -> str:
|
|
32
|
+
"""
|
|
33
|
+
Get os and graphical shell
|
|
34
|
+
|
|
35
|
+
Returns:
|
|
36
|
+
str: your <<os>>::<<graphical shell>>
|
|
37
|
+
"""
|
|
38
|
+
def get_window_by_process_id(self, process_id: typing.SupportsInt) -> Window:
|
|
39
|
+
"""
|
|
40
|
+
Find window by process id
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
process_id (int): Window title to search for
|
|
44
|
+
|
|
45
|
+
Returns:
|
|
46
|
+
Window | None: Found window or null if window does not exist
|
|
47
|
+
|
|
48
|
+
Raises:
|
|
49
|
+
appwindows.exceptions.WindowDoesNotFoundxception: If window is not found
|
|
50
|
+
"""
|
|
51
|
+
def get_window_by_title(self, title: str) -> Window:
|
|
52
|
+
"""
|
|
53
|
+
Find window by its title substring
|
|
54
|
+
|
|
55
|
+
Args:
|
|
56
|
+
title (str): Window title to search for
|
|
57
|
+
|
|
58
|
+
Returns:
|
|
59
|
+
Window: Found window
|
|
60
|
+
|
|
61
|
+
Raises:
|
|
62
|
+
appwindows.exceptions.WindowDoesNotFoundxception: If window is not found
|
|
63
|
+
"""
|
|
64
|
+
class Window:
|
|
65
|
+
"""
|
|
66
|
+
Interface representing an application window
|
|
67
|
+
"""
|
|
68
|
+
def close(self) -> None:
|
|
69
|
+
"""
|
|
70
|
+
Close the window
|
|
71
|
+
"""
|
|
72
|
+
def get_points(self) -> geometry.QuadPoints:
|
|
73
|
+
"""
|
|
74
|
+
Get all points associated with the window
|
|
75
|
+
|
|
76
|
+
Returns:
|
|
77
|
+
appwindows.geometry.QuadPoints: QuadPoints object with all points
|
|
78
|
+
|
|
79
|
+
Raises:
|
|
80
|
+
appwindows.exceptions.WindowDoesNotValidException: If window is invalid
|
|
81
|
+
"""
|
|
82
|
+
def get_process_id(self) -> int:
|
|
83
|
+
"""
|
|
84
|
+
Get the window process id
|
|
85
|
+
|
|
86
|
+
Returns:
|
|
87
|
+
int: process id
|
|
88
|
+
|
|
89
|
+
Raises:
|
|
90
|
+
appwindows.exceptions.WindowDoesNotValidException: If window is invalid
|
|
91
|
+
"""
|
|
92
|
+
def get_screenshot(self) -> numpy.typing.NDArray[numpy.uint8]:
|
|
93
|
+
"""
|
|
94
|
+
Get current window image
|
|
95
|
+
|
|
96
|
+
Returns:
|
|
97
|
+
ndarray: image in ndarray
|
|
98
|
+
|
|
99
|
+
Raises:
|
|
100
|
+
appwindows.exceptions.WindowDoesNotValidException: If window is invalid
|
|
101
|
+
"""
|
|
102
|
+
def get_size(self) -> geometry.Size:
|
|
103
|
+
"""
|
|
104
|
+
Get current window size
|
|
105
|
+
|
|
106
|
+
Returns:
|
|
107
|
+
Size: Current window dimensions
|
|
108
|
+
|
|
109
|
+
Raises:
|
|
110
|
+
appwindows.exceptions.WindowDoesNotValidException: If window is invalid
|
|
111
|
+
"""
|
|
112
|
+
def get_title(self) -> str:
|
|
113
|
+
"""
|
|
114
|
+
Get the window title
|
|
115
|
+
|
|
116
|
+
Returns:
|
|
117
|
+
str: Window title
|
|
118
|
+
|
|
119
|
+
Raises:
|
|
120
|
+
appwindows.exceptions.WindowDoesNotValidException: If window is invalid
|
|
121
|
+
"""
|
|
122
|
+
def is_valid(self) -> bool:
|
|
123
|
+
"""
|
|
124
|
+
Is window valid
|
|
125
|
+
|
|
126
|
+
Returns:
|
|
127
|
+
bool: is valid
|
|
128
|
+
|
|
129
|
+
Raises:
|
|
130
|
+
appwindows.exceptions.WindowDoesNotValidException: If window is invalid
|
|
131
|
+
"""
|
|
132
|
+
def move(self, point: geometry.Point) -> None:
|
|
133
|
+
"""
|
|
134
|
+
Move window to specified position
|
|
135
|
+
|
|
136
|
+
Args:
|
|
137
|
+
point (appwindows.geometry.Point): New window position
|
|
138
|
+
|
|
139
|
+
Raises:
|
|
140
|
+
appwindows.exceptions.WindowDoesNotValidException: If window is invalid
|
|
141
|
+
"""
|
|
142
|
+
def resize(self, size: geometry.Size) -> None:
|
|
143
|
+
"""
|
|
144
|
+
Resize the window
|
|
145
|
+
|
|
146
|
+
Args:
|
|
147
|
+
size (appwindows.geometry.Size): New window dimensions
|
|
148
|
+
|
|
149
|
+
Raises:
|
|
150
|
+
appwindows.exceptions.InvalidSizeError: If size is invalid appwindows.exceptions.WindowDoesNotValidException: If window is invalid
|
|
151
|
+
"""
|
|
152
|
+
def set_fullscreen(self, is_maximize: bool) -> None:
|
|
153
|
+
"""
|
|
154
|
+
Maximize or restore the window
|
|
155
|
+
|
|
156
|
+
Args:
|
|
157
|
+
is_fullscreen (bool): True to window on fullscreen
|
|
158
|
+
|
|
159
|
+
Raises:
|
|
160
|
+
appwindows.exceptions.WindowDoesNotValidException: If window is invalid
|
|
161
|
+
"""
|
|
162
|
+
def set_minimize(self, is_minimize: bool) -> None:
|
|
163
|
+
"""
|
|
164
|
+
Set window active state
|
|
165
|
+
|
|
166
|
+
Args:
|
|
167
|
+
is_minimize (bool): True to activate window
|
|
168
|
+
|
|
169
|
+
Raises:
|
|
170
|
+
appwindows.exceptions.WindowDoesNotValidException: If window is invalid
|
|
171
|
+
"""
|
|
172
|
+
def to_background(self) -> None:
|
|
173
|
+
"""
|
|
174
|
+
Moved window to background
|
|
175
|
+
|
|
176
|
+
Raises:
|
|
177
|
+
appwindows.exceptions.WindowDoesNotValidException: If window is invalid
|
|
178
|
+
"""
|
|
179
|
+
def to_foreground(self) -> None:
|
|
180
|
+
"""
|
|
181
|
+
Moved window to foreground
|
|
182
|
+
|
|
183
|
+
Raises:
|
|
184
|
+
appwindows.exceptions.WindowDoesNotValidException: If window is invalid
|
|
185
|
+
"""
|
|
186
|
+
def get_finder() -> Finder:
|
|
187
|
+
"""
|
|
188
|
+
Get the window finder instance
|
|
189
|
+
|
|
190
|
+
Returns:
|
|
191
|
+
Finder: Instance of window finder interface
|
|
192
|
+
"""
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"""
|
|
2
|
+
exception classes
|
|
3
|
+
"""
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
__all__: list[str] = ['InvalidSizeException', 'WindowDoesNotFoundException', 'WindowDoesNotValidException']
|
|
6
|
+
class InvalidSizeException(Exception):
|
|
7
|
+
pass
|
|
8
|
+
class WindowDoesNotFoundException(Exception):
|
|
9
|
+
pass
|
|
10
|
+
class WindowDoesNotValidException(Exception):
|
|
11
|
+
pass
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"""
|
|
2
|
+
classes for work with geometry
|
|
3
|
+
"""
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
import typing
|
|
6
|
+
|
|
7
|
+
__all__: list[str] = ['Point', 'QuadPoints', 'Size']
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Point:
|
|
11
|
+
"""
|
|
12
|
+
Represents a 2D point with x and y coordinates
|
|
13
|
+
"""
|
|
14
|
+
__hash__: typing.ClassVar[None] = None
|
|
15
|
+
|
|
16
|
+
def __add__(self, arg0: Point) -> Point:
|
|
17
|
+
"""
|
|
18
|
+
Add two points
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
def __eq__(self, arg0: Point) -> bool:
|
|
22
|
+
"""
|
|
23
|
+
Points is equal
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
def __init__(self, x: typing.SupportsInt, y: typing.SupportsInt) -> None:
|
|
27
|
+
"""
|
|
28
|
+
Create a point with specified coordinates
|
|
29
|
+
|
|
30
|
+
Args:
|
|
31
|
+
x (int): X coordinate
|
|
32
|
+
y (int): Y coordinate
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
def __mul__(self, arg0: Point) -> Point:
|
|
36
|
+
"""
|
|
37
|
+
Multiply two points
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
def __sub__(self, arg0: Point) -> Point:
|
|
41
|
+
"""
|
|
42
|
+
Subtract two points
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
def __truediv__(self, arg0: Point) -> Point:
|
|
46
|
+
"""
|
|
47
|
+
Divide two points
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
def __str__(self) -> str:
|
|
51
|
+
"""
|
|
52
|
+
To string
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
@property
|
|
56
|
+
def x(self) -> int:
|
|
57
|
+
"""
|
|
58
|
+
X coordinate
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
@property
|
|
62
|
+
def y(self) -> int:
|
|
63
|
+
"""
|
|
64
|
+
Y coordinate
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class QuadPoints:
|
|
69
|
+
"""
|
|
70
|
+
Vertices of a quadrilateral
|
|
71
|
+
"""
|
|
72
|
+
|
|
73
|
+
def __init__(self, left_top: Point, right_top: Point, right_bottom: Point, left_bottom: Point) -> None:
|
|
74
|
+
"""
|
|
75
|
+
QuadPoints constructor
|
|
76
|
+
|
|
77
|
+
Args:
|
|
78
|
+
left_top (appwindows.geometry.Point): left top point
|
|
79
|
+
right_top (appwindows.geometry.Point): right top point
|
|
80
|
+
right_bottom (appwindows.geometry.Point): right bottom point
|
|
81
|
+
left_bottom (appwindows.geometry.Point): left bottom point
|
|
82
|
+
"""
|
|
83
|
+
|
|
84
|
+
def __str__(self) -> str:
|
|
85
|
+
"""
|
|
86
|
+
To string
|
|
87
|
+
"""
|
|
88
|
+
|
|
89
|
+
@property
|
|
90
|
+
def left_bottom(self) -> Point:
|
|
91
|
+
"""
|
|
92
|
+
Left bottom point
|
|
93
|
+
"""
|
|
94
|
+
|
|
95
|
+
@property
|
|
96
|
+
def left_top(self) -> Point:
|
|
97
|
+
"""
|
|
98
|
+
Left top point
|
|
99
|
+
"""
|
|
100
|
+
|
|
101
|
+
@property
|
|
102
|
+
def right_bottom(self) -> Point:
|
|
103
|
+
"""
|
|
104
|
+
Right bottom point
|
|
105
|
+
"""
|
|
106
|
+
|
|
107
|
+
@property
|
|
108
|
+
def right_top(self) -> Point:
|
|
109
|
+
"""
|
|
110
|
+
Right top point
|
|
111
|
+
"""
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
class Size:
|
|
115
|
+
"""
|
|
116
|
+
Represents dimensions with width and height
|
|
117
|
+
"""
|
|
118
|
+
|
|
119
|
+
def __init__(self, width: typing.SupportsInt, height: typing.SupportsInt) -> None:
|
|
120
|
+
"""
|
|
121
|
+
Create size with specified dimensions
|
|
122
|
+
|
|
123
|
+
Args:
|
|
124
|
+
width (int): Width dimension
|
|
125
|
+
height (int): Height dimension
|
|
126
|
+
|
|
127
|
+
Raises:
|
|
128
|
+
InvalidSizeError: If width or height are invalid
|
|
129
|
+
"""
|
|
130
|
+
|
|
131
|
+
def __str__(self) -> str:
|
|
132
|
+
"""
|
|
133
|
+
To string
|
|
134
|
+
"""
|
|
135
|
+
|
|
136
|
+
def __eq__(self, arg0: Point) -> bool:
|
|
137
|
+
"""
|
|
138
|
+
Points is equal
|
|
139
|
+
"""
|
|
140
|
+
|
|
141
|
+
@property
|
|
142
|
+
def height(self) -> int:
|
|
143
|
+
"""
|
|
144
|
+
Height dimension
|
|
145
|
+
"""
|
|
146
|
+
|
|
147
|
+
@property
|
|
148
|
+
def width(self) -> int:
|
|
149
|
+
"""
|
|
150
|
+
Width dimension
|
|
151
|
+
"""
|
|
File without changes
|