Skip to content

Commit 36c1052

Browse files
committed
readthedocs integration. First attempt
1 parent f5211b6 commit 36c1052

File tree

5 files changed

+188
-179
lines changed

5 files changed

+188
-179
lines changed

docs/source/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/source/conf.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,16 @@
3333
html_theme = 'alabaster'
3434
html_static_path = ['_static']
3535
myst_heading_anchors = 7
36+
37+
# -- Copy the modules documentation ------------------------------------------
38+
# https://stackoverflow.com/questions/66495200/is-it-possible-to-include-external-rst-files-in-my-documentation
39+
from urllib.request import urlretrieve
40+
41+
urlretrieve (
42+
"https://raw.githubusercontent.com/kalmat/pywinctl/master/README.md",
43+
"README.md"
44+
)
45+
urlretrieve (
46+
"https://raw.githubusercontent.com/kalmat/pywinctl/master/docstrings.md",
47+
"docstrings.md"
48+
)

docs/source/docstrings.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/source/index.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ Welcome to PyWinCtl's documentation!
99
.. toctree::
1010
:maxdepth: 3
1111

12-
readme <README.md>
12+
Readme <README.md>
1313

1414
:hidden:
1515

1616
docstrings <docstrings.md>
17-
18-

docstrings.md

Lines changed: 174 additions & 174 deletions
Original file line numberDiff line numberDiff line change
@@ -369,180 +369,6 @@ Defaults to ''False''
369369

370370
returns ''True'' if permissions are already granted or platform is not macOS
371371

372-
## WatchDog Methods
373-
374-
```python
375-
class _WatchDog()
376-
```
377-
378-
Set a watchdog, in a separate Thread, to be notified when some window states change
379-
380-
Notice that changes will be notified according to the window status at the very moment of instantiating this class
381-
382-
IMPORTANT: This can be extremely slow in macOS Apple Script version
383-
384-
Available methods:
385-
:meth start: Initialize and start watchdog and selected callbacks
386-
:meth updateCallbacks: Change the states this watchdog is hooked to
387-
:meth updateInterval: Change the interval to check changes
388-
:meth kill: Stop the entire watchdog and all its hooks
389-
:meth isAlive: Check if watchdog is running
390-
391-
<a id="..pywinctl._main._WatchDog.start"></a>
392-
393-
#### start
394-
395-
```python
396-
def start(isAliveCB: Callable[[bool], None] | None = None,
397-
isActiveCB: Callable[[bool], None] | None = None,
398-
isVisibleCB: Callable[[bool], None] | None = None,
399-
isMinimizedCB: Callable[[bool], None] | None = None,
400-
isMaximizedCB: Callable[[bool], None] | None = None,
401-
resizedCB: Callable[[Tuple[int, int]], None] | None = None,
402-
movedCB: Callable[[Tuple[int, int]], None] | None = None,
403-
changedTitleCB: Callable[[str], None] | None = None,
404-
changedDisplayCB: Callable[[List[str]], None] | None = None,
405-
interval: float = 0.3)
406-
```
407-
408-
Initialize and start watchdog and hooks (callbacks to be invoked when desired window states change)
409-
410-
Notice that changes will be notified according to the window status at the very moment of execute start()
411-
412-
The watchdog is asynchronous, so notifications will not be immediate (adjust interval value to your needs)
413-
414-
The callbacks definition MUST MATCH their return value (boolean, string or (int, int))
415-
416-
IMPORTANT: This can be extremely slow in macOS Apple Script version
417-
418-
**Arguments**:
419-
420-
- `isAliveCB`: callback to call if window is not alive. Set to None to not watch this
421-
Returns the new alive status value (False)
422-
- `isActiveCB`: callback to invoke if window changes its active status. Set to None to not watch this
423-
Returns the new active status value (True/False)
424-
- `isVisibleCB`: callback to invoke if window changes its visible status. Set to None to not watch this
425-
Returns the new visible status value (True/False)
426-
- `isMinimizedCB`: callback to invoke if window changes its minimized status. Set to None to not watch this
427-
Returns the new minimized status value (True/False)
428-
- `isMaximizedCB`: callback to invoke if window changes its maximized status. Set to None to not watch this
429-
Returns the new maximized status value (True/False)
430-
- `resizedCB`: callback to invoke if window changes its size. Set to None to not watch this
431-
Returns the new size (width, height)
432-
- `movedCB`: callback to invoke if window changes its position. Set to None to not watch this
433-
Returns the new position (x, y)
434-
- `changedTitleCB`: callback to invoke if window changes its title. Set to None to not watch this
435-
Returns the new title (as string)
436-
- `changedDisplayCB`: callback to invoke if window changes display. Set to None to not watch this
437-
Returns the new display name (as string)
438-
- `interval`: set the interval to watch window changes. Default is 0.3 seconds
439-
440-
<a id="..pywinctl._main._WatchDog.updateCallbacks"></a>
441-
442-
#### updateCallbacks
443-
444-
```python
445-
def updateCallbacks(isAliveCB: Callable[[bool], None] | None = None,
446-
isActiveCB: Callable[[bool], None] | None = None,
447-
isVisibleCB: Callable[[bool], None] | None = None,
448-
isMinimizedCB: Callable[[bool], None] | None = None,
449-
isMaximizedCB: Callable[[bool], None] | None = None,
450-
resizedCB: Callable[[Tuple[int, int]], None] | None = None,
451-
movedCB: Callable[[Tuple[int, int]], None] | None = None,
452-
changedTitleCB: Callable[[str], None] | None = None,
453-
changedDisplayCB: Callable[[List[str]], None]
454-
| None = None)
455-
```
456-
457-
Change the states this watchdog is hooked to
458-
459-
The callbacks definition MUST MATCH their return value (boolean, string or (int, int))
460-
461-
IMPORTANT: When updating callbacks, remember to set ALL desired callbacks or they will be deactivated
462-
463-
IMPORTANT: Remember to set ALL desired callbacks every time, or they will be defaulted to None (and unhooked)
464-
465-
**Arguments**:
466-
467-
- `isAliveCB`: callback to call if window is not alive. Set to None to not watch this
468-
Returns the new alive status value (False)
469-
- `isActiveCB`: callback to invoke if window changes its active status. Set to None to not watch this
470-
Returns the new active status value (True/False)
471-
- `isVisibleCB`: callback to invoke if window changes its visible status. Set to None to not watch this
472-
Returns the new visible status value (True/False)
473-
- `isMinimizedCB`: callback to invoke if window changes its minimized status. Set to None to not watch this
474-
Returns the new minimized status value (True/False)
475-
- `isMaximizedCB`: callback to invoke if window changes its maximized status. Set to None to not watch this
476-
Returns the new maximized status value (True/False)
477-
- `resizedCB`: callback to invoke if window changes its size. Set to None to not watch this
478-
Returns the new size (width, height)
479-
- `movedCB`: callback to invoke if window changes its position. Set to None to not watch this
480-
Returns the new position (x, y)
481-
- `changedTitleCB`: callback to invoke if window changes its title. Set to None to not watch this
482-
Returns the new title (as string)
483-
- `changedDisplayCB`: callback to invoke if window changes display. Set to None to not watch this
484-
Returns the new display name (as string)
485-
486-
<a id="..pywinctl._main._WatchDog.updateInterval"></a>
487-
488-
#### updateInterval
489-
490-
```python
491-
def updateInterval(interval: float = 0.3)
492-
```
493-
494-
Change the interval to check changes
495-
496-
**Arguments**:
497-
498-
- `interval`: set the interval to watch window changes. Default is 0.3 seconds
499-
500-
<a id="..pywinctl._main._WatchDog.setTryToFind"></a>
501-
502-
#### setTryToFind
503-
504-
```python
505-
def setTryToFind(tryToFind: bool)
506-
```
507-
508-
In macOS Apple Script version, if set to ''True'' and in case title changes, watchdog will try to find
509-
510-
a similar title within same application to continue monitoring it. It will stop if set to ''False'' or
511-
similar title not found.
512-
513-
IMPORTANT:
514-
515-
- It will have no effect in other platforms (Windows and Linux) and classes (MacOSNSWindow)
516-
- This behavior is deactivated by default, so you need to explicitly activate it
517-
518-
**Arguments**:
519-
520-
- `tryToFind`: set to ''True'' to try to find a similar title. Set to ''False'' to deactivate this behavior
521-
522-
<a id="..pywinctl._main._WatchDog.stop"></a>
523-
524-
#### stop
525-
526-
```python
527-
def stop()
528-
```
529-
530-
Stop the entire WatchDog and all its hooks
531-
532-
<a id="..pywinctl._main._WatchDog.isAlive"></a>
533-
534-
#### -[watchdog-]()isAlive
535-
536-
```python
537-
def isAlive()
538-
```
539-
540-
Check if watchdog is running
541-
542-
**Returns**:
543-
544-
''True'' if watchdog is alive
545-
546372
## Window Methods
547373

548374
```python
@@ -1175,6 +1001,180 @@ possible new title, empty if no similar title found or same title if it didn't c
11751001

11761002
<a id="..pywinctl._pywinctl_macos.MacOSWindow._Menu"></a>
11771003

1004+
## WatchDog Methods
1005+
1006+
```python
1007+
class _WatchDog()
1008+
```
1009+
1010+
Set a watchdog, in a separate Thread, to be notified when some window states change
1011+
1012+
Notice that changes will be notified according to the window status at the very moment of instantiating this class
1013+
1014+
IMPORTANT: This can be extremely slow in macOS Apple Script version
1015+
1016+
Available methods:
1017+
:meth start: Initialize and start watchdog and selected callbacks
1018+
:meth updateCallbacks: Change the states this watchdog is hooked to
1019+
:meth updateInterval: Change the interval to check changes
1020+
:meth kill: Stop the entire watchdog and all its hooks
1021+
:meth isAlive: Check if watchdog is running
1022+
1023+
<a id="..pywinctl._main._WatchDog.start"></a>
1024+
1025+
#### start
1026+
1027+
```python
1028+
def start(isAliveCB: Callable[[bool], None] | None = None,
1029+
isActiveCB: Callable[[bool], None] | None = None,
1030+
isVisibleCB: Callable[[bool], None] | None = None,
1031+
isMinimizedCB: Callable[[bool], None] | None = None,
1032+
isMaximizedCB: Callable[[bool], None] | None = None,
1033+
resizedCB: Callable[[Tuple[int, int]], None] | None = None,
1034+
movedCB: Callable[[Tuple[int, int]], None] | None = None,
1035+
changedTitleCB: Callable[[str], None] | None = None,
1036+
changedDisplayCB: Callable[[List[str]], None] | None = None,
1037+
interval: float = 0.3)
1038+
```
1039+
1040+
Initialize and start watchdog and hooks (callbacks to be invoked when desired window states change)
1041+
1042+
Notice that changes will be notified according to the window status at the very moment of execute start()
1043+
1044+
The watchdog is asynchronous, so notifications will not be immediate (adjust interval value to your needs)
1045+
1046+
The callbacks definition MUST MATCH their return value (boolean, string or (int, int))
1047+
1048+
IMPORTANT: This can be extremely slow in macOS Apple Script version
1049+
1050+
**Arguments**:
1051+
1052+
- `isAliveCB`: callback to call if window is not alive. Set to None to not watch this
1053+
Returns the new alive status value (False)
1054+
- `isActiveCB`: callback to invoke if window changes its active status. Set to None to not watch this
1055+
Returns the new active status value (True/False)
1056+
- `isVisibleCB`: callback to invoke if window changes its visible status. Set to None to not watch this
1057+
Returns the new visible status value (True/False)
1058+
- `isMinimizedCB`: callback to invoke if window changes its minimized status. Set to None to not watch this
1059+
Returns the new minimized status value (True/False)
1060+
- `isMaximizedCB`: callback to invoke if window changes its maximized status. Set to None to not watch this
1061+
Returns the new maximized status value (True/False)
1062+
- `resizedCB`: callback to invoke if window changes its size. Set to None to not watch this
1063+
Returns the new size (width, height)
1064+
- `movedCB`: callback to invoke if window changes its position. Set to None to not watch this
1065+
Returns the new position (x, y)
1066+
- `changedTitleCB`: callback to invoke if window changes its title. Set to None to not watch this
1067+
Returns the new title (as string)
1068+
- `changedDisplayCB`: callback to invoke if window changes display. Set to None to not watch this
1069+
Returns the new display name (as string)
1070+
- `interval`: set the interval to watch window changes. Default is 0.3 seconds
1071+
1072+
<a id="..pywinctl._main._WatchDog.updateCallbacks"></a>
1073+
1074+
#### updateCallbacks
1075+
1076+
```python
1077+
def updateCallbacks(isAliveCB: Callable[[bool], None] | None = None,
1078+
isActiveCB: Callable[[bool], None] | None = None,
1079+
isVisibleCB: Callable[[bool], None] | None = None,
1080+
isMinimizedCB: Callable[[bool], None] | None = None,
1081+
isMaximizedCB: Callable[[bool], None] | None = None,
1082+
resizedCB: Callable[[Tuple[int, int]], None] | None = None,
1083+
movedCB: Callable[[Tuple[int, int]], None] | None = None,
1084+
changedTitleCB: Callable[[str], None] | None = None,
1085+
changedDisplayCB: Callable[[List[str]], None]
1086+
| None = None)
1087+
```
1088+
1089+
Change the states this watchdog is hooked to
1090+
1091+
The callbacks definition MUST MATCH their return value (boolean, string or (int, int))
1092+
1093+
IMPORTANT: When updating callbacks, remember to set ALL desired callbacks or they will be deactivated
1094+
1095+
IMPORTANT: Remember to set ALL desired callbacks every time, or they will be defaulted to None (and unhooked)
1096+
1097+
**Arguments**:
1098+
1099+
- `isAliveCB`: callback to call if window is not alive. Set to None to not watch this
1100+
Returns the new alive status value (False)
1101+
- `isActiveCB`: callback to invoke if window changes its active status. Set to None to not watch this
1102+
Returns the new active status value (True/False)
1103+
- `isVisibleCB`: callback to invoke if window changes its visible status. Set to None to not watch this
1104+
Returns the new visible status value (True/False)
1105+
- `isMinimizedCB`: callback to invoke if window changes its minimized status. Set to None to not watch this
1106+
Returns the new minimized status value (True/False)
1107+
- `isMaximizedCB`: callback to invoke if window changes its maximized status. Set to None to not watch this
1108+
Returns the new maximized status value (True/False)
1109+
- `resizedCB`: callback to invoke if window changes its size. Set to None to not watch this
1110+
Returns the new size (width, height)
1111+
- `movedCB`: callback to invoke if window changes its position. Set to None to not watch this
1112+
Returns the new position (x, y)
1113+
- `changedTitleCB`: callback to invoke if window changes its title. Set to None to not watch this
1114+
Returns the new title (as string)
1115+
- `changedDisplayCB`: callback to invoke if window changes display. Set to None to not watch this
1116+
Returns the new display name (as string)
1117+
1118+
<a id="..pywinctl._main._WatchDog.updateInterval"></a>
1119+
1120+
#### updateInterval
1121+
1122+
```python
1123+
def updateInterval(interval: float = 0.3)
1124+
```
1125+
1126+
Change the interval to check changes
1127+
1128+
**Arguments**:
1129+
1130+
- `interval`: set the interval to watch window changes. Default is 0.3 seconds
1131+
1132+
<a id="..pywinctl._main._WatchDog.setTryToFind"></a>
1133+
1134+
#### setTryToFind
1135+
1136+
```python
1137+
def setTryToFind(tryToFind: bool)
1138+
```
1139+
1140+
In macOS Apple Script version, if set to ''True'' and in case title changes, watchdog will try to find
1141+
1142+
a similar title within same application to continue monitoring it. It will stop if set to ''False'' or
1143+
similar title not found.
1144+
1145+
IMPORTANT:
1146+
1147+
- It will have no effect in other platforms (Windows and Linux) and classes (MacOSNSWindow)
1148+
- This behavior is deactivated by default, so you need to explicitly activate it
1149+
1150+
**Arguments**:
1151+
1152+
- `tryToFind`: set to ''True'' to try to find a similar title. Set to ''False'' to deactivate this behavior
1153+
1154+
<a id="..pywinctl._main._WatchDog.stop"></a>
1155+
1156+
#### stop
1157+
1158+
```python
1159+
def stop()
1160+
```
1161+
1162+
Stop the entire WatchDog and all its hooks
1163+
1164+
<a id="..pywinctl._main._WatchDog.isAlive"></a>
1165+
1166+
#### -[watchdog-]()isAlive
1167+
1168+
```python
1169+
def isAlive()
1170+
```
1171+
1172+
Check if watchdog is running
1173+
1174+
**Returns**:
1175+
1176+
''True'' if watchdog is alive
1177+
11781178
## Menu Methods
11791179

11801180
```python

0 commit comments

Comments
 (0)