Skip to content

Commit

Permalink
doing JS() feature/rule-change and pyjslib cleanup on these files
Browse files Browse the repository at this point in the history
  • Loading branch information
Jameson.Quinn authored and Jameson.Quinn committed Aug 21, 2010
1 parent 5425f16 commit b82fcb3
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 86 deletions.
4 changes: 2 additions & 2 deletions examples/gmaps/oldExample.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ def jsOpts(options):
JS("return {};")

def getStart(ui):
JS("return ui.values[0]")
JS("return @{{ui}}.values[0]")
def getEnd(ui):
JS("return ui.values[1]")
JS("return @{{ui}}.values[1]")

class Greed:
def onModuleLoad(self):
Expand Down
2 changes: 1 addition & 1 deletion examples/jsobject/TestDict.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def __init__(self):
d = {'hello': 'world',
'goodbye': 2}
JS("""
self.dict = new dictobj();
@{{self}}.dict = new dictobj();
""")
self.dict.init(d)

Expand Down
2 changes: 1 addition & 1 deletion examples/jsobject/TestRect.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class Rect:
def __init__(self, x, y):
JS("""self.rect = new rectobj();""")
JS("""@{{self}}.rect = new rectobj();""")
self.rect.init(x, y)

def add(self, r):
Expand Down
13 changes: 7 additions & 6 deletions examples/raphael/raphael.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def getColor(self, brightness=None):
""" Return the next colour to use in the spectrum.
"""
JS("""
colour = this._canvas.getColor();
@{{colour}} = this._canvas.getColor();
""")
return colour

Expand Down Expand Up @@ -135,7 +135,7 @@ def set(self):
We return a RaphaelSetElement representing the set.
"""
JS("""
self._element = this._canvas.set();
@{{self}}._element = this._canvas.set();
""")
return RaphaelSetElement(self._element)

Expand Down Expand Up @@ -455,12 +455,13 @@ def getBBox(self):
We return a dictionary with 'x', 'y', 'width' and 'height'
elements.
"""
x = y = width = height = 0 #declared
JS("""
var bounds = this._element.getBBox();
var x = bounds.x;
var y = bounds.y;
var width = bounds.width;
var height = bounds.height;
@{{x}} = bounds.x;
@{{y}} = bounds.y;
@{{width}} = bounds.width;
@{{height}} = bounds.height;
""")
return {'x' : x,
'y' : y,
Expand Down
Loading

0 comments on commit b82fcb3

Please sign in to comment.