import sys import ORBit, bonobo from time import time from threading import Thread TYPELIB_NAME = "Accessibility" orb = ORBit.CORBA.ORB_init() ORBit.load_typelib(TYPELIB_NAME) import Accessibility import Accessibility__POA NUM_CALLS = 18000 class ORBThread(Thread): def __init__(self): Thread.__init__(self) self.setDaemon(True) def run(self): orb.run() class AtspiEventListener(Accessibility__POA.EventListener): def ref(self): pass def unref(self): pass def register(self, reg, name): reg.registerGlobalEventListener(self._this(), name)
#!/usr/bin/env python '''This is a client to the test/everything/server test program distributed with ORBit2.''' import sys, os import unittest import ORBit ORBit.load_typelib('Everything') import CORBA # this one is loaded from the typelib ... from orbit import test import constants # from test/everything/constants.h class EverythingTestCase(unittest.TestCase): def test01_attribute(self): '''attributes''' objref = factory.getBasicServer() assert objref._is_a('IDL:orbit/test/BasicServer:1.0') val = objref.foo assert val == constants.STRING_RETN objref.foo = constants.STRING_IN lval = objref.bah
#!/usr/bin/python # # pass the IOR returned by the following command as an argument: # activation-client -s "repo_ids.has('IDL:Nautilus/MetafileFactory:1.0')" | tail -1 # import sys, os import ORBit, CORBA # we can load type information from a typelib ORBit.load_typelib('Bonobo') # or by parsing IDL ... nautilusdir = os.environ['HOME'] + '/cvs/gnome2/nautilus' ORBit.load_file( '%s/libnautilus-private/nautilus-metafile-server.idl' % nautilusdir, '-I%s -I/usr/share/idl -D__ORBIT_IDL__ -D__nautilus_view_component_COMPILATION' % nautilusdir) import Nautilus__POA class Monitor(Nautilus__POA.MetafileMonitor): i = 0 # Bonobo::Unknown methods ... def ref(self): print "Ref!" def unref(self): print "Unref!"
import sys import ORBit, bonobo from time import time from threading import Thread TYPELIB_NAME = "Accessibility" orb = ORBit.CORBA.ORB_init() ORBit.load_typelib(TYPELIB_NAME) import Accessibility import Accessibility__POA NUM_CALLS = 18000 class ORBThread(Thread): def __init__(self): Thread.__init__(self) self.setDaemon(True) def run(self): orb.run() class AtspiEventListener(Accessibility__POA.EventListener): def ref(self): pass def unref(self): pass
import sys import ORBit sys.path.append('.libs') ORBit.load_typelib('./TestCall_module') import CORBA, PyORBit, PyORBit__POA import cTestCall class PyTestCall(PyORBit__POA.TestCall): def op1(self, other): this = self._this() print " Python impl of TestCall.op1 invoked" other.op2(this) def op2(self, other): print " Python impl of TestCall.op2 invoked" other.op3() def op3(self): this = self._this() print " Python impl of TestCall.op3 invoked" orb = CORBA.ORB_init(sys.argv) poa = orb.resolve_initial_references('RootPOA') # create the C objref c_objref = cTestCall.create_TestCall(orb)
import ORBit import bonobo, gnome ORBit.load_typelib('Accessibility') gnome.init('list-apps', '0.0') REGISTRY_IID = 'OAFIID:Accessibility_Registry:1.0' registry = bonobo.activation.activate("iid == '%s'" % REGISTRY_IID) # get first desktop desktop = registry.getDesktop(0) for i in range(desktop.childCount): child = desktop.getChildAtIndex(i) print child.name child.unref() desktop.unref() registry.unref()
#!/usr/bin/env python '''This is a client to the test/everything/server test program distributed with ORBit2.''' import sys, os import unittest import ORBit ORBit.load_typelib('Everything') import CORBA # this one is loaded from the typelib ... from orbit import test import constants # from test/everything/constants.h class EverythingTestCase(unittest.TestCase): def test01_attribute(self): '''attributes''' objref = factory.getBasicServer() assert objref._is_a('IDL:orbit/test/BasicServer:1.0') val = objref.foo assert val == constants.STRING_RETN objref.foo = constants.STRING_IN lval = objref.bah
import sys import ORBit sys.path.append('.libs') ORBit.load_typelib('./TestCall_module') import CORBA, PyORBit, PyORBit__POA import cTestCall class PyTestCall(PyORBit__POA.TestCall): def op1(self, other): this = self._this() print " Python impl of TestCall.op1 invoked" other.op2(this) def op2(self, other): print " Python impl of TestCall.op2 invoked" other.op3() def op3(self): this = self._this() print " Python impl of TestCall.op3 invoked" orb = CORBA.ORB_init(sys.argv) poa = orb.resolve_initial_references('RootPOA') # create the C objref c_objref = cTestCall.create_TestCall(orb) # create the python objref py_servant = PyTestCall() py_objref = py_servant._this()
# -*- Mode: Python; py-indent-offset: 4 -*- import gobject del gobject # load the bonobo typelib import ORBit ORBit.load_typelib('Bonobo') del ORBit import activation from _bonobo import * class UnknownBaseImpl(object): def __init__(self): self.__bobj = ForeignObject(self._this()) self.__bobj.connect("destroy", self.__destroy) def get_bonobo_object(self): return self.__bobj def ref(self): self.__bobj.ref() def unref(self): self.__bobj.unref() def queryInterface(self, repoid): return self.__bobj.query_local_interface(repoid).corba_objref() def __destroy(self, foreign): # print "Deactivating Object" poa = self._default_POA() id = poa.servant_to_id(self) poa.deactivate_object(id) # print "Removing reference to ForeignObject"