quality/apidox/src

Sebastian Kügler sebas at kde.org
Wed Mar 28 22:58:44 UTC 2012


SVN commit 1287531 by sebas:

Plasma QML apidox script works recursively now

This script now takes a base path, walks into it and generates a 
flat list of html files, just like for the plasma components 
previously.

The script should be run from kde-runtime/plasma/declarativeimports/ like so:

qmlapigenerator.py -v "Plasma Quick master" \
	-t /home/sebas/kdesvn/src/apidox/data \
	-i /home/sebas/kdesvn/src/kde-runtime/plasma/declarativeimports/  \
	-o out/ 

CCMAIL:winter at kde.org
CCMAIL:plasma-devel at kde.org



 M  +12 -15    qmlapigenerator.py  


--- trunk/quality/apidox/src/qmlapigenerator.py #1287530:1287531
@@ -9,6 +9,7 @@
 class File:
 	def __init__(self,string):
 		self.qmlFile = string + ".qml"
+		self.fullPath = ""
 		self.className = string
 		self.properties = {}
 		self.inherits = []
@@ -21,7 +22,7 @@
 		self.errorLine = 0
 	def createApi(self):
 		print self.className
-		f = open(qmlPath + '/' + self.qmlFile, "r")
+		f = open(self.fullPath, "r")
 		self.apiFlags = {"Inherits:" : False, "Imports:" : False, "Description:" : False, "Properties:" : False, "Signals:" : False, "Methods:": False}
 		insideApi = False
 		inherits = {}
@@ -58,9 +59,6 @@
 			self.error = True
 			self.errorLine = i
 
-
-
-
 	def retrieveInherits(self,string):
 		if self.apiFlags["Inherits:"] == True:
 			self.inherits.append(string)
@@ -202,8 +200,6 @@
 				contentsString += ('<li><a href="#' + self.signalsList()[key]["name"] + '">' + self.signalsList()[key]["name"] + "</a></li>")
 			contentsString += '</ul>'
 
-
-
 		if len(self.propertyList()) > 0:
 			contentsString += ("<h2>Properties</h2>")
 			for key in range(len(self.propertyList())):
@@ -258,10 +254,18 @@
 templateFile.close()
 
 linksHtml = '<ul>\n'
-for fileName in sorted(os.listdir(qmlPath)):
-	if '.qml' in fileName:
+
+for root, subFolders, files in os.walk(qmlPath):
+	for fileName in files:
+		if fileName.endswith('.qml'):
+			if (root.split('/')[-1] in ("test", "gallery", "touch", "private")): continue
 		className = fileName.replace(".qml", "")
+			parser = File(className)
+			parser.fullPath = root + "/" + fileName
+			parser.createApi()
+			parser.writeHtml()
 		linksHtml += '<li><a href="./' + className + '.html">' + className + '</a></li>\n'
+
 linksHtml += '</ul>\n'
 
 outFile = open(outPath + '/index.html',"w")
@@ -269,12 +273,5 @@
 outFile.write(templateString.format(*varg))
 outFile.close()
 
-for fileName in os.listdir(qmlPath):
-	if '.qml' in fileName:
-		className = fileName.replace(".qml", "")
-		parser = File(className)
-		parser.createApi()
-		parser.writeHtml()
 
 
-


More information about the Plasma-devel mailing list