本文整理匯總了Python中omniORB.CORBA.id方法的典型用法代碼示例。如果您正苦於以下問題:Python CORBA.id方法的具體用法?Python CORBA.id怎麽用?Python CORBA.id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類omniORB.CORBA
的用法示例。
在下文中一共展示了CORBA.id方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _set_money
# 需要導入模塊: from omniORB import CORBA [as 別名]
# 或者: from omniORB.CORBA import id [as 別名]
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
示例2: create
# 需要導入模塊: from omniORB import CORBA [as 別名]
# 或者: from omniORB.CORBA import id [as 別名]
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
示例3: close
# 需要導入模塊: from omniORB import CORBA [as 別名]
# 或者: from omniORB.CORBA import id [as 別名]
def close(self, evt):
if self.toplevel:
self.toplevel = None
try:
self.game.unwatchGame(self.cookie)
except CORBA.SystemException, ex:
print "System exception trying to unwatch game:"
print " ", CORBA.id(ex), ex
id = poa.servant_to_id(self)
poa.deactivate_object(id)
示例4: killGame
# 需要導入模塊: from omniORB import CORBA [as 別名]
# 或者: from omniORB.CORBA import id [as 別名]
def killGame(self):
selection = self.listbox.curselection()
if selection == ():
return
index = int(selection[0])
info = self.gameList[index]
try:
info.obj.kill()
msg = "killed"
except CORBA.SystemException, ex:
print "System exception trying to kill game:"
print " ", CORBA.id(ex), ex
msg = "error contacting object"
示例5: getGameList
# 需要導入模塊: from omniORB import CORBA [as 別名]
# 或者: from omniORB.CORBA import id [as 別名]
def getGameList(self):
"""Get the list of games from the GameFactory, and populate
the Listbox in the GUI"""
# To make life interesting, we get the game information
# structures one at a time from the server. It would be far
# more sensible to get them many at a time.
self.gameList = []
self.listbox.delete(0, END)
try:
seq, iterator = self.gameFactory.listGames(0)
except CORBA.SystemException, ex:
print "System exception contacting GameFactory:"
print " ", CORBA.id(ex), ex
return
示例6: click
# 需要導入模塊: from omniORB import CORBA [as 別名]
# 或者: from omniORB.CORBA import id [as 別名]
def click(self, evt):
x = evt.x / 100
y = evt.y / 100
try:
self.statusMessage("Waiting for other player...")
state = self.controller.play(x, y)
self.drawState(state)
except TicTacToe.GameController.SquareOccupied:
self.statusMessage("Square already occupied")
except TicTacToe.GameController.NotYourGo:
self.statusMessage("Not your go")
except TicTacToe.GameController.InvalidCoordinates:
self.statusMessage("Eek! Invalid coordinates")
except CORBA.SystemException:
print "System exception trying to contact GameController:"
print " ", CORBA.id(ex), ex
self.statusMessage("System exception contacting GameController!")
示例7: newGameEntered
# 需要導入模塊: from omniORB import CORBA [as 別名]
# 或者: from omniORB.CORBA import id [as 別名]
def newGameEntered(self, evt):
name = evt.widget.get()
self.newGameDialogue.destroy()
self.newGameDialogue = None
if name == "":
self.statusMessage("You must give a non-empty name")
return
try:
game = self.gameFactory.newGame(name)
except TicTacToe.GameFactory.NameInUse:
self.statusMessage("Game name in use")
return
except CORBA.SystemException, ex:
print "System exception trying to create new game:"
print " ", CORBA.id(ex), ex
self.statusMessage("System exception trying to create new game")
return
示例8: selectGame
# 需要導入模塊: from omniORB import CORBA [as 別名]
# 或者: from omniORB.CORBA import id [as 別名]
def selectGame(self, evt):
selection = self.listbox.curselection()
if selection == ():
return
index = int(selection[0])
info = self.gameList[index]
try:
players = info.obj._get_players()
if players == 0:
msg = "no players yet"
elif players == 1:
msg = "one player waiting"
else:
msg = "game in progress"
except CORBA.SystemException, ex:
print "System exception contacting Game:"
print " ", CORBA.id(ex), ex
msg = "error contacting Game object"
示例9: watchGame
# 需要導入模塊: from omniORB import CORBA [as 別名]
# 或者: from omniORB.CORBA import id [as 別名]
def watchGame(self):
selection = self.listbox.curselection()
if selection == ():
return
index = int(selection[0])
info = self.gameList[index]
si = Spectator_i(self.master, info.name)
id = poa.activate_object(si)
so = poa.id_to_reference(id)
try:
cookie, state = info.obj.watchGame(so)
si.go(info.obj, cookie, state)
self.statusMessage("Watching %s" % info.name)
except CORBA.SystemException, ex:
poa.deactivate_object(id)
print "System exception trying to watch game:"
print " ", CORBA.id(ex), ex
self.statusMessage("%s: system exception contacting game" % info.name)
self.getGameList()
示例10: TypeNotSupportedExImpl
# 需要導入模塊: from omniORB import CORBA [as 別名]
# 或者: from omniORB.CORBA import id [as 別名]
else:
raise TypeNotSupportedExImpl(nvSeq=[NameValue("channelname",
self.channelName),
NameValue("reason",
"Not a structured event")])
#User didn't specify type_name. Assume it's the name of the
#repository ID. If that doesn't work either, must be a simple
#CORBA type.
if (type_name == None) and (simple_data != None):
try:
type_name = str(simple_data.__class__.__name__)
except Exception, e:
self.logger.logWarning(str(e))
print_exc()
type_name = str(CORBA.id(simple_data))
elif (simple_data == None):
raise CouldntPerformActionExImpl(nvSeq=[NameValue("channelname",
self.channelName),
NameValue("reason",
"Empty data")])
#create the CORBA Any in the "normal" manner first. If this
#fails, try omniORB's any helper module designed for simple types.
try:
corba_any = CORBA.Any(CORBA.TypeCode(CORBA.id(simple_data)),
simple_data)
except Exception, e:
self.logger.logTrace(str(e))
try:
corba_any = any.to_any(simple_data)
示例11: ServantActivator_i
# 需要導入模塊: from omniORB import CORBA [as 別名]
# 或者: from omniORB.CORBA import id [as 別名]
poa.create_request_processing_policy(PortableServer.USE_SERVANT_MANAGER),
poa.create_lifespan_policy(PortableServer.PERSISTENT)]
child = poa.create_POA("MyPOA", poaManager, ps)
# Create the ServantActivator and set it as the child's ServantManager
# Note that since ServantActivator is a LocalObject, we do not need to
# activate the servant in a POA.
sai = ServantActivator_i()
child.set_servant_manager(sai)
del sai
# Create an object reference with no servant
eo = child.create_reference_with_id("MyEcho", CORBA.id(_GlobalIDL.Echo))
print orb.object_to_string(eo)
# Run, or do some local calls...
if not (len(sys.argv) > 1 and sys.argv[1] == "-l"):
orb.run()
time.sleep(1)
print "Calling..."
# On this invocation, the servant will be activated
print eo.echoString("Hello from same address space")
time.sleep(1)
# This invocation uses the local case optimisation, since the servant