source: trunk/examples/objects/api/python/number @ 1610

Last change on this file since 1610 was 1610, checked in by dkearney, 11 years ago

updates and adding example code to python and tcl apis

File size: 9.6 KB
Line 
1Rappture.Number
2
3constructors/destructors
4    Rappture.Number()
5    Rappture.Number(name, units, val[, min, max, label, desc])
6    Rappture.Number(numObj)
7
8methods
9    n.name([val])
10    n.path([val])
11    n.label([val])
12    n.desc([val])
13    n.hints([val])
14    n.color([val])
15    n.def([val])
16    n.cur([val])
17    n.min([val])
18    n.max([val])
19    n.units([u])
20    n.property(key[, val])
21    n.propremove(key)
22    n.convert(to)
23    n.value(units)
24    n.vvalue([...])
25    n.random()
26    n.diff(o)
27    n.addPreset(label, desc, val[, units])
28    n.delPreset(label)
29    n.configure(as, c)
30    n.dump(as, c)
31    n.outcome()
32    n.is()
33
34---------------------------------------
35Rappture.Number([name, units, val[, min, max, label, desc]])
36    Purpose: construct a number object
37    Input Arguments: 0, 3 or 7
38        1. name - object's name
39        2. units - object's units
40        3. val - default value
41        4. min - minimum accepted value
42        5. max - maximum accepted value
43        6. label - object's label
44        7. desc - object's description
45    Return Value: a newly created number object
46    Notes: input arguments are used to construct the number object
47    Code Example:
48
49Rappture.Number(numObj)
50    Purpose: construct a number object based on number object numObj
51    Input Arguments: 1
52        1. numObj - number object to copy
53    Return Value: a newly created number object
54    Notes: None
55    Code Example:
56
57
58n.name([val])
59    Purpose: get/set the id name of the object
60    Input Arguments: at most 1
61        1. val - new id name
62    Return Value: the name of the object
63    Notes: if no name is set, None will be returned
64           the id name is used to identify this object from
65           all other objects and should be unique
66           val, if provided, is used to set the object name
67    Code Example:
68
69n.path([val])
70    Purpose: get/set the path of the object
71    Input Arguments: at most 1
72        1. val - new path
73    Return Value: path of the object
74    Notes: if no path is set, None will be returned
75           the path tells where this object sits in the
76           hierarchy of objects.
77           val, if provided, is used to set the object path
78    Code Example:
79
80n.label([val])
81    Purpose: get/set the label of the object
82    Input Arguments: at most 1
83        1. val - new label
84    Return Value: label of the object
85    Notes: if no label is set, None will be returned
86           the label is used by the graphical user interface.
87           val, if provided, is used to set the object label
88    Code Example:
89
90n.desc([val])
91    Purpose: get/set the description of the object
92    Input Arguments: at most 1
93        1. val - new description
94    Return Value: description of the object
95    Notes: if no description is set, None will be returned
96           the description is used by the graphical user
97           interface to describe what type of data is being
98           requested and how the input is used.
99           val, if provided, is used to set the object description
100    Code Example:
101
102n.hints([val])
103    Purpose: get/set the hints of the object
104    Input Arguments: at most 1
105        1. val - new hints
106    Return Value: hints of the object
107    Notes: if no hints are set, None will be returned
108           the hints are used by the graphical user interface
109           val, if provided, is used to set the object hints
110    Code Example:
111
112n.color([val])
113    Purpose: get/set the color of the object
114    Input Arguments: at most 1
115        1. val - new color
116    Return Value: color of the object
117    Notes: if no color is set, None will be returned
118           the color is used by the graphical user interface
119           val, if provided, is used to set the object color
120    Code Example:
121
122n.def([val])
123    Purpose: get/set the default value
124    Input Arguments: at most 1
125        1. val - new default value
126    Return Value: default value of the object
127    Notes: if no default is set, None will be returned
128           val, if provided, is used to set the object default value
129    Code Example:
130
131n.cur([val])
132    Purpose: get/set the current value
133    Input Arguments: at most 1
134        1. val - new current value
135    Return Value: current value of the object
136    Notes: if no current is set, None will be returned
137           val, if provided, is used to set the object current value
138    Code Example:
139
140n.min([val])
141    Purpose: get/set the minimum accepted value of this object
142    Input Arguments: at most 1
143        1. double val - new minimum accepted value
144    Return Value: the minimum value this object will accept.
145    Notes: if no min is set, None will be returned
146           val, if provided, is used to set the object min
147    Code Example:
148
149n.max([val])
150    Purpose: get/set the maximum accepted value of this object
151    Input Arguments: 1
152        1. val - new maximum accepted value
153    Return Value: the maximum value this object will accept.
154    Notes: if no max is set, None will be returned
155           val, if provided, is used to set the object max
156    Code Example:
157
158n.units([val])
159    Purpose: get/set the units of this object
160    Input Arguments: 1
161        1. val - new units
162    Return Value: the string representing the object's units
163    Notes: if no units are set, None will be returned
164           val, if provided, is used to set the object units
165    Code Example:
166
167n.property(key[, val])
168    Purpose: get/set a generic property in the property database
169    Input Arguments: at most 2
170        1. key - property name
171        2. val - property value
172    Return Value: value of the property
173    Notes: A copy val is stored in the property database
174    Code Example:
175
176n.propremove(key)
177    Purpose: remove a property from the property database
178    Input Arguments: 1
179        1. key - property name
180    Return Value: value of the property
181    Notes: None
182    Code Example:
183
184n.convert(to)
185    Purpose: convert the def and cur values to "to" units
186    Input Arguments: 1
187        1. to - string of units to convert to
188    Return Value: Outcome object
189    Notes: the values stored in the object are changed
190    Code Example:
191
192n.value(to)
193    Purpose: return the value of the object with units of "to"
194    Input Arguments: 1
195        1. to - string of units to convert to
196    Return Value: value of the object
197    Notes: cur() is used as the base value. if cur was not set
198            by the user (cur() == None), def() is used.
199            if def was not set (def() == None), 0.0 is used
200            as the value.
201    Code Example:
202
203n.vvalue([...])
204    Purpose: return the value of the object after applying a
205                varying number of hints about how the value
206                should be configured
207    Input Arguments:
208        1. variable number of hints
209    Return Value: value of the object after applying hints.
210    Notes: vvalue will parse out the recognisable hints from
211                va_list arg. Values stored in the object are
212                not changed. Hint strings should have the form
213                hintKey=hintVal and be comma separated
214    Code Example:
215
216n.random()
217    Purpose: populate the object with a random value
218    Input Arguments: 0
219    Return Value: None
220    Notes: the current value of this object will be populated
221           with a random value that fits within the min and
222           max if they were specified.
223    Code Example:
224
225n.diff(o)
226    Purpose: return a list showing the differences between
227             this object and Rappture Object o
228    Input Arguments: 1
229        1. o - Rappture Object to diff against
230    Return Value: list of differences between objects
231    Notes: None
232    Code Example:
233
234n.addPreset(label, desc, val[, units])
235    Purpose: add a preset to this object
236    Input Arguments: 3 or 4
237        1. label - label of the preset
238        2. desc - description of the preset
239        3. val - value of the preset, possibly with units
240        4. units - units of the preset
241    Return Value: None
242    Notes: presets are stored in the object in the same order
243                in which they are created
244    Code Example:
245
246n.delPreset(label)
247    Purpose: delete the preset labeled "label" from this object
248    Input Arguments: 1
249        1. label - label of the preset
250    Return Value: None
251    Notes: preset is removed from the object
252    Code Example:
253
254n.configure(as, c)
255    Purpose: configure the object based on the data in "c".
256                use "as" to determine the type of data in "c".
257    Input Arguments: 2
258        1. as - type of data stored in "c".
259                valid values include:
260                    RPCONFIG_XML
261                    RPCONFIG_TREE
262        2. c - data to configure the object from.
263               if as is...     then c should be...
264               RPCONFIG_XML    const char *xmltext
265               RPCONFIG_TREE   RP_ParserXML *object
266    Return Value: None
267    Notes: object is configured based on values in "c"
268    Code Example:
269
270n.dump(as, c)
271    Purpose: dump the object values based to the object "c".
272                use "as" to determine how to dump the data.
273    Input Arguments: 2
274        1. as - type of data stored in "c".
275                valid values include:
276                    RPCONFIG_XML
277                    RPCONFIG_TREE
278        2. c - data to configure the object from.
279               if as is...     then c should be...
280               RPCONFIG_XML    ClientDataXml *object
281               RPCONFIG_TREE   RP_ParserXML *object
282    Return Value: None
283    Notes: None
284    Code Example:
285
286n.outcome()
287    Purpose: return the status of this object as an Outcome.
288    Input Arguments: 0
289    Return Value: status of the object as an Outcome
290    Notes: None
291    Code Example:
292
293n.is()
294    Purpose: return an integer tag describing the object.
295    Input Arguments: 0
296    Return Value: integer tag unique to all number objects
297    Notes: None
298    Code Example:
Note: See TracBrowser for help on using the repository browser.