Permalink
Browse files

Added missing CSS to Raphael example

  • Loading branch information...
1 parent e77d67c commit a7f5008d5022da2c57e0eb3f59fc6b9a9442d037 Schackmann@.(none) committed with keesbos Oct 27, 2010
No changes.
@@ -1,8 +1,3 @@
-""" test.py
-
- Simple testing framework for the raphael wrapper.
-"""
-
import pyjd
from pyjamas.ui.RootPanel import RootPanel
from pyjamas.ui.TabPanel import TabPanel
@@ -160,7 +155,7 @@ def onElementContextmenu(self, sender,event):
DOM.eventPreventDefault(event)
if __name__ == "__main__":
- pyjd.setup("./media/events.html")
+ pyjd.setup("public/events.html")
events=Events()
RootPanel().add(events)
events.draw()
@@ -12,7 +12,7 @@
from pyjamas.raphael.raphael import Raphael,DOCK_CONNECTION
-class SimpleGraffle(SimplePanel):
+class Graffle(SimplePanel):
def __init__(self,width=600,height=300):
SimplePanel.__init__(self)
self.canvas = Raphael(width,height)
@@ -28,22 +28,23 @@ def draw(self):
self.circle2.setAttrs({'cursor':'move','opacity':0.6})
self.circle2.drag(self._move_circle,start,up)
- line={'stroke':'#fff','stroke-width':3}
- bg={'stroke': '#000', 'stroke-width':5}
- self.connection_circle=self.canvas.connection(self.circle1,self.circle2,line=line,bg=bg,cp1=DOCK_CONNECTION.EAST,cp2=DOCK_CONNECTION.WEST)
-
self.rect1=self.canvas.rect(200,100,30,30)
self.rect1.setAttr('fill','#000')
self.rect1.drag(self._move_rect,start,up)
self.rect2=self.canvas.rect(200,150,30,30)
self.rect2.setAttr('fill','#000')
self.rect2.drag(self._move_rect,start,up)
-
+
+ def connect(self):
line={'stroke':'#fff','stroke-width':3}
bg={'stroke': '#000', 'stroke-width':5}
- self.connection_rect=self.canvas.connection(self.rect1,self.rect2,line=line,bg=bg)
+ self.connection_rect=self.canvas.connection(self.rect1,self.rect2,line=line,bg=bg)
+ line={'stroke':'#fff','stroke-width':3}
+ bg={'stroke': '#000', 'stroke-width':5}
+ self.connection_circle=self.canvas.connection(self.circle1,self.circle2,line=line,bg=bg,cp1=DOCK_CONNECTION.EAST,cp2=DOCK_CONNECTION.WEST)
+
def _move_rect(self,obj,dx,dy,x,y):
obj.translate(dx-obj.dx,dy-obj.dy)
obj.dx=dx
@@ -66,9 +67,10 @@ def up(obj):
pass
if __name__ == "__main__":
- pyjd.setup("./media/graffle.html")
- graffle=SimpleGraffle()
+ pyjd.setup("public/graffle.html")
+ graffle=Graffle()
RootPanel().add(graffle)
graffle.draw()
+ graffle.connect()
pyjd.run()
@@ -2,7 +2,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="pygwt:module" content="events">
- <link rel='stylesheet' href='events.css'>
+ <link rel='stylesheet' href='raphael.css'>
<script type="text/javascript" src="raphael.js"></script>
<title>Raphael Showcase - Events</title>
</head>
@@ -2,7 +2,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="pygwt:module" content="graffle">
- <link rel='stylesheet' href='graffle.css'>
+ <link rel='stylesheet' href='raphael.css'>
<script type="text/javascript" src="raphael.js"></script>
<title>Raphael Showcase - Graffle</title>
</head>
@@ -0,0 +1,6 @@
+.teststyle {
+ font-size: 200%;
+ margin: 20px;
+ padding: 20px;
+ background-color: #00ff00;
+}
@@ -2,7 +2,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="pygwt:module" content="raphael_showcase">
- <link rel='stylesheet' href='raphael_showcase.css'>
+ <link rel='stylesheet' href='raphael.css'>
<script type="text/javascript" src="raphael.js"></script>
<title>Raphael Showcase</title>
</head>
@@ -2,7 +2,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="pygwt:module" content="spinner">
- <link rel='stylesheet' href='spinner.css'>
+ <link rel='stylesheet' href='raphael.css'>
<script type="text/javascript" src="raphael.js"></script>
<title>Raphael Showcase - Spinner</title>
</head>
@@ -13,11 +13,11 @@
from pyjamas.ui import HasAlignment
from pyjamas import DOM
from pyjamas import log
-from pyjamas.raphael.raphael import Raphael
+#from pyjamas.raphael.raphael import Raphael
-from graffle import Graffle
-from events import Events
-from spinner import Spinner
+import graffle
+import events
+import spinner
class TabContainer(DockPanel):
@@ -60,34 +60,38 @@ def onModuleLoad(self):
self.tab_events=TabRaphaelContainer()
self.tab_events.set_headline('Events Example')
- self.tab_events.set_raphael(Events(width=600,height=300))
+ self.tab_events.set_raphael(events.Events(width=600,height=300))
self.tab_events.set_status('Execute events on Raphael Elemnts')
- self.tabs.add(self.tab_simple, 'Events')
+ self.tabs.add(self.tab_events, 'Events')
- tab_graffle=TabRaphaelContainer()
- tab_graffle.set_headline('This is a simple example of the Raphael Graffle')
- tab_graffle.set_raphael(Graffle(width=600,height=300))
- self.tabs.add(tab_sgraffle, 'Graffle')
+ self.tab_graffle=TabRaphaelContainer()
+ self.tab_graffle.set_headline('This is a simple example of the Raphael Graffle')
+ self.tab_graffle.set_raphael(graffle.Graffle(width=600,height=300))
+ self.tabs.add(self.tab_graffle, 'Graffle')
- tab_spinner=TabRaphaelContainer()
- tab_spinner.set_headline('This Raphael Spinner Example')
- tab_spinner.set_raphael(Spinner(width=600,height=300))
- self.tabs.add(tab_sgraffle, 'Spinner')
+ self.tab_spinner=TabRaphaelContainer()
+ self.tab_spinner.set_headline('This Raphael Spinner Example')
+ self.tab_spinner.set_raphael(spinner.Spinner(width=600,height=300))
+ self.tabs.add(self.tab_spinner, 'Spinner')
self.tabs.selectTab(0)
self.tabs.setWidth("100%")
self.tabs.setHeight("100%")
RootPanel().add(self.tabs)
def draw(self):
- self.tab_simple.raphael.draw()
+ self.tab_spinner.raphael.draw()
+ self.tab_graffle.raphael.draw()
+ #self.tab_events.raphael.draw()
+
if __name__ == "__main__":
- pyjd.setup("./media/raphael_showcase.html")
+ pyjd.setup("public/raphael_showcase.html")
app=ShowCaseApp()
app.onModuleLoad()
app.draw()
- app.rect1.getBBox()
+ app.tab_graffle.raphael.connect()
+ app.tab_events.raphael.connect()
pyjd.run()
@@ -1,7 +1,3 @@
-""" test.py
-
- Simple testing framework for the raphael wrapper.
-"""
from pyjamas.ui.HTML import HTML
from pyjamas.ui.RootPanel import RootPanel
from pyjamas.ui.SimplePanel import SimplePanel
@@ -19,7 +15,7 @@
class Spinner(SimplePanel):
""" Our testing panel.
"""
- def __init__(self):
+ def __init__(self,width=600,height=300):
""" Standard initialiser.
"""
SimplePanel.__init__(self)
@@ -67,7 +63,7 @@ def onTimer(self, timerID):
#############################################################################
if __name__ == "__main__":
- pyjd.setup("./media/spinner.html")
+ pyjd.setup("public/spinner.html")
spinner=Spinner()
RootPanel().add(spinner)
spinner.draw()

0 comments on commit a7f5008

Please sign in to comment.