diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000..50d37fe7 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,35 @@ +name: Build docs + +on: + pull_request: + branches: + - main + +jobs: + build-and-upload: + name: Build & Upload Artifact + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v3 + with: + python-version: "3.10" + + - uses: tlambert03/setup-qt-libs@v1 + + - name: Install Dependencies + run: | + python -m pip install --upgrade pip + python -m pip install ".[docs]" + - name: Build Docs + uses: aganders3/headless-gui@v1 + with: + run: make html + working-directory: ./docs + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: docs + path: docs/_build diff --git a/docs/changelog.rst b/docs/changelog.rst index 6a5afa08..32530ba3 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -6,7 +6,7 @@ Changelog New features ~~~~~~~~~~~~ -- Added `MPLWidget` as a widget containing just a Matplotlib canvas +- Added ``MPLWidget`` as a widget containing just a Matplotlib canvas without any association with a napari viewer. Visual improvements @@ -24,7 +24,7 @@ Changes - Labels plotting with the features scatter widget no longer have underscores replaced with spaces. - ``NapariMPLWidget.update_layers()`` has been removed as it is intended to be - private API. Use `NapariMPLWidget.on_update_layers` instead to implement + private API. Use ``NapariMPLWidget.on_update_layers`` instead to implement funcitonality when layer selection is changed. Bug fixes diff --git a/docs/conf.py b/docs/conf.py index efff247a..f27cce85 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -13,7 +13,7 @@ # import os # import sys # sys.path.insert(0, os.path.abspath('.')) -# import qtgallery +import qtgallery # -- Project information ----------------------------------------------------- @@ -30,27 +30,23 @@ extensions = [ "numpydoc", "sphinx_gallery.gen_gallery", - # "qtgallery", "sphinx_automodapi.automodapi", "sphinx_automodapi.smart_resolver", "sphinx.ext.intersphinx", ] sphinx_gallery_conf = { - # Don't run any gallery examples, because they're not working on - # readthedocs at the moment - "filename_pattern": "a^", - # "image_scrapers": (qtgallery.qtscraper,), - # "reset_modules": (qtgallery.reset_qapp,), + "filename_pattern": ".", + "image_scrapers": (qtgallery.qtscraper,), + "reset_modules": (qtgallery.reset_qapp,), } - -# qtgallery_conf = { -# "xvfb_size": (640, 480), -# "xvfb_color_depth": 24, -# "xfvb_use_xauth": False, -# "xfvb_extra_args": [], -# } +qtgallery_conf = { + "xvfb_size": (640, 480), + "xvfb_color_depth": 24, + "xfvb_use_xauth": False, + "xfvb_extra_args": [], +} numpydoc_show_class_members = False automodapi_inheritance_diagram = False @@ -66,7 +62,10 @@ nitpicky = True # Can't work out how to link this properley using intersphinx and the PyQT6 docs. # TODO: fix at some point -nitpick_ignore = [("py:class", "PyQt6.QtWidgets.QWidget")] +nitpick_ignore = [ + ("py:class", "PyQt6.QtWidgets.QWidget"), + ("py:class", "PyQt5.QtWidgets.QWidget"), +] # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] diff --git a/setup.cfg b/setup.cfg index aa4769a3..1e09aca4 100644 --- a/setup.cfg +++ b/setup.cfg @@ -50,6 +50,7 @@ docs = napari[all] numpydoc pydata-sphinx-theme + qtgallery sphinx sphinx-automodapi sphinx-gallery diff --git a/src/napari_matplotlib/base.py b/src/napari_matplotlib/base.py index 3cdcc69c..6d18fc64 100644 --- a/src/napari_matplotlib/base.py +++ b/src/napari_matplotlib/base.py @@ -103,12 +103,12 @@ class NapariMPLWidget(MPLWidget): """ Widget containing a Matplotlib canvas and toolbar. - In addition to `BaseNapariMPLWidget`, this class handles callbacks + In addition to ``BaseNapariMPLWidget``, this class handles callbacks to automatically update figures when the layer selection or z-step is changed in the napari viewer. To take advantage of this sub-classes should implement the ``clear()`` and ``draw()`` methods. - When both the z-step and layer selection is changed, ``clear()`` is called + When both the z-step and layer selection is changed, ``clear()`` is called and if the number a type of selected layers are valid for the widget ``draw()`` is then called. When layer selection is changed ``on_update_layers()`` is also called, which can be useful e.g. for updating a layer list in a