commit/nvda: norrumar: Added hasDoc() method to check if the current add-on has documentation.

  • From: commits-noreply@xxxxxxxxxxxxx
  • To: nvda-addons-commits@xxxxxxxxxxxxx
  • Date: Sat, 22 Feb 2014 21:32:44 -0000

1 new commit in nvda:

https://bitbucket.org/nvdaaddonteam/nvda/commits/907c3a3e7fb6/
Changeset:   907c3a3e7fb6
Branch:      t2694
User:        norrumar
Date:        2014-02-22 22:31:56
Summary:     Added hasDoc() method to check if the current add-on has 
documentation.

Affected #:  1 file

diff --git a/source/addonHandler.py b/source/addonHandler.py
index c792447..4a96cfe 100644
--- a/source/addonHandler.py
+++ b/source/addonHandler.py
@@ -324,15 +324,20 @@ class Addon(object):
                return None
 
        def getDocPath(self):
-               docFileName = self.manifest['docname']
                docPath = self.getDocFolder()
-               if docPath is not None:
-                       docFile = os.path.join(docPath, docFileName)
-                       if os.path.isfile(docFile):
-                               docPath = docFile
+               if docPath is None: return None
+               docFileName = self.manifest['docname']
+               docFile = os.path.join(docPath, docFileName)
+               if os.path.isfile(docFile):
+                       docPath = docFile
                return docPath
 
+       def hasDoc(self):
+               if self.getDocPath() is None: return False
+               return os.path.exists(self.getDocPath())
+
        def openDocPath(self):
+               if not self.hasDoc(): return
                try:
                        os.startfile(self.getDocPath())
                except WindowsError:

Repository URL: https://bitbucket.org/nvdaaddonteam/nvda/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.

Other related posts:

  • » commit/nvda: norrumar: Added hasDoc() method to check if the current add-on has documentation. - commits-noreply