]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/docs/bin/docparser/wxclasses.py
3 html_heading
= "<H3><font color=\"red\">%s</font></H3>"
5 def stylesAsHtml(styles
, extraStyles
=False):
6 heading
= "Window styles"
8 heading
= "Extra window styles"
10 html
= html_heading
% heading
11 html
+= """<table width="95%">"""
13 html
+= "<tr><td>%s</td><td>%s</td>" % (style
[0], style
[1])
20 def __init__(self
, name
, description
="", derivedFrom
=[], styles
=[], extrastyles
=[]):
22 self
.description
= description
23 self
.derivedFrom
= derivedFrom
25 self
.extrastyles
= extrastyles
27 self
.propConflicts
= []
31 html
= "<H1>%s</H1>" % self
.name
32 html
+= self
.description
33 if len(self
.derivedFrom
) > 0:
34 html
+= html_heading
% "Derived from"
35 for der
in self
.derivedFrom
:
36 derurl
= der
.replace("wx.", "wx").lower()
37 html
+= "<a href=\"wx_%s.html\">%s</a></br>" % (derurl
, der
)
39 if len(self
.styles
) > 0:
40 html
+= stylesAsHtml(self
.styles
)
42 if len(self
.extrastyles
) > 0:
43 html
+= stylesAsHtml(self
.extrastyles
, extraStyles
=True)
48 restText
= "DocStr(%s,\n" % (self
.name
)
53 def createProps(self
):
56 for conflict
in self
.propConflicts
:
57 if conflict
in propList
:
58 propList
.remove(conflict
)
60 basename
= self
.name
.replace("wx", "")
64 if propname
[0] == "3":
65 propname
= "Three" + propname
[1:]
67 getter
= "wx.%s.Get%s" % (basename
, prop
)
68 setter
= "wx.%s.Set%s" % (basename
, prop
)
69 propsText
+= "wx.%s.%s = property(%s" % (basename
, propname
, getter
)
70 hasSetter
= eval("(\"%s\" in dir(wx.%s))" % ("Set" + prop
, basename
))
72 propsText
+= ", %s" % setter
81 def __init__(self
, name
, parent
, prototypes
=[], params
={}, description
="", remarks
=""):
84 self
.prototypes
= prototypes
86 self
.description
= description
87 self
.remarks
= remarks
89 self
.pythonOverrides
= []
94 # The below code converts prototypes into ReST, but currently isn't
95 # needed. Left here in case we change approach later.
97 #for proto in self.prototypes:
98 # restText += proto[1] + "("
100 # for arg in proto[2]:
101 # restText += "%s %s" % (arg[0].replace("wx.", ""), arg[1])
102 # if counter < len(proto[2]):
106 # restText += "-> " + proto[0]
110 if len(self
.params
) > 0:
112 for param
in self
.params
:
113 restText
+= "\n:param %s: %s" % (param
[0], restconvert
.htmlToReST(param
[1]))
116 restText
+= restconvert
.htmlToReST(self
.description
.strip())
120 anchorname
= self
.getAnchorName()
121 retval
= "<A name=\"%s\"></A>" % (anchorname
)
122 retval
+= "<H3>%s</H3>" % self
.name
123 if len(self
.pythonOverrides
) > 0:
124 for myfunc
in self
.pythonOverrides
:
125 retval
+= "<p><b>%s</b></br>%s</p>" % (myfunc
[0], myfunc
[1])
127 for proto
in self
.prototypes
:
130 retval
+= proto
[0] + " "
131 retval
+= proto
[1] + "("
134 retval
+= "%s <i>%s</i>" % (arg
[0], arg
[1])
135 if counter
< len(proto
[2]):
138 retval
+= ")</B></P>"
140 if len(self
.params
) > 0:
141 retval
+= "<table width=\"90%%\" cellspacing=\"10\">"
142 for param
in self
.params
:
143 retval
+= "<tr><td align=\"right\"><i>%s</i></td><td bgcolor=\"#E3E3E3\">%s</td></tr>" % (param
[0], param
[1])
146 retval
+= "<p>%s</p>" % self
.description
148 if self
.remarks
!= "":
149 retval
+= "<font color=\"red\">Remarks</font><h4>%s</h4></font>" % self
.remarks
153 def getAnchorName(self
):
154 anchorname
= self
.parent
.name
.lower() + self
.name
.lower()
155 if self
.parent
.name
== self
.name
:
156 anchorname
= self
.name
.lower()
161 retval
= "method: " + self
.name
162 retval
+= "\n\nprototypes: "
163 for proto
in self
.prototypes
:
164 retval
+= "\t%s" % `proto`
165 retval
+= "\n\nparams: "
166 for param
in self
.params
:
167 retval
+= "%s: %s" % (param
, self
.params
[param
])
169 retval
+= "\n\ndescription: \n" + self
.description
171 retval
+= "remarks: \n" + self
.remarks