8000 linking front thumbnails and updating screenshots · matplotlib/matplotlib@0a58484 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0a58484

Browse files
committed
linking front thumbnails and updating screenshots
1 parent e232afe commit 0a58484

File tree

5 files changed

+68
-125
lines changed

5 files changed

+68
-125
lines changed

doc/_templates/index.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,18 @@ <h1>Introduction</h1>
5555
interface toolkits.</p>
5656

5757
<div class="responsive_screenshots">
58-
<a a href="{{ pathto('users/screenshots') }}">
58+
<a a href="{{ pathto('tutorials/01_introductory/sample_plots') }}">
5959
<div class="responsive_subfig">
60-
<img align="middle", src="{{ pathto('_static/membrane_frontpage.png', 1) }}", border="0", alt="screenshots"/>
60+
<img align="middle", src="{{ pathto('_images/sphx_glr_membrane_thumb.png', 1) }}", border="0", alt="screenshots"/>
6161
</div>
6262
<div class="responsive_subfig">
63-
<img align="middle", src="{{ pathto('_static/histogram_frontpage.png', 1) }}", border="0", alt="screenshots"/>
63+
<img align="middle", src="{{ pathto('_images/sphx_glr_histogram_thumb1.png', 1) }}", border="0", alt="screenshots"/>
6464
</div>
6565
<div class="responsive_subfig">
66-
<img align="middle", src="{{ pathto('_static/contour_frontpage.png', 1) }}", border="0", alt="screenshots"/>
66+
<img align="middle", src="{{ pathto('_images/sphx_glr_contour_thumb.png', 1) }}", border="0", alt="screenshots"/>
6767
</div>
6868
<div class="responsive_subfig">
69-
<img align="middle", src="{{ pathto('_static/surface3d_frontpage.png', 1) }}", border="0", alt="screenshots"/>
69+
<img align="middle", src="{{ pathto('_images/sphx_glr_3D_thumb.png', 1) }}", border="0", alt="screenshots"/>
7070
</div>
7171
</a>
7272
</div>
@@ -75,8 +75,8 @@ <h1>Introduction</h1>
7575
<p>Matplotlib tries to make easy things easy and hard things possible.
7676
You can generate plots, histograms, power spectra, bar charts,
7777
errorcharts, scatterplots, etc., with just a few lines of code.
78-
For a example, see the <a href="{{ pathto('users/screenshots')
79-
}}">screenshots</a> and <a href="{{ pathto('gallery/index') }}">thumbnail</a> gallery.</p>
78+
For examples, see the <a href="{{ pathto('tutorials/01_introductory/sample_plots')
79+
}}">sample plots</a> and <a href="{{ pathto('gallery/index') }}">thumbnail</a> gallery.</p>
8080

8181
<p>For simple plotting the <tt>pyplot</tt> module provides a
8282
MATLAB-like interface, particularly when combined

doc/make.py

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -52,45 +52,6 @@ def linkcheck():
5252
[sys.executable]
5353
+ '-msphinx -b linkcheck -d build/doctrees . build/linkcheck'.split())
5454

55-
56-
# For generating PNGs of the top row of index.html:
57-
FRONTPAGE_PY_PATH = "../examples/frontpage/" # python scripts location
58-
FRONTPAGE_PNG_PATH = "_static/" # png files location
59-
# png files and corresponding generation scripts:
60-
FRONTPAGE_PNGS = {"surface3d_frontpage.png": "3D.py",
61-
"contour_frontpage.png": "contour.py",
62-
"histogram_frontpage.png": "histogram.py",
63-
"membrane_frontpage.png": "membrane.py"}
64-
65-
66-
def generate_frontpage_pngs(only_if_needed=True):
67-
"""Executes the scripts for PNG generation of the top row of index.html.
68-
69-
If `only_if_needed` is `True`, then the PNG file is only generated, if it
70-
doesn't exist or if the python file is newer.
71-
72-
Note that the element `div.responsive_screenshots` in the file
73-
`_static/mpl.css` has the height and cumulative width of the used PNG files
74-
as attributes. This ensures that the magnification of those PNGs is <= 1.
75-
"""
76-
for fn_png, fn_py in FRONTPAGE_PNGS.items():
77-
pn_png = os.path.join(FRONTPAGE_PNG_PATH, fn_png) # get full paths
78-
pn_py = os.path.join(FRONTPAGE_PY_PATH, fn_py)
79-
80-
# Read file modification times:
81-
mtime_py = os.path.getmtime(pn_py)
82-
mtime_png = (os.path.getmtime(pn_png) if os.path.exists(pn_png) else
83-
mtime_py - 1) # set older time, if file doesn't exist
84-
85-
if only_if_needed and mtime_py <= mtime_png:
86-
continue # do nothing if png is newer
87-
88-
# Execute python as subprocess (preferred over os.system()):
89-
subprocess.check_call(
90-
[sys.executable, pn_py]) # raises CalledProcessError()
91-
os.rename(fn_png, pn_png) # move file to _static/ directory
92-
93-
9455
DEPSY_PATH = "_static/depsy_badge.svg"
9556
DEPSY_URL = "http://depsy.org/api/package/pypi/matplotlib/badge.svg"
9657
DEPSY_DEFAULT = "_static/depsy_badge_default.svg"
@@ -121,7 +82,6 @@ def fetch_depsy_badge():
12182
def html(buildername='html'):
12283
"""Build Sphinx 'html' target. """
12384
check_build()
124-
generate_frontpage_pngs()
12585
fetch_depsy_badge()
12686

12787
rc = '../lib/matplotlib/mpl-data/matplotlibrc'
@@ -213,10 +173,6 @@ def clean():
213173
for filename in glob.glob(pattern):
214174
if os.path.exists(filename):
215175
os.remove(filename)
216-
for fn in FRONTPAGE_PNGS.keys(): # remove generated PNGs
217-
pn = os.path.join(FRONTPAGE_PNG_PATH, fn)
218-
if os.path.exists(pn):
219-
os.remove(os.path.join(pn))
220176

221177

222178
def build_all():

doc/users/examples_index.rst

Lines changed: 0 additions & 7 deletions
This file was deleted.

doc/users/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ User's Guide
1515
intro.rst
1616
installing.rst
1717
interactive.rst
18-
examples_index
1918
whats_new.rst
2019
github_stats.rst
2120
license.rst

0 commit comments

Comments
 (0)
0