@@ -62,6 +62,29 @@ def __init__(self, params, i):
62
62
self .parameter = params .Get_Parameter (i )
63
63
self .name = self .parameter .Get_Name ()
64
64
self .description = self .parameter .Get_Description ()
65
+ self .typeName = self .parameter .Get_Type_Name ()
66
+ if self .parameter .is_Output ():
67
+ self .typeName = "Output " + self .typeName
68
+ if self .parameter .is_Input ():
69
+ self .typeName = "Input " + self .typeName
70
+ typ = self .parameter .Get_Type ()
71
+ self .minimum = None
72
+ self .maximum = None
73
+ if (typ == saga .PARAMETER_TYPE_Int ) or \
74
+ (typ == saga .PARAMETER_TYPE_Double ) or \
75
+ (typ == saga .PARAMETER_TYPE_Degree ) or \
76
+ (typ == saga .PARAMETER_TYPE_Range ):
77
+ parameterValue = self .parameter .asValue ()
78
+ if parameterValue .has_Minimum ():
79
+ self .minimum = parameterValue .Get_Minimum ()
80
+ if parameterValue .has_Maximum ():
81
+ self .maximum = parameterValue .Get_Maximum ()
82
+ self .choices = None
83
+ if typ == saga .PARAMETER_TYPE_Choice :
84
+ parameterChoice = self .parameter .asChoice ()
85
+ self .choices = [parameterChoice .Get_Item (i ) for i in
86
+ range (parameterChoice .Get_Count ())]
87
+
65
88
66
89
def getLibraryPaths (userPath = None ):
67
90
try :
@@ -98,13 +121,21 @@ def writeHTML(path, mod):
98
121
docs += "<div class='author'>%s</div>\n " % mod .author
99
122
docs += "<div class='description'>%s</div>\n " % mod .description .replace ('\n ' , '<br/>\n ' )
100
123
if mod .parameters ():
101
- docs += "<h2>Parameters: </h2>\n <dl class='parameters'>\n "
124
+ docs += "<h2>Parameters</h2>\n <dl class='parameters'>\n "
102
125
for p in mod .parameters ():
103
- docs += "\t <dt>%s</dt>" % p .name
104
- docs += "<dd>%s</dd>\n " % p .description
126
+ constraints = list ()
127
+ if p .minimum :
128
+ constraints .append ("Minimum: " + str (p .minimum ))
129
+ if p .maximum :
130
+ constraints .append ("Maximum: " + str (p .maximum ))
131
+ if p .choices :
132
+ constraints .append ("Available choices: " + ', ' .join (p .choices ))
133
+
134
+ docs += "\t <dt>%s <div class='type'>%s</div></dt>" % (p .name , p .typeName )
135
+ docs += "<dd>%s <div class='constraints'>%s</div></dd>\n " % (p .description , '; ' .join (constraints ))
105
136
docs += "</dl>"
106
137
out = open (path , 'w' )
107
- out .write ('<html><body>\n ' )
138
+ out .write ('<html>\n <head><link rel="stylesheet" type="text/css" href="help.css" /></head> \n <body>\n ' )
108
139
out .write (docs .encode ('utf-8' ))
109
140
out .write ('\n </body></html>\n ' )
110
141
out .close ()
0 commit comments