Skip to content

Commit

Permalink
Merge pull request #168 from p5py/doc-cleanup
Browse files Browse the repository at this point in the history
Cleanup Documentation Build Warnings
  • Loading branch information
arihantparsoya authored May 24, 2020
2 parents acafa3c + 1211ce0 commit fb9373c
Show file tree
Hide file tree
Showing 23 changed files with 51 additions and 48 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,4 @@ def __getattr__(cls, name):
]

def setup(app):
app.add_javascript('p5.min.js')
app.add_js_file('p5.min.js')
4 changes: 0 additions & 4 deletions docs/examples/image/create image.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,3 @@ Create Image


The ``create_image()`` function provides a fresh buffer of pixels to play with. This example creates an image gradient.


.. code:: python
2 changes: 1 addition & 1 deletion docs/reference/attributes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Attributes
==========

.. automodule:: p5

:noindex:

fill()
-------
Expand Down
9 changes: 5 additions & 4 deletions docs/reference/color.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Color
=====

.. automodule:: p5

:noindex:

Color
-----
Expand All @@ -26,21 +26,22 @@ fill()
------

.. autofunction:: fill

:noindex:

no_fill()
---------

.. autofunction:: no_fill

:noindex:

stroke()
--------

.. autofunction:: stroke

:noindex:

no_stroke()
-----------

.. autofunction:: no_stroke
:noindex:
1 change: 1 addition & 0 deletions docs/reference/environment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Environment
===========

.. automodule:: p5
:noindex:

size()
======
Expand Down
4 changes: 3 additions & 1 deletion docs/reference/image.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Image
=====

.. module:: p5
:noindex:

PImage
======
Expand Down Expand Up @@ -34,12 +35,13 @@ tint()
------

.. autofunction:: tint
:noindex:

no_tint()
---------

.. autofunction:: no_tint

:noindex:

Pixels
======
Expand Down
1 change: 1 addition & 0 deletions docs/reference/math.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Math
====

.. automodule:: p5
:noindex:

.. note::

Expand Down
1 change: 1 addition & 0 deletions docs/reference/output.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Output
======

.. module:: p5
:noindex:

Image
=====
Expand Down
1 change: 1 addition & 0 deletions docs/reference/shape.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Shape
=====

.. automodule:: p5
:noindex:

PShape
======
Expand Down
1 change: 1 addition & 0 deletions docs/reference/structure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Structure
=========

.. module:: p5
:noindex:

setup()
=======
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/svg.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ SVG
===

.. module:: p5

:noindex:

load_shape()
------------
Expand Down
3 changes: 2 additions & 1 deletion docs/reference/transform.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Transform
=========

.. automodule:: p5
:noindex:

push_matrix()
-------------
Expand Down Expand Up @@ -69,7 +70,7 @@ camera()
.. autofunction:: camera()

perspective()
---------
-------------

.. autofunction:: perspective()

Expand Down
12 changes: 6 additions & 6 deletions docs/reference/typography.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Typography
==========

.. automodule:: p5

:noindex:

Loading and displaying
======================
Expand Down Expand Up @@ -35,13 +35,13 @@ Text Attributes


text_align()
-----------
------------

.. autofunction:: text_align


text_leading()
-----------
--------------

.. autofunction:: text_leading

Expand All @@ -56,18 +56,18 @@ Metrics
=======

text_ascent()
-----------
-------------

.. autofunction:: text_ascent


text_descent()
-----------
---------------

.. autofunction:: text_descent


text_width()
-----------
------------

.. autofunction:: text_width
4 changes: 2 additions & 2 deletions docs/tutorials/2D transformations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ The Transformation Matrix
Every time you do a rotation, translation, or scaling, the information required to do the transformation is accumulated into a table of numbers. This table, or matrix has only a few rows and columns, yet, through the miracle of mathematics, it contains all the information needed to do any series of transformations. And that’s why ``push_matrix()`` has that word in their name.

Push (and Pop)
============
==============

What about the push part of the name? It comes from a computer concept known as a stack, which works like a spring-loaded tray dispenser in a cafeteria. When someone returns a tray to the stack, its weight pushes the platform down. When someone needs a tray, he takes it from the top of the stack, and the remaining trays pop up a little bit.

Expand Down Expand Up @@ -497,7 +497,7 @@ Because this is a new concept, rather than integrate it into the robot program,
if __name__ == '__main__':
run()
That works great. What happens if we draw the rectangle so it is taller than it is wide? Change the preceding code to read ``rect((0, 0), 10, 50)`. How come it doesn’t seem to follow the mouse any more? The answer is that the rectangle really is still following the mouse, but it’s the short side of the rectangle that does the following. Our eyes are trained to want the long side to be tracked. Because the long side is at a 90 degree angle to the short side, you have to subtract 90° (or π/2 radians) to get the desired effect. Change the preceding code to read rotate(angle - HALF_PI) and try it again. Since Processing deals almost exclusively in radians, the language has defined the constants PI (180°), HALF_PI (90°), QUARTER_PI (45°) and TWO_PI (360°) for your convenience.
That works great. What happens if we draw the rectangle so it is taller than it is wide? Change the preceding code to read ``rect((0, 0), 10, 50)``. How come it doesn’t seem to follow the mouse any more? The answer is that the rectangle really is still following the mouse, but it’s the short side of the rectangle that does the following. Our eyes are trained to want the long side to be tracked. Because the long side is at a 90 degree angle to the short side, you have to subtract 90° (or π/2 radians) to get the desired effect. Change the preceding code to read rotate(angle - HALF_PI) and try it again. Since Processing deals almost exclusively in radians, the language has defined the constants PI (180°), HALF_PI (90°), QUARTER_PI (45°) and TWO_PI (360°) for your convenience.

At this point, we can write the final version of the arm-tracking program. We start off with definitions of constants and variables. The number 39 in the definition of MIDPOINT_X comes from the fact that the body of the robot starts at x-coordinate 14 and is 50 pixels wide, so 39 (14 + 25) is the horizontal midpoint of the robot’s body.

Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/coordinate system and shapes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ A ``point()`` is the easiest of the shapes and a good place to start. To draw a
:align: center
:width: 50%

A ``line()``isn't terribly difficult either and simply requires two points: (x1,y1) and (x2,y2):
A ``line()`` isn't terribly difficult either and simply requires two points: (x1,y1) and (x2,y2):

.. image:: ./coordinate_system_and_shapes-res/drawing-06.svg
:align: center
Expand Down
6 changes: 3 additions & 3 deletions docs/tutorials/curves.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Arcs are fine, but they’re plain. The next function, ``curve()``, lets you dra
curve((cpx1, cpy1), (x1, y1), (x2, y2), (cpx2, cpy2))
.. code:: python
.. code:: none
cpx1, cpy1 Coordinates of the first control point
x1, y1 Coordinates of the curve’s starting point
Expand Down Expand Up @@ -153,7 +153,7 @@ Bézier Curves

Though better than arcs, spline curves don’t seem to have those graceful, swooping curves that say “art.” For those, you need to draw Bézier curves with the ``bezier()`` function. As with spline curves, the ``bezier()`` function has eight parameters, but the order is different:

.. code:: python
.. code:: none
bezier((x1, y1), (cpx1, cpy1), (cpx2, cpy2), (x2, y2))
x1, y1 Coordinates of the curve’s starting point
Expand Down Expand Up @@ -289,5 +289,5 @@ Summary

* Use ``arc()`` when you need a segment of a circle or an ellipse. You can’t make continuous arcs or use them as part of a shape.
* Use ``curve()`` when you need a small curve between two points. Use curveVertex() to make a continuous series of curves as part of a shape.
* Use ``bezier()`` when you need long, smooth curves. Use ``bezier_vertex()` to make a continuous series of Bézier curves as part of a shape.
* Use ``bezier()`` when you need long, smooth curves. Use ``bezier_vertex()`` to make a continuous series of Bézier curves as part of a shape.

2 changes: 1 addition & 1 deletion docs/tutorials/interactivity.rst
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ To invert the value of the mouse, subtract the mouse_x value from the width of t
if __name__ == '__main__':
run()
The Processing variables ``pmouse_x`` and ``pmouse_y` store the mouse values from the previous frame. If the mouse does not move, the values will be the same, but if the mouse is moving quickly there can be large differences between the values. To see the difference, run the following program and alternate moving the mouse slowly and quickly. Watch the values print to the console.
The Processing variables ``pmouse_x`` and ``pmouse_y`` store the mouse values from the previous frame. If the mouse does not move, the values will be the same, but if the mouse is moving quickly there can be large differences between the values. To see the difference, run the following program and alternate moving the mouse slowly and quickly. Watch the values print to the console.

.. code:: python
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/objects.rst
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ Nevertheless, this is quite an important skill to learn, and, ultimately, is one

Arguments are local variables used inside the body of a function that get filled with values when the function is called. In the examples, they have one purpose only: to initialize the variables inside of an object. These are the variables that count—the car's actual color, the car's actual x location, and so on. The constructor's arguments are just temporary, and exist solely to pass a value from where the object is made into the object itself.

This allows us to make a variety of objects using the same constructor. You might also just write the word temp in your argument names to remind you of what is going on (c vs. tempC). You will also see programmers use an underscore (c vs. c_) in many examples. You can name these whatever you want, of course. However, it is advisable to choose a name that makes sense to you, and also to stay consistent.
This allows us to make a variety of objects using the same constructor. You might also just write the word temp in your argument names to remind you of what is going on (``c`` vs. ``tempC``). You will also see programmers use an underscore (``c`` vs. ``c_``) in many examples. You can name these whatever you want, of course. However, it is advisable to choose a name that makes sense to you, and also to stay consistent.

We can now take a look at the same sketch with multiple object instances, each with unique properties.

Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/strings and drawing text.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Another useful method is ``len()``. This is easy to confuse with the length prop
message = "This String is 34 characters long."
print(len(message))
We can also change a String to all uppercase using the ``upper()` method:
We can also change a String to all uppercase using the ``upper()`` method:

.. code:: python
Expand Down
15 changes: 7 additions & 8 deletions docs/tutorials/vector.rst
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,6 @@ Let's say I have the following two vectors:

.. figure:: ./vector-res/v.svg
:align: right
:scale: 50%

.. math::
Expand Down Expand Up @@ -1554,12 +1553,12 @@ then have:
direction = mouse - self.location
We now have a Vector that points from the mover's location all the
way to the mouse. If the object were to actually accelerate using
that vector, it would instantaneously appear at the mouse location.
This does not make for good animation, of course, and what we want to
do is now decide how fast that object should accelerate towards the
mouse.
We now have a Vector that points from the mover's location all the
way to the mouse. If the object were to actually accelerate using
that vector, it would instantaneously appear at the mouse location.
This does not make for good animation, of course, and what we want to
do is now decide how fast that object should accelerate towards the
mouse.


In order to set the magnitude (whatever it may be) of our acceleration
Expand All @@ -1571,7 +1570,7 @@ anything equals anything.

.. code:: python
anything = ???
anything = some_number
direction.normalize()
direction = direction * anything
Expand Down
2 changes: 1 addition & 1 deletion p5/core/primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ def square(coordinate, side_length, mode=None):
'CENTER' and 'RADIUS' the coordinate represents the center of
the square.
:type coordinate: tuple | list |p5.Vector
:type coordinate: tuple | list | p5.Vector
:param side_length: The side_length of the square (for modes
'CORNER' and 'CENTER') or hald of the side length (for the
Expand Down
10 changes: 5 additions & 5 deletions p5/core/svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def load_shape(filename):
PShape object.
:param filename: link to .svg file
:type filename: str
:type filename: str
"""
tree = etree.parse(filename)
Expand Down Expand Up @@ -209,13 +209,13 @@ def shape(shape, x=0, y=0):
Draws shapes to the display window
:param shape: shape object
:type shape: PShape
:type shape: PShape
:param x: x-coordinate of the shape
:type x: float
:type x: float
:param y: y-coordinate of the shape
:type y: float
:param y: y-coordinate of the shape
:type y: float
"""
with transforms.push_matrix():
transforms.translate(x, y)
Expand Down
11 changes: 5 additions & 6 deletions p5/core/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,11 @@ def camera(position, target_position, up_vector):
orientation of the camera).
When called with no arguments, this function
creates a default camera equivalent to
camera(
(0, 0, (height/2.0) / tan(PI*30.0 / 180.0)),
(0, 0, 0),
(0, 1, 0)
)
creates a default camera equivalent to::
camera((0, 0, (height/2.0) / tan(PI*30.0 / 180.0)),
(0, 0, 0),
(0, 1, 0))
:param position: camera position coordinates
:type position: tuple
Expand Down

0 comments on commit fb9373c

Please sign in to comment.