mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
formatting
This commit is contained in:
parent
506fe267ba
commit
4d1615b740
@ -14,11 +14,9 @@ class ConnectionRepository(DirectObject.DirectObject, CConnectionRepository):
|
|||||||
connection (and exchange datagrams) with a gameserver. This
|
connection (and exchange datagrams) with a gameserver. This
|
||||||
includes ClientRepository and AIRepository.
|
includes ClientRepository and AIRepository.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
notify = DirectNotifyGlobal.directNotify.newCategory("ConnectionRepository")
|
notify = DirectNotifyGlobal.directNotify.newCategory("ConnectionRepository")
|
||||||
taskPriority = -30
|
taskPriority = -30
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
DirectObject.DirectObject.__init__(self)
|
DirectObject.DirectObject.__init__(self)
|
||||||
CConnectionRepository.__init__(self)
|
CConnectionRepository.__init__(self)
|
||||||
@ -32,14 +30,14 @@ class ConnectionRepository(DirectObject.DirectObject, CConnectionRepository):
|
|||||||
# This is not as robust a socket library as NSPR's, but the
|
# This is not as robust a socket library as NSPR's, but the
|
||||||
# HTTPClient interface does a good job of negotiating the
|
# HTTPClient interface does a good job of negotiating the
|
||||||
# connection over an HTTP proxy if one is in use.
|
# connection over an HTTP proxy if one is in use.
|
||||||
|
#
|
||||||
# Set it to 'nspr' to use Panda's net interface
|
# Set it to 'nspr' to use Panda's net interface
|
||||||
# (e.g. QueuedConnectionManager, etc.) to establish the
|
# (e.g. QueuedConnectionManager, etc.) to establish the
|
||||||
# connection, which ultimately uses the NSPR socket library.
|
# connection, which ultimately uses the NSPR socket library.
|
||||||
# This is a much better socket library, but it may be more
|
# This is a much better socket library, but it may be more
|
||||||
# than you need for most applications; and there is no support
|
# than you need for most applications; and there is no support
|
||||||
# for proxies.
|
# for proxies.
|
||||||
|
#
|
||||||
# Set it to 'default' to use the HTTPClient interface if a
|
# Set it to 'default' to use the HTTPClient interface if a
|
||||||
# proxy is in place, but the NSPR interface if we don't have a
|
# proxy is in place, but the NSPR interface if we don't have a
|
||||||
# proxy.
|
# proxy.
|
||||||
@ -133,10 +131,11 @@ class ConnectionRepository(DirectObject.DirectObject, CConnectionRepository):
|
|||||||
self.dclassesByNumber[number] = dclass
|
self.dclassesByNumber[number] = dclass
|
||||||
|
|
||||||
def importModule(self, dcImports, moduleName, importSymbols):
|
def importModule(self, dcImports, moduleName, importSymbols):
|
||||||
""" Imports the indicated moduleName and all of its symbols
|
"""
|
||||||
|
Imports the indicated moduleName and all of its symbols
|
||||||
into the current namespace. This more-or-less reimplements
|
into the current namespace. This more-or-less reimplements
|
||||||
the Python import command. """
|
the Python import command.
|
||||||
|
"""
|
||||||
module = __import__(moduleName, globals(), locals(), importSymbols)
|
module = __import__(moduleName, globals(), locals(), importSymbols)
|
||||||
|
|
||||||
if importSymbols:
|
if importSymbols:
|
||||||
@ -152,10 +151,8 @@ class ConnectionRepository(DirectObject.DirectObject, CConnectionRepository):
|
|||||||
for symbolName in importSymbols:
|
for symbolName in importSymbols:
|
||||||
if hasattr(module, symbolName):
|
if hasattr(module, symbolName):
|
||||||
dcImports[symbolName] = getattr(module, symbolName)
|
dcImports[symbolName] = getattr(module, symbolName)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise StandardError, 'Symbol %s not defined in module %s.' % (symbolName, moduleName)
|
raise StandardError, 'Symbol %s not defined in module %s.' % (symbolName, moduleName)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# "import moduleName"
|
# "import moduleName"
|
||||||
|
|
||||||
@ -242,7 +239,8 @@ class ConnectionRepository(DirectObject.DirectObject, CConnectionRepository):
|
|||||||
failureCallback(0, '', *failureArgs)
|
failureCallback(0, '', *failureArgs)
|
||||||
|
|
||||||
def disconnect(self):
|
def disconnect(self):
|
||||||
"""Closes the previously-established connection.
|
"""
|
||||||
|
Closes the previously-established connection.
|
||||||
"""
|
"""
|
||||||
self.notify.info("Closing connection to server.")
|
self.notify.info("Closing connection to server.")
|
||||||
CConnectionRepository.disconnect(self)
|
CConnectionRepository.disconnect(self)
|
||||||
@ -373,13 +371,17 @@ class ConnectionRepository(DirectObject.DirectObject, CConnectionRepository):
|
|||||||
self.setSimulatedDisconnect(0)
|
self.setSimulatedDisconnect(0)
|
||||||
|
|
||||||
def doFind(self, str):
|
def doFind(self, str):
|
||||||
""" returns list of distributed objects with matching str in value """
|
"""
|
||||||
|
Returns list of distributed objects with matching str in value.
|
||||||
|
"""
|
||||||
for value in self.doId2do.values():
|
for value in self.doId2do.values():
|
||||||
if `value`.find(str) >= 0:
|
if `value`.find(str) >= 0:
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def doFindAll(self, str):
|
def doFindAll(self, str):
|
||||||
""" returns list of distributed objects with matching str in value """
|
"""
|
||||||
|
Returns list of distributed objects with matching str in value.
|
||||||
|
"""
|
||||||
matches = []
|
matches = []
|
||||||
for value in self.doId2do.values():
|
for value in self.doId2do.values():
|
||||||
if `value`.find(str) >= 0:
|
if `value`.find(str) >= 0:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user