mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-02 00:27:27 +00:00
Python: Begin docs for model
This requires use of the pdoc API to work around an issue with the base methods not showing up in the docs.
This commit is contained in:
parent
d420bd8113
commit
a313916ce6
4 changed files with 41 additions and 7 deletions
21
api/python/build_docs.py
Normal file
21
api/python/build_docs.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
# Copyright © SixtyFPS GmbH <info@slint.dev>
|
||||
# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
|
||||
|
||||
import slint
|
||||
import pdoc
|
||||
import os
|
||||
|
||||
if __name__ == "__main__":
|
||||
doc = pdoc.doc.Module(slint)
|
||||
|
||||
model_cls = doc.get("Model")
|
||||
for method in model_cls.inherited_members[("builtins", "PyModelBase")]:
|
||||
method.is_inherited = False
|
||||
if not method.name.startswith("_") and method.name != "init_self":
|
||||
model_cls.own_members.append(method)
|
||||
|
||||
out = pdoc.render.html_module(module=doc, all_modules={"foo": doc})
|
||||
|
||||
os.makedirs("docs", exist_ok=True)
|
||||
with open("docs/index.html", "w") as f:
|
||||
f.write(out)
|
Loading…
Add table
Add a link
Reference in a new issue