DocumentationTools/QtHelpGenerator.py

changeset 945
8cd4d08fa9f6
parent 839
9605f699731f
child 1509
c0b5e693b0eb
--- a/DocumentationTools/QtHelpGenerator.py	Fri Mar 11 08:55:14 2011 +0100
+++ b/DocumentationTools/QtHelpGenerator.py	Fri Mar 11 16:51:57 2011 +0100
@@ -51,12 +51,13 @@
 HelpCollectionProjectFile = 'source.qhcp'
 HelpCollectionFile = 'collection.qhc'
 
+
 class QtHelpGenerator(object):
     """
     Class implementing the QtHelp generator for the builtin documentation generator.
     """
-    def __init__(self, htmlDir, 
-                 outputDir, namespace, virtualFolder, filterName, filterAttributes, 
+    def __init__(self, htmlDir,
+                 outputDir, namespace, virtualFolder, filterName, filterAttributes,
                  title, createCollection):
         """
         Constructor
@@ -82,9 +83,9 @@
         self.createCollection = createCollection
         
         self.packages = {
-            "00index" : {
-                "subpackages" : {},
-                "modules" : {}
+            "00index": {
+                "subpackages": {},
+                "modules": {}
             }
         }
         self.remembered = False
@@ -95,7 +96,7 @@
         Public method to remember a documentation file.
         
         @param file The filename to be remembered. (string)
-        @param moduleDocument The ModuleDocument object containing the 
+        @param moduleDocument The ModuleDocument object containing the
             information for the file.
         @param basename The basename of the file hierarchy to be documented.
             The basename is stripped off the filename if it starts with
@@ -120,11 +121,11 @@
             elt["subpackages"][package] = moduleDocument.name()
             
             self.packages[package] = {
-                "subpackages" : {},
-                "modules" : {}
+                "subpackages": {},
+                "modules": {}
             }
             
-            kwEntry = ("{0} (Package)".format(package.split('.')[-1]), 
+            kwEntry = ("{0} (Package)".format(package.split('.')[-1]),
                        joinext("index-{0}".format(package), ".html"))
             if kwEntry not in self.keywords:
                 self.keywords.append(kwEntry)
@@ -140,7 +141,7 @@
         elt["modules"][moduleDocument.name()] = moduleDocument.name()
         
         if "__init__" not in file:
-            kwEntry = ("{0} (Module)".format(moduleDocument.name().split('.')[-1]), 
+            kwEntry = ("{0} (Module)".format(moduleDocument.name().split('.')[-1]),
                        joinext(moduleDocument.name(), ".html"))
             if kwEntry not in self.keywords:
                 self.keywords.append(kwEntry)
@@ -160,8 +161,8 @@
         """
         indent = level * '  '
         indent1 = indent + '  '
-        s  = indent + '<section title="{0}" ref="{1}">\n'.format(
-            package == "00index" and self.title or package, 
+        s = indent + '<section title="{0}" ref="{1}">\n'.format(
+            package == "00index" and self.title or package,
              package == "00index" and \
                 joinext("index", ".html") or \
                 joinext("index-{0}".format(package), ".html"))
@@ -193,7 +194,7 @@
         else:
             return txt
     
-    def generateFiles(self, basename = "", newline = None):
+    def generateFiles(self, basename="", newline=None):
         """
         Public method to generate all index files.
         
@@ -222,30 +223,30 @@
              for kw in self.keywords])
         
         helpAttribs = {
-            "namespace" : self.namespace, 
-            "folder" : self.virtualFolder, 
-            "filter_name" : self.filterName, 
-            "filter_attributes" : filterAttribs, 
-            "sections" : sections, 
-            "keywords" : keywords, 
-            "files" : files, 
+            "namespace": self.namespace,
+            "folder": self.virtualFolder,
+            "filter_name": self.filterName,
+            "filter_attributes": filterAttribs,
+            "sections": sections,
+            "keywords": keywords,
+            "files": files,
         }
         
         txt = self.__convertEol(HelpProject.format(**helpAttribs), newline)
-        f = open(os.path.join(self.outputDir, HelpProjectFile), "w", 
-                 encoding = "utf-8", newline = newline)
+        f = open(os.path.join(self.outputDir, HelpProjectFile), "w",
+                 encoding="utf-8", newline=newline)
         f.write(txt)
         f.close()
         
         if self.createCollection and \
            not os.path.exists(os.path.join(self.outputDir, HelpCollectionProjectFile)):
             collectionAttribs = {
-                "helpfile" : HelpHelpFile, 
+                "helpfile": HelpHelpFile,
             }
             
             txt = self.__convertEol(HelpCollection.format(**collectionAttribs), newline)
-            f = open(os.path.join(self.outputDir, HelpCollectionProjectFile), 
-                     "w", encoding = "utf-8", newline = newline)
+            f = open(os.path.join(self.outputDir, HelpCollectionProjectFile),
+                     "w", encoding="utf-8", newline=newline)
             f.write(txt)
             f.close()
         
@@ -258,7 +259,7 @@
         # generate the compressed files
         shutil.copy(os.path.join(self.outputDir, HelpProjectFile), self.htmlDir)
         os.chdir(self.htmlDir)
-        subprocess.call(["qhelpgenerator", "source.qhp", 
+        subprocess.call(["qhelpgenerator", "source.qhp",
                          "-o", os.path.join(self.outputDir, HelpHelpFile)])
         os.remove(HelpProjectFile)
         

eric ide

mercurial