Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: Add slicer.parameterNodeWrapper autodocs #6876

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions Base/Python/slicer/parameterNodeWrapper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
access.
"""

import os
import sys
_standalone_python = "python" in str.lower(os.path.split(sys.executable)[-1])

from .default import *
from .guiConnectors import *
from .guiCreation import *
if not _standalone_python:
from .guiConnectors import *
from .guiCreation import *
from .parameterPack import *
from .serializers import *
from .types import *
Expand All @@ -17,3 +22,5 @@
unannotatedType,
)
from .wrapper import *

del _standalone_python
12 changes: 10 additions & 2 deletions Base/Python/slicer/parameterNodeWrapper/wrapper.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
"""The wrapper module is responsible for creating parameterNodeWrappers"""

import logging
import os
import sys
import typing
from typing import Optional
import weakref

import qt
_standalone_python = "python" in str.lower(os.path.split(sys.executable)[-1])

if not _standalone_python:
import qt

import slicer
import vtk

from .default import Default, extractDefault
from .guiConnectors import GuiConnector, createGuiConnector, _getPackNameToWidgetMap
if not _standalone_python:
from .guiConnectors import GuiConnector, createGuiConnector, _getPackNameToWidgetMap
from .parameterInfo import ParameterInfo
from .parameterPack import _checkMember as checkPackMember
from .serializers import Serializer, createSerializer
from .util import splitAnnotations, splitPossiblyDottedName, unannotatedType

del _standalone_python

__all__ = [
"parameterNodeWrapper",
"SlicerParameterNamePropertyName",
Expand Down
3 changes: 2 additions & 1 deletion Docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
#SPHINXBUILD = sphinx-build
SPHINXBUILD = PythonSlicer -m sphinx
SPHINXPROJ = 3DSlicer
SOURCEDIR = .
BUILDDIR = _build
Expand Down
15 changes: 11 additions & 4 deletions Docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import importlib
import lxml.etree as ET
import os
import sys
from datetime import date

sys.path.insert(0, os.path.abspath("../Base/Python"))
try:
import slicer.kits
except ImportError:
sys.path.insert(0, os.path.abspath("../Base/Python"))


# -- General configuration ------------------------------------------------
Expand All @@ -48,10 +52,13 @@
]

autodoc_mock_imports = [
"ctk",
"qt",
"vtk",
]
for module in ["ctk", "qt", "vtk"]:
try:
importlib.import_module(module)
except ImportError:
print("[conf] Failed to import %s. Appending to autodoc_mock_imports" % module)
autodoc_mock_imports.append(module)

myst_enable_extensions = [
"attrs_inline", # Enable parsing of inline attributes (see https://myst-parser.readthedocs.io/en/latest/syntax/optional.html#inline-attributes)
Expand Down
7 changes: 5 additions & 2 deletions Docs/developer_guide/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ Python-style documentation is available for the following packages:
```{toctree}
:maxdepth: 2

mrml
slicer
```

```{toctree}
:maxdepth: 1

vtkTeem
vtkAddon
vtkITK
```

Expand Down
11 changes: 0 additions & 11 deletions Docs/developer_guide/mrml.md

This file was deleted.

10 changes: 10 additions & 0 deletions Docs/developer_guide/slicer.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,13 @@
:undoc-members:
:show-inheritance:
```

## slicer.parameterNodeWrapper

```{eval-rst}
.. automodule:: slicer.parameterNodeWrapper
:members:
:undoc-members:
:imported-members:
:show-inheritance:
```
11 changes: 0 additions & 11 deletions Docs/developer_guide/vtkAddon.md

This file was deleted.

Loading