Skip to content

Commit 33d2194

Browse files
authored
Doc: Improvements and fixes (fix BoboTiG#37)
Also: - Build the documentation on Tavis CI - Remove support for Python 3.3
1 parent cf781ca commit 33d2194

File tree

11 files changed

+102
-425
lines changed

11 files changed

+102
-425
lines changed

.readthedocs.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# http://read-the-docs.readthedocs.io/en/latest/yaml-config.html
2+
3+
# Use that Python version to buil the documentation
4+
python:
5+
version: 3

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
language: python
22
python:
33
- 2.7
4-
- 3.3
54
- 3.4
65
- 3.5
76
- 3.6
@@ -20,13 +19,14 @@ env:
2019
- DISPLAY=":42"
2120

2221
install:
23-
- pip install flake8 numpy pillow pylint
22+
- pip install flake8 numpy pillow pylint sphinx
2423
- pip install -e .
2524

2625
script:
2726
- py.test --showlocals --display=":42.0"
2827
- flake8 mss
2928
- pylint mss
29+
- if [[ $TRAVIS_PYTHON_VERSION > '2.8' ]]; then cd docs && make clean html; fi
3030

3131
after_script:
3232
- xpra stop :42

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ History:
33
<see Git checking messages for history>
44

55
dev 2017/xx/xx
6+
- removed support for Python 3.3
7+
- CI: build the documentation
8+
- doc: improvements and fixes (fix #37)
69

710
3.1.1 2017/11/27
811
- MSS: add the 'mss' entry point

README.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ An ultra fast cross-platform multiple screenshots module in pure python using ct
2323
- very basic, it will grab one screen shot by monitor or a screen shot of all monitors and save it to a PNG file;
2424
- but you can use PIL and benefit from all its formats (or add yours directly);
2525
- integrate well with Numpy and OpenCV;
26-
- it could be easily embedded into games and other softwares which require fast and plateforme optimized methods to grab screenshots;
26+
- it could be easily embedded into games and other softwares which require fast and plateforme optimized methods to grab screenshots (like Computer Vision);
2727
- get the `source code on GitHub <https://github.com/BoboTiG/python-mss>`_;
28-
- learn with a `bunch of examples <https://python-mss.readthedocs.io/en/dev/examples.html>`_;
28+
- learn with a `bunch of examples <https://python-mss.readthedocs.io/en/latest/examples.html>`_;
2929
- you can `report a bug <https://github.com/BoboTiG/python-mss/issues>`_;
3030
- need some help? Use the tag *python-mss* on `StackOverflow <https://stackoverflow.com/questions/tagged/python-mss>`_;
3131
- and there is a `complete, and beautiful, documentation <https://python-mss.readthedocs.io>`_ :)
32-
- **MSS** stands for Multiple ScreenShots;
32+
- **MSS** stands for Multiple Screen Shots;
3333

3434

3535
Installation

docs/source/api.rst

Lines changed: 39 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,19 @@ GNU/Linux
1212

1313
.. class:: MSS
1414

15-
.. method:: __init__(display=None)
15+
.. method:: __init__([display=None])
1616

17-
:param: str display: display to use.
17+
:type display: str or None
18+
:param display: The display to use.
1819

1920
GNU/Linux initializations.
2021

21-
.. method:: grab(monitor) -> ScreenShot
22+
.. method:: grab(monitor)
2223

23-
:exception ScreenShotError: When color depth is not 32 (rare).
24-
:rtype: ScreenShot
24+
:rtype: :class:`mss.base.ScreenShot`
25+
:raises ScreenShotError: When color depth is not 32 (rare).
2526

26-
See :attr:`mss.base.MSSBase.grab` for details.
27+
See :meth:`mss.base.MSSBase.grab()` for details.
2728

2829

2930
Methods
@@ -35,11 +36,11 @@ Methods
3536

3637
The parent's class for every OS implementation.
3738

38-
.. method:: grab(monitor) -> ScreenShot
39+
.. method:: grab(monitor)
3940

4041
:param dict monitor: monitor's information.
41-
:exception NotImplementedError: Subclasses need to implement this.
42-
:rtype: ScreenShot
42+
:rtype: :class:`ScreenShot`
43+
:raises NotImplementedError: Subclasses need to implement this.
4344

4445
Retrieve screen pixels for a given monitor.
4546

@@ -48,12 +49,14 @@ Methods
4849
``monitor`` can be a ``tuple`` like ``PIL.Image.grab()`` accepts,
4950
it will be converted to the appropriate ``dict``.
5051

51-
.. method:: save(mon=1, output='mon-{mon}.png', callback=None) -> generator
52+
.. method:: save([mon=1], [output='mon-{mon}.png'], [callback=None])
5253

5354
:param int mon: the monitor's number.
5455
:param str output: the output's file name.
55-
:param callable callback: callback called before saving the screen shot to a file. Takes the ``output`` argument as parameter.
56-
:return generator: Created file(s).
56+
:type callback: callable or None
57+
:param callback: callback called before saving the screen shot to a file. Takes the ``output`` argument as parameter.
58+
:rtype: iterable
59+
:return: Created file(s).
5760

5861
Grab a screen shot and save it to a file.
5962
The ``output`` parameter can take several keywords to customize the filename:
@@ -65,14 +68,14 @@ Methods
6568
- ``{height}``: the screen shot's height
6669
- ``{date}``: the current date using the default formatter
6770

68-
As it is using the `py::format()` function, you can specify formatting options like ``{date:%Y-%m-%s}``.
71+
As it is using the :py:func:`format()` function, you can specify formatting options like ``{date:%Y-%m-%s}``.
6972

70-
.. method:: shot() -> str
73+
.. method:: shot()
7174

7275
:return str: The created file.
7376

7477
Helper to save the screen shot of the first monitor, by default.
75-
You can pass the same arguments as for ``save``.
78+
You can pass the same arguments as for :meth:`save()`.
7679

7780
.. versionadded:: 3.0.0
7881

@@ -85,34 +88,34 @@ Methods
8588
A better name would have been *Image*, but to prevent collisions
8689
with ``PIL.Image``, it has been decided to use *ScreenShot*.
8790

88-
.. classmethod:: from_size(cls, data, width, height) -> ScreenShot
91+
.. classmethod:: from_size(cls, data, width, height)
8992

9093
:param bytearray data: raw BGRA pixels retrieved by ctype
9194
OS independent implementations.
9295
:param int width: the monitor's width.
9396
:param int height: the monitor's height.
94-
:rtype: ScreenShot
97+
:rtype: :class:`ScreenShot`
9598

9699
Instanciate a new class given only screen shot's data and size.
97100

98-
.. method:: pixels(coord_x, coord_y) -> Tuple[int, int, int]
101+
.. method:: pixels(coord_x, coord_y)
99102

100103
:param int coord_x: The x coordinate.
101104
:param int coord_y: The y coordinate.
102-
:rtype: Tuple[int, int, int]
105+
:rtype: tuple(int, int, int)
103106

104107
Get the pixel value at the given position.
105108

106-
.. versionadded:: 3.0.0
109+
.. versionadded:: 3.0.0
107110

108111
.. module:: mss.tools
109112

110-
.. method:: to_png(data, size, output) -> None
113+
.. method:: to_png(data, size, output)
111114

112115
:param bytes data: RGBRGB...RGB data.
113116
:param tuple size: The (width, height) pair.
114117
:param str output: output's file name.
115-
:exception ScreenShotError: On error when writing ``data`` to ``output``.
118+
:raises ScreenShotError: On error when writing ``data`` to ``output``.
116119

117120
Dump data to the image file. Pure Python PNG implementation.
118121

@@ -143,62 +146,63 @@ Properties
143146
- ``width``: the width
144147
- ``height``: the height
145148

146-
:type: List[Dict[str, int]]
149+
:rtype: list[dict[str, int]]
147150

148151
.. class:: ScreenShot
149152

150153
.. attribute:: __array_interface__()
151154

152155
Numpy array interface support. It uses raw data in BGRA form.
153156

154-
:type: Dict[str, Any]
157+
:rtype: dict[str, Any]
155158

156159
.. attribute:: pos
157160

158161
The screen shot's coordinates.
159162

160-
:type: NamedTuple
163+
:rtype: :py:func:`collections.namedtuple()`
161164

162165
.. attribute:: top
163166

164167
The screen shot's top coordinate.
165168

166-
:type: int
169+
:rtype: int
167170

168171
.. attribute:: left
169172

170173
The screen shot's left coordinate.
171-
:type: int
174+
175+
:rtype: int
172176

173177
.. attribute:: size
174178

175179
The screen shot's size.
176180

177-
:type: NamedTuple
181+
:rtype: :py:func:`collections.namedtuple()`
178182

179183
.. attribute:: width
180184

181185
The screen shot's width.
182186

183-
:type: int
187+
:rtype: int
184188

185189
.. attribute:: height
186190

187191
The screen shot's height.
188192

189-
:type: int
193+
:rtype: int
190194

191195
.. attribute:: pixels
192196

193197
List of RGB tuples.
194198

195-
:type: List[Tuple[int, int, int]]
199+
:rtype: list[tuple(int, int, int)]
196200

197201
.. attribute:: rgb
198202

199203
Computed RGB values from the BGRA raw pixels.
200204

201-
:type: bytes
205+
:rtype: bytes
202206

203207
.. versionadded:: 3.0.0
204208

@@ -218,6 +222,8 @@ Factory
218222

219223
.. module:: mss.factory
220224

221-
.. function:: mss() -> MSSBase
225+
.. function:: mss()
222226

223227
Factory function to instance the appropriate MSS class.
228+
229+
:rtype: :class:`mss.base.MSSBase`

0 commit comments

Comments
 (0)