[nvda-addons] Re: commit/addonTemplate: norrumar: Support for addons documentation: initial commit.

  • From: Noelia <nrm1977@xxxxxxxxx>
  • To: nvda-addons@xxxxxxxxxxxxx
  • Date: Wed, 22 May 2013 23:10:25 +0200

Hello, I have tried to send a pull request for this new branch. You
can accept it in case you think it's useful.
Thanks.

2013/5/20, commits-noreply@xxxxxxxxxxxxx <commits-noreply@xxxxxxxxxxxxx>:
> 1 new commit in addonTemplate:
>
> https://bitbucket.org/nvdaaddonteam/addontemplate/commits/23e3b6657ac0/
> Changeset:   23e3b6657ac0
> Branch:      addonDocSupport
> User:        norrumar
> Date:        2013-05-20 20:53:14
> Summary:     Support for addons documentation: initial commit.
>
> Affected #:  2 files
>
> diff --git a/README.md b/README.md
> index c173c24..1a6d239 100644
> --- a/README.md
> +++ b/README.md
> @@ -33,6 +33,8 @@ To create a new NVDA add-on, taking advantage of this
> template:
>  - In the **buildVars.py** file, change variable **addon_info** with your
> add-on's information (name, summary, description, version, author and url).
>  - Put your code in the usual folders for NVDA extension, under the
> **addon** folder. For instance: globalPlugins, synthDrivers, etc. You can
> delete folders you don't need for your particular add-on package.
>  - Gettext translations must be placed into
> addon\locale\<lang>/LC_MESSAGES\nvda.po.
> +- Documentation files must be placed into addon\doc\<lang>/fileName,
> readme.html by default.
> +- You can copy docHandler.py to a globalPlugins or appModules folder. Then
> import it and use docHandler.openDocPath() to open the documentation file
> corresponding to NVDA's current language, or English by default.
>  - To package the add-on for distribution, open a command line, change to
> the folder that has the **SCONSTRUCT** file and run the **scons** command.
> The created add-on, if there were no errors, is placed in the current
> directory.
>  - You can further customize variables in the **buildVars.py** file.
>
>
> diff --git a/docHandler.py b/docHandler.py
> new file mode 100644
> index 0000000..da9c1d5
> --- /dev/null
> +++ b/docHandler.py
> @@ -0,0 +1,41 @@
> +# -*- coding: UTF-8 -*-
> +
> +# docHandler: module for managing addons documentation
> +# See: http://community.nvda-project.org/ticket/2694
> +
> +import os
> +import languageHandler
> +
> +_addonDir = os.path.join(os.path.dirname(__file__), "..") # The root of an
> addon folder
> +_docFileName = "readme.html" # The name of an addon documentation file
> +
> +def getDocFolder(addonDir=_addonDir):
> +     langs = [languageHandler.getLanguage(), "en"]
> +     for lang in langs:
> +             docFolder = os.path.join(addonDir, "doc", lang)
> +             if os.path.isdir(docFolder):
> +                     return docFolder
> +             if "_" in lang:
> +                     tryLang = lang.split("_")[0]
> +                     docFolder = os.path.join(addonDir, "doc", tryLang)
> +                     if os.path.isdir(docFolder):
> +                             return docFolder
> +                     if tryLang == "en":
> +                             break
> +             if lang == "en":
> +                     break
> +     return None
> +
> +def getDocPath(docFileName=_docFileName):
> +     docPath = getDocFolder()
> +     if docPath is not None:
> +             docFile = os.path.join(docPath, docFileName)
> +             if os.path.isfile(docFile):
> +                     docPath = docFile
> +     return docPath
> +
> +def openDocPath():
> +     try:
> +             os.startfile(getDocPath())
> +     except WindowsError:
> +             pass
> \ No newline at end of file
>
> Repository URL: https://bitbucket.org/nvdaaddonteam/addontemplate/
>
> --
>
> This is a commit notification from bitbucket.org. You are receiving
> this because you have the service enabled, addressing the recipient of
> this email.
> ----------------------------------------------------------------
>
> NVDA add-ons Central: A list for discussing NVDA add-ons
>
> To post a message, send an email to nvda-addons@xxxxxxxxxxxxx.
>
> To unsubscribe, send an email with the subject line of "unsubscribe"
> (without quotes) to nvda-addons-request@xxxxxxxxxxxxx.
>
> If you have questions for list moderators, please send a message to
> nvda-addons-moderators@xxxxxxxxxxxxx.
>
>
----------------------------------------------------------------

NVDA add-ons Central: A list for discussing NVDA add-ons

To post a message, send an email to nvda-addons@xxxxxxxxxxxxx.

To unsubscribe, send an email with the subject line of "unsubscribe" (without 
quotes) to nvda-addons-request@xxxxxxxxxxxxx.

If you have questions for list moderators, please send a message to 
nvda-addons-moderators@xxxxxxxxxxxxx.

Other related posts: