source: trunk/python/Rappture/number.py @ 20

Last change on this file since 20 was 9, checked in by mmc, 19 years ago

Massive changes across the entire toolkit. Rearranged the
XML description to agree better with new documentation and
conventions.

Added a small start of Rappture.interface and Rappture.number
in the python directory. This is the new way of doing Rappture--
by declaring variables directly in the program, not using XML
directly at all.

File size: 795 bytes
Line 
1# ----------------------------------------------------------------------
2#  COMPONENT: number
3#
4# ======================================================================
5#  AUTHOR:  Michael McLennan, Purdue University
6#  Copyright (c) 2005  Purdue Research Foundation, West Lafayette, IN
7# ======================================================================
8import Rappture
9
10class number:
11    def __init__(self,path,**kwargs):
12        """
13        Blah, blah...
14        """
15
16        self.path = path
17        self.attribs = kwargs
18
19    def put(self,lib):
20        lib.put(self.path)
21        for key,val in self.attribs.items():
22            lib.put(self.path+'.'+key, str(val))
23
24    def __coerce__(self,other):
25        s = Rappture.driver.get(self.path+'.current')
26        return (float(s),other)
Note: See TracBrowser for help on using the repository browser.