def __init__(self): super(BoxSource, self).__init__(['width_out = width_in', 'height_out = height_in', 'depth_out = depth_in']) # For get_closest_proxy(). sub = self.add('subcontainer', Container()) sub.add('subvar', Int())
def _populate(self, container, path): """ Populate a container from a remote object. container: Container The local container object to be populated. path: string Path on server corresponding to `container`. """ info = self._client.list_properties(path) for prop, typ, iotype in info: if hasattr(container, prop): container.raise_exception( 'Name %r already bound to %r' % (prop, getattr(container, prop)), AttributeError) rpath = '.'.join([path, prop]) if typ == 'PHXDouble' or typ == 'PHXLong' or typ == 'PHXString': enum_valstrs = self._client.get(rpath + '.enumValues') if enum_valstrs: container.add_trait( prop, EnumProxy(iotype, self._client, rpath, typ, enum_valstrs)) continue if typ == 'PHXBoolean': container.add_trait(prop, BoolProxy(iotype, self._client, rpath)) elif typ == 'PHXDouble': container.add_trait(prop, FloatProxy(iotype, self._client, rpath)) elif typ == 'PHXLong': container.add_trait(prop, IntProxy(iotype, self._client, rpath)) elif typ == 'PHXRawFile': container.add_trait( prop, FileProxy(iotype, self._client, rpath, self)) elif typ == 'PHXString': container.add_trait(prop, StrProxy(iotype, self._client, rpath)) elif typ == 'PHXGroup': group = container.add(prop, Container()) self._populate(group, rpath) # Recurse. elif typ.startswith('double['): container.add_trait( prop, ArrayProxy(iotype, self._client, rpath, float)) elif typ.startswith('long['): container.add_trait( prop, ArrayProxy(iotype, self._client, rpath, int)) elif typ.startswith('java.lang.String['): container.add_trait( prop, ListProxy(iotype, self._client, rpath, str)) elif typ == 'PHXScriptObject': container.add(prop, ObjProxy(iotype, self._client, rpath)) else: raise NotImplementedError('%r type %r' % (prop, typ))
def __init__(self): super(Box, self).__init__([ 'surface_area = (width*(height+depth) + depth*height)*2', 'volume = width*height*depth']) self.pid = os.getpid() # For get_closest_proxy(). sub = self.add('subcontainer', Container()) sub.add('subvar', Int())
def setUp(self): """this setup function will be called before each test in this class""" self.hobj = Container() self.hobj.add('int1', Int(98, low=0, high=99, iotype='in')) self.hobj.add('int2', Int(13, iotype='out')) self.hobj.add('int3', Int(low=0, high=99, iotype='in')) self.hobj.int1 = 3 self.hobj.int2 = 42 self.hobj.int3 = 1
def setUp(self): """this setup function will be called before each test in this class""" self.hobj = Container() self.hobj.add('float1', Float(98.9, low=0., high=99.0, desc="Stuff", iotype='in', units='ft')) self.hobj.add('float2', Float(13.2, iotype='out', units='inch', low=-9999.)) self.hobj.add('float3', Float(low=0., high=99., iotype='in', units='kg')) self.hobj.float1 = 3.1415926 self.hobj.float2 = 42. self.hobj.float3 = 1.1
def setUp(self): self.top = Container() self.h1 = Container() self.top.add('h1', self.h1) self.h11 = Container() self.h12 = Container() self.h121 = Container() self.h122 = Container() self.h1.add('h11', self.h11) self.h1.add('h12', self.h12) self.h12.add('h121', self.h121) self.h12.add('h122', self.h122)
def setUp(self): self.top = Container() self.h1 = Container(doc="a hierarchy member") self.top.add('h1', self.h1) self.h11 = Container() self.h12 = Container() self.h121 = Container() self.h122 = Container() self.h1.add('h11', self.h11) self.h1.add('h12', self.h12) self.h12.add('h121', self.h121) self.h12.add('h122', self.h122)
def __init__(self): super(MyComponent, self).__init__() self.add('cont', Container()) self.cont.add('dyntrait', Float(3.))
def setUp(self): """this setup function will be called before each test in this class""" self.hobj = Container() self.hobj.add('iface_sock', Slot(MyIface)) self.hobj.add('class_sock', Slot(MyClass))
def setUp(self): """this setup function will be called before each test in this class""" self.hobj = Container()
def setUp(self): """this setup function will be called before each test in this class""" self.hobj = Container() self.hobj.add('list1', List(iotype='in'))