From 42b8fb0cbbab02a88720fd700d34cf96a491c71b Mon Sep 17 00:00:00 2001
From: David Stansby <dstansby@gmail.com>
Date: Mon, 15 May 2023 08:49:52 +0100
Subject: [PATCH 1/9] Revert "Disable gallery execution"

This reverts commit f88ec4a33166c4b4fffc0664cbdbcdc8137fcc38.
---
 docs/conf.py | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index efff247a..9986ab64 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -37,11 +37,9 @@
 ]
 
 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,),
 }
 
 

From c7a5e4e60595650475bdac317090392163ef25ee Mon Sep 17 00:00:00 2001
From: David Stansby <dstansby@gmail.com>
Date: Mon, 15 May 2023 08:50:28 +0100
Subject: [PATCH 2/9] Revert "Disable gallery generation"

This reverts commit 27dcdc9f29b3dccbb419584f102f2ba2c7238f7e.
---
 docs/conf.py | 17 ++++++++---------
 setup.cfg    |  1 +
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index 9986ab64..d1a90a9b 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,7 +30,7 @@
 extensions = [
     "numpydoc",
     "sphinx_gallery.gen_gallery",
-    # "qtgallery",
+    "qtgallery",
     "sphinx_automodapi.automodapi",
     "sphinx_automodapi.smart_resolver",
     "sphinx.ext.intersphinx",
@@ -42,13 +42,12 @@
     "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
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

From a22be3038ace69efe1a4d92f0707da31ffbfba25 Mon Sep 17 00:00:00 2001
From: David Stansby <dstansby@gmail.com>
Date: Thu, 18 May 2023 14:26:34 +0100
Subject: [PATCH 3/9] Try building docs on GH actions

---
 .github/workflows/docs.yml | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 .github/workflows/docs.yml

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

From e0213e72e47c891455bdaba660c511ee34fdd201 Mon Sep 17 00:00:00 2001
From: David Stansby <dstansby@gmail.com>
Date: Thu, 18 May 2023 14:33:03 +0100
Subject: [PATCH 4/9] Try commenting out xvfb config

---
 docs/conf.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index d1a90a9b..5a317aed 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -42,12 +42,12 @@
     "reset_modules": (qtgallery.reset_qapp,),
 }
 
-qtgallery_conf = {
+"""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

From 734a8f4a934c9d7cba0db03e5d6d5bfd24954bee Mon Sep 17 00:00:00 2001
From: melissawm <melissawm@gmail.com>
Date: Mon, 22 May 2023 13:39:30 -0300
Subject: [PATCH 5/9] WIP: Fixing gallery build

---
 docs/conf.py | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index 5a317aed..dd89740f 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -30,7 +30,6 @@
 extensions = [
     "numpydoc",
     "sphinx_gallery.gen_gallery",
-    "qtgallery",
     "sphinx_automodapi.automodapi",
     "sphinx_automodapi.smart_resolver",
     "sphinx.ext.intersphinx",
@@ -42,12 +41,12 @@
     "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
@@ -63,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"]

From 926ab87408d97a9ddad0dac3615423e15f1cb61a Mon Sep 17 00:00:00 2001
From: melissawm <melissawm@gmail.com>
Date: Mon, 22 May 2023 13:42:53 -0300
Subject: [PATCH 6/9] WIP

---
 src/napari_matplotlib/base.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/napari_matplotlib/base.py b/src/napari_matplotlib/base.py
index 1480fdca..fdbc8f81 100644
--- a/src/napari_matplotlib/base.py
+++ b/src/napari_matplotlib/base.py
@@ -21,8 +21,7 @@
 
 
 class NapariMPLWidget(QWidget):
-    """
-    Widget containing a Matplotlib canvas and toolbar.
+    """Widget containing a Matplotlib canvas and toolbar.
 
     This creates a single FigureCanvas, which contains a single
     `~matplotlib.figure.Figure`, and an associated toolbar.

From 6b2658938f4e86872dd9806c6c52c2bbb6e1fc75 Mon Sep 17 00:00:00 2001
From: melissawm <melissawm@gmail.com>
Date: Mon, 22 May 2023 13:51:18 -0300
Subject: [PATCH 7/9] WIP

---
 docs/changelog.rst            | 4 ++--
 src/napari_matplotlib/base.py | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

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/src/napari_matplotlib/base.py b/src/napari_matplotlib/base.py
index 8b94fb0e..6d18fc64 100644
--- a/src/napari_matplotlib/base.py
+++ b/src/napari_matplotlib/base.py
@@ -103,7 +103,7 @@ 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.

From 088458714e87e97897fea7981efd22e3608e0a94 Mon Sep 17 00:00:00 2001
From: melissawm <melissawm@gmail.com>
Date: Mon, 22 May 2023 14:03:12 -0300
Subject: [PATCH 8/9] Add gallery config back

---
 docs/conf.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index dd89740f..418129ca 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -41,12 +41,12 @@
     "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

From 612fb3270a4e1f37f1f7eb732f3fb090b3ca2554 Mon Sep 17 00:00:00 2001
From: "pre-commit-ci[bot]"
 <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date: Thu, 25 May 2023 08:22:01 +0000
Subject: [PATCH 9/9] [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
---
 docs/conf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/conf.py b/docs/conf.py
index 418129ca..f27cce85 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -64,7 +64,7 @@
 # TODO: fix at some point
 nitpick_ignore = [
     ("py:class", "PyQt6.QtWidgets.QWidget"),
-    ("py:class", "PyQt5.QtWidgets.QWidget")
+    ("py:class", "PyQt5.QtWidgets.QWidget"),
 ]
 
 # Add any paths that contain templates here, relative to this directory.