Commit 8a7bbc2
feat: move to a strategy implementation design. (#494)
* Move to a strategy implementation design.
See also BoboTiG/python-mss issue #486.
The user will always work with a single class: mss.MSS. Differences
in implementation, such as platform or capture strategy, are hidden in
an internal implementation object held by the mss.MSS object.
This allows us to change the implementation, with arbitrary class
hierarchies, without worrying about preserving compatibility with
internal class names.
This deprecates the existing `mss` factory function, although it can
easily be kept for as long as needed to give users time to adapt.
It also deprecates the existing `mss.{platform}.MSS` types. These are
exposed to the user, so somebody calling `mss.{platform}.MSS()` in
10.x can still reasonably expect to get a `mss.{platform}.MSS` object
back. However, in 11.0, we can remove the type entirely, and either
remove those symbols, or make them deprecated aliases for `mss.MSS`.
Where possible, deprecated functionality emits a `DeprecationWarning`.
However, note that these are ignored by default, unless triggered by
code in `__main__`.
Many of the API docs are removed, since this change removes much of
the API surface. However, they are still in available for
backwards-compatibility.
This change adds tests for everything that was in the 10.1 docs,
examples, etc, at least at a basic level: for instance, it tests that
`mss.linux.MSS` still works as both a constructor and a type (for
`isinstance`), and that `mss.linux.ZPIXMAP` still exists (it was
listed in the 10.1 docs).
The existing code, tests, and docs are changed to use `mss.MSS`.
* Add CHANGELOG / CHANGES entries
* Allow and test all kwargs on all platforms.
The mss_impl fixture would add an implicit display= argument,
regardless of platform. The code at that time would ignore it, but we
should be (and in the previous commit, were) more strict. Change
mss_impl to only use display= if appropriate, so we can be more strict
in the future.
In 10.1, these were allowed at all times, and ignored if the platform
didn't use them. Emulate this behavior in mss.MSS (and mss.mss), with
DeprecationWarnings, and test.
* Don't explicitly pass display in one of the tests.
I'm pretty sure it's unnecessary there. Not sure why it was being done.
* Comment fixes
* List the keyword args for mss.MSS explicitly, instead of using **kwargs.
This lets IDEs and code checkers know what is acceptable. This lets
them autocomplete, and identify incorrect options in user code.
* Move the shm_fallback_reason to a more general performance_status property.
* Warn and ignore for --with-cursor in command line on non-Linux.
* Put the --with-cursor warning on stderr, not stdout
* Allow system-specific kwargs on multiple systems
Co-authored-by: Mickaël Schoentgen <contact@tiger-222.fr>
* Restore a TODO that was accidentally removed earlier
* Formatting fix
---------
Co-authored-by: Mickaël Schoentgen <contact@tiger-222.fr>1 parent 4cf1a06 commit 8a7bbc2
File tree
59 files changed
+983
-554
lines changed- demos
- docs/source
- examples
- src
- mss
- linux
- tests
- third_party
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
59 files changed
+983
-554
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
243 | | - | |
| 243 | + | |
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
342 | 342 | | |
343 | 343 | | |
344 | 344 | | |
345 | | - | |
| 345 | + | |
346 | 346 | | |
347 | 347 | | |
348 | 348 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
| 167 | + | |
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| |||
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
437 | | - | |
| 437 | + | |
438 | 438 | | |
439 | 439 | | |
440 | 440 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | 10 | | |
31 | 11 | | |
32 | 12 | | |
33 | 13 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | | - | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
0 commit comments