From 5b0302604969bfc9584b3e8ac5de2f682587f68f Mon Sep 17 00:00:00 2001 From: Darren Ranalli Date: Wed, 2 Jul 2008 01:25:56 +0000 Subject: [PATCH] give immediate feedback if pstats can't connect --- direct/src/showbase/ShowBase.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/direct/src/showbase/ShowBase.py b/direct/src/showbase/ShowBase.py index ee13b4a1fa..4c184c2ed2 100644 --- a/direct/src/showbase/ShowBase.py +++ b/direct/src/showbase/ShowBase.py @@ -1348,15 +1348,19 @@ class ShowBase(DirectObject.DirectObject): def createStats(self, hostname=None, port=None): # You can specify pstats-host in your Config.prc or use ~pstats/~aipstats # The default is localhost - if self.wantStats: - if PStatClient.isConnected(): - PStatClient.disconnect() - # these default values match the C++ default values - if hostname is None: - hostname = '' - if port is None: - port = -1 - PStatClient.connect(hostname, port) + if not self.wantStats: + return False + + if PStatClient.isConnected(): + PStatClient.disconnect() + # these default values match the C++ default values + if hostname is None: + hostname = '' + if port is None: + port = -1 + PStatClient.connect(hostname, port) + return PStatClient.isConnected() + def addSfxManager(self, extraSfxManager): # keep a list of sfx manager objects to apply settings to,