diff --git a/docs/api.rst b/docs/api.rst new file mode 100644 index 0000000..2e43d62 --- /dev/null +++ b/docs/api.rst @@ -0,0 +1,7 @@ +API of win32_window_monitor +=========================== + +.. automodule:: win32_window_monitor + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/conf.py b/docs/conf.py index 955d200..91e509f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,4 +1,7 @@ import sphinx_rtd_theme +import os +import sys +sys.path.insert(0, os.path.abspath('..')) # Configuration file for the Sphinx documentation builder. # @@ -21,8 +24,15 @@ "myst_parser", ] +# TODO check the napoleon extension which allow more compact/readable docstring: +# https://sphinxcontrib-napoleon.readthedocs.io/en/latest/ + + templates_path = ['_templates'] -exclude_patterns = [] +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + +# ensure that __all__ is not ignored +autosummary_imported_members = True # -- Options for HTML output ------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output diff --git a/docs/index.rst b/docs/index.rst index b22e46b..f350975 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -74,12 +74,7 @@ example is not generated when restoring a minimized window. :maxdepth: 2 :caption: Contents: -.. automodule:: win32_window_monitor - :members: - -.. autosummary:: - :toctree: generated - + api .. include ../README.md diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..954237b --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/win32_window_monitor/__init__.py b/win32_window_monitor/__init__.py index 46ad222..412e1d7 100644 --- a/win32_window_monitor/__init__.py +++ b/win32_window_monitor/__init__.py @@ -13,4 +13,22 @@ run_message_loop, post_quit_message, post_quit_message_on_break_signal, -) \ No newline at end of file +) + +__all__ = [ + # ids + 'HookEvent', + 'ObjectId', + # win32api + 'WinEventProcType', + 'HWINEVENTHOOK', + 'get_process_filename', + 'get_hwnd_process_id', + 'get_window_title', + 'set_win_event_hook', + 'unhook_win_event', + 'init_com', + 'run_message_loop', + 'post_quit_message', + 'post_quit_message_on_break_signal', +] diff --git a/win32_window_monitor/win32api.py b/win32_window_monitor/win32api.py index 1dee286..825a7d1 100644 --- a/win32_window_monitor/win32api.py +++ b/win32_window_monitor/win32api.py @@ -161,7 +161,6 @@ def init_com(): def run_message_loop(): """ Runs WIN32 message loop (user32.GetMessageW) until WM_QUIT is received. - :return: """ msg = ctypes.wintypes.MSG() while user32.GetMessageW(ctypes.byref(msg), 0, 0, 0) != 0: