[pypy-svn] r29305 - in pypy/dist/pypy/translator/js: demo/jsdemo proxy proxy/testme tools
ericvrp at codespeak.net
ericvrp at codespeak.net
Sun Jun 25 11:15:16 CEST 2006
Author: ericvrp
Date: Sun Jun 25 11:15:09 2006
New Revision: 29305
Modified:
pypy/dist/pypy/translator/js/demo/jsdemo/bnb.py
pypy/dist/pypy/translator/js/proxy/README.txt
pypy/dist/pypy/translator/js/proxy/testme/controllers.py
pypy/dist/pypy/translator/js/tools/start_bnb.py
Log:
Fix image path. Better error handling. Fix missing import.
And starting to play with extendion the rpython script.
Modified: pypy/dist/pypy/translator/js/demo/jsdemo/bnb.py
==============================================================================
--- pypy/dist/pypy/translator/js/demo/jsdemo/bnb.py (original)
+++ pypy/dist/pypy/translator/js/demo/jsdemo/bnb.py Sun Jun 25 11:15:09 2006
@@ -7,7 +7,7 @@
from pypy.translator.js.demo.jsdemo.controllers import Root
from pypy.rpython.ootypesystem.bltregistry import BasicExternal, MethodDesc
-from pypy.translator.js.proxy.testme.servermessage import ServerMessage, PMSG_INLINE_FRAME
+from pypy.translator.js.proxy.testme.servermessage import log, ServerMessage, PMSG_INLINE_FRAME
from pypy.translator.js.proxy.testme.msgstruct import *
from cherrypy import session
@@ -29,9 +29,11 @@
try:
port = re.findall('value=".*"', urllib.urlopen('http://%s:8000' % host).read())[0]
except IOError:
- import sys
log("ERROR: Can't connect to BnB server on %s:8000" % host)
sys.exit()
+ except IndexError:
+ log("ERROR: Connected to BnB server but unable to detect a running game")
+ sys.exit()
port = int(port[7:-1])
_methods = {
@@ -41,7 +43,7 @@
def serverMessage(self):
sessionid = session['_id']
if sessionid not in self._serverMessage:
- self._serverMessage[sessionid] = ServerMessage('static/images')
+ self._serverMessage[sessionid] = ServerMessage('static/images/')
return self._serverMessage[sessionid]
@turbogears.expose(html="jsdemo.templates.bnb")
Modified: pypy/dist/pypy/translator/js/proxy/README.txt
==============================================================================
--- pypy/dist/pypy/translator/js/proxy/README.txt (original)
+++ pypy/dist/pypy/translator/js/proxy/README.txt Sun Jun 25 11:15:09 2006
@@ -1,4 +1,4 @@
-testme
+testme proxy for BnB
This is a TurboGears (http://www.turbogears.org) project. It can be
-started by running the start-testme.py script.
\ No newline at end of file
+started by running the testme-start.py script.
Modified: pypy/dist/pypy/translator/js/proxy/testme/controllers.py
==============================================================================
--- pypy/dist/pypy/translator/js/proxy/testme/controllers.py (original)
+++ pypy/dist/pypy/translator/js/proxy/testme/controllers.py Sun Jun 25 11:15:09 2006
@@ -6,6 +6,7 @@
import socket
import urllib
import re
+import sys
from servermessage import ServerMessage, log, PMSG_INLINE_FRAME
from random import random
from md5 import md5
@@ -19,9 +20,11 @@
try:
port = re.findall('value=".*"', urllib.urlopen('http://%s:8000' % host).read())[0]
except IOError:
- import sys
log("ERROR: Can't connect to BnB server on %s:8000" % host)
sys.exit()
+ except IndexError:
+ log("ERROR: Connected to BnB server but unable to detect a running game")
+ sys.exit()
port = int(port[7:-1])
def serverMessage(self):
Modified: pypy/dist/pypy/translator/js/tools/start_bnb.py
==============================================================================
--- pypy/dist/pypy/translator/js/tools/start_bnb.py (original)
+++ pypy/dist/pypy/translator/js/tools/start_bnb.py Sun Jun 25 11:15:09 2006
@@ -41,6 +41,18 @@
## fn = compile_function(mochikit, [], root = Root)
## fn()
+class Stats(object):
+ """ Class containing some statistics
+ """
+ def __init__(self):
+ self.starttime = 0
+ self.n_received_inline_frames = 0
+ self.n_rendered_inline_frames = 0
+ self.n_rendered_dynamic_sprites = 0
+ self.n_sprites = 0 #why is inline frame broken up?
+
+stats = Stats()
+
class SpriteContainer(object):
""" Class containing all sprites
"""
@@ -104,6 +116,8 @@
img = sc.get_sprite(msg['icon_code'])
img.style.left = msg['x'] + 'px'
img.style.top = msg['y'] + 'px'
+ stats.n_sprites += 1
+ get_document().title = str(stats.n_sprites) + " sprites"
elif msg['type'] == 'end_frame':
pass
sc.revive()
More information about the Pypy-commit
mailing list