Skip to content
This repository was archived by the owner on Oct 7, 2024. It is now read-only.

Commit 4e46091

Browse files
committed
docs: add documentation
1 parent 46472ea commit 4e46091

10 files changed

Lines changed: 513 additions & 0 deletions

File tree

.readthedocs.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Set the version of Python and other tools you might need
9+
build:
10+
os: ubuntu-22.04
11+
tools:
12+
python: "3.11"
13+
# You can also specify other tool versions:
14+
# nodejs: "19"
15+
# rust: "1.64"
16+
# golang: "1.19"
17+
18+
# Build documentation in the docs/ directory with Sphinx
19+
sphinx:
20+
configuration: docs/conf.py
21+
22+
# If using Sphinx, optionally build your docs in additional formats such as PDF
23+
# formats:
24+
# - pdf
25+
26+
# Optionally declare the Python requirements required to build your docs
27+
python:
28+
install:
29+
- requirements: docs/requirements.txt

docs/api/index.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
=============
2+
API reference
3+
=============
4+
5+
.. toctree::
6+
:maxdepth: 2
7+
:caption: Contents:
8+
9+
winsdk
10+
windows

docs/api/windows.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
===============================
2+
:mod:`winsdk.windows` namespace
3+
===============================
4+
5+
The :mod:`winsdk.windows` package contains the automatically generate bindings
6+
for the Windows SDK.
7+
8+
Since most of the code is generated, there currently aren't Python API docs.
9+
You can use https://learn.microsoft.com/en-us/uwp/api/ instead, keeping in mind
10+
the Python naming conventions and other rules mentioned in :doc:`../types` section.
11+
12+
.. tip:: The ``winsdk`` package includes type hints so you can use those if
13+
you are unsure of a return type or a parameter type.
14+
15+
.. todo:: We could consider using https://github.com/MicrosoftDocs/winrt-api to autogenerate Python docs.
16+
17+
---------------
18+
Interop modules
19+
---------------
20+
21+
There are also special ``interop`` modules that provide extra functionality
22+
to bridge between WinRT and other interfaces.
23+
24+
.. toctree::
25+
:maxdepth: 2
26+
27+
windows/graphics.capture.interop
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
=====================================================
2+
:mod:`winsdk.windows.graphics.capture.interop` module
3+
=====================================================
4+
5+
APIs for desktop interop with the `Windows.Graphics.Capture
6+
<https://learn.microsoft.com/uwp/api/windows.graphics.capture>`_ namespace.
7+
8+
9+
.. function:: create_for_monitor(monitor)
10+
11+
Targets a monitor(s) for the creation of a graphics capture item.
12+
13+
:param int monitor: The monitor handle (``HMONITOR``) that represents the monitor to capture.
14+
15+
:return: A graphics capture item.
16+
:rtype: :obj:`winsdk.windows.graphics.capture.GraphicsCaptureItem`
17+
18+
.. seealso:: https://learn.microsoft.com/windows/win32/api/windows.graphics.capture.interop/nf-windows-graphics-capture-interop-igraphicscaptureiteminterop-createformonitor
19+
20+
21+
.. function:: create_for_window(window)
22+
23+
Targets a single window for the creation of a graphics capture item.
24+
25+
:param int window: The window handle (``HWND``) that represents the window to capture.
26+
27+
:return: A graphics capture item.
28+
:rtype: :obj:`winsdk.windows.graphics.capture.GraphicsCaptureItem`
29+
30+
.. seealso:: https://learn.microsoft.com/windows/win32/api/windows.graphics.capture.interop/nf-windows-graphics-capture-interop-igraphicscaptureiteminterop-createforwindow

docs/api/winsdk.rst

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
===========================
2+
:mod:`winsdk.system` module
3+
===========================
4+
5+
.. class:: Object
6+
7+
A wrapper around the WinRT ``System.Object`` type.
8+
9+
This is the base type of all WinRT runtime objects and cannot be
10+
instantiated directly.
11+
12+
This type currently has no members.
13+
14+
.. class:: Array(type, [initializer, ] /)
15+
16+
A wrapper around the WinRT ``System.Array`` type.
17+
18+
This type implements the Python sequence protocol.
19+
20+
:param type:
21+
The type to use for elements of the array. This can be a WinRT
22+
type or a format string for fundamental types.
23+
:type type: str or type
24+
:param initializer:
25+
An optional iterator of values to use to initialize the array.
26+
If an integer value is given, an empty array of that size will
27+
be initialized. For value types, any object supporting the
28+
CPython buffer protocol with the correct layout can be used
29+
as an initializer.
30+
:type initializer: int or iter or buffer
31+
32+
33+
Creation examples::
34+
35+
from winsdk import Array
36+
from winsdk.windows.foundation import Point
37+
38+
# array of 10 32-bit unsigned integers.
39+
a1 = Array("I", 10)
40+
# array of 3 points with initial values
41+
a2 = Array(Point, [Point(1, 1), Point(2, 2), Point(3, 3)])
42+
43+
Sequence protocol examples::
44+
45+
# get the number of elements in the array
46+
size = len(a1)
47+
# get the first element of the array
48+
item = a1[0]
49+
# get the last element of the array
50+
item = a1[-1]
51+
# iterate all items of the array
52+
for item in a1: ...
53+
# test for element in array
54+
if item in a1: ...
55+

docs/conf.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# For the full list of built-in configuration values, see the documentation:
4+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
5+
6+
7+
# -- Project information --
8+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
9+
10+
11+
project = 'winsdk'
12+
copyright = '2022-2023, David Lechner'
13+
author = 'David Lechner'
14+
15+
# -- General configuration --
16+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
17+
18+
extensions = [
19+
"sphinx.ext.intersphinx",
20+
"sphinx.ext.todo",
21+
]
22+
23+
# templates_path = ['_templates']
24+
exclude_patterns = ['.venv', '_build', 'Thumbs.db', '.DS_Store']
25+
26+
27+
# -- Options for HTML output --
28+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
29+
30+
html_theme = 'sphinx_rtd_theme'
31+
html_static_path = ['_static']
32+
33+
# -- Options for intersphinx extension --
34+
# https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html#configuration
35+
intersphinx_mapping = {'python': ('https://docs.python.org/3', None)}
36+
37+
# -- Options for todo extension --
38+
# https://www.sphinx-doc.org/en/master/usage/extensions/todo.html#configuration
39+
todo_include_todos = True

docs/index.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
======
2+
winsdk
3+
======
4+
5+
The ``winsdk`` package provides access to Windows Runtime (WinRT) APIs.
6+
7+
8+
9+
.. toctree::
10+
:maxdepth: 3
11+
:caption: Contents:
12+
13+
types
14+
api/index
15+
16+
17+
Indices and tables
18+
==================
19+
20+
* :ref:`genindex`
21+
* :ref:`modindex`
22+
* :ref:`search`

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=.
11+
set BUILDDIR=_build
12+
13+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% -W %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

docs/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Sphinx==6.1.3
2+
sphinx-rtd-theme==1.2.0

0 commit comments

Comments
 (0)