Skip to content

Commit 33638f3

Browse files
#7 Finish documentation
1 parent d0a3a06 commit 33638f3

15 files changed

Lines changed: 238 additions & 59 deletions

doc/source/_ext/jedidocs.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
def setup(app):
2+
app.add_crossref_type(
3+
directivename="jedi",
4+
rolename="jedi",
5+
indextemplate="pair: %s; jedi")

doc/source/api.rst

Lines changed: 97 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ API Reference
22
======================
33

44
The API reference documentation is auto extracted from the source code and only
5-
cover the public API exposed by the **pyqode.core** package.
5+
cover the public API exposed by the **pyqode.python** package.
66

77
.. contents:: :local:
88

@@ -25,7 +25,96 @@ QPythonCodeEdit
2525

2626
Modes
2727
-----------
28+
CalltipsMode
29+
++++++++++++++++
30+
.. autoclass:: pyqode.python.CalltipsMode
31+
:members:
32+
33+
JediCompletionProvider
34+
+++++++++++++++++++++++++
35+
.. autoclass:: pyqode.python.JediCompletionProvider
36+
:members:
37+
38+
PEP8CheckerMode
39+
++++++++++++++++++
40+
41+
.. autoclass:: pyqode.python.PEP8CheckerMode
42+
:members:
43+
44+
PyAutoIndentMode
45+
+++++++++++++++++
46+
47+
.. autoclass:: pyqode.python.PyAutoIndentMode
48+
:members:
49+
50+
PyFlakesCheckerMode
51+
+++++++++++++++++++++
52+
53+
.. autoclass:: pyqode.python.PyFlakesCheckerMode
54+
:members:
55+
56+
PyHighlighterMode
57+
++++++++++++++++++++++
58+
59+
.. autoclass:: pyqode.python.PyHighlighterMode
60+
:members:
61+
62+
.. autoattribute:: pyqode.python.DEFAULT_LIGHT_STYLES
2863

64+
Default (white) color scheme for :class:`pyqode.python.PyHighlighterMode`
65+
Those values are added to :attr:`pyqode.core.QCodeEdit.style` properties in
66+
the *Python* section:
67+
68+
.. code-block:: python
69+
70+
{'keyword': TextStyle('#808000 nbold nitalic nunderlined'),
71+
'builtins': TextStyle('#808000 nbold nitalic nunderlined'),
72+
'operator': TextStyle('darkGray nbold nitalic nunderlined'),
73+
'punctuation': TextStyle('darkGray nbold nitalic nunderlined'),
74+
'decorator': TextStyle('#808000 nbold nitalic nunderlined'),
75+
'brace': TextStyle('#404040 nbold nitalic nunderlined'),
76+
'class': TextStyle('#800080 nbold nitalic nunderlined'),
77+
'function': TextStyle('#800080 nbold nitalic nunderlined'),
78+
'string': TextStyle('#008000 nbold nitalic nunderlined'),
79+
'docstring': TextStyle('#0000AA nbold nitalic nunderlined'),
80+
'comment': TextStyle('#008000 nbold italic nunderlined'),
81+
'self': TextStyle('#8F2828 nbold italic nunderlined'),
82+
'numbers': TextStyle('#000080 nbold nitalic nunderlined'),
83+
'predefined': TextStyle('#B200B2 nbold nitalic nunderlined'),
84+
'docstringTag': TextStyle('#0000FF nbold nitalic underlined'),}
85+
86+
87+
.. autoattribute:: pyqode.python.DEFAULT_DARK_STYLES
88+
89+
90+
Alternative dark color scheme for :class:`pyqode.python.PyHighlighterMode`
91+
Those values are added to :attr:`pyqode.core.QCodeEdit.style` properties in
92+
the *Python* section:
93+
94+
.. code-block:: python
95+
96+
{'keyword': TextStyle('#CC7832 bold nitalic nunderlined'),
97+
'builtins': TextStyle('#CC7832 nbold nitalic nunderlined'),
98+
'operator': TextStyle('#A9B7C6 nbold nitalic nunderlined'),
99+
'punctuation': TextStyle('#A9B7C6 nbold nitalic nunderlined'),
100+
'decorator': TextStyle('#BBB529 nbold nitalic nunderlined'),
101+
'brace': TextStyle('#AAAAAA nbold nitalic nunderlined'),
102+
'class': TextStyle('#A9B7C6 bold nitalic nunderlined'),
103+
'function': TextStyle('#A9B7C6 bold nitalic nunderlined'),
104+
'string': TextStyle('#A5C261 nbold nitalic nunderlined'),
105+
'docstring': TextStyle('#629755 nbold nitalic nunderlined'),
106+
'comment': TextStyle('#808080 nbold italic nunderlined'),
107+
'self': TextStyle('#94558D nbold italic nunderlined'),
108+
'numbers': TextStyle('#6897B3 nbold nitalic nunderlined'),
109+
'predefined': TextStyle('#B200B2 nbold nitalic nunderlined'),
110+
'docstringTag': TextStyle('#427735 bold nitalic underlined'),}
111+
112+
113+
PyIndenterMode
114+
++++++++++++++++++++++
115+
116+
.. autoclass:: pyqode.python.PyIndenterMode
117+
:members:
29118

30119
Panels
31120
--------------
@@ -34,3 +123,10 @@ PreLoadPanel
34123
+++++++++++++
35124
.. autoclass:: pyqode.python.PreLoadPanel
36125
:members:
126+
127+
128+
Utilities
129+
--------------
130+
131+
.. autofunction:: pyqode.python.setDarkColorScheme
132+
.. autofunction:: pyqode.python.setLightColorScheme

doc/source/bugs.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ Each package (pyqode.core, pyqode.python,...) has its own issue tracker,
77
if you're in doubt about which issue tracker to use, use the pyqode.core issue
88
tracker.
99

10-
.. _`issue tracker`: https://github.com/ColinDuquesnoy/pyQode/issues?state=open
10+
.. _`issue tracker`: https://github.com/ColinDuquesnoy/pyqode.python/issues?state=open

doc/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def __getattr__(cls, name):
5252

5353
# Add any Sphinx extension module names here, as strings. They can be extensions
5454
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
55-
extensions = ['coredocs', 'sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.pngmath', 'sphinx.ext.ifconfig', 'sphinx.ext.viewcode', 'sphinx.ext.graphviz', 'sphinx.ext.inheritance_diagram']
55+
extensions = ['coredocs', 'jedidocs', 'sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.pngmath', 'sphinx.ext.ifconfig', 'sphinx.ext.viewcode', 'sphinx.ext.graphviz', 'sphinx.ext.inheritance_diagram']
5656

5757
# Add any paths that contain templates here, relative to this directory.
5858
templates_path = ['_templates']
@@ -277,7 +277,7 @@ def __getattr__(cls, name):
277277
intersphinx_mapping = {
278278
'python': ('http://python.readthedocs.org/en/v2.7.2/', None),
279279
'pyqodecore': ('http://pyqodecore.readthedocs.org/en/latest/', None),
280-
}
280+
'jedi': ('http://jedi.readthedocs.org/en/latest/', None)}
281281

282282

283283
# -- Options for Inheritance diagrams-------------------------------------------

doc/source/contribute.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
Contributing
22
==================
33

4-
pyQode is an open-source project, and it needs your help to go on growing and improving.
4+
pyqode.core is an open-source project, and it needs your help to go on growing
5+
and improving.
56

67
You can contribute in many different ways:
78

@@ -12,13 +13,14 @@ You can contribute in many different ways:
1213

1314
If you have any question, just open an issue on the issue tracker.
1415

15-
.. _`issue tracker`: https://github.com/ColinDuquesnoy/pyqode.core/issues?state=open
16+
.. _`issue tracker`: https://github.com/ColinDuquesnoy/pyqode.python/issues?state=open
1617
.. _`wiki`: https://github.com/ColinDuquesnoy/pyqode.core/wiki/Extensions
1718
.. _`here`: https://github.com/ColinDuquesnoy/pyqode.core/wiki/Projects
1819

1920
Recommendation for submitting a post request:
2021
-------------------------------------------------
21-
Pull Requests are great (on the dev branch)! Readme/Documentation changes are ok in the master branch.
22+
Pull Requests are great (on the dev branch)! Readme/Documentation changes are
23+
ok in the master branch.
2224

2325
- Fork the Repo on github.
2426
- Add your name to AUTHORS.txt

doc/source/credits.rst

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
Credits
22
==============
33

4-
pyQode uses a couple of external libraries and projects.
4+
pyqode.python uses a couple of external libraries that were really helpful:
55

6-
Here is the complete list:
7-
* python
8-
* Qt using PySide or PyQt
9-
* Tango icons
10-
* Pygments
6+
* `Jedi`_: code completion, calltips
7+
* `PEP8`_: style checker
8+
* `pyFlakes`_: syntax checker
119

12-
The framework has been greatly inspired by the Qt Creator source code.
10+
Thanks to their developers for their great work!
11+
12+
.. _`Jedi`: https://pypi.python.org/pypi/jedi
13+
.. _`PEP8`: https://pypi.python.org/pypi/pep8
14+
.. _`pyFlakes`: https://pypi.python.org/pypi/pyflakes

doc/source/license.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
License
22
============
33

4-
pyQode is licensed under the MIT license.
4+
pyqode.python is licensed under the MIT license.
55

66

77
The MIT License (MIT)

pyqode/python/__init__.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,19 @@
2929
import re
3030
import sys
3131
import pyqode.core
32-
from pyqode.qt import QtCore
32+
from pyqode.qt import QtCore, QtGui
33+
34+
# public API
3335
from pyqode.python.modes import CalltipsMode
3436
from pyqode.python.modes import JediCompletionProvider
3537
from pyqode.python.modes import PEP8CheckerMode
3638
from pyqode.python.modes import PyAutoIndentMode
3739
from pyqode.python.modes import PyFlakesCheckerMode
38-
from pyqode.python.modes import PyIndenterMode
3940
from pyqode.python.modes import PyHighlighterMode
41+
from pyqode.python.modes import PyIndenterMode
4042
from pyqode.python.modes import DEFAULT_DARK_STYLES
4143
from pyqode.python.modes import DEFAULT_LIGHT_STYLES
4244
from pyqode.python.panels import PreLoadPanel
43-
from pyqode.qt import QtGui
4445

4546

4647
#: pyqode-python version
@@ -126,7 +127,7 @@ def useDarkStyle(self, use=True):
126127
"""
127128
if not use:
128129
return
129-
set_dark_color_scheme(self)
130+
setDarkColorScheme(self)
130131

131132
@QtCore.Slot()
132133
def useLightStyle(self, use=True):
@@ -136,7 +137,7 @@ def useLightStyle(self, use=True):
136137
"""
137138
if not use:
138139
return
139-
set_light_color_scheme(self)
140+
setLightColorScheme(self)
140141

141142
def detectEncoding(self, data):
142143
"""
@@ -153,7 +154,7 @@ def detectEncoding(self, data):
153154
return encoding
154155

155156

156-
def set_dark_color_scheme(codeEdit):
157+
def setDarkColorScheme(codeEdit):
157158
"""
158159
Set a dark scheme on a :class:`pyqode.core.QCodeEdit`.
159160
@@ -178,7 +179,7 @@ def set_dark_color_scheme(codeEdit):
178179
codeEdit.style = style
179180

180181

181-
def set_light_color_scheme(codeEdit):
182+
def setLightColorScheme(codeEdit):
182183
"""
183184
Set a light scheme on a :class:`pyqode.core.QCodeEdit`.
184185
@@ -207,4 +208,5 @@ def set_light_color_scheme(codeEdit):
207208
__all__ = ["PEP8CheckerMode", 'PyHighlighterMode', 'PyAutoIndentMode',
208209
"CalltipsMode", "JediCompletionProvider", "PyFlakesCheckerMode",
209210
"PyIndenterMode", "PreLoadPanel", "__version__", "QPythonCodeEdit",
210-
"set_light_color_scheme", "set_light_color_scheme"]
211+
"setLightColorScheme", "setDarkColorScheme",
212+
"DEFAULT_LIGHT_STYLES", "DEFAULT_DARK_STYLES"]

pyqode/python/modes/autoindent.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@
3030

3131
class PyAutoIndentMode(AutoIndentMode):
3232
"""
33-
A basic auto indent mode that provides a basic auto indentation based
34-
on the previous line indentation.
35-
36-
This mode can be extended by overriding the _getIndent method.
33+
Customised :class:`pyqode.core.AutoIndentMode` for python, the indentation
34+
level is based on the previous line indent but is automatically incremented
35+
after a *:* and decremented after *pass* or *return*
3736
"""
3837
#: Mode identifier
3938
IDENTIFIER = "pyAutoIndentMode"
@@ -44,14 +43,6 @@ def __init__(self):
4443
super(PyAutoIndentMode, self).__init__()
4544

4645
def _getIndent(self, tc):
47-
"""
48-
Return the indentation text (a series of spaces, tabs)
49-
50-
The indentation level is based on the indentation level of the previous
51-
line
52-
53-
:param tc: QTextCursor
54-
"""
5546
pos = tc.position()
5647
if pos != 0:
5748
indent = AutoIndentMode._getIndent(self, tc)

pyqode/python/modes/calltips.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,13 @@ def __call__(self, *args, **kwargs):
5555

5656

5757
class CalltipsMode(Mode, QtCore.QObject):
58+
"""
59+
This mode shows function/method call tips in a QToolTip using
60+
:meth:`jedi.Script.call_signatures`.
61+
"""
62+
#: Mode identifier
5863
IDENTIFIER = "calltipsMode"
64+
#: Mode description
5965
DESCRIPTION = "Provides functions calltips using the jedi library"
6066

6167
tooltipDisplayRequested = QtCore.Signal(object, int)

0 commit comments

Comments
 (0)