From: Sébastien CHAZALLET Date: Mon, 8 Apr 2013 14:11:26 +0000 (+0200) Subject: Premier commit : Code et doc (état de publication) X-Git-Url: http://git.inspyration.org/?p=gedit%2Fflake8;a=commitdiff_plain;h=c6dc5bddf01030cc08eb7d6e249ec0afe34682cb Premier commit : Code et doc (état de publication) --- c6dc5bddf01030cc08eb7d6e249ec0afe34682cb diff --git a/doc/Makefile b/doc/Makefile new file mode 100644 index 0000000..413e4c6 --- /dev/null +++ b/doc/Makefile @@ -0,0 +1,177 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = build + +# User-friendly check for sphinx-build +ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) +$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) +endif + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source +# the i18n builder cannot share the environment and doctrees with the others +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source + +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext + +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " texinfo to make Texinfo files" + @echo " info to make Texinfo files and run them through makeinfo" + @echo " gettext to make PO message catalogs" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " xml to make Docutils-native XML files" + @echo " pseudoxml to make pseudoxml-XML files for display purposes" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +clean: + rm -rf $(BUILDDIR)/* + +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/geditFlake8integration.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/geditFlake8integration.qhc" + +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/geditFlake8integration" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/geditFlake8integration" + @echo "# devhelp" + +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +latexpdf: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +latexpdfja: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through platex and dvipdfmx..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +texinfo: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo + @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." + @echo "Run \`make' in that directory to run these through makeinfo" \ + "(use \`make info' here to do that automatically)." + +info: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo "Running Texinfo files through makeinfo..." + make -C $(BUILDDIR)/texinfo info + @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." + +gettext: + $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale + @echo + @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." + +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." + +xml: + $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml + @echo + @echo "Build finished. The XML files are in $(BUILDDIR)/xml." + +pseudoxml: + $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml + @echo + @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." diff --git a/doc/build/doctrees/environment.pickle b/doc/build/doctrees/environment.pickle new file mode 100644 index 0000000..6fd543a Binary files /dev/null and b/doc/build/doctrees/environment.pickle differ diff --git a/doc/build/doctrees/flake8_integration.doctree b/doc/build/doctrees/flake8_integration.doctree new file mode 100644 index 0000000..958674f Binary files /dev/null and b/doc/build/doctrees/flake8_integration.doctree differ diff --git a/doc/build/doctrees/index.doctree b/doc/build/doctrees/index.doctree new file mode 100644 index 0000000..a91e743 Binary files /dev/null and b/doc/build/doctrees/index.doctree differ diff --git a/doc/build/html/.buildinfo b/doc/build/html/.buildinfo new file mode 100644 index 0000000..def1d83 --- /dev/null +++ b/doc/build/html/.buildinfo @@ -0,0 +1,4 @@ +# Sphinx build info version 1 +# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. +config: 491b1a3dfc64f3a67eb65dcfc437df87 +tags: a205e9ed8462ae86fdd2f73488852ba9 diff --git a/doc/build/html/_modules/flake8_integration/configuration.html b/doc/build/html/_modules/flake8_integration/configuration.html new file mode 100644 index 0000000..8d72d25 --- /dev/null +++ b/doc/build/html/_modules/flake8_integration/configuration.html @@ -0,0 +1,190 @@ + + + + + + + + flake8_integration.configuration — gedit Flake8 integration 0.1 documentation + + + + + + + + + + + + + + + +
+
+
+
+ +

Source code for flake8_integration.configuration

+#-*- coding: utf8 -*-
+
+"""Module used to configure plugin from an easy-to-use widget
+
+:author: Sébastien CHAZALLET <s.chazallet@gmail.com>
+:organization: InsPyration EURL
+:copyright: Copyright © InsPyration EURL <www.inspyration.org>
+:license: GPL 3 <http://www.gnu.org/licenses/gpl.html>
+
+:version: 0.1
+"""
+
+from gettext import gettext as _
+
+from gi.repository import Gtk
+
+
+STUFF = 1
+
+
+
[docs]class GeditFlake8ConfigWidget(Gtk.Box): + +
[docs] def __init__(self, settings): + """Initialize the configuration widget from SettingsManager properties + + :type self: GeditFlake8ConfigWidget + :param self: Current widget + + :type settings: SettingsManager + :param settings: Object used to define all configurable properties + + :rtype: None + """ + + # the current widget is a box + Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL, spacing=6) + + # reference to settings + self.settings = settings + + # store useful entries into a dictionary + # in order to get their values later + self.entries = {} + + # Add a label on the top ot widget + self.pack_start(Gtk.Label(_("Add to ignore list")), True, True, 0) + + # create one checkbox for each warning that can be ignored + for key, option in self.settings.get_ignore_items(): + button = Gtk.CheckButton(option) + button.set_active(self.settings.is_in_ignore_list(key)) + self.pack_start(button, True, True, 0) + # add the check button to entries + self.entries[key] = button + + # create an Hbox to get the label and the entry on the same line + hbox = Gtk.Box(spacing=3) + self.pack_start(hbox, True, True, 0) + + # label for complexity entry + hbox.pack_start(Gtk.Label(_("Complexity")), True, True, 0) + + # complexity entry is an widget allowing us to be sure to have an int + complexity_entry = Gtk.SpinButton() + complexity_entry.set_adjustment(Gtk.Adjustment( + self.settings.get_complexity(), -1, 21, 1, 1, 1)) + hbox.pack_start(complexity_entry, True, True, 0) + # add the widget to entries + self.entries[self.settings.get_complexity_key()] = complexity_entry + + # add an event to get back values and use them + self.connect("destroy", self.on_configure_destroy) +
+
[docs] def on_configure_destroy(self, widget): + """Called when the widget is destroyed + + :type self: GeditFlake8ConfigWidget + :param self: Current widget + + :type widget: GeditFlake8ConfigWidget + :param widget: Current widget + + :rtype: None + """ + + # extract complexity form element and get complexity value + complexity = int( + self.entries.pop(self.settings.get_complexity_key()).get_text()) + + # extract all other values + values = {k: v.get_active() for k, v in self.entries.items()} + + # add back complexity value + values[self.settings.get_complexity_key()] = complexity + + # update settings + self.settings.update_setting(values)
+
+ +
+
+
+
+
+ + +
+
+
+
+ + + + \ No newline at end of file diff --git a/doc/build/html/_modules/flake8_integration/integrated.html b/doc/build/html/_modules/flake8_integration/integrated.html new file mode 100644 index 0000000..7c5e3d7 --- /dev/null +++ b/doc/build/html/_modules/flake8_integration/integrated.html @@ -0,0 +1,194 @@ + + + + + + + + flake8_integration.integrated — gedit Flake8 integration 0.1 documentation + + + + + + + + + + + + + + + +
+
+
+
+ +

Source code for flake8_integration.integrated

+#-*- coding: utf8 -*-
+
+"""Module used to manage the results of flake8 :
+
+> 1. get them instead of print them ;
+> 2. format them ;
+
+This module works with Python2 and Python3
+
+:author: Sébastien CHAZALLET <s.chazallet@gmail.com>
+:organization: InsPyration EURL
+:copyright: Copyright © InsPyration EURL <www.inspyration.org>
+:license: GPL 3 <http://www.gnu.org/licenses/gpl.html>
+
+:version: 0.1
+"""
+
+
+import sys
+if sys.version_info.major == 2:
+    from io import BytesIO as IO
+else:
+    from io import StringIO as IO
+
+from flake8.main import check_code
+
+
+
[docs]def _intercept_printed(action, *args, **kwargs): + """Function used to redirect printed to returned value + + :type action: function + :param action: Called function that we intercept prints + + :rtype: str + :return: all that was printed by the call of action + + >>> def do(): + ... print('Hello World') + ... + >>> result = _intercept_printed(do) + >>> print(result) + Hello World + <BLANKLINE> + """ + with IO() as buff: + out, sys.stdout = sys.stdout, buff + action(*args, **kwargs) + sys.stdout = out + buff.seek(0) + return buff.read() + +
+
[docs]def _format_flake8_results(warnings): + """Function used to extract useful informations from flake8 results + + :type warnings: str + :param warnings: Warnings generated by flake8 + + :rtype: list + :return: list of (code:str, line:int, col:int, description:str) + + >>> result = _format_flake8_results( + ... '''stdin:1:10: E901 SyntaxError: unexpected EOF while parsing + ... stdin:2:1: E901 TokenError: EOF in multi-line statement''') + >>> for r in result: + ... print r + ... + (' e901', 1, 10, 'SyntaxError: unexpected EOF while parsing') + (' e901', 2, 1, 'TokenError: EOF in multi-line statement') + """ + result = [] + for warning in warnings.splitlines(): + cols = warning.split(':') + result.append((cols[3][:5].lower(), + int(cols[1]), + int(cols[2]), + cols[3][6:] + ':' + ':'.join(cols[4:]))) + return result + +
+
[docs]def check_code_and_get_formated_result(code, ignore=(), complexity=-1): + """Function used to return the printed result of flake8 check_code function + + >>> result = check_code_with_flake8("a = 42") + >>> print(result) + <BLANKLINE> + >>> result = check_code_with_flake8("a = f(42") + >>> print(result) + stdin:1:10: E901 SyntaxError: unexpected EOF while parsing + stdin:2:1: E901 TokenError: EOF in multi-line statement + <BLANKLINE> + """ + return _format_flake8_results( + _intercept_printed( + check_code, + **{"code": code, "ignore": ignore, "complexity": complexity})) + +
+if __name__ == '__main__': + import doctest + doctest.testmod() +
+ +
+
+
+
+
+ + +
+
+
+
+ + + + \ No newline at end of file diff --git a/doc/build/html/_modules/flake8_integration/settings.html b/doc/build/html/_modules/flake8_integration/settings.html new file mode 100644 index 0000000..c2ede62 --- /dev/null +++ b/doc/build/html/_modules/flake8_integration/settings.html @@ -0,0 +1,263 @@ + + + + + + + + flake8_integration.settings — gedit Flake8 integration 0.1 documentation + + + + + + + + + + + + + + + +
+
+
+
+ +

Source code for flake8_integration.settings

+#-*- coding: utf-8 -*-
+
+"""Module used to define how to manage settings and their persistence
+
+:author: Sébastien CHAZALLET <s.chazallet@gmail.com>
+:organization: InsPyration EURL
+:copyright: Copyright © InsPyration EURL <www.inspyration.org>
+:license: GPL 3 <http://www.gnu.org/licenses/gpl.html>
+
+:version: 0.1
+"""
+
+from gettext import gettext as _
+
+from gi.repository import Gio
+
+FLAKE8_KEY_BASE = 'org.gnome.gedit.plugins.flake8_integration'
+
+FLAKE8_KEY_W191 = "w191"
+FLAKE8_KEY_W291 = "w291"
+FLAKE8_KEY_W292 = "w292"
+FLAKE8_KEY_W293 = "w293"
+FLAKE8_KEY_W391 = "w391"
+
+FLAKE8_IGNORED_KEYS = (FLAKE8_KEY_W191, FLAKE8_KEY_W291, FLAKE8_KEY_W292,
+                       FLAKE8_KEY_W293, FLAKE8_KEY_W391)
+
+CONFIG_OPTIONS = {FLAKE8_KEY_W191: _("w191: identation contains tabs"),
+                  FLAKE8_KEY_W291: _("w291: trailling whitespace"),
+                  FLAKE8_KEY_W292: _("w292: no new line at end of file"),
+                  FLAKE8_KEY_W293: _("w293: blank line contains whitespace"),
+                  FLAKE8_KEY_W391: _("w391: blank line at end of file")}
+
+FLAKE8_KEY_COMPLEXITY = "complexity"
+
+
+
[docs]class SettingsManager(object): + """Allow to manage local settings and it persistent storage""" + +
[docs] def __init__(self): + """Initialize Settings Manager + + :type self: SettingsManager + :param self: Current manager + + :rtype: None + """ + + #_settings allow persistent storage of configuration + self._settings = Gio.Settings.new(FLAKE8_KEY_BASE) + #settings contains configuration usable in the plugin + self.settings = {} + # pull local settings from persistent storage + self.pull_settings() +
+
[docs] def pull_settings(self): + """Pull operation update local settings from persistent storage + + :type self: SettingsManager + :param self: Current manager + + :rtype: None + """ + + # pull ignore list + for tag in FLAKE8_IGNORED_KEYS: + self.settings[tag] = self._settings.get_boolean(tag) + # pull complexity + self.settings[FLAKE8_KEY_COMPLEXITY] = self._settings.get_int( + FLAKE8_KEY_COMPLEXITY) +
+
[docs] def push_settings(self): + """Push operation allow persistent storage update from local settings + + :type self: SettingsManager + :param self: Current manager + + :rtype: None + """ + + # push ignore list + for tag in FLAKE8_IGNORED_KEYS: + self._settings.set_boolean(tag, self.settings[tag]) + # push complexity + self._settings.set_int(FLAKE8_KEY_COMPLEXITY, + self.settings[FLAKE8_KEY_COMPLEXITY]) +
+
[docs] def update_setting(self, values={}): + """Updating settings allow to update local and persistent settings + + :type self: SettingsManager + :param self: Current manager + :type values: dict + :param values: values to store persistently + + :rtype: None + """ + # update local settings + self.settings.update(values) + # push local settings to persistent storage + self.push_settings() +
+
[docs] def get_ignore_keys(self): + """Allow to share information about keys used to store ignore list + + :type self: SettingsManager + :param self: Current manager + + :rtype: list of str + :return: list of ignore keys + """ + return FLAKE8_IGNORED_KEYS +
+
[docs] def get_ignore_items(self): + """Allow to share information about keys used to store ignore list + + :type self: SettingsManager + :param self: Current manager + + :rtype: list of tuple of str + :return: list of (ignore key, ignore label) + """ + return CONFIG_OPTIONS.items() +
+
[docs] def get_complexity_key(self): + """Allow to share information about key used to store complexity + + :type self: SettingsManager + :param self: Current manager + + :rtype: str + :return: name of the complexity key + """ + return FLAKE8_KEY_COMPLEXITY +
+
[docs] def is_in_ignore_list(self, key): + """Answer to "Is tag in ignore list ?" question + + :type self: SettingsManager + :param self: Current manager + :type key: str + :param key: flake8 key as defined in FLAKE8_IGNORED_KEYS + + :rtype: bool + :return: True if the key is in ignore list, False otherwise + """ + return self.settings[key] +
+
[docs] def get_ignore_list(self): + """Get the user defined warning keys to ignore + + :type self: SettingsManager + :param self: Current manager + + :rtype: list of str + :return: list of warning keys + """ + return [tag for tag, value in self.settings.items() + if tag in FLAKE8_IGNORED_KEYS and value is True] +
+
[docs] def get_complexity(self): + """Get the user defined complexity parameter + + :type self: SettingsManager + :param self: Current manager + + :rtype: int + :return: complexity + """ + return self.settings[FLAKE8_KEY_COMPLEXITY]
+
+ +
+
+
+
+
+ + +
+
+
+
+ + + + \ No newline at end of file diff --git a/doc/build/html/_modules/flake8_integration/tree.html b/doc/build/html/_modules/flake8_integration/tree.html new file mode 100644 index 0000000..0453f97 --- /dev/null +++ b/doc/build/html/_modules/flake8_integration/tree.html @@ -0,0 +1,232 @@ + + + + + + + + flake8_integration.tree — gedit Flake8 integration 0.1 documentation + + + + + + + + + + + + + + + +
+
+
+
+ +

Source code for flake8_integration.tree

+#-*- coding: utf-8 -*-
+
+"""Module managing the tree and all stuff around it
+
+:author: Sébastien CHAZALLET <s.chazallet@gmail.com>
+:organization: InsPyration EURL
+:copyright: Copyright © InsPyration EURL <www.inspyration.org>
+:license: GPL 3 <http://www.gnu.org/licenses/gpl.html>
+
+:version: 0.1
+"""
+
+
+from gettext import gettext as _
+
+from gi.repository import Gtk
+
+SP_COL_TITLES = (_("Code"), _("L"), _("C"), _("Errors / Warnings"))
+SP_COL_TYPES = (str, int, int, str)
+
+PYTHON_ICON = 'gnome-mime-text-x-python'
+
+
+
[docs]class GeditFlake8Tree(Gtk.TreeView): + """Tree inside gedit side panel containing all flake8 warnings""" + +
[docs] def __init__(self, window): + """Configure tree columns, tree selection and add it to side panel + + :type self: GeditFlake8Tree + :param self: Current tree + :type window: Gedit.Window + :param window: GEdit window object + + :rtype: None + """ + + # use a list store to manage warnings + Gtk.TreeView.__init__(self, Gtk.ListStore(*SP_COL_TYPES)) + + # compose window + self.window = window + + # create columns + for index, title in enumerate(SP_COL_TITLES): + self.append_column(Gtk.TreeViewColumn( + _(title), + Gtk.CellRendererText(), + text=index)) + + # Allow to do something when a tree line is selected + self.get_selection().connect("changed", self.on_tree_selection) + + # create an icon for the side panel + image = Gtk.Image() + image.set_from_icon_name(PYTHON_ICON, Gtk.IconSize.MENU) + + # get the side panel (created by GEdit) + sp = self.window.get_side_panel() + + # Add the tree in the side panel + sp.add_item( + self, + 'flake8_results', + _("Flake8 results"), + image + ) + + # set the side panel invisible + sp.set_property("visible", False) +
+
[docs] def remove(self): + """remove the tree from the side panel + + :type self: GeditFlake8Tree + :param self: Current tree + + :rtype: None + """ + + # get the side panel (created by GEdit) + sp = self.window.get_side_panel() + sp.remove_item(self) +
+
[docs] def activate(self): + """show the tree in the side panel + + :type self: GeditFlake8Tree + :param self: Current tree + + :rtype: None + """ + + sp = self.window.get_side_panel() + sp.set_property("visible", True) + sp.activate_item(self) +
+
[docs] def on_tree_selection(self, selection): + """When a tree line is selected, go to the file linked line + + :type self: GeditFlake8Tree + :param self: Current tree + :type selection: Gtk.TreeSelection + :param selection: Current selection + + :rtype: None + """ + + doc = self.window.get_active_document() + if not doc: + return + + # get the tree line selected and put the cursor to the file linked line + model, treeiter = selection.get_selected() + doc.goto_line(model[treeiter][1] - 1) + + # scroll the view to the cursor + self.window.get_active_view().scroll_to_cursor() +
+
[docs] def update_model(self, datas): + """Update the tree with new datas + + :type self: GeditFlake8Tree + :param self: Current tree + :type datas: list + :param datas: list of ready to use (str, int, int, str) tuples + + :rtype: None + """ + + # get the model (Gtk.ListStore) + model = self.get_model() + + # Empty model + model.clear() + + # Fill model with new values + for data in datas: + model.append(data)
+
+ +
+
+
+
+
+ + +
+
+
+
+ + + + \ No newline at end of file diff --git a/doc/build/html/_modules/flake8_integration/windowactivatable.html b/doc/build/html/_modules/flake8_integration/windowactivatable.html new file mode 100644 index 0000000..99fe0f3 --- /dev/null +++ b/doc/build/html/_modules/flake8_integration/windowactivatable.html @@ -0,0 +1,277 @@ + + + + + + + + flake8_integration.windowactivatable — gedit Flake8 integration 0.1 documentation + + + + + + + + + + + + + + + +
+
+
+
+ +

Source code for flake8_integration.windowactivatable

+#-*- coding: utf-8 -*-
+
+"""Main module of the Plugin for gedit that allow flake8 integration
+
+:author: Sébastien CHAZALLET <s.chazallet@gmail.com>
+:organization: InsPyration EURL
+:copyright: Copyright © InsPyration EURL <www.inspyration.org>
+:license: GPL 3 <http://www.gnu.org/licenses/gpl.html>
+
+:version: 0.1
+"""
+
+
+from gettext import gettext as _
+
+from gi.repository import GObject, Gtk, Gedit, PeasGtk
+
+from integrated import check_code_and_get_formated_result as check_code
+from settings import SettingsManager
+from tree import GeditFlake8Tree
+from configuration import GeditFlake8ConfigWidget
+
+# Menu to insert in gedit's 'Tools' menu
+ui_str = """<ui>
+  <menubar name="MenuBar">
+    <menu name="ToolsMenu" action="Tools">
+      <placeholder name="ToolsOps_2">
+        <menuitem name="GeditFlake8" action="GeditFlake8"/>
+      </placeholder>
+    </menu>
+  </menubar>
+</ui>
+"""
+
+
+
[docs]class GeditFlake8WindowActivatable(GObject.Object, + Gedit.WindowActivatable, + PeasGtk.Configurable): + """Main module of the gedit flake8 plugin""" + + __gtype_name__ = "GeditFlake8WindowActivatable" + + window = GObject.property(type=Gedit.Window) + +
[docs] def __init__(self): + """Initialize plugin + + :type action: function + :param action: Called function that we intercept prints + + :rtype: None + """ + GObject.Object.__init__(self) + # Initialize settings + self._settings = SettingsManager() + self.flake8_tree = None +
+
[docs] def do_activate(self): + """Activate the plugin + + :type self: GeditFlake8WindowActivatable + :param self: Current plugin + + :rtype: None + """ + # Get the Gtk.UIManager + manager = self.window.get_ui_manager() + + # Create a new action group + self._action_group = Gtk.ActionGroup("GeditFlake8PluginActions") + self._action_group.add_actions([("GeditFlake8", + None, + _("Check Python source code"), + None, + _("Check Python source code"), + self.on_check_source_code)]) + + # Insert the action group + manager.insert_action_group(self._action_group, -1) + + # Merge the UI + self._ui_id = manager.add_ui_from_string(ui_str) + + # Create a tree + self.flake8_tree = GeditFlake8Tree(self.window) +
+
[docs] def do_deactivate(self): + """Deactivate the plugin + + :type self: GeditFlake8WindowActivatable + :param self: Current plugin + + :rtype: None + """ + # Remove the tree from the side panel + self.flake8_tree.remove() + + # Delete tree object + self.flake8_tree = None + + # Get the Gtk.UIManager + manager = self.window.get_ui_manager() + + # Remove the ui + manager.remove_ui(self._ui_id) + + # Remove the action group + manager.remove_action_group(self._action_group) + + # Delete the action group object + self._action_group = None + + # Make sure the manager updates + manager.ensure_update() +
+
[docs] def do_update_state(self): + """Allow to activate the plugin only if the document is python code + If the document is a new document, it hasto be saved or the language of + the document has to be set. + + :type self: GeditFlake8WindowActivatable + :param self: Current plugin + + :rtype: None + """ + state = False + doc = self.window.get_active_document() + if doc is not None: + language = doc.get_language() + if language is not None: + state = language.get_id() in ["python", "python3"] + self._action_group.set_sensitive(state) +
+
[docs] def do_create_configure_widget(self): + """Action when a user want to configure the plugin + + :type self: GeditFlake8WindowActivatable + :param self: Current plugin + + :rtype: GeditFlake8ConfigWidget + :return: a configuration widget + """ + return GeditFlake8ConfigWidget(self._settings) +
+
[docs] def on_check_source_code(self, action): + """The user ask to check code source : + 1\ check there is a doc and the doc is python code + 2\ use flake8 + 3\ put flake8 results into the tree and activate it + + :type self: GeditFlake8WindowActivatable + :param self: Current plugin + + :type action: Gtk.Action + :param action: Called function that we intercept prints + + :rtype: None + """ + + # Get the document content + doc = self.window.get_active_document() + if not doc: + return + + # check the language of current document is set + language = doc.get_language() + if language is None: + return + + # check the language of current document is python + if language.get_id() not in ["python", "python3"]: + return + + # Use flake8 to get warnings + warnings = check_code( + doc.get_text(doc.get_start_iter(), doc.get_end_iter(), False), + map(str.upper, self._settings.get_ignore_list()), + self._settings.get_complexity()) + + # Empty store + self.flake8_tree.update_model(warnings) + + # Activate tree + self.flake8_tree.activate()
+
+ +
+
+
+
+
+ + +
+
+
+
+ + + + \ No newline at end of file diff --git a/doc/build/html/_modules/index.html b/doc/build/html/_modules/index.html new file mode 100644 index 0000000..b3251d4 --- /dev/null +++ b/doc/build/html/_modules/index.html @@ -0,0 +1,95 @@ + + + + + + + + Overview: module code — gedit Flake8 integration 0.1 documentation + + + + + + + + + + + + + + +
+ +
+
+ + +
+
+
+
+ + + + \ No newline at end of file diff --git a/doc/build/html/_sources/flake8_integration.txt b/doc/build/html/_sources/flake8_integration.txt new file mode 100644 index 0000000..02418fa --- /dev/null +++ b/doc/build/html/_sources/flake8_integration.txt @@ -0,0 +1,60 @@ +Auto generated documentation +============================ + +Plugin +------ +.. automodule:: flake8_integration + :members: + :private-members: + :special-members: + +Integrated +---------- + +.. automodule:: flake8_integration.integrated + :members: + :private-members: + :special-members: + +Window activatable +------------------ + +.. automodule:: flake8_integration.windowactivatable + :members: + :private-members: + :special-members: + +Tree +---- + +.. automodule:: flake8_integration.tree + :members: + :private-members: + :special-members: + +Settings +-------- + +.. automodule:: flake8_integration.settings + :members: + :private-members: + :special-members: + +Configuration +------------- + +.. automodule:: flake8_integration.configuration + :members: + :private-members: + :special-members: + +.. autoclass:: GeditFlake8ConfigWidget + :members: + :private-members: + :special-members: + +Status +------ + +This plugin is under active development. + diff --git a/doc/build/html/_sources/index.txt b/doc/build/html/_sources/index.txt new file mode 100644 index 0000000..53e9347 --- /dev/null +++ b/doc/build/html/_sources/index.txt @@ -0,0 +1,23 @@ +.. gedit Flake8 integration documentation master file, created by + sphinx-quickstart on Mon Apr 8 11:46:38 2013. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to gedit Flake8 integration's documentation! +==================================================== + +Contents: + +.. toctree:: + :maxdepth: 2 + + flake8_integration + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + diff --git a/doc/build/html/_static/ajax-loader.gif b/doc/build/html/_static/ajax-loader.gif new file mode 100644 index 0000000..61faf8c Binary files /dev/null and b/doc/build/html/_static/ajax-loader.gif differ diff --git a/doc/build/html/_static/basic.css b/doc/build/html/_static/basic.css new file mode 100644 index 0000000..a04c8e1 --- /dev/null +++ b/doc/build/html/_static/basic.css @@ -0,0 +1,540 @@ +/* + * basic.css + * ~~~~~~~~~ + * + * Sphinx stylesheet -- basic theme. + * + * :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +/* -- main layout ----------------------------------------------------------- */ + +div.clearer { + clear: both; +} + +/* -- relbar ---------------------------------------------------------------- */ + +div.related { + width: 100%; + font-size: 90%; +} + +div.related h3 { + display: none; +} + +div.related ul { + margin: 0; + padding: 0 0 0 10px; + list-style: none; +} + +div.related li { + display: inline; +} + +div.related li.right { + float: right; + margin-right: 5px; +} + +/* -- sidebar --------------------------------------------------------------- */ + +div.sphinxsidebarwrapper { + padding: 10px 5px 0 10px; +} + +div.sphinxsidebar { + float: left; + width: 230px; + margin-left: -100%; + font-size: 90%; +} + +div.sphinxsidebar ul { + list-style: none; +} + +div.sphinxsidebar ul ul, +div.sphinxsidebar ul.want-points { + margin-left: 20px; + list-style: square; +} + +div.sphinxsidebar ul ul { + margin-top: 0; + margin-bottom: 0; +} + +div.sphinxsidebar form { + margin-top: 10px; +} + +div.sphinxsidebar input { + border: 1px solid #98dbcc; + font-family: sans-serif; + font-size: 1em; +} + +div.sphinxsidebar #searchbox input[type="text"] { + width: 170px; +} + +div.sphinxsidebar #searchbox input[type="submit"] { + width: 30px; +} + +img { + border: 0; +} + +/* -- search page ----------------------------------------------------------- */ + +ul.search { + margin: 10px 0 0 20px; + padding: 0; +} + +ul.search li { + padding: 5px 0 5px 20px; + background-image: url(file.png); + background-repeat: no-repeat; + background-position: 0 7px; +} + +ul.search li a { + font-weight: bold; +} + +ul.search li div.context { + color: #888; + margin: 2px 0 0 30px; + text-align: left; +} + +ul.keywordmatches li.goodmatch a { + font-weight: bold; +} + +/* -- index page ------------------------------------------------------------ */ + +table.contentstable { + width: 90%; +} + +table.contentstable p.biglink { + line-height: 150%; +} + +a.biglink { + font-size: 1.3em; +} + +span.linkdescr { + font-style: italic; + padding-top: 5px; + font-size: 90%; +} + +/* -- general index --------------------------------------------------------- */ + +table.indextable { + width: 100%; +} + +table.indextable td { + text-align: left; + vertical-align: top; +} + +table.indextable dl, table.indextable dd { + margin-top: 0; + margin-bottom: 0; +} + +table.indextable tr.pcap { + height: 10px; +} + +table.indextable tr.cap { + margin-top: 10px; + background-color: #f2f2f2; +} + +img.toggler { + margin-right: 3px; + margin-top: 3px; + cursor: pointer; +} + +div.modindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +div.genindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +/* -- general body styles --------------------------------------------------- */ + +a.headerlink { + visibility: hidden; +} + +h1:hover > a.headerlink, +h2:hover > a.headerlink, +h3:hover > a.headerlink, +h4:hover > a.headerlink, +h5:hover > a.headerlink, +h6:hover > a.headerlink, +dt:hover > a.headerlink { + visibility: visible; +} + +div.body p.caption { + text-align: inherit; +} + +div.body td { + text-align: left; +} + +.field-list ul { + padding-left: 1em; +} + +.first { + margin-top: 0 !important; +} + +p.rubric { + margin-top: 30px; + font-weight: bold; +} + +img.align-left, .figure.align-left, object.align-left { + clear: left; + float: left; + margin-right: 1em; +} + +img.align-right, .figure.align-right, object.align-right { + clear: right; + float: right; + margin-left: 1em; +} + +img.align-center, .figure.align-center, object.align-center { + display: block; + margin-left: auto; + margin-right: auto; +} + +.align-left { + text-align: left; +} + +.align-center { + text-align: center; +} + +.align-right { + text-align: right; +} + +/* -- sidebars -------------------------------------------------------------- */ + +div.sidebar { + margin: 0 0 0.5em 1em; + border: 1px solid #ddb; + padding: 7px 7px 0 7px; + background-color: #ffe; + width: 40%; + float: right; +} + +p.sidebar-title { + font-weight: bold; +} + +/* -- topics ---------------------------------------------------------------- */ + +div.topic { + border: 1px solid #ccc; + padding: 7px 7px 0 7px; + margin: 10px 0 10px 0; +} + +p.topic-title { + font-size: 1.1em; + font-weight: bold; + margin-top: 10px; +} + +/* -- admonitions ----------------------------------------------------------- */ + +div.admonition { + margin-top: 10px; + margin-bottom: 10px; + padding: 7px; +} + +div.admonition dt { + font-weight: bold; +} + +div.admonition dl { + margin-bottom: 0; +} + +p.admonition-title { + margin: 0px 10px 5px 0px; + font-weight: bold; +} + +div.body p.centered { + text-align: center; + margin-top: 25px; +} + +/* -- tables ---------------------------------------------------------------- */ + +table.docutils { + border: 0; + border-collapse: collapse; +} + +table.docutils td, table.docutils th { + padding: 1px 8px 1px 5px; + border-top: 0; + border-left: 0; + border-right: 0; + border-bottom: 1px solid #aaa; +} + +table.field-list td, table.field-list th { + border: 0 !important; +} + +table.footnote td, table.footnote th { + border: 0 !important; +} + +th { + text-align: left; + padding-right: 5px; +} + +table.citation { + border-left: solid 1px gray; + margin-left: 1px; +} + +table.citation td { + border-bottom: none; +} + +/* -- other body styles ----------------------------------------------------- */ + +ol.arabic { + list-style: decimal; +} + +ol.loweralpha { + list-style: lower-alpha; +} + +ol.upperalpha { + list-style: upper-alpha; +} + +ol.lowerroman { + list-style: lower-roman; +} + +ol.upperroman { + list-style: upper-roman; +} + +dl { + margin-bottom: 15px; +} + +dd p { + margin-top: 0px; +} + +dd ul, dd table { + margin-bottom: 10px; +} + +dd { + margin-top: 3px; + margin-bottom: 10px; + margin-left: 30px; +} + +dt:target, .highlighted { + background-color: #fbe54e; +} + +dl.glossary dt { + font-weight: bold; + font-size: 1.1em; +} + +.field-list ul { + margin: 0; + padding-left: 1em; +} + +.field-list p { + margin: 0; +} + +.refcount { + color: #060; +} + +.optional { + font-size: 1.3em; +} + +.versionmodified { + font-style: italic; +} + +.system-message { + background-color: #fda; + padding: 5px; + border: 3px solid red; +} + +.footnote:target { + background-color: #ffa; +} + +.line-block { + display: block; + margin-top: 1em; + margin-bottom: 1em; +} + +.line-block .line-block { + margin-top: 0; + margin-bottom: 0; + margin-left: 1.5em; +} + +.guilabel, .menuselection { + font-family: sans-serif; +} + +.accelerator { + text-decoration: underline; +} + +.classifier { + font-style: oblique; +} + +abbr, acronym { + border-bottom: dotted 1px; + cursor: help; +} + +/* -- code displays --------------------------------------------------------- */ + +pre { + overflow: auto; + overflow-y: hidden; /* fixes display issues on Chrome browsers */ +} + +td.linenos pre { + padding: 5px 0px; + border: 0; + background-color: transparent; + color: #aaa; +} + +table.highlighttable { + margin-left: 0.5em; +} + +table.highlighttable td { + padding: 0 0.5em 0 0.5em; +} + +tt.descname { + background-color: transparent; + font-weight: bold; + font-size: 1.2em; +} + +tt.descclassname { + background-color: transparent; +} + +tt.xref, a tt { + background-color: transparent; + font-weight: bold; +} + +h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt { + background-color: transparent; +} + +.viewcode-link { + float: right; +} + +.viewcode-back { + float: right; + font-family: sans-serif; +} + +div.viewcode-block:target { + margin: -1px -10px; + padding: 0 10px; +} + +/* -- math display ---------------------------------------------------------- */ + +img.math { + vertical-align: middle; +} + +div.body div.math p { + text-align: center; +} + +span.eqno { + float: right; +} + +/* -- printout stylesheet --------------------------------------------------- */ + +@media print { + div.document, + div.documentwrapper, + div.bodywrapper { + margin: 0 !important; + width: 100%; + } + + div.sphinxsidebar, + div.related, + div.footer, + #top-link { + display: none; + } +} \ No newline at end of file diff --git a/doc/build/html/_static/comment-bright.png b/doc/build/html/_static/comment-bright.png new file mode 100644 index 0000000..551517b Binary files /dev/null and b/doc/build/html/_static/comment-bright.png differ diff --git a/doc/build/html/_static/comment-close.png b/doc/build/html/_static/comment-close.png new file mode 100644 index 0000000..09b54be Binary files /dev/null and b/doc/build/html/_static/comment-close.png differ diff --git a/doc/build/html/_static/comment.png b/doc/build/html/_static/comment.png new file mode 100644 index 0000000..92feb52 Binary files /dev/null and b/doc/build/html/_static/comment.png differ diff --git a/doc/build/html/_static/default.css b/doc/build/html/_static/default.css new file mode 100644 index 0000000..e534a07 --- /dev/null +++ b/doc/build/html/_static/default.css @@ -0,0 +1,256 @@ +/* + * default.css_t + * ~~~~~~~~~~~~~ + * + * Sphinx stylesheet -- default theme. + * + * :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +@import url("basic.css"); + +/* -- page layout ----------------------------------------------------------- */ + +body { + font-family: sans-serif; + font-size: 100%; + background-color: #11303d; + color: #000; + margin: 0; + padding: 0; +} + +div.document { + background-color: #1c4e63; +} + +div.documentwrapper { + float: left; + width: 100%; +} + +div.bodywrapper { + margin: 0 0 0 230px; +} + +div.body { + background-color: #ffffff; + color: #000000; + padding: 0 20px 30px 20px; +} + +div.footer { + color: #ffffff; + width: 100%; + padding: 9px 0 9px 0; + text-align: center; + font-size: 75%; +} + +div.footer a { + color: #ffffff; + text-decoration: underline; +} + +div.related { + background-color: #133f52; + line-height: 30px; + color: #ffffff; +} + +div.related a { + color: #ffffff; +} + +div.sphinxsidebar { +} + +div.sphinxsidebar h3 { + font-family: 'Trebuchet MS', sans-serif; + color: #ffffff; + font-size: 1.4em; + font-weight: normal; + margin: 0; + padding: 0; +} + +div.sphinxsidebar h3 a { + color: #ffffff; +} + +div.sphinxsidebar h4 { + font-family: 'Trebuchet MS', sans-serif; + color: #ffffff; + font-size: 1.3em; + font-weight: normal; + margin: 5px 0 0 0; + padding: 0; +} + +div.sphinxsidebar p { + color: #ffffff; +} + +div.sphinxsidebar p.topless { + margin: 5px 10px 10px 10px; +} + +div.sphinxsidebar ul { + margin: 10px; + padding: 0; + color: #ffffff; +} + +div.sphinxsidebar a { + color: #98dbcc; +} + +div.sphinxsidebar input { + border: 1px solid #98dbcc; + font-family: sans-serif; + font-size: 1em; +} + + + +/* -- hyperlink styles ------------------------------------------------------ */ + +a { + color: #355f7c; + text-decoration: none; +} + +a:visited { + color: #355f7c; + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + + + +/* -- body styles ----------------------------------------------------------- */ + +div.body h1, +div.body h2, +div.body h3, +div.body h4, +div.body h5, +div.body h6 { + font-family: 'Trebuchet MS', sans-serif; + background-color: #f2f2f2; + font-weight: normal; + color: #20435c; + border-bottom: 1px solid #ccc; + margin: 20px -20px 10px -20px; + padding: 3px 0 3px 10px; +} + +div.body h1 { margin-top: 0; font-size: 200%; } +div.body h2 { font-size: 160%; } +div.body h3 { font-size: 140%; } +div.body h4 { font-size: 120%; } +div.body h5 { font-size: 110%; } +div.body h6 { font-size: 100%; } + +a.headerlink { + color: #c60f0f; + font-size: 0.8em; + padding: 0 4px 0 4px; + text-decoration: none; +} + +a.headerlink:hover { + background-color: #c60f0f; + color: white; +} + +div.body p, div.body dd, div.body li { + text-align: justify; + line-height: 130%; +} + +div.admonition p.admonition-title + p { + display: inline; +} + +div.admonition p { + margin-bottom: 5px; +} + +div.admonition pre { + margin-bottom: 5px; +} + +div.admonition ul, div.admonition ol { + margin-bottom: 5px; +} + +div.note { + background-color: #eee; + border: 1px solid #ccc; +} + +div.seealso { + background-color: #ffc; + border: 1px solid #ff6; +} + +div.topic { + background-color: #eee; +} + +div.warning { + background-color: #ffe4e4; + border: 1px solid #f66; +} + +p.admonition-title { + display: inline; +} + +p.admonition-title:after { + content: ":"; +} + +pre { + padding: 5px; + background-color: #eeffcc; + color: #333333; + line-height: 120%; + border: 1px solid #ac9; + border-left: none; + border-right: none; +} + +tt { + background-color: #ecf0f3; + padding: 0 1px 0 1px; + font-size: 0.95em; +} + +th { + background-color: #ede; +} + +.warning tt { + background: #efc2c2; +} + +.note tt { + background: #d6d6d6; +} + +.viewcode-back { + font-family: sans-serif; +} + +div.viewcode-block:target { + background-color: #f4debf; + border-top: 1px solid #ac9; + border-bottom: 1px solid #ac9; +} \ No newline at end of file diff --git a/doc/build/html/_static/doctools.js b/doc/build/html/_static/doctools.js new file mode 100644 index 0000000..8614442 --- /dev/null +++ b/doc/build/html/_static/doctools.js @@ -0,0 +1,235 @@ +/* + * doctools.js + * ~~~~~~~~~~~ + * + * Sphinx JavaScript utilities for all documentation. + * + * :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +/** + * select a different prefix for underscore + */ +$u = _.noConflict(); + +/** + * make the code below compatible with browsers without + * an installed firebug like debugger +if (!window.console || !console.firebug) { + var names = ["log", "debug", "info", "warn", "error", "assert", "dir", + "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", + "profile", "profileEnd"]; + window.console = {}; + for (var i = 0; i < names.length; ++i) + window.console[names[i]] = function() {}; +} + */ + +/** + * small helper function to urldecode strings + */ +jQuery.urldecode = function(x) { + return decodeURIComponent(x).replace(/\+/g, ' '); +}; + +/** + * small helper function to urlencode strings + */ +jQuery.urlencode = encodeURIComponent; + +/** + * This function returns the parsed url parameters of the + * current request. Multiple values per key are supported, + * it will always return arrays of strings for the value parts. + */ +jQuery.getQueryParameters = function(s) { + if (typeof s == 'undefined') + s = document.location.search; + var parts = s.substr(s.indexOf('?') + 1).split('&'); + var result = {}; + for (var i = 0; i < parts.length; i++) { + var tmp = parts[i].split('=', 2); + var key = jQuery.urldecode(tmp[0]); + var value = jQuery.urldecode(tmp[1]); + if (key in result) + result[key].push(value); + else + result[key] = [value]; + } + return result; +}; + +/** + * highlight a given string on a jquery object by wrapping it in + * span elements with the given class name. + */ +jQuery.fn.highlightText = function(text, className) { + function highlight(node) { + if (node.nodeType == 3) { + var val = node.nodeValue; + var pos = val.toLowerCase().indexOf(text); + if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) { + var span = document.createElement("span"); + span.className = className; + span.appendChild(document.createTextNode(val.substr(pos, text.length))); + node.parentNode.insertBefore(span, node.parentNode.insertBefore( + document.createTextNode(val.substr(pos + text.length)), + node.nextSibling)); + node.nodeValue = val.substr(0, pos); + } + } + else if (!jQuery(node).is("button, select, textarea")) { + jQuery.each(node.childNodes, function() { + highlight(this); + }); + } + } + return this.each(function() { + highlight(this); + }); +}; + +/** + * Small JavaScript module for the documentation. + */ +var Documentation = { + + init : function() { + this.fixFirefoxAnchorBug(); + this.highlightSearchWords(); + this.initIndexTable(); + }, + + /** + * i18n support + */ + TRANSLATIONS : {}, + PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; }, + LOCALE : 'unknown', + + // gettext and ngettext don't access this so that the functions + // can safely bound to a different name (_ = Documentation.gettext) + gettext : function(string) { + var translated = Documentation.TRANSLATIONS[string]; + if (typeof translated == 'undefined') + return string; + return (typeof translated == 'string') ? translated : translated[0]; + }, + + ngettext : function(singular, plural, n) { + var translated = Documentation.TRANSLATIONS[singular]; + if (typeof translated == 'undefined') + return (n == 1) ? singular : plural; + return translated[Documentation.PLURALEXPR(n)]; + }, + + addTranslations : function(catalog) { + for (var key in catalog.messages) + this.TRANSLATIONS[key] = catalog.messages[key]; + this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')'); + this.LOCALE = catalog.locale; + }, + + /** + * add context elements like header anchor links + */ + addContextElements : function() { + $('div[id] > :header:first').each(function() { + $('\u00B6'). + attr('href', '#' + this.id). + attr('title', _('Permalink to this headline')). + appendTo(this); + }); + $('dt[id]').each(function() { + $('\u00B6'). + attr('href', '#' + this.id). + attr('title', _('Permalink to this definition')). + appendTo(this); + }); + }, + + /** + * workaround a firefox stupidity + */ + fixFirefoxAnchorBug : function() { + if (document.location.hash && $.browser.mozilla) + window.setTimeout(function() { + document.location.href += ''; + }, 10); + }, + + /** + * highlight the search words provided in the url in the text + */ + highlightSearchWords : function() { + var params = $.getQueryParameters(); + var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : []; + if (terms.length) { + var body = $('div.body'); + window.setTimeout(function() { + $.each(terms, function() { + body.highlightText(this.toLowerCase(), 'highlighted'); + }); + }, 10); + $('') + .appendTo($('#searchbox')); + } + }, + + /** + * init the domain index toggle buttons + */ + initIndexTable : function() { + var togglers = $('img.toggler').click(function() { + var src = $(this).attr('src'); + var idnum = $(this).attr('id').substr(7); + $('tr.cg-' + idnum).toggle(); + if (src.substr(-9) == 'minus.png') + $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); + else + $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); + }).css('display', ''); + if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { + togglers.click(); + } + }, + + /** + * helper function to hide the search marks again + */ + hideSearchWords : function() { + $('#searchbox .highlight-link').fadeOut(300); + $('span.highlighted').removeClass('highlighted'); + }, + + /** + * make the url absolute + */ + makeURL : function(relativeURL) { + return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL; + }, + + /** + * get the current relative url + */ + getCurrentURL : function() { + var path = document.location.pathname; + var parts = path.split(/\//); + $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() { + if (this == '..') + parts.pop(); + }); + var url = parts.join('/'); + return path.substring(url.lastIndexOf('/') + 1, path.length - 1); + } +}; + +// quick alias for translations +_ = Documentation.gettext; + +$(document).ready(function() { + Documentation.init(); +}); diff --git a/doc/build/html/_static/down-pressed.png b/doc/build/html/_static/down-pressed.png new file mode 100644 index 0000000..6f7ad78 Binary files /dev/null and b/doc/build/html/_static/down-pressed.png differ diff --git a/doc/build/html/_static/down.png b/doc/build/html/_static/down.png new file mode 100644 index 0000000..3003a88 Binary files /dev/null and b/doc/build/html/_static/down.png differ diff --git a/doc/build/html/_static/file.png b/doc/build/html/_static/file.png new file mode 100644 index 0000000..d18082e Binary files /dev/null and b/doc/build/html/_static/file.png differ diff --git a/doc/build/html/_static/jquery.js b/doc/build/html/_static/jquery.js new file mode 100644 index 0000000..198b3ff --- /dev/null +++ b/doc/build/html/_static/jquery.js @@ -0,0 +1,4 @@ +/*! jQuery v1.7.1 jquery.com | jquery.org/license */ +(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"":"")+""),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;g=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
a",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="
"+""+"
",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="
t
",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="
",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")}; +f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&i.push({elem:this,matches:d.slice(e)});for(j=0;j0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
","
"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function() +{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); \ No newline at end of file diff --git a/doc/build/html/_static/minus.png b/doc/build/html/_static/minus.png new file mode 100644 index 0000000..da1c562 Binary files /dev/null and b/doc/build/html/_static/minus.png differ diff --git a/doc/build/html/_static/plus.png b/doc/build/html/_static/plus.png new file mode 100644 index 0000000..b3cb374 Binary files /dev/null and b/doc/build/html/_static/plus.png differ diff --git a/doc/build/html/_static/pygments.css b/doc/build/html/_static/pygments.css new file mode 100644 index 0000000..1a14f2a --- /dev/null +++ b/doc/build/html/_static/pygments.css @@ -0,0 +1,62 @@ +.highlight .hll { background-color: #ffffcc } +.highlight { background: #eeffcc; } +.highlight .c { color: #408090; font-style: italic } /* Comment */ +.highlight .err { border: 1px solid #FF0000 } /* Error */ +.highlight .k { color: #007020; font-weight: bold } /* Keyword */ +.highlight .o { color: #666666 } /* Operator */ +.highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */ +.highlight .cp { color: #007020 } /* Comment.Preproc */ +.highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */ +.highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */ +.highlight .gd { color: #A00000 } /* Generic.Deleted */ +.highlight .ge { font-style: italic } /* Generic.Emph */ +.highlight .gr { color: #FF0000 } /* Generic.Error */ +.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ +.highlight .gi { color: #00A000 } /* Generic.Inserted */ +.highlight .go { color: #303030 } /* Generic.Output */ +.highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ +.highlight .gs { font-weight: bold } /* Generic.Strong */ +.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +.highlight .gt { color: #0040D0 } /* Generic.Traceback */ +.highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */ +.highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */ +.highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */ +.highlight .kp { color: #007020 } /* Keyword.Pseudo */ +.highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */ +.highlight .kt { color: #902000 } /* Keyword.Type */ +.highlight .m { color: #208050 } /* Literal.Number */ +.highlight .s { color: #4070a0 } /* Literal.String */ +.highlight .na { color: #4070a0 } /* Name.Attribute */ +.highlight .nb { color: #007020 } /* Name.Builtin */ +.highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */ +.highlight .no { color: #60add5 } /* Name.Constant */ +.highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */ +.highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */ +.highlight .ne { color: #007020 } /* Name.Exception */ +.highlight .nf { color: #06287e } /* Name.Function */ +.highlight .nl { color: #002070; font-weight: bold } /* Name.Label */ +.highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ +.highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */ +.highlight .nv { color: #bb60d5 } /* Name.Variable */ +.highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */ +.highlight .w { color: #bbbbbb } /* Text.Whitespace */ +.highlight .mf { color: #208050 } /* Literal.Number.Float */ +.highlight .mh { color: #208050 } /* Literal.Number.Hex */ +.highlight .mi { color: #208050 } /* Literal.Number.Integer */ +.highlight .mo { color: #208050 } /* Literal.Number.Oct */ +.highlight .sb { color: #4070a0 } /* Literal.String.Backtick */ +.highlight .sc { color: #4070a0 } /* Literal.String.Char */ +.highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */ +.highlight .s2 { color: #4070a0 } /* Literal.String.Double */ +.highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */ +.highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */ +.highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */ +.highlight .sx { color: #c65d09 } /* Literal.String.Other */ +.highlight .sr { color: #235388 } /* Literal.String.Regex */ +.highlight .s1 { color: #4070a0 } /* Literal.String.Single */ +.highlight .ss { color: #517918 } /* Literal.String.Symbol */ +.highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */ +.highlight .vc { color: #bb60d5 } /* Name.Variable.Class */ +.highlight .vg { color: #bb60d5 } /* Name.Variable.Global */ +.highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */ +.highlight .il { color: #208050 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/doc/build/html/_static/searchtools.js b/doc/build/html/_static/searchtools.js new file mode 100644 index 0000000..56676b2 --- /dev/null +++ b/doc/build/html/_static/searchtools.js @@ -0,0 +1,622 @@ +/* + * searchtools.js_t + * ~~~~~~~~~~~~~~~~ + * + * Sphinx JavaScript utilties for the full-text search. + * + * :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + + +/** + * Porter Stemmer + */ +var Stemmer = function() { + + var step2list = { + ational: 'ate', + tional: 'tion', + enci: 'ence', + anci: 'ance', + izer: 'ize', + bli: 'ble', + alli: 'al', + entli: 'ent', + eli: 'e', + ousli: 'ous', + ization: 'ize', + ation: 'ate', + ator: 'ate', + alism: 'al', + iveness: 'ive', + fulness: 'ful', + ousness: 'ous', + aliti: 'al', + iviti: 'ive', + biliti: 'ble', + logi: 'log' + }; + + var step3list = { + icate: 'ic', + ative: '', + alize: 'al', + iciti: 'ic', + ical: 'ic', + ful: '', + ness: '' + }; + + var c = "[^aeiou]"; // consonant + var v = "[aeiouy]"; // vowel + var C = c + "[^aeiouy]*"; // consonant sequence + var V = v + "[aeiou]*"; // vowel sequence + + var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0 + var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1 + var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1 + var s_v = "^(" + C + ")?" + v; // vowel in stem + + this.stemWord = function (w) { + var stem; + var suffix; + var firstch; + var origword = w; + + if (w.length < 3) + return w; + + var re; + var re2; + var re3; + var re4; + + firstch = w.substr(0,1); + if (firstch == "y") + w = firstch.toUpperCase() + w.substr(1); + + // Step 1a + re = /^(.+?)(ss|i)es$/; + re2 = /^(.+?)([^s])s$/; + + if (re.test(w)) + w = w.replace(re,"$1$2"); + else if (re2.test(w)) + w = w.replace(re2,"$1$2"); + + // Step 1b + re = /^(.+?)eed$/; + re2 = /^(.+?)(ed|ing)$/; + if (re.test(w)) { + var fp = re.exec(w); + re = new RegExp(mgr0); + if (re.test(fp[1])) { + re = /.$/; + w = w.replace(re,""); + } + } + else if (re2.test(w)) { + var fp = re2.exec(w); + stem = fp[1]; + re2 = new RegExp(s_v); + if (re2.test(stem)) { + w = stem; + re2 = /(at|bl|iz)$/; + re3 = new RegExp("([^aeiouylsz])\\1$"); + re4 = new RegExp("^" + C + v + "[^aeiouwxy]$"); + if (re2.test(w)) + w = w + "e"; + else if (re3.test(w)) { + re = /.$/; + w = w.replace(re,""); + } + else if (re4.test(w)) + w = w + "e"; + } + } + + // Step 1c + re = /^(.+?)y$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(s_v); + if (re.test(stem)) + w = stem + "i"; + } + + // Step 2 + re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + suffix = fp[2]; + re = new RegExp(mgr0); + if (re.test(stem)) + w = stem + step2list[suffix]; + } + + // Step 3 + re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + suffix = fp[2]; + re = new RegExp(mgr0); + if (re.test(stem)) + w = stem + step3list[suffix]; + } + + // Step 4 + re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; + re2 = /^(.+?)(s|t)(ion)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(mgr1); + if (re.test(stem)) + w = stem; + } + else if (re2.test(w)) { + var fp = re2.exec(w); + stem = fp[1] + fp[2]; + re2 = new RegExp(mgr1); + if (re2.test(stem)) + w = stem; + } + + // Step 5 + re = /^(.+?)e$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(mgr1); + re2 = new RegExp(meq1); + re3 = new RegExp("^" + C + v + "[^aeiouwxy]$"); + if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) + w = stem; + } + re = /ll$/; + re2 = new RegExp(mgr1); + if (re.test(w) && re2.test(w)) { + re = /.$/; + w = w.replace(re,""); + } + + // and turn initial Y back to y + if (firstch == "y") + w = firstch.toLowerCase() + w.substr(1); + return w; + } +} + + + +/** + * Simple result scoring code. + */ +var Scorer = { + // Implement the following function to further tweak the score for each result + // The function takes a result array [filename, title, anchor, descr, score] + // and returns the new score. + /* + score: function(result) { + return result[4]; + }, + */ + + // query matches the full name of an object + objNameMatch: 11, + // or matches in the last dotted part of the object name + objPartialMatch: 6, + // Additive scores depending on the priority of the object + objPrio: {0: 15, // used to be importantResults + 1: 5, // used to be objectResults + 2: -5}, // used to be unimportantResults + // Used when the priority is not in the mapping. + objPrioDefault: 0, + + // query found in title + title: 15, + // query found in terms + term: 5 +}; + + +/** + * Search Module + */ +var Search = { + + _index : null, + _queued_query : null, + _pulse_status : -1, + + init : function() { + var params = $.getQueryParameters(); + if (params.q) { + var query = params.q[0]; + $('input[name="q"]')[0].value = query; + this.performSearch(query); + } + }, + + loadIndex : function(url) { + $.ajax({type: "GET", url: url, data: null, + dataType: "script", cache: true, + complete: function(jqxhr, textstatus) { + if (textstatus != "success") { + document.getElementById("searchindexloader").src = url; + } + }}); + }, + + setIndex : function(index) { + var q; + this._index = index; + if ((q = this._queued_query) !== null) { + this._queued_query = null; + Search.query(q); + } + }, + + hasIndex : function() { + return this._index !== null; + }, + + deferQuery : function(query) { + this._queued_query = query; + }, + + stopPulse : function() { + this._pulse_status = 0; + }, + + startPulse : function() { + if (this._pulse_status >= 0) + return; + function pulse() { + var i; + Search._pulse_status = (Search._pulse_status + 1) % 4; + var dotString = ''; + for (i = 0; i < Search._pulse_status; i++) + dotString += '.'; + Search.dots.text(dotString); + if (Search._pulse_status > -1) + window.setTimeout(pulse, 500); + } + pulse(); + }, + + /** + * perform a search for something (or wait until index is loaded) + */ + performSearch : function(query) { + // create the required interface elements + this.out = $('#search-results'); + this.title = $('

' + _('Searching') + '

').appendTo(this.out); + this.dots = $('').appendTo(this.title); + this.status = $('

').appendTo(this.out); + this.output = $('
'); + } + // Prettify the comment rating. + comment.pretty_rating = comment.rating + ' point' + + (comment.rating == 1 ? '' : 's'); + // Make a class (for displaying not yet moderated comments differently) + comment.css_class = comment.displayed ? '' : ' moderate'; + // Create a div for this comment. + var context = $.extend({}, opts, comment); + var div = $(renderTemplate(commentTemplate, context)); + + // If the user has voted on this comment, highlight the correct arrow. + if (comment.vote) { + var direction = (comment.vote == 1) ? 'u' : 'd'; + div.find('#' + direction + 'v' + comment.id).hide(); + div.find('#' + direction + 'u' + comment.id).show(); + } + + if (opts.moderator || comment.text != '[deleted]') { + div.find('a.reply').show(); + if (comment.proposal_diff) + div.find('#sp' + comment.id).show(); + if (opts.moderator && !comment.displayed) + div.find('#cm' + comment.id).show(); + if (opts.moderator || (opts.username == comment.username)) + div.find('#dc' + comment.id).show(); + } + return div; + } + + /** + * A simple template renderer. Placeholders such as <%id%> are replaced + * by context['id'] with items being escaped. Placeholders such as <#id#> + * are not escaped. + */ + function renderTemplate(template, context) { + var esc = $(document.createElement('div')); + + function handle(ph, escape) { + var cur = context; + $.each(ph.split('.'), function() { + cur = cur[this]; + }); + return escape ? esc.text(cur || "").html() : cur; + } + + return template.replace(/<([%#])([\w\.]*)\1>/g, function() { + return handle(arguments[2], arguments[1] == '%' ? true : false); + }); + } + + /** Flash an error message briefly. */ + function showError(message) { + $(document.createElement('div')).attr({'class': 'popup-error'}) + .append($(document.createElement('div')) + .attr({'class': 'error-message'}).text(message)) + .appendTo('body') + .fadeIn("slow") + .delay(2000) + .fadeOut("slow"); + } + + /** Add a link the user uses to open the comments popup. */ + $.fn.comment = function() { + return this.each(function() { + var id = $(this).attr('id').substring(1); + var count = COMMENT_METADATA[id]; + var title = count + ' comment' + (count == 1 ? '' : 's'); + var image = count > 0 ? opts.commentBrightImage : opts.commentImage; + var addcls = count == 0 ? ' nocomment' : ''; + $(this) + .append( + $(document.createElement('a')).attr({ + href: '#', + 'class': 'sphinx-comment-open' + addcls, + id: 'ao' + id + }) + .append($(document.createElement('img')).attr({ + src: image, + alt: 'comment', + title: title + })) + .click(function(event) { + event.preventDefault(); + show($(this).attr('id').substring(2)); + }) + ) + .append( + $(document.createElement('a')).attr({ + href: '#', + 'class': 'sphinx-comment-close hidden', + id: 'ah' + id + }) + .append($(document.createElement('img')).attr({ + src: opts.closeCommentImage, + alt: 'close', + title: 'close' + })) + .click(function(event) { + event.preventDefault(); + hide($(this).attr('id').substring(2)); + }) + ); + }); + }; + + var opts = { + processVoteURL: '/_process_vote', + addCommentURL: '/_add_comment', + getCommentsURL: '/_get_comments', + acceptCommentURL: '/_accept_comment', + deleteCommentURL: '/_delete_comment', + commentImage: '/static/_static/comment.png', + closeCommentImage: '/static/_static/comment-close.png', + loadingImage: '/static/_static/ajax-loader.gif', + commentBrightImage: '/static/_static/comment-bright.png', + upArrow: '/static/_static/up.png', + downArrow: '/static/_static/down.png', + upArrowPressed: '/static/_static/up-pressed.png', + downArrowPressed: '/static/_static/down-pressed.png', + voting: false, + moderator: false + }; + + if (typeof COMMENT_OPTIONS != "undefined") { + opts = jQuery.extend(opts, COMMENT_OPTIONS); + } + + var popupTemplate = '\ +
\ +

\ + Sort by:\ + best rated\ + newest\ + oldest\ +

\ +
Comments
\ +
\ + loading comments...
\ +
    \ +
    \ +

    Add a comment\ + (markup):

    \ +
    \ + reStructured text markup: *emph*, **strong**, \ + ``code``, \ + code blocks: :: and an indented block after blank line
    \ +
    \ + \ +

    \ + \ + Propose a change ▹\ + \ + \ + Propose a change ▿\ + \ +

    \ + \ + \ + \ + \ + \ +
    \ +
    '; + + var commentTemplate = '\ +
    \ +
    \ +
    \ + \ + \ + \ + \ + \ + \ +
    \ +
    \ + \ + \ + \ + \ + \ + \ +
    \ +
    \ +
    \ +

    \ + <%username%>\ + <%pretty_rating%>\ + <%time.delta%>\ +

    \ +
    <#text#>
    \ +

    \ + \ + reply ▿\ + proposal ▹\ + proposal ▿\ + \ + \ +

    \ +
    \
    +<#proposal_diff#>\
    +        
    \ +
      \ +
      \ +
      \ +
      \ + '; + + var replyTemplate = '\ +
    • \ +
      \ +
      \ + \ + \ + \ + \ + \ + \ +
      \ +
    • '; + + $(document).ready(function() { + init(); + }); +})(jQuery); + +$(document).ready(function() { + // add comment anchors for all paragraphs that are commentable + $('.sphinx-has-comment').comment(); + + // highlight search words in search results + $("div.context").each(function() { + var params = $.getQueryParameters(); + var terms = (params.q) ? params.q[0].split(/\s+/) : []; + var result = $(this); + $.each(terms, function() { + result.highlightText(this.toLowerCase(), 'highlighted'); + }); + }); + + // directly open comment window if requested + var anchor = document.location.hash; + if (anchor.substring(0, 9) == '#comment-') { + $('#ao' + anchor.substring(9)).click(); + document.location.hash = '#s' + anchor.substring(9); + } +}); diff --git a/doc/build/html/flake8_integration.html b/doc/build/html/flake8_integration.html new file mode 100644 index 0000000..02570ff --- /dev/null +++ b/doc/build/html/flake8_integration.html @@ -0,0 +1,774 @@ + + + + + + + + Auto generated documentation — gedit Flake8 integration 0.1 documentation + + + + + + + + + + + + + + + +
      +
      +
      +
      + +
      +

      Auto generated documentation¶

      +
      +

      Plugin¶

      +

      Plugin for gedit that allow flake8 integration

      +
      +++ + + + + + + + + + + + +
      author:Sébastien CHAZALLET <s.chazallet@gmail.com>
      organization:InsPyration EURL
      copyright:Copyright © InsPyration EURL <www.inspyration.org>
      license:GPL 3 <http://www.gnu.org/licenses/gpl.html>
      version:0.1
      + +
      +

      Integrated¶

      +

      Module used to manage the results of flake8 :

      +

      > 1. get them instead of print them ; +> 2. format them ;

      +

      This module works with Python2 and Python3

      + +++ + + + + + + + + + + + +
      author:Sébastien CHAZALLET <s.chazallet@gmail.com>
      organization:InsPyration EURL
      copyright:Copyright © InsPyration EURL <www.inspyration.org>
      license:GPL 3 <http://www.gnu.org/licenses/gpl.html>
      version:0.1
      +
      +
      +flake8_integration.integrated._format_flake8_results(warnings)[source]¶
      +

      Function used to extract useful informations from flake8 results

      + +++ + + + + + + + +
      Parameters:warnings (str) – Warnings generated by flake8
      Return type:list
      Returns:list of (code:str, line:int, col:int, description:str)
      +
      >>> result = _format_flake8_results(
      +...     '''stdin:1:10: E901 SyntaxError: unexpected EOF while parsing
      +...     stdin:2:1: E901 TokenError: EOF in multi-line statement''')
      +>>> for r in result:
      +...     print r
      +...
      +(' e901', 1, 10, 'SyntaxError: unexpected EOF while parsing')
      +(' e901', 2, 1, 'TokenError: EOF in multi-line statement')
      +
      +
      +
      + +
      +
      +flake8_integration.integrated._intercept_printed(action, *args, **kwargs)[source]¶
      +

      Function used to redirect printed to returned value

      + +++ + + + + + + + +
      Parameters:action (function) – Called function that we intercept prints
      Return type:str
      Returns:all that was printed by the call of action
      +
      >>> def do():
      +...     print('Hello World')
      +...
      +>>> result = _intercept_printed(do)
      +>>> print(result)
      +Hello World
      +
      +
      +
      + +
      +
      +flake8_integration.integrated.check_code_and_get_formated_result(code, ignore=(), complexity=-1)[source]¶
      +

      Function used to return the printed result of flake8 check_code function

      +
      >>> result = check_code_with_flake8("a = 42")
      +>>> print(result)
      +
      +>>> result = check_code_with_flake8("a = f(42")
      +>>> print(result)
      +stdin:1:10: E901 SyntaxError: unexpected EOF while parsing
      +stdin:2:1: E901 TokenError: EOF in multi-line statement
      +
      +
      +
      + +
      +
      +

      Window activatable¶

      +

      Main module of the Plugin for gedit that allow flake8 integration

      + +++ + + + + + + + + + + + +
      author:Sébastien CHAZALLET <s.chazallet@gmail.com>
      organization:InsPyration EURL
      copyright:Copyright © InsPyration EURL <www.inspyration.org>
      license:GPL 3 <http://www.gnu.org/licenses/gpl.html>
      version:0.1
      +
      +
      +class flake8_integration.windowactivatable.GeditFlake8WindowActivatable[source]¶
      +

      Main module of the gedit flake8 plugin

      +
      +
      +__init__()[source]¶
      +

      Initialize plugin

      + +++ + + + + + +
      Parameters:action (function) – Called function that we intercept prints
      Return type:None
      +
      + +
      +
      +do_activate()[source]¶
      +

      Activate the plugin

      + +++ + + + + + +
      Parameters:self (GeditFlake8WindowActivatable) – Current plugin
      Return type:None
      +
      + +
      +
      +do_create_configure_widget()[source]¶
      +

      Action when a user want to configure the plugin

      + +++ + + + + + + + +
      Parameters:self (GeditFlake8WindowActivatable) – Current plugin
      Return type:GeditFlake8ConfigWidget
      Returns:a configuration widget
      +
      + +
      +
      +do_deactivate()[source]¶
      +

      Deactivate the plugin

      + +++ + + + + + +
      Parameters:self (GeditFlake8WindowActivatable) – Current plugin
      Return type:None
      +
      + +
      +
      +do_update_state()[source]¶
      +

      Allow to activate the plugin only if the document is python code +If the document is a new document, it hasto be saved or the language of +the document has to be set.

      + +++ + + + + + +
      Parameters:self (GeditFlake8WindowActivatable) – Current plugin
      Return type:None
      +
      + +
      +
      +on_check_source_code(action)[source]¶
      +

      The user ask to check code source : +1check there is a doc and the doc is python code +2use flake8 +3put flake8 results into the tree and activate it

      + +++ + + + + + +
      Parameters:
        +
      • self (GeditFlake8WindowActivatable) – Current plugin
      • +
      • action (Gtk.Action) – Called function that we intercept prints
      • +
      +
      Return type:

      None

      +
      +
      + +
      + +
      +
      +

      Tree¶

      +

      Module managing the tree and all stuff around it

      + +++ + + + + + + + + + + + +
      author:Sébastien CHAZALLET <s.chazallet@gmail.com>
      organization:InsPyration EURL
      copyright:Copyright © InsPyration EURL <www.inspyration.org>
      license:GPL 3 <http://www.gnu.org/licenses/gpl.html>
      version:0.1
      +
      +
      +class flake8_integration.tree.GeditFlake8Tree(window)[source]¶
      +

      Tree inside gedit side panel containing all flake8 warnings

      +
      +
      +__init__(window)[source]¶
      +

      Configure tree columns, tree selection and add it to side panel

      + +++ + + + + + +
      Parameters:
        +
      • self (GeditFlake8Tree) – Current tree
      • +
      • window (Gedit.Window) – GEdit window object
      • +
      +
      Return type:

      None

      +
      +
      + +
      +
      +activate()[source]¶
      +

      show the tree in the side panel

      + +++ + + + + + +
      Parameters:self (GeditFlake8Tree) – Current tree
      Return type:None
      +
      + +
      +
      +on_tree_selection(selection)[source]¶
      +

      When a tree line is selected, go to the file linked line

      + +++ + + + + + +
      Parameters:
        +
      • self (GeditFlake8Tree) – Current tree
      • +
      • selection (Gtk.TreeSelection) – Current selection
      • +
      +
      Return type:

      None

      +
      +
      + +
      +
      +remove()[source]¶
      +

      remove the tree from the side panel

      + +++ + + + + + +
      Parameters:self (GeditFlake8Tree) – Current tree
      Return type:None
      +
      + +
      +
      +update_model(datas)[source]¶
      +

      Update the tree with new datas

      + +++ + + + + + +
      Parameters:
        +
      • self (GeditFlake8Tree) – Current tree
      • +
      • datas (list) – list of ready to use (str, int, int, str) tuples
      • +
      +
      Return type:

      None

      +
      +
      + +
      + +
      +
      +

      Settings¶

      +

      Module used to define how to manage settings and their persistence

      + +++ + + + + + + + + + + + +
      author:Sébastien CHAZALLET <s.chazallet@gmail.com>
      organization:InsPyration EURL
      copyright:Copyright © InsPyration EURL <www.inspyration.org>
      license:GPL 3 <http://www.gnu.org/licenses/gpl.html>
      version:0.1
      +
      +
      +class flake8_integration.settings.SettingsManager[source]¶
      +

      Allow to manage local settings and it persistent storage

      +
      +
      +__init__()[source]¶
      +

      Initialize Settings Manager

      + +++ + + + + + +
      Parameters:self (SettingsManager) – Current manager
      Return type:None
      +
      + +
      +
      +__weakref__¶
      +

      list of weak references to the object (if defined)

      +
      + +
      +
      +get_complexity()[source]¶
      +

      Get the user defined complexity parameter

      + +++ + + + + + + + +
      Parameters:self (SettingsManager) – Current manager
      Return type:int
      Returns:complexity
      +
      + +
      +
      +get_complexity_key()[source]¶
      +

      Allow to share information about key used to store complexity

      + +++ + + + + + + + +
      Parameters:self (SettingsManager) – Current manager
      Return type:str
      Returns:name of the complexity key
      +
      + +
      +
      +get_ignore_items()[source]¶
      +

      Allow to share information about keys used to store ignore list

      + +++ + + + + + + + +
      Parameters:self (SettingsManager) – Current manager
      Return type:list of tuple of str
      Returns:list of (ignore key, ignore label)
      +
      + +
      +
      +get_ignore_keys()[source]¶
      +

      Allow to share information about keys used to store ignore list

      + +++ + + + + + + + +
      Parameters:self (SettingsManager) – Current manager
      Return type:list of str
      Returns:list of ignore keys
      +
      + +
      +
      +get_ignore_list()[source]¶
      +

      Get the user defined warning keys to ignore

      + +++ + + + + + + + +
      Parameters:self (SettingsManager) – Current manager
      Return type:list of str
      Returns:list of warning keys
      +
      + +
      +
      +is_in_ignore_list(key)[source]¶
      +

      Answer to “Is tag in ignore list ?” question

      + +++ + + + + + + + +
      Parameters:
        +
      • self (SettingsManager) – Current manager
      • +
      • key (str) – flake8 key as defined in FLAKE8_IGNORED_KEYS
      • +
      +
      Return type:

      bool

      +
      Returns:

      True if the key is in ignore list, False otherwise

      +
      +
      + +
      +
      +pull_settings()[source]¶
      +

      Pull operation update local settings from persistent storage

      + +++ + + + + + +
      Parameters:self (SettingsManager) – Current manager
      Return type:None
      +
      + +
      +
      +push_settings()[source]¶
      +

      Push operation allow persistent storage update from local settings

      + +++ + + + + + +
      Parameters:self (SettingsManager) – Current manager
      Return type:None
      +
      + +
      +
      +update_setting(values={})[source]¶
      +

      Updating settings allow to update local and persistent settings

      + +++ + + + + + +
      Parameters:
        +
      • self (SettingsManager) – Current manager
      • +
      • values (dict) – values to store persistently
      • +
      +
      Return type:

      None

      +
      +
      + +
      + +
      +
      +

      Configuration¶

      +

      Module used to configure plugin from an easy-to-use widget

      + +++ + + + + + + + + + + + +
      author:Sébastien CHAZALLET <s.chazallet@gmail.com>
      organization:InsPyration EURL
      copyright:Copyright © InsPyration EURL <www.inspyration.org>
      license:GPL 3 <http://www.gnu.org/licenses/gpl.html>
      version:0.1
      +
      +
      +class flake8_integration.configuration.GeditFlake8ConfigWidget(settings)[source]¶
      +
      +
      +__init__(settings)[source]¶
      +

      Initialize the configuration widget from SettingsManager properties

      + +++ + + + + + +
      Parameters:
        +
      • self (GeditFlake8ConfigWidget) – Current widget
      • +
      • settings (SettingsManager) – Object used to define all configurable properties
      • +
      +
      Return type:

      None

      +
      +
      + +
      +
      +on_configure_destroy(widget)[source]¶
      +

      Called when the widget is destroyed

      + +++ + + + + + +
      Parameters:
        +
      • self (GeditFlake8ConfigWidget) – Current widget
      • +
      • widget (GeditFlake8ConfigWidget) – Current widget
      • +
      +
      Return type:

      None

      +
      +
      + +
      + +
      +
      +

      Status¶

      +

      This plugin is under active development.

      +
      + + + + + + +
      +
      +

      Table Of Contents

      + + +

      Previous topic

      +

      Welcome to gedit Flake8 integration’s documentation!

      +

      This Page

      + + + +
      +
      +
      + + + + + \ No newline at end of file diff --git a/doc/build/html/genindex.html b/doc/build/html/genindex.html new file mode 100644 index 0000000..74258a8 --- /dev/null +++ b/doc/build/html/genindex.html @@ -0,0 +1,347 @@ + + + + + + + + + Index — gedit Flake8 integration 0.1 documentation + + + + + + + + + + + + + + +
      +
      +
      +
      + + +

      Index

      + +
      + _ + | A + | C + | D + | F + | G + | I + | O + | P + | R + | S + | U + +
      +

      _

      + + + +
      + +
      __init__() (flake8_integration.configuration.GeditFlake8ConfigWidget method) +
      + +
      + +
      (flake8_integration.settings.SettingsManager method) +
      + + +
      (flake8_integration.tree.GeditFlake8Tree method) +
      + + +
      (flake8_integration.windowactivatable.GeditFlake8WindowActivatable method) +
      + +
      + +
      __weakref__ (flake8_integration.settings.SettingsManager attribute) +
      + +
      + +
      _format_flake8_results() (in module flake8_integration.integrated) +
      + + +
      _intercept_printed() (in module flake8_integration.integrated) +
      + +
      + +

      A

      + + +
      + +
      activate() (flake8_integration.tree.GeditFlake8Tree method) +
      + +
      + +

      C

      + + +
      + +
      check_code_and_get_formated_result() (in module flake8_integration.integrated) +
      + +
      + +

      D

      + + + +
      + +
      do_activate() (flake8_integration.windowactivatable.GeditFlake8WindowActivatable method) +
      + + +
      do_create_configure_widget() (flake8_integration.windowactivatable.GeditFlake8WindowActivatable method) +
      + +
      + +
      do_deactivate() (flake8_integration.windowactivatable.GeditFlake8WindowActivatable method) +
      + + +
      do_update_state() (flake8_integration.windowactivatable.GeditFlake8WindowActivatable method) +
      + +
      + +

      F

      + + + +
      + +
      flake8_integration (module) +
      + + +
      flake8_integration.configuration (module) +
      + + +
      flake8_integration.integrated (module) +
      + +
      + +
      flake8_integration.settings (module) +
      + + +
      flake8_integration.tree (module) +
      + + +
      flake8_integration.windowactivatable (module) +
      + +
      + +

      G

      + + + +
      + +
      GeditFlake8ConfigWidget (class in flake8_integration.configuration) +
      + + +
      GeditFlake8Tree (class in flake8_integration.tree) +
      + + +
      GeditFlake8WindowActivatable (class in flake8_integration.windowactivatable) +
      + + +
      get_complexity() (flake8_integration.settings.SettingsManager method) +
      + +
      + +
      get_complexity_key() (flake8_integration.settings.SettingsManager method) +
      + + +
      get_ignore_items() (flake8_integration.settings.SettingsManager method) +
      + + +
      get_ignore_keys() (flake8_integration.settings.SettingsManager method) +
      + + +
      get_ignore_list() (flake8_integration.settings.SettingsManager method) +
      + +
      + +

      I

      + + +
      + +
      is_in_ignore_list() (flake8_integration.settings.SettingsManager method) +
      + +
      + +

      O

      + + + +
      + +
      on_check_source_code() (flake8_integration.windowactivatable.GeditFlake8WindowActivatable method) +
      + + +
      on_configure_destroy() (flake8_integration.configuration.GeditFlake8ConfigWidget method) +
      + +
      + +
      on_tree_selection() (flake8_integration.tree.GeditFlake8Tree method) +
      + +
      + +

      P

      + + + +
      + +
      pull_settings() (flake8_integration.settings.SettingsManager method) +
      + +
      + +
      push_settings() (flake8_integration.settings.SettingsManager method) +
      + +
      + +

      R

      + + +
      + +
      remove() (flake8_integration.tree.GeditFlake8Tree method) +
      + +
      + +

      S

      + + +
      + +
      SettingsManager (class in flake8_integration.settings) +
      + +
      + +

      U

      + + + +
      + +
      update_model() (flake8_integration.tree.GeditFlake8Tree method) +
      + +
      + +
      update_setting() (flake8_integration.settings.SettingsManager method) +
      + +
      + + + +
      +
      +
      +
      +
      + + + + + +
      +
      +
      +
      + + + + \ No newline at end of file diff --git a/doc/build/html/index.html b/doc/build/html/index.html new file mode 100644 index 0000000..49a1a6f --- /dev/null +++ b/doc/build/html/index.html @@ -0,0 +1,138 @@ + + + + + + + + Welcome to gedit Flake8 integration’s documentation! — gedit Flake8 integration 0.1 documentation + + + + + + + + + + + + + + + +
      +
      +
      +
      + +
      +

      Welcome to gedit Flake8 integration’s documentation!¶

      +

      Contents:

      + +
      +
      +

      Indices and tables¶

      + +
      + + +
      +
      +
      +
      +
      +

      Table Of Contents

      + + +

      Next topic

      +

      Auto generated documentation

      +

      This Page

      + + + +
      +
      +
      +
      + + + + \ No newline at end of file diff --git a/doc/build/html/objects.inv b/doc/build/html/objects.inv new file mode 100644 index 0000000..f143d47 Binary files /dev/null and b/doc/build/html/objects.inv differ diff --git a/doc/build/html/py-modindex.html b/doc/build/html/py-modindex.html new file mode 100644 index 0000000..47f803c --- /dev/null +++ b/doc/build/html/py-modindex.html @@ -0,0 +1,135 @@ + + + + + + + + Python Module Index — gedit Flake8 integration 0.1 documentation + + + + + + + + + + + + + + + + + +
      +
      +
      +
      + + +

      Python Module Index

      + +
      + f +
      + + + + + + + + + + + + + + + + + + + + + + +
       
      + f
      + flake8_integration +
          + flake8_integration.configuration +
          + flake8_integration.integrated +
          + flake8_integration.settings +
          + flake8_integration.tree +
          + flake8_integration.windowactivatable +
      + + +
      +
      +
      +
      +
      + + +
      +
      +
      +
      + + + + \ No newline at end of file diff --git a/doc/build/html/search.html b/doc/build/html/search.html new file mode 100644 index 0000000..eb9fae8 --- /dev/null +++ b/doc/build/html/search.html @@ -0,0 +1,106 @@ + + + + + + + + Search — gedit Flake8 integration 0.1 documentation + + + + + + + + + + + + + + + + + + + + +
      +
      +
      +
      + +

      Search

      +
      + +

      + Please activate JavaScript to enable the search + functionality. +

      +
      +

      + From here you can search these documents. Enter your search + words into the box below and click "search". Note that the search + function will automatically search for all of the words. Pages + containing fewer words won't appear in the result list. +

      +
      + + + +
      + +
      + +
      + +
      +
      +
      +
      +
      +
      +
      +
      +
      + + + + \ No newline at end of file diff --git a/doc/build/html/searchindex.js b/doc/build/html/searchindex.js new file mode 100644 index 0000000..0b79aab --- /dev/null +++ b/doc/build/html/searchindex.js @@ -0,0 +1 @@ +Search.setIndex({envversion:42,terms:{all:0,code:0,show:0,syntaxerror:0,settingsmanag:0,"3put":0,"__weakref__":0,languag:0,paramet:0,redirect:0,content:1,onli:0,copyright:0,how:0,gtk:0,activ:0,add:0,complex:0,dict:0,persist:0,main:0,local:0,deactiv:0,them:0,sourc:0,"return":0,around:0,format:0,fals:0,none:0,initi:0,on_configure_destroi:0,world:0,flake8_integr:0,python3:0,python2:0,name:0,organ:0,geditflake8configwidget:0,geditflake8windowactivat:0,list:0,get_ignore_list:0,stuff:0,contain:0,"_intercept_print":0,eurl:0,manag:0,www:0,work:0,do_update_st:0,blanklin:0,result:0,arg:0,extract:0,gmail:0,index:1,get_ignore_item:0,get_ignore_kei:0,kei:0,tokenerror:0,label:0,current:0,version:0,on_check_source_cod:0,print:0,"new":0,refer:0,widget:0,object:0,update_set:0,insid:0,weak:0,intercept:0,ask:0,org:0,do_deactiv:0,geditflake8tre:0,valu:0,panel:0,update_model:0,about:0,easi:0,column:0,"s\u00e9bastien":0,page:1,chazallet:0,action:0,treeselect:0,com:0,col:0,user:0,oper:0,modul:[0,1],storag:0,select:0,gpl:0,e901:0,from:0,do_create_configure_widget:0,licens:0,question:0,"2use":0,"int":0,call:0,statement:0,check_cod:0,inspyr:0,type:0,store:0,"function":0,unexpect:0,tupl:0,under:0,search:1,warn:0,pars:0,pull_set:0,line:0,"true":0,check_code_with_flake8:0,eof:0,pull:0,multi:0,save:0,gnu:0,remov:0,properti:0,defin:0,"while":0,kwarg:0,str:0,doc:0,otherwis:0,def:0,get_complexity_kei:0,readi:0,do_activ:0,side:0,gedit:0,tag:0,file:0,check:0,"__init__":0,develop:0,want:0,author:0,destroi:0,self:0,get:0,when:0,check_code_and_get_formated_result:0,python:0,html:0,bool:0,answer:0,instead:0,get_complex:0,updat:0,http:0,thi:0,is_in_ignore_list:0,windowactivat:0,flake8:0,share:0,"_format_flake8_result":0,data:0,"class":0,"1check":0,push_set:0,flake8_ignored_kei:0,stdin:0,descript:0,on_tree_select:0,inform:0,ignor:0,allow:0,push:0,link:0,hello:0,hasto:0},objtypes:{"0":"py:module","1":"py:method","2":"py:function","3":"py:attribute","4":"py:class"},objnames:{"0":["py","module","Python module"],"1":["py","method","Python method"],"2":["py","function","Python function"],"3":["py","attribute","Python attribute"],"4":["py","class","Python class"]},filenames:["flake8_integration","index"],titles:["Auto generated documentation","Welcome to gedit Flake8 integration’s documentation!"],objects:{"":{flake8_integration:[0,0,1,""]},"flake8_integration.settings.SettingsManager":{get_ignore_keys:[0,1,1,""],get_ignore_items:[0,1,1,""],push_settings:[0,1,1,""],is_in_ignore_list:[0,1,1,""],update_setting:[0,1,1,""],get_ignore_list:[0,1,1,""],pull_settings:[0,1,1,""],get_complexity_key:[0,1,1,""],get_complexity:[0,1,1,""],"__weakref__":[0,3,1,""],"__init__":[0,1,1,""]},"flake8_integration.settings":{SettingsManager:[0,4,1,""]},"flake8_integration.configuration":{GeditFlake8ConfigWidget:[0,4,1,""]},"flake8_integration.windowactivatable.GeditFlake8WindowActivatable":{do_update_state:[0,1,1,""],on_check_source_code:[0,1,1,""],do_activate:[0,1,1,""],do_create_configure_widget:[0,1,1,""],do_deactivate:[0,1,1,""],"__init__":[0,1,1,""]},"flake8_integration.windowactivatable":{GeditFlake8WindowActivatable:[0,4,1,""]},"flake8_integration.tree":{GeditFlake8Tree:[0,4,1,""]},flake8_integration:{configuration:[0,0,1,""],tree:[0,0,1,""],integrated:[0,0,1,""],windowactivatable:[0,0,1,""],settings:[0,0,1,""]},"flake8_integration.integrated":{"_format_flake8_results":[0,2,1,""],"_intercept_printed":[0,2,1,""],check_code_and_get_formated_result:[0,2,1,""]},"flake8_integration.tree.GeditFlake8Tree":{update_model:[0,1,1,""],activate:[0,1,1,""],on_tree_selection:[0,1,1,""],remove:[0,1,1,""],"__init__":[0,1,1,""]},"flake8_integration.configuration.GeditFlake8ConfigWidget":{on_configure_destroy:[0,1,1,""],"__init__":[0,1,1,""]}},titleterms:{statu:0,set:0,welcom:1,plugin:0,auto:0,gener:0,configur:0,tree:0,gedit:1,window:0,integr:[0,1],indic:1,tabl:1,document:[0,1],activat:0,flake8:1}}) \ No newline at end of file diff --git a/doc/make.bat b/doc/make.bat new file mode 100644 index 0000000..5357979 --- /dev/null +++ b/doc/make.bat @@ -0,0 +1,242 @@ +@ECHO OFF + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set BUILDDIR=build +set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source +set I18NSPHINXOPTS=%SPHINXOPTS% source +if NOT "%PAPER%" == "" ( + set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% + set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% +) + +if "%1" == "" goto help + +if "%1" == "help" ( + :help + echo.Please use `make ^` where ^ is one of + echo. html to make standalone HTML files + echo. dirhtml to make HTML files named index.html in directories + echo. singlehtml to make a single large HTML file + echo. pickle to make pickle files + echo. json to make JSON files + echo. htmlhelp to make HTML files and a HTML help project + echo. qthelp to make HTML files and a qthelp project + echo. devhelp to make HTML files and a Devhelp project + echo. epub to make an epub + echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter + echo. text to make text files + echo. man to make manual pages + echo. texinfo to make Texinfo files + echo. gettext to make PO message catalogs + echo. changes to make an overview over all changed/added/deprecated items + echo. xml to make Docutils-native XML files + echo. pseudoxml to make pseudoxml-XML files for display purposes + echo. linkcheck to check all external links for integrity + echo. doctest to run all doctests embedded in the documentation if enabled + goto end +) + +if "%1" == "clean" ( + for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i + del /q /s %BUILDDIR%\* + goto end +) + + +%SPHINXBUILD% 2> nul +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "html" ( + %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/html. + goto end +) + +if "%1" == "dirhtml" ( + %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. + goto end +) + +if "%1" == "singlehtml" ( + %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. + goto end +) + +if "%1" == "pickle" ( + %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can process the pickle files. + goto end +) + +if "%1" == "json" ( + %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can process the JSON files. + goto end +) + +if "%1" == "htmlhelp" ( + %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can run HTML Help Workshop with the ^ +.hhp project file in %BUILDDIR%/htmlhelp. + goto end +) + +if "%1" == "qthelp" ( + %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can run "qcollectiongenerator" with the ^ +.qhcp project file in %BUILDDIR%/qthelp, like this: + echo.^> qcollectiongenerator %BUILDDIR%\qthelp\geditFlake8integration.qhcp + echo.To view the help file: + echo.^> assistant -collectionFile %BUILDDIR%\qthelp\geditFlake8integration.ghc + goto end +) + +if "%1" == "devhelp" ( + %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. + goto end +) + +if "%1" == "epub" ( + %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The epub file is in %BUILDDIR%/epub. + goto end +) + +if "%1" == "latex" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "latexpdf" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + cd %BUILDDIR%/latex + make all-pdf + cd %BUILDDIR%/.. + echo. + echo.Build finished; the PDF files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "latexpdfja" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + cd %BUILDDIR%/latex + make all-pdf-ja + cd %BUILDDIR%/.. + echo. + echo.Build finished; the PDF files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "text" ( + %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The text files are in %BUILDDIR%/text. + goto end +) + +if "%1" == "man" ( + %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The manual pages are in %BUILDDIR%/man. + goto end +) + +if "%1" == "texinfo" ( + %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. + goto end +) + +if "%1" == "gettext" ( + %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The message catalogs are in %BUILDDIR%/locale. + goto end +) + +if "%1" == "changes" ( + %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes + if errorlevel 1 exit /b 1 + echo. + echo.The overview file is in %BUILDDIR%/changes. + goto end +) + +if "%1" == "linkcheck" ( + %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck + if errorlevel 1 exit /b 1 + echo. + echo.Link check complete; look for any errors in the above output ^ +or in %BUILDDIR%/linkcheck/output.txt. + goto end +) + +if "%1" == "doctest" ( + %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest + if errorlevel 1 exit /b 1 + echo. + echo.Testing of doctests in the sources finished, look at the ^ +results in %BUILDDIR%/doctest/output.txt. + goto end +) + +if "%1" == "xml" ( + %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The XML files are in %BUILDDIR%/xml. + goto end +) + +if "%1" == "pseudoxml" ( + %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml. + goto end +) + +:end diff --git a/doc/source/conf.py b/doc/source/conf.py new file mode 100644 index 0000000..5767377 --- /dev/null +++ b/doc/source/conf.py @@ -0,0 +1,310 @@ +# -*- coding: utf-8 -*- +# +# gedit Flake8 integration documentation build configuration file, created by +# sphinx-quickstart on Mon Apr 8 11:46:38 2013. +# +# This file is execfile()d with the current directory set to its containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys, os + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +sys.path.insert(0, os.path.abspath(os.path.join('..', '..'))) + +# -- General configuration ----------------------------------------------------- + +# If your documentation needs a minimal Sphinx version, state it here. +#needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be extensions +# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.pngmath', 'sphinx.ext.mathjax', 'sphinx.ext.viewcode'] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The encoding of source files. +#source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'gedit Flake8 integration' +copyright = u'2013, Sébastien CHAZALLET' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = '0.1' +# The full version, including alpha/beta/rc tags. +release = '0.1' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +#language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = [] + +# The reST default role (used for this markup: `text`) to use for all documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + +# If true, keep warnings as "system message" paragraphs in the built documents. +#keep_warnings = False + + +# -- Options for HTML output --------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = 'default' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_domain_indices = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +#html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +#html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = None + +# Output file base name for HTML help builder. +htmlhelp_basename = 'geditFlake8integrationdoc' + + +# -- Options for LaTeX output -------------------------------------------------- + +latex_elements = { +# The paper size ('letterpaper' or 'a4paper'). +#'papersize': 'letterpaper', + +# The font size ('10pt', '11pt' or '12pt'). +#'pointsize': '10pt', + +# Additional stuff for the LaTeX preamble. +#'preamble': '', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, documentclass [howto/manual]). +latex_documents = [ + ('index', 'geditFlake8integration.tex', u'gedit Flake8 integration Documentation', + u'Sébastien CHAZALLET', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# If true, show page references after internal links. +#latex_show_pagerefs = False + +# If true, show URL addresses after external links. +#latex_show_urls = False + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_domain_indices = True + + +# -- Options for manual page output -------------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + ('index', 'geditflake8integration', u'gedit Flake8 integration Documentation', + [u'Sébastien CHAZALLET'], 1) +] + +# If true, show URL addresses after external links. +#man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------------ + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + ('index', 'geditFlake8integration', u'gedit Flake8 integration Documentation', + u'Sébastien CHAZALLET', 'geditFlake8integration', 'One line description of project.', + 'Miscellaneous'), +] + +# Documents to append as an appendix to all manuals. +#texinfo_appendices = [] + +# If false, no module index is generated. +#texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +#texinfo_show_urls = 'footnote' + +# If true, do not generate a @detailmenu in the "Top" node's menu. +#texinfo_no_detailmenu = False + + +# -- Options for Epub output --------------------------------------------------- + +# Bibliographic Dublin Core info. +epub_title = u'gedit Flake8 integration' +epub_author = u'Sébastien CHAZALLET' +epub_publisher = u'Sébastien CHAZALLET' +epub_copyright = u'2013, Sébastien CHAZALLET' + +# The language of the text. It defaults to the language option +# or en if the language is not set. +#epub_language = '' + +# The scheme of the identifier. Typical schemes are ISBN or URL. +#epub_scheme = '' + +# The unique identifier of the text. This can be a ISBN number +# or the project homepage. +#epub_identifier = '' + +# A unique identification for the text. +#epub_uid = '' + +# A tuple containing the cover image and cover page html template filenames. +#epub_cover = () + +# A sequence of (type, uri, title) tuples for the guide element of content.opf. +#epub_guide = () + +# HTML files that should be inserted before the pages created by sphinx. +# The format is a list of tuples containing the path and title. +#epub_pre_files = [] + +# HTML files shat should be inserted after the pages created by sphinx. +# The format is a list of tuples containing the path and title. +#epub_post_files = [] + +# A list of files that should not be packed into the epub file. +#epub_exclude_files = [] + +# The depth of the table of contents in toc.ncx. +#epub_tocdepth = 3 + +# Allow duplicate toc entries. +#epub_tocdup = True + +# Fix unsupported image types using the PIL. +#epub_fix_images = False + +# Scale large images. +#epub_max_image_width = 0 + +# If 'no', URL addresses will not be shown. +#epub_show_urls = 'inline' + +# If false, no index is generated. +#epub_use_index = True + + +# Example configuration for intersphinx: refer to the Python standard library. +intersphinx_mapping = {'http://docs.python.org/': None} diff --git a/doc/source/flake8_integration.rst b/doc/source/flake8_integration.rst new file mode 100644 index 0000000..02418fa --- /dev/null +++ b/doc/source/flake8_integration.rst @@ -0,0 +1,60 @@ +Auto generated documentation +============================ + +Plugin +------ +.. automodule:: flake8_integration + :members: + :private-members: + :special-members: + +Integrated +---------- + +.. automodule:: flake8_integration.integrated + :members: + :private-members: + :special-members: + +Window activatable +------------------ + +.. automodule:: flake8_integration.windowactivatable + :members: + :private-members: + :special-members: + +Tree +---- + +.. automodule:: flake8_integration.tree + :members: + :private-members: + :special-members: + +Settings +-------- + +.. automodule:: flake8_integration.settings + :members: + :private-members: + :special-members: + +Configuration +------------- + +.. automodule:: flake8_integration.configuration + :members: + :private-members: + :special-members: + +.. autoclass:: GeditFlake8ConfigWidget + :members: + :private-members: + :special-members: + +Status +------ + +This plugin is under active development. + diff --git a/doc/source/index.rst b/doc/source/index.rst new file mode 100644 index 0000000..53e9347 --- /dev/null +++ b/doc/source/index.rst @@ -0,0 +1,23 @@ +.. gedit Flake8 integration documentation master file, created by + sphinx-quickstart on Mon Apr 8 11:46:38 2013. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to gedit Flake8 integration's documentation! +==================================================== + +Contents: + +.. toctree:: + :maxdepth: 2 + + flake8_integration + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + diff --git a/flake8_integration.plugin b/flake8_integration.plugin new file mode 100644 index 0000000..cb0d9d6 --- /dev/null +++ b/flake8_integration.plugin @@ -0,0 +1,9 @@ +[Plugin] +Loader=python +Module=flake8_integration +IAge=3 +Name=Flake8 for gedit +Description=Check your python source code with Flake8 +Authors=Sébastien CHAZALLET +Copyright=Copyright © 2013 CHAZALLET Sébastien +Website=http://inspyration.org \ No newline at end of file diff --git a/flake8_integration/__init__.py b/flake8_integration/__init__.py new file mode 100644 index 0000000..840ec99 --- /dev/null +++ b/flake8_integration/__init__.py @@ -0,0 +1,12 @@ +#-*- coding: utf-8 -*- +"""Plugin for gedit that allow flake8 integration + +:author: Sébastien CHAZALLET +:organization: InsPyration EURL +:copyright: Copyright © InsPyration EURL +:license: GPL 3 + +:version: 0.1 +""" + +from windowactivatable import GeditFlake8WindowActivatable diff --git a/flake8_integration/__init__.pyc b/flake8_integration/__init__.pyc new file mode 100644 index 0000000..3d0f0bb Binary files /dev/null and b/flake8_integration/__init__.pyc differ diff --git a/flake8_integration/config.pyc b/flake8_integration/config.pyc new file mode 100644 index 0000000..b53b03b Binary files /dev/null and b/flake8_integration/config.pyc differ diff --git a/flake8_integration/configuration.py b/flake8_integration/configuration.py new file mode 100644 index 0000000..f497ff7 --- /dev/null +++ b/flake8_integration/configuration.py @@ -0,0 +1,97 @@ +#-*- coding: utf8 -*- + +"""Module used to configure plugin from an easy-to-use widget + +:author: Sébastien CHAZALLET +:organization: InsPyration EURL +:copyright: Copyright © InsPyration EURL +:license: GPL 3 + +:version: 0.1 +""" + +from gettext import gettext as _ + +from gi.repository import Gtk + + +STUFF = 1 + + +class GeditFlake8ConfigWidget(Gtk.Box): + + def __init__(self, settings): + """Initialize the configuration widget from SettingsManager properties + + :type self: GeditFlake8ConfigWidget + :param self: Current widget + + :type settings: SettingsManager + :param settings: Object used to define all configurable properties + + :rtype: None + """ + + # the current widget is a box + Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL, spacing=6) + + # reference to settings + self.settings = settings + + # store useful entries into a dictionary + # in order to get their values later + self.entries = {} + + # Add a label on the top ot widget + self.pack_start(Gtk.Label(_("Add to ignore list")), True, True, 0) + + # create one checkbox for each warning that can be ignored + for key, option in self.settings.get_ignore_items(): + button = Gtk.CheckButton(option) + button.set_active(self.settings.is_in_ignore_list(key)) + self.pack_start(button, True, True, 0) + # add the check button to entries + self.entries[key] = button + + # create an Hbox to get the label and the entry on the same line + hbox = Gtk.Box(spacing=3) + self.pack_start(hbox, True, True, 0) + + # label for complexity entry + hbox.pack_start(Gtk.Label(_("Complexity")), True, True, 0) + + # complexity entry is an widget allowing us to be sure to have an int + complexity_entry = Gtk.SpinButton() + complexity_entry.set_adjustment(Gtk.Adjustment( + self.settings.get_complexity(), -1, 21, 1, 1, 1)) + hbox.pack_start(complexity_entry, True, True, 0) + # add the widget to entries + self.entries[self.settings.get_complexity_key()] = complexity_entry + + # add an event to get back values and use them + self.connect("destroy", self.on_configure_destroy) + + def on_configure_destroy(self, widget): + """Called when the widget is destroyed + + :type self: GeditFlake8ConfigWidget + :param self: Current widget + + :type widget: GeditFlake8ConfigWidget + :param widget: Current widget + + :rtype: None + """ + + # extract complexity form element and get complexity value + complexity = int( + self.entries.pop(self.settings.get_complexity_key()).get_text()) + + # extract all other values + values = {k: v.get_active() for k, v in self.entries.items()} + + # add back complexity value + values[self.settings.get_complexity_key()] = complexity + + # update settings + self.settings.update_setting(values) diff --git a/flake8_integration/configuration.pyc b/flake8_integration/configuration.pyc new file mode 100644 index 0000000..ba6630c Binary files /dev/null and b/flake8_integration/configuration.pyc differ diff --git a/flake8_integration/integrated.py b/flake8_integration/integrated.py new file mode 100644 index 0000000..178bccb --- /dev/null +++ b/flake8_integration/integrated.py @@ -0,0 +1,102 @@ +#-*- coding: utf8 -*- + +"""Module used to manage the results of flake8 : + +> 1. get them instead of print them ; +> 2. format them ; + +This module works with Python2 and Python3 + +:author: Sébastien CHAZALLET +:organization: InsPyration EURL +:copyright: Copyright © InsPyration EURL +:license: GPL 3 + +:version: 0.1 +""" + + +import sys +if sys.version_info.major == 2: + from io import BytesIO as IO +else: + from io import StringIO as IO + +from flake8.main import check_code + + +def _intercept_printed(action, *args, **kwargs): + """Function used to redirect printed to returned value + + :type action: function + :param action: Called function that we intercept prints + + :rtype: str + :return: all that was printed by the call of action + + >>> def do(): + ... print('Hello World') + ... + >>> result = _intercept_printed(do) + >>> print(result) + Hello World + + """ + with IO() as buff: + out, sys.stdout = sys.stdout, buff + action(*args, **kwargs) + sys.stdout = out + buff.seek(0) + return buff.read() + + +def _format_flake8_results(warnings): + """Function used to extract useful informations from flake8 results + + :type warnings: str + :param warnings: Warnings generated by flake8 + + :rtype: list + :return: list of (code:str, line:int, col:int, description:str) + + >>> result = _format_flake8_results( + ... '''stdin:1:10: E901 SyntaxError: unexpected EOF while parsing + ... stdin:2:1: E901 TokenError: EOF in multi-line statement''') + >>> for r in result: + ... print r + ... + (' e901', 1, 10, 'SyntaxError: unexpected EOF while parsing') + (' e901', 2, 1, 'TokenError: EOF in multi-line statement') + """ + result = [] + for warning in warnings.splitlines(): + cols = warning.split(':') + result.append((cols[3][:5].lower(), + int(cols[1]), + int(cols[2]), + cols[3][6:] + ':' + ':'.join(cols[4:]))) + return result + + +def check_code_and_get_formated_result(code, ignore=(), complexity=-1): + """Function used to return the printed result of flake8 check_code function + + >>> result = check_code_with_flake8("a = 42") + >>> print(result) + + >>> result = check_code_with_flake8("a = f(42") + >>> print(result) + stdin:1:10: E901 SyntaxError: unexpected EOF while parsing + stdin:2:1: E901 TokenError: EOF in multi-line statement + + """ + return _format_flake8_results( + _intercept_printed( + check_code, + **{"code": code, "ignore": ignore, "complexity": complexity})) + + +if __name__ == '__main__': + import doctest + doctest.testmod() + diff --git a/flake8_integration/integrated.pyc b/flake8_integration/integrated.pyc new file mode 100644 index 0000000..79e5272 Binary files /dev/null and b/flake8_integration/integrated.pyc differ diff --git a/flake8_integration/org.gnome.gedit.plugins.flake8_integration.gschema.xml b/flake8_integration/org.gnome.gedit.plugins.flake8_integration.gschema.xml new file mode 100644 index 0000000..56d966f --- /dev/null +++ b/flake8_integration/org.gnome.gedit.plugins.flake8_integration.gschema.xml @@ -0,0 +1,35 @@ + + + + + false + identation contains tabs + Add "W191: identation contains tabs" to ignore list ? + + + false + trailling whitespace + Add "W291: trailling whitespace" to ignore list ? + + + false + no new line at end of file + Add "W292: no new line at end of file" to ignore list ? + + + false + blank line contains whitespace + Add "W293: blank line contains whitespace" to ignore list ? + + + false + blank line at end of file + Add "W391: blank line at end of file" to ignore list ? + + + -1 + complexity (mccabe) + any value > 0 enables complexity checking with mccabe + + + diff --git a/flake8_integration/settings.py b/flake8_integration/settings.py new file mode 100644 index 0000000..1a398d4 --- /dev/null +++ b/flake8_integration/settings.py @@ -0,0 +1,170 @@ +#-*- coding: utf-8 -*- + +"""Module used to define how to manage settings and their persistence + +:author: Sébastien CHAZALLET +:organization: InsPyration EURL +:copyright: Copyright © InsPyration EURL +:license: GPL 3 + +:version: 0.1 +""" + +from gettext import gettext as _ + +from gi.repository import Gio + +FLAKE8_KEY_BASE = 'org.gnome.gedit.plugins.flake8_integration' + +FLAKE8_KEY_W191 = "w191" +FLAKE8_KEY_W291 = "w291" +FLAKE8_KEY_W292 = "w292" +FLAKE8_KEY_W293 = "w293" +FLAKE8_KEY_W391 = "w391" + +FLAKE8_IGNORED_KEYS = (FLAKE8_KEY_W191, FLAKE8_KEY_W291, FLAKE8_KEY_W292, + FLAKE8_KEY_W293, FLAKE8_KEY_W391) + +CONFIG_OPTIONS = {FLAKE8_KEY_W191: _("w191: identation contains tabs"), + FLAKE8_KEY_W291: _("w291: trailling whitespace"), + FLAKE8_KEY_W292: _("w292: no new line at end of file"), + FLAKE8_KEY_W293: _("w293: blank line contains whitespace"), + FLAKE8_KEY_W391: _("w391: blank line at end of file")} + +FLAKE8_KEY_COMPLEXITY = "complexity" + + +class SettingsManager(object): + """Allow to manage local settings and it persistent storage""" + + def __init__(self): + """Initialize Settings Manager + + :type self: SettingsManager + :param self: Current manager + + :rtype: None + """ + + #_settings allow persistent storage of configuration + self._settings = Gio.Settings.new(FLAKE8_KEY_BASE) + #settings contains configuration usable in the plugin + self.settings = {} + # pull local settings from persistent storage + self.pull_settings() + + def pull_settings(self): + """Pull operation update local settings from persistent storage + + :type self: SettingsManager + :param self: Current manager + + :rtype: None + """ + + # pull ignore list + for tag in FLAKE8_IGNORED_KEYS: + self.settings[tag] = self._settings.get_boolean(tag) + # pull complexity + self.settings[FLAKE8_KEY_COMPLEXITY] = self._settings.get_int( + FLAKE8_KEY_COMPLEXITY) + + def push_settings(self): + """Push operation allow persistent storage update from local settings + + :type self: SettingsManager + :param self: Current manager + + :rtype: None + """ + + # push ignore list + for tag in FLAKE8_IGNORED_KEYS: + self._settings.set_boolean(tag, self.settings[tag]) + # push complexity + self._settings.set_int(FLAKE8_KEY_COMPLEXITY, + self.settings[FLAKE8_KEY_COMPLEXITY]) + + def update_setting(self, values={}): + """Updating settings allow to update local and persistent settings + + :type self: SettingsManager + :param self: Current manager + :type values: dict + :param values: values to store persistently + + :rtype: None + """ + # update local settings + self.settings.update(values) + # push local settings to persistent storage + self.push_settings() + + def get_ignore_keys(self): + """Allow to share information about keys used to store ignore list + + :type self: SettingsManager + :param self: Current manager + + :rtype: list of str + :return: list of ignore keys + """ + return FLAKE8_IGNORED_KEYS + + def get_ignore_items(self): + """Allow to share information about keys used to store ignore list + + :type self: SettingsManager + :param self: Current manager + + :rtype: list of tuple of str + :return: list of (ignore key, ignore label) + """ + return CONFIG_OPTIONS.items() + + def get_complexity_key(self): + """Allow to share information about key used to store complexity + + :type self: SettingsManager + :param self: Current manager + + :rtype: str + :return: name of the complexity key + """ + return FLAKE8_KEY_COMPLEXITY + + def is_in_ignore_list(self, key): + """Answer to "Is tag in ignore list ?" question + + :type self: SettingsManager + :param self: Current manager + :type key: str + :param key: flake8 key as defined in FLAKE8_IGNORED_KEYS + + :rtype: bool + :return: True if the key is in ignore list, False otherwise + """ + return self.settings[key] + + def get_ignore_list(self): + """Get the user defined warning keys to ignore + + :type self: SettingsManager + :param self: Current manager + + :rtype: list of str + :return: list of warning keys + """ + return [tag for tag, value in self.settings.items() + if tag in FLAKE8_IGNORED_KEYS and value is True] + + def get_complexity(self): + """Get the user defined complexity parameter + + :type self: SettingsManager + :param self: Current manager + + :rtype: int + :return: complexity + """ + return self.settings[FLAKE8_KEY_COMPLEXITY] diff --git a/flake8_integration/settings.pyc b/flake8_integration/settings.pyc new file mode 100644 index 0000000..a61c068 Binary files /dev/null and b/flake8_integration/settings.pyc differ diff --git a/flake8_integration/tree.py b/flake8_integration/tree.py new file mode 100644 index 0000000..438ebfb --- /dev/null +++ b/flake8_integration/tree.py @@ -0,0 +1,139 @@ +#-*- coding: utf-8 -*- + +"""Module managing the tree and all stuff around it + +:author: Sébastien CHAZALLET +:organization: InsPyration EURL +:copyright: Copyright © InsPyration EURL +:license: GPL 3 + +:version: 0.1 +""" + + +from gettext import gettext as _ + +from gi.repository import Gtk + +SP_COL_TITLES = (_("Code"), _("L"), _("C"), _("Errors / Warnings")) +SP_COL_TYPES = (str, int, int, str) + +PYTHON_ICON = 'gnome-mime-text-x-python' + + +class GeditFlake8Tree(Gtk.TreeView): + """Tree inside gedit side panel containing all flake8 warnings""" + + def __init__(self, window): + """Configure tree columns, tree selection and add it to side panel + + :type self: GeditFlake8Tree + :param self: Current tree + :type window: Gedit.Window + :param window: GEdit window object + + :rtype: None + """ + + # use a list store to manage warnings + Gtk.TreeView.__init__(self, Gtk.ListStore(*SP_COL_TYPES)) + + # compose window + self.window = window + + # create columns + for index, title in enumerate(SP_COL_TITLES): + self.append_column(Gtk.TreeViewColumn( + _(title), + Gtk.CellRendererText(), + text=index)) + + # Allow to do something when a tree line is selected + self.get_selection().connect("changed", self.on_tree_selection) + + # create an icon for the side panel + image = Gtk.Image() + image.set_from_icon_name(PYTHON_ICON, Gtk.IconSize.MENU) + + # get the side panel (created by GEdit) + sp = self.window.get_side_panel() + + # Add the tree in the side panel + sp.add_item( + self, + 'flake8_results', + _("Flake8 results"), + image + ) + + # set the side panel invisible + sp.set_property("visible", False) + + def remove(self): + """remove the tree from the side panel + + :type self: GeditFlake8Tree + :param self: Current tree + + :rtype: None + """ + + # get the side panel (created by GEdit) + sp = self.window.get_side_panel() + sp.remove_item(self) + + def activate(self): + """show the tree in the side panel + + :type self: GeditFlake8Tree + :param self: Current tree + + :rtype: None + """ + + sp = self.window.get_side_panel() + sp.set_property("visible", True) + sp.activate_item(self) + + def on_tree_selection(self, selection): + """When a tree line is selected, go to the file linked line + + :type self: GeditFlake8Tree + :param self: Current tree + :type selection: Gtk.TreeSelection + :param selection: Current selection + + :rtype: None + """ + + doc = self.window.get_active_document() + if not doc: + return + + # get the tree line selected and put the cursor to the file linked line + model, treeiter = selection.get_selected() + doc.goto_line(model[treeiter][1] - 1) + + # scroll the view to the cursor + self.window.get_active_view().scroll_to_cursor() + + def update_model(self, datas): + """Update the tree with new datas + + :type self: GeditFlake8Tree + :param self: Current tree + :type datas: list + :param datas: list of ready to use (str, int, int, str) tuples + + :rtype: None + """ + + # get the model (Gtk.ListStore) + model = self.get_model() + + # Empty model + model.clear() + + # Fill model with new values + for data in datas: + model.append(data) diff --git a/flake8_integration/tree.pyc b/flake8_integration/tree.pyc new file mode 100644 index 0000000..e3f43be Binary files /dev/null and b/flake8_integration/tree.pyc differ diff --git a/flake8_integration/windowactivatable.py b/flake8_integration/windowactivatable.py new file mode 100644 index 0000000..ae7d6d8 --- /dev/null +++ b/flake8_integration/windowactivatable.py @@ -0,0 +1,184 @@ +#-*- coding: utf-8 -*- + +"""Main module of the Plugin for gedit that allow flake8 integration + +:author: Sébastien CHAZALLET +:organization: InsPyration EURL +:copyright: Copyright © InsPyration EURL +:license: GPL 3 + +:version: 0.1 +""" + + +from gettext import gettext as _ + +from gi.repository import GObject, Gtk, Gedit, PeasGtk + +from integrated import check_code_and_get_formated_result as check_code +from settings import SettingsManager +from tree import GeditFlake8Tree +from configuration import GeditFlake8ConfigWidget + +# Menu to insert in gedit's 'Tools' menu +ui_str = """ + + + + + + + + +""" + + +class GeditFlake8WindowActivatable(GObject.Object, + Gedit.WindowActivatable, + PeasGtk.Configurable): + """Main module of the gedit flake8 plugin""" + + __gtype_name__ = "GeditFlake8WindowActivatable" + + window = GObject.property(type=Gedit.Window) + + def __init__(self): + """Initialize plugin + + :type action: function + :param action: Called function that we intercept prints + + :rtype: None + """ + GObject.Object.__init__(self) + # Initialize settings + self._settings = SettingsManager() + self.flake8_tree = None + + def do_activate(self): + """Activate the plugin + + :type self: GeditFlake8WindowActivatable + :param self: Current plugin + + :rtype: None + """ + # Get the Gtk.UIManager + manager = self.window.get_ui_manager() + + # Create a new action group + self._action_group = Gtk.ActionGroup("GeditFlake8PluginActions") + self._action_group.add_actions([("GeditFlake8", + None, + _("Check Python source code"), + None, + _("Check Python source code"), + self.on_check_source_code)]) + + # Insert the action group + manager.insert_action_group(self._action_group, -1) + + # Merge the UI + self._ui_id = manager.add_ui_from_string(ui_str) + + # Create a tree + self.flake8_tree = GeditFlake8Tree(self.window) + + def do_deactivate(self): + """Deactivate the plugin + + :type self: GeditFlake8WindowActivatable + :param self: Current plugin + + :rtype: None + """ + # Remove the tree from the side panel + self.flake8_tree.remove() + + # Delete tree object + self.flake8_tree = None + + # Get the Gtk.UIManager + manager = self.window.get_ui_manager() + + # Remove the ui + manager.remove_ui(self._ui_id) + + # Remove the action group + manager.remove_action_group(self._action_group) + + # Delete the action group object + self._action_group = None + + # Make sure the manager updates + manager.ensure_update() + + def do_update_state(self): + """Allow to activate the plugin only if the document is python code + If the document is a new document, it hasto be saved or the language of + the document has to be set. + + :type self: GeditFlake8WindowActivatable + :param self: Current plugin + + :rtype: None + """ + state = False + doc = self.window.get_active_document() + if doc is not None: + language = doc.get_language() + if language is not None: + state = language.get_id() in ["python", "python3"] + self._action_group.set_sensitive(state) + + def do_create_configure_widget(self): + """Action when a user want to configure the plugin + + :type self: GeditFlake8WindowActivatable + :param self: Current plugin + + :rtype: GeditFlake8ConfigWidget + :return: a configuration widget + """ + return GeditFlake8ConfigWidget(self._settings) + + def on_check_source_code(self, action): + """The user ask to check code source : + 1\ check there is a doc and the doc is python code + 2\ use flake8 + 3\ put flake8 results into the tree and activate it + + :type self: GeditFlake8WindowActivatable + :param self: Current plugin + + :type action: Gtk.Action + :param action: Called function that we intercept prints + + :rtype: None + """ + + # Get the document content + doc = self.window.get_active_document() + if not doc: + return + + # check the language of current document is set + language = doc.get_language() + if language is None: + return + + # check the language of current document is python + if language.get_id() not in ["python", "python3"]: + return + + # Use flake8 to get warnings + warnings = check_code( + doc.get_text(doc.get_start_iter(), doc.get_end_iter(), False), + map(str.upper, self._settings.get_ignore_list()), + self._settings.get_complexity()) + + # Empty store + self.flake8_tree.update_model(warnings) + + # Activate tree + self.flake8_tree.activate() diff --git a/flake8_integration/windowactivatable.pyc b/flake8_integration/windowactivatable.pyc new file mode 100644 index 0000000..bb93558 Binary files /dev/null and b/flake8_integration/windowactivatable.pyc differ