本文整理匯總了Python中omniORB.CORBA類的典型用法代碼示例。如果您正苦於以下問題:Python CORBA類的具體用法?Python CORBA怎麽用?Python CORBA使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了CORBA類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: onSelectSmeshObject
def onSelectSmeshObject(self):
'''
This function is the slot connected on the mesh selection
button. It memorizes the selected mesh and put its name in the
text field of the dialog box.
'''
mySObject, myEntry = guihelper.getSObjectSelected()
if CORBA.is_nil(mySObject):
self.__ui.txtSmeshObject.setText("You must choose a mesh")
self.__ui.txtGroupName.setText("")
self.__ui.txtSmeshObject.setEnabled(False)
self.__ui.btnAddInput.setEnabled(False)
self.__selectedMesh = None
return
self.smeshStudyTool.updateStudy(studyedit.getActiveStudyId())
self.__selectedMesh = self.smeshStudyTool.getMeshObjectFromSObject(mySObject)
if CORBA.is_nil(self.__selectedMesh):
self.__ui.txtSmeshObject.setText("The selected object is not a mesh")
self.__ui.txtGroupName.setText("")
self.__ui.txtSmeshObject.setEnabled(False)
self.__ui.btnAddInput.setEnabled(False)
self.__selectedMesh = None
return
myName = mySObject.GetName()
self.__ui.txtSmeshObject.setText(myName)
self.__ui.txtSmeshObject.setEnabled(True)
self.__ui.btnAddInput.setEnabled(True)
# We can suggest a default group name from the mesh name
self.__ui.txtGroupName.setText(myName)
示例2: destroyRecursive
def destroyRecursive(self, context):
cont = True
bl = []
bi = 0
bl, bi = context.list(self._blLength)
while cont:
for i in range(len(bl)):
if bl[i].binding_type == CosNaming.ncontext:
obj = context.resolve(bl[i].binding_name)
next_context = obj._narrow(CosNaming.NamingContext)
self.destroyRecursive(next_context)
context.unbind(bl[i].binding_name)
next_context.destroy()
elif bl[i].binding_type == CosNaming.nobject:
context.unbind(bl[i].binding_name)
else:
assert(0)
if CORBA.is_nil(bi):
cont = False
else:
bi.next_n(self._blLength, bl)
if not (CORBA.is_nil(bi)):
bi.destroy()
return
示例3: PBMeshSmeshPressed
def PBMeshSmeshPressed(self):
from omniORB import CORBA
import salome
from salome.kernel import studyedit
from salome.smesh.smeshstudytools import SMeshStudyTools
from salome.gui import helper as guihelper
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
mySObject, myEntry = guihelper.getSObjectSelected()
if CORBA.is_nil(mySObject) or mySObject==None:
#QMessageBox.critical(self, "Mesh", "select an input mesh")
self.LE_MeshSmesh.setText("")
self.MeshIn=""
self.LE_MeshFile.setText("")
self.fichierIn=""
return
self.smeshStudyTool = SMeshStudyTools()
try:
self.__selectedMesh = self.smeshStudyTool.getMeshObjectFromSObject(mySObject)
except:
QMessageBox.critical(self, "Mesh", "select an input mesh")
return
if CORBA.is_nil(self.__selectedMesh):
QMessageBox.critical(self, "Mesh", "select an input mesh")
return
myName = mySObject.GetName()
#print "MeshSmeshNameChanged", myName
self.MeshIn=myName
self.LE_MeshSmesh.setText(myName)
self.LE_MeshFile.setText("")
self.fichierIn=""
示例4: sdoToDFC
def sdoToDFC(self, sdo, dfc):
if CORBA.is_nil(sdo):
return False
dfc[0] = sdo._narrow(OpenRTM.DataFlowComponent)
if CORBA.is_nil(dfc[0]):
return False
return True
示例5: _set_money
def _set_money( self, money ):
try:
CORBA.id(money)
currency = getCurrency(money.currencyCode)
m = Money(0, currency)
m._setState(money.amount, currency)
money = m
except CORBA.BAD_PARAM:
pass
self._money = money
示例6: test_getPortRef
def test_getPortRef(self):
getP = self._pa.getPortRef("")
self.assertEqual(CORBA.is_nil(getP), True)
getP = self._pa.getPortRef("port1")
self.assertEqual(CORBA.is_nil(getP), False)
self.assertEqual(getP.get_port_profile().name, "port1")
getP = self._pa.getPortRef("port0")
self.assertEqual(CORBA.is_nil(getP), False)
self.assertEqual(getP.get_port_profile().name, "port0")
return
示例7: subscribeFromIor
def subscribeFromIor(self, properties):
self._rtcout.RTC_TRACE("subscribeFromIor()")
index = OpenRTM_aist.NVUtil.find_index(properties,
"dataport.corba_cdr.inport_ior")
if index < 0:
self._rtcout.RTC_ERROR("inport_ior not found")
return False
ior = ""
try:
ior = any.from_any(properties[index].value, keep_structs=True)
except:
self._rtcout.RTC_ERROR(sys.exc_info()[0])
if not ior:
self._rtcout.RTC_ERROR("inport_ior has no string")
return False
orb = OpenRTM_aist.Manager.instance().getORB()
obj = orb.string_to_object(ior)
if CORBA.is_nil(obj):
self._rtcout.RTC_ERROR("invalid IOR string has been passed")
return False
if not self.setObject(obj):
self._rtcout.RTC_WARN("Setting object to consumer failed.")
return False
return True
示例8: subscribeFromRef
def subscribeFromRef(self, properties):
self._rtcout.RTC_TRACE("subscribeFromRef()")
index = OpenRTM_aist.NVUtil.find_index(properties,
"dataport.corba_cdr.inport_ref")
if index < 0:
self._rtcout.RTC_ERROR("inport_ref not found")
return False
obj = None
try:
obj = any.from_any(properties[index].value, keep_structs=True)
except:
self._rtcout.RTC_ERROR(sys.exc_info()[0])
if not obj:
self._rtcout.RTC_ERROR("prop[inport_ref] is not objref")
return False
if CORBA.is_nil(obj):
self._rtcout.RTC_ERROR("prop[inport_ref] is not objref")
return False
if not self.setObject(obj):
self._rtcout.RTC_ERROR("Setting object to consumer failed.")
return False
return True
示例9: onInitialize
def onInitialize(self):
self._rtcout.RTC_TRACE("onInitialize()")
active_set = self._properties.getProperty("configuration.active_config",
"default")
if self._configsets.haveConfig(active_set):
self._configsets.update(active_set)
else:
self._configsets.update("default")
mgr = OpenRTM_aist.Manager.instance()
sdos = []
for member in self._members[0]:
if member == "":
continue
rtc = mgr.getComponent(member)
if rtc is None:
print "no RTC found: ", member
continue
sdo = rtc.getObjRef()
if CORBA.is_nil(sdo):
continue
OpenRTM_aist.CORBA_SeqUtil.push_back(sdos, sdo)
try:
self._org.set_members(sdos)
except:
self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
return RTC.RTC_OK
示例10: addOrganizationToTarget
def addOrganizationToTarget(self, member):
conf = member._config
if CORBA.is_nil(conf):
return
conf.add_organization(self._objref)
return
示例11: removeOrganizationFromTarget
def removeOrganizationFromTarget(self, member):
# get given RTC's configuration object
if CORBA.is_nil(member._config):
return
# set organization to target RTC's conf
ret = member._config.remove_organization(self._pId)
return
示例12: setObject
def setObject(self, ior):
self._ior = ior
orb = OpenRTM_aist.Manager.instance().getORB()
obj = orb.string_to_object(ior)
if CORBA.is_nil(obj):
return False
return self._consumer.setObject(obj)
示例13: __call__
def __call__(self, obj):
try:
if CORBA.is_nil(obj):
print "No service connected."
else:
self._result[0] = obj.echo(self._msg)
except:
pass
示例14: init
def init(self, name_server):
self._nameServer = "corbaloc::" + name_server + "/NameService"
obj = self._orb.string_to_object(self._nameServer)
self._rootContext = obj._narrow(CosNaming.NamingContext)
if CORBA.is_nil(self._rootContext):
raise MemoryError
return
示例15: create
def create( self, money):
try:
CORBA.id(money)
currency = getCurrency(money.currencyCode)
m = Money(money.amount, currency)
money = m
except CORBA.BAD_PARAM:
pass
pk = '%.5f' % time()
moneyWidget = MoneyWidget(pk)
moneyWidget._set_money(money)
self.PersistenceService.create(moneyWidget)
# Notify our observers that a new entity has been created
#self._notifyCreate(moneyWidget)
return moneyWidget